Model/SensitivityLabelModel.ps1

#
# Cloud Governance Api
# Contact: support@avepoint.com
#

<#
SensitivityLabelModel<PSCustomObject>
#>


function New-SensitivityLabelModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Tenant},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TenantName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ParentId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ParentName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${FullName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Privacy} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowGuestSharing} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${SiteSharing}
    )

    Process {
        'Creating PSCustomObject: Cloud.Governance.Client => SensitivityLabelModel' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        
        $PSO = [PSCustomObject]@{
            "Id" = ${Id}
            "Name" = ${Name}
            "Tenant" = ${Tenant}
            "TenantName" = ${TenantName}
            "ParentId" = ${ParentId}
            "ParentName" = ${ParentName}
            "FullName" = ${FullName}
            "Privacy" = ${Privacy}
            "AllowGuestSharing" = ${AllowGuestSharing}
            "SiteSharing" = ${SiteSharing}
        }

        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 = $("Id", "Name", "Tenant", "TenantName", "ParentId", "ParentName", "FullName", "Privacy", "AllowGuestSharing", "SiteSharing")
        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 "Id"))) { #optional property not found
            $Id = $null
        } else {
            $Id = $JsonParameters.PSobject.Properties["Id"].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 "Tenant"))) { #optional property not found
            $Tenant = $null
        } else {
            $Tenant = $JsonParameters.PSobject.Properties["Tenant"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "TenantName"))) { #optional property not found
            $TenantName = $null
        } else {
            $TenantName = $JsonParameters.PSobject.Properties["TenantName"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "ParentId"))) { #optional property not found
            $ParentId = $null
        } else {
            $ParentId = $JsonParameters.PSobject.Properties["ParentId"].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 "FullName"))) { #optional property not found
            $FullName = $null
        } else {
            $FullName = $JsonParameters.PSobject.Properties["FullName"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "Privacy"))) { #optional property not found
            $Privacy = $null
        } else {
            $Privacy = $JsonParameters.PSobject.Properties["Privacy"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "AllowGuestSharing"))) { #optional property not found
            $AllowGuestSharing = $null
        } else {
            $AllowGuestSharing = $JsonParameters.PSobject.Properties["AllowGuestSharing"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "SiteSharing"))) { #optional property not found
            $SiteSharing = $null
        } else {
            $SiteSharing = $JsonParameters.PSobject.Properties["SiteSharing"].value
        }

        $PSO = [PSCustomObject]@{
            "Id" = ${Id}
            "Name" = ${Name}
            "Tenant" = ${Tenant}
            "TenantName" = ${TenantName}
            "ParentId" = ${ParentId}
            "ParentName" = ${ParentName}
            "FullName" = ${FullName}
            "Privacy" = ${Privacy}
            "AllowGuestSharing" = ${AllowGuestSharing}
            "SiteSharing" = ${SiteSharing}
        }

        return $PSO
    }

}