Model/CheckSiteHubSiteSettingModel.ps1

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

<#
CheckSiteHubSiteSettingModel<PSCustomObject>
#>


function New-CheckSiteHubSiteSettingModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsHubSite} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${HubSiteTitle},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${AssociatedHubSiteId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${EnabledUsers}
    )

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

        
        $PSO = [PSCustomObject]@{
            "IsHubSite" = ${IsHubSite}
            "HubSiteTitle" = ${HubSiteTitle}
            "AssociatedHubSiteId" = ${AssociatedHubSiteId}
            "EnabledUsers" = ${EnabledUsers}
        }

        return $PSO
    }
}

<#
CheckSiteHubSiteSettingModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

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

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

        $PSO = [PSCustomObject]@{
            "IsHubSite" = ${IsHubSite}
            "HubSiteTitle" = ${HubSiteTitle}
            "AssociatedHubSiteId" = ${AssociatedHubSiteId}
            "EnabledUsers" = ${EnabledUsers}
        }

        return $PSO
    }

}