Model/ChangedSiteDesignModel.ps1

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

<#
ChangedSiteDesignModel<PSCustomObject>
#>


function New-ChangedSiteDesignModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Title},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsOutOfBoxTemplate} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Tenant},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${SupportedWebTemplates}
    )

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

        
        $PSO = [PSCustomObject]@{
            "Id" = ${Id}
            "Title" = ${Title}
            "IsOutOfBoxTemplate" = ${IsOutOfBoxTemplate}
            "Tenant" = ${Tenant}
            "SupportedWebTemplates" = ${SupportedWebTemplates}
        }

        return $PSO
    }
}

<#
ChangedSiteDesignModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ChangedSiteDesignModel
        $AllProperties = $("Id", "Title", "IsOutOfBoxTemplate", "Tenant", "SupportedWebTemplates")
        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 "Title"))) { #optional property not found
            $Title = $null
        } else {
            $Title = $JsonParameters.PSobject.Properties["Title"].value
        }

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

        $PSO = [PSCustomObject]@{
            "Id" = ${Id}
            "Title" = ${Title}
            "IsOutOfBoxTemplate" = ${IsOutOfBoxTemplate}
            "Tenant" = ${Tenant}
            "SupportedWebTemplates" = ${SupportedWebTemplates}
        }

        return $PSO
    }

}