Model/HubSiteUrl.ps1

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

<#
HubSiteUrl<PSCustomObject>
#>


function New-HubSiteUrl {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Url},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${PermissionGroupCount} = 0,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Title}
    )

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

        
        $PSO = [PSCustomObject]@{
            "Url" = ${Url}
            "PermissionGroupCount" = ${PermissionGroupCount}
            "Id" = ${Id}
            "Title" = ${Title}
        }

        return $PSO
    }
}

<#
HubSiteUrl<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

        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
        }

        $PSO = [PSCustomObject]@{
            "Url" = ${Url}
            "PermissionGroupCount" = ${PermissionGroupCount}
            "Id" = ${Id}
            "Title" = ${Title}
        }

        return $PSO
    }

}