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