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