Model/ChangeSiteProfilesCheckResult.ps1

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

<#
ChangeSiteProfilesCheckResult<PSCustomObject>
#>


function New-ChangeSiteProfilesCheckResult {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Office365TenantId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsAppliedPolicy} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${OriginalPolicy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${HasOngoingRenewTask} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${HasOngoingElectionTask} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${OriginalExternalSharingProfile},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${OriginalStorageManagementProfile},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${OriginalContactElectionProfile},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${OriginalRenewalProfile},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SiteUrl},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Classification},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Sensitivity},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Privacy} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SiteTitle},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${PrimaryContact},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${SecondaryContact},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsValid} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ErrorMessage},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${MessageCode} = "None"
    )

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

        
        $PSO = [PSCustomObject]@{
            "Office365TenantId" = ${Office365TenantId}
            "IsAppliedPolicy" = ${IsAppliedPolicy}
            "OriginalPolicy" = ${OriginalPolicy}
            "HasOngoingRenewTask" = ${HasOngoingRenewTask}
            "HasOngoingElectionTask" = ${HasOngoingElectionTask}
            "OriginalExternalSharingProfile" = ${OriginalExternalSharingProfile}
            "OriginalStorageManagementProfile" = ${OriginalStorageManagementProfile}
            "OriginalContactElectionProfile" = ${OriginalContactElectionProfile}
            "OriginalRenewalProfile" = ${OriginalRenewalProfile}
            "SiteUrl" = ${SiteUrl}
            "Classification" = ${Classification}
            "Sensitivity" = ${Sensitivity}
            "Privacy" = ${Privacy}
            "SiteTitle" = ${SiteTitle}
            "PrimaryContact" = ${PrimaryContact}
            "SecondaryContact" = ${SecondaryContact}
            "IsValid" = ${IsValid}
            "ErrorMessage" = ${ErrorMessage}
            "MessageCode" = ${MessageCode}
        }

        return $PSO
    }
}

<#
ChangeSiteProfilesCheckResult<PSCustomObject>
#>

function ConvertFrom-JsonToChangeSiteProfilesCheckResult {
    Param(
        [AllowEmptyString()]
        [string]$Json
    )

    Process {
        'Converting JSON to PSCustomObject: Cloud.Governance.Client => ChangeSiteProfilesCheckResult' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ChangeSiteProfilesCheckResult
        $AllProperties = $("Office365TenantId", "IsAppliedPolicy", "OriginalPolicy", "HasOngoingRenewTask", "HasOngoingElectionTask", "OriginalExternalSharingProfile", "OriginalStorageManagementProfile", "OriginalContactElectionProfile", "OriginalRenewalProfile", "SiteUrl", "Classification", "Sensitivity", "Privacy", "SiteTitle", "PrimaryContact", "SecondaryContact", "IsValid", "ErrorMessage", "MessageCode")
        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 "Office365TenantId"))) { #optional property not found
            $Office365TenantId = $null
        } else {
            $Office365TenantId = $JsonParameters.PSobject.Properties["Office365TenantId"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "Office365TenantId" = ${Office365TenantId}
            "IsAppliedPolicy" = ${IsAppliedPolicy}
            "OriginalPolicy" = ${OriginalPolicy}
            "HasOngoingRenewTask" = ${HasOngoingRenewTask}
            "HasOngoingElectionTask" = ${HasOngoingElectionTask}
            "OriginalExternalSharingProfile" = ${OriginalExternalSharingProfile}
            "OriginalStorageManagementProfile" = ${OriginalStorageManagementProfile}
            "OriginalContactElectionProfile" = ${OriginalContactElectionProfile}
            "OriginalRenewalProfile" = ${OriginalRenewalProfile}
            "SiteUrl" = ${SiteUrl}
            "Classification" = ${Classification}
            "Sensitivity" = ${Sensitivity}
            "Privacy" = ${Privacy}
            "SiteTitle" = ${SiteTitle}
            "PrimaryContact" = ${PrimaryContact}
            "SecondaryContact" = ${SecondaryContact}
            "IsValid" = ${IsValid}
            "ErrorMessage" = ${ErrorMessage}
            "MessageCode" = ${MessageCode}
        }

        return $PSO
    }

}