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