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