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