Model/ChangeHubSiteContentModel.ps1

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

<#
ChangeHubSiteContentModel<PSCustomObject>
#>


function New-ChangeHubSiteContentModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${EnabledUsers},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${HubSiteTitle},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${HubSiteId}
    )

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

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

        return $PSO
    }
}

<#
ChangeHubSiteContentModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

        return $PSO
    }

}