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