Model/HubSiteSetting.ps1

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

<#
HubSiteSetting<PSCustomObject>
#>


function New-HubSiteSetting {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ConvertHubSite} = "RegisterAsHubSite",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${AssociateToHubSite},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${RegisterAsHubSite},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivityId}
    )

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

        
        $PSO = [PSCustomObject]@{
            "ConvertHubSite" = ${ConvertHubSite}
            "AssociateToHubSite" = ${AssociateToHubSite}
            "RegisterAsHubSite" = ${RegisterAsHubSite}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }
}

<#
HubSiteSetting<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

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

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

        $PSO = [PSCustomObject]@{
            "ConvertHubSite" = ${ConvertHubSite}
            "AssociateToHubSite" = ${AssociateToHubSite}
            "RegisterAsHubSite" = ${RegisterAsHubSite}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }

}