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