Model/ChangeSiteProfilesModel.ps1

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

<#
ChangeSiteProfilesModel<PSCustomObject>
#>


function New-ChangeSiteProfilesModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TenantId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Url},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Title},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsManagedByGAO} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ObjectName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ObjectIdentity},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${OriginalPolicyId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivityId}
    )

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

        
        $PSO = [PSCustomObject]@{
            "Id" = ${Id}
            "TenantId" = ${TenantId}
            "Url" = ${Url}
            "Title" = ${Title}
            "IsManagedByGAO" = ${IsManagedByGAO}
            "ObjectName" = ${ObjectName}
            "ObjectIdentity" = ${ObjectIdentity}
            "OriginalPolicyId" = ${OriginalPolicyId}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }
}

<#
ChangeSiteProfilesModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ChangeSiteProfilesModel
        $AllProperties = $("Id", "TenantId", "Url", "Title", "IsManagedByGAO", "ObjectName", "ObjectIdentity", "OriginalPolicyId", "ActivityId")
        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 "TenantId"))) { #optional property not found
            $TenantId = $null
        } else {
            $TenantId = $JsonParameters.PSobject.Properties["TenantId"].value
        }

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "Id" = ${Id}
            "TenantId" = ${TenantId}
            "Url" = ${Url}
            "Title" = ${Title}
            "IsManagedByGAO" = ${IsManagedByGAO}
            "ObjectName" = ${ObjectName}
            "ObjectIdentity" = ${ObjectIdentity}
            "OriginalPolicyId" = ${OriginalPolicyId}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }

}