Model/ManualImportEnvironmentJobModel.ps1
# # Cloud Governance Api # Contact: support@avepoint.com # <# ManualImportEnvironmentJobModel<PSCustomObject> #> function New-ManualImportEnvironmentJobModel { [CmdletBinding()] Param ( [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${ObjectType} = "None", [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject[]] ${Workspaces}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Name}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Description}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${FileName} ) Process { 'Creating PSCustomObject: Cloud.Governance.Client => ManualImportEnvironmentJobModel' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "ObjectType" = ${ObjectType} "Workspaces" = ${Workspaces} "Name" = ${Name} "Description" = ${Description} "FileName" = ${FileName} } return $PSO } } <# ManualImportEnvironmentJobModel<PSCustomObject> #> function ConvertFrom-JsonToManualImportEnvironmentJobModel { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: Cloud.Governance.Client => ManualImportEnvironmentJobModel' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in ManualImportEnvironmentJobModel $AllProperties = $("ObjectType", "Workspaces", "Name", "Description", "FileName") 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 "ObjectType"))) { #optional property not found $ObjectType = $null } else { $ObjectType = $JsonParameters.PSobject.Properties["ObjectType"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "Workspaces"))) { #optional property not found $Workspaces = $null } else { $Workspaces = $JsonParameters.PSobject.Properties["Workspaces"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "Name"))) { #optional property not found $Name = $null } else { $Name = $JsonParameters.PSobject.Properties["Name"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "Description"))) { #optional property not found $Description = $null } else { $Description = $JsonParameters.PSobject.Properties["Description"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "FileName"))) { #optional property not found $FileName = $null } else { $FileName = $JsonParameters.PSobject.Properties["FileName"].value } $PSO = [PSCustomObject]@{ "ObjectType" = ${ObjectType} "Workspaces" = ${Workspaces} "Name" = ${Name} "Description" = ${Description} "FileName" = ${FileName} } return $PSO } } |