Model/JobMonitorGridModel.ps1
# # Cloud Governance Api # Contact: support@avepoint.com # <# JobMonitorGridModel<PSCustomObject> #> function New-JobMonitorGridModel { [CmdletBinding()] Param ( [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Id}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Title}, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${Type} = "ServiceTemplate", [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${TypeDescription}, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${Mode} = "None", [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${ModeDescription}, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${Status} = "Running", [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${StatusDescription}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${FileName}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[System.DateTime]] ${ModifiedTime}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Operator}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${OperatorDisplayName}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${IsAllowDownload} = $false, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${IsAllowStop} = $false ) Process { 'Creating PSCustomObject: Cloud.Governance.Client => JobMonitorGridModel' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "Id" = ${Id} "Title" = ${Title} "Type" = ${Type} "TypeDescription" = ${TypeDescription} "Mode" = ${Mode} "ModeDescription" = ${ModeDescription} "Status" = ${Status} "StatusDescription" = ${StatusDescription} "FileName" = ${FileName} "ModifiedTime" = ${ModifiedTime} "Operator" = ${Operator} "OperatorDisplayName" = ${OperatorDisplayName} "IsAllowDownload" = ${IsAllowDownload} "IsAllowStop" = ${IsAllowStop} } return $PSO } } <# JobMonitorGridModel<PSCustomObject> #> function ConvertFrom-JsonToJobMonitorGridModel { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: Cloud.Governance.Client => JobMonitorGridModel' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in JobMonitorGridModel $AllProperties = $("Id", "Title", "Type", "TypeDescription", "Mode", "ModeDescription", "Status", "StatusDescription", "FileName", "ModifiedTime", "Operator", "OperatorDisplayName", "IsAllowDownload", "IsAllowStop") foreach ($name in $JsonParameters.PsObject.Properties.Name) { if (!($AllProperties.Contains($name))) { throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" } } if (!([bool]($JsonParameters.PSobject.Properties.name -match "Id"))) { #optional property not found $Id = $null } else { $Id = $JsonParameters.PSobject.Properties["Id"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "Title"))) { #optional property not found $Title = $null } else { $Title = $JsonParameters.PSobject.Properties["Title"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "Type"))) { #optional property not found $Type = $null } else { $Type = $JsonParameters.PSobject.Properties["Type"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "TypeDescription"))) { #optional property not found $TypeDescription = $null } else { $TypeDescription = $JsonParameters.PSobject.Properties["TypeDescription"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "Mode"))) { #optional property not found $Mode = $null } else { $Mode = $JsonParameters.PSobject.Properties["Mode"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "ModeDescription"))) { #optional property not found $ModeDescription = $null } else { $ModeDescription = $JsonParameters.PSobject.Properties["ModeDescription"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "Status"))) { #optional property not found $Status = $null } else { $Status = $JsonParameters.PSobject.Properties["Status"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "StatusDescription"))) { #optional property not found $StatusDescription = $null } else { $StatusDescription = $JsonParameters.PSobject.Properties["StatusDescription"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "FileName"))) { #optional property not found $FileName = $null } else { $FileName = $JsonParameters.PSobject.Properties["FileName"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "ModifiedTime"))) { #optional property not found $ModifiedTime = $null } else { $ModifiedTime = $JsonParameters.PSobject.Properties["ModifiedTime"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "Operator"))) { #optional property not found $Operator = $null } else { $Operator = $JsonParameters.PSobject.Properties["Operator"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "OperatorDisplayName"))) { #optional property not found $OperatorDisplayName = $null } else { $OperatorDisplayName = $JsonParameters.PSobject.Properties["OperatorDisplayName"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "IsAllowDownload"))) { #optional property not found $IsAllowDownload = $null } else { $IsAllowDownload = $JsonParameters.PSobject.Properties["IsAllowDownload"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "IsAllowStop"))) { #optional property not found $IsAllowStop = $null } else { $IsAllowStop = $JsonParameters.PSobject.Properties["IsAllowStop"].value } $PSO = [PSCustomObject]@{ "Id" = ${Id} "Title" = ${Title} "Type" = ${Type} "TypeDescription" = ${TypeDescription} "Mode" = ${Mode} "ModeDescription" = ${ModeDescription} "Status" = ${Status} "StatusDescription" = ${StatusDescription} "FileName" = ${FileName} "ModifiedTime" = ${ModifiedTime} "Operator" = ${Operator} "OperatorDisplayName" = ${OperatorDisplayName} "IsAllowDownload" = ${IsAllowDownload} "IsAllowStop" = ${IsAllowStop} } return $PSO } } |