Model/SiteTemplateSettingCustomSiteTemplate.ps1

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

<#
SiteTemplateSettingCustomSiteTemplate<PSCustomObject>
#>


function New-SiteTemplateSettingCustomSiteTemplate {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TemplateStoreUrl},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TemplateName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${ClearSolutionGallery} = $false
    )

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

        
        $PSO = [PSCustomObject]@{
            "TemplateStoreUrl" = ${TemplateStoreUrl}
            "TemplateName" = ${TemplateName}
            "ClearSolutionGallery" = ${ClearSolutionGallery}
        }

        return $PSO
    }
}

<#
SiteTemplateSettingCustomSiteTemplate<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SiteTemplateSettingCustomSiteTemplate
        $AllProperties = $("TemplateStoreUrl", "TemplateName", "ClearSolutionGallery")
        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 "TemplateStoreUrl"))) { #optional property not found
            $TemplateStoreUrl = $null
        } else {
            $TemplateStoreUrl = $JsonParameters.PSobject.Properties["TemplateStoreUrl"].value
        }

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

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

        $PSO = [PSCustomObject]@{
            "TemplateStoreUrl" = ${TemplateStoreUrl}
            "TemplateName" = ${TemplateName}
            "ClearSolutionGallery" = ${ClearSolutionGallery}
        }

        return $PSO
    }

}