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