Model/GetManagePermissionModelParameter.ps1

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

<#
GetManagePermissionModelParameter<PSCustomObject>
#>


function New-GetManagePermissionModelParameter {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Uri},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${NodeType} = "Container",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SiteId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ExternalSharingOptions} = "Disabled",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ManagePermissionSettingActivityId}
    )

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

        
        $PSO = [PSCustomObject]@{
            "Uri" = ${Uri}
            "NodeType" = ${NodeType}
            "SiteId" = ${SiteId}
            "ExternalSharingOptions" = ${ExternalSharingOptions}
            "ManagePermissionSettingActivityId" = ${ManagePermissionSettingActivityId}
        }

        return $PSO
    }
}

<#
GetManagePermissionModelParameter<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in GetManagePermissionModelParameter
        $AllProperties = $("Uri", "NodeType", "SiteId", "ExternalSharingOptions", "ManagePermissionSettingActivityId")
        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 "Uri"))) { #optional property not found
            $Uri = $null
        } else {
            $Uri = $JsonParameters.PSobject.Properties["Uri"].value
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "Uri" = ${Uri}
            "NodeType" = ${NodeType}
            "SiteId" = ${SiteId}
            "ExternalSharingOptions" = ${ExternalSharingOptions}
            "ManagePermissionSettingActivityId" = ${ManagePermissionSettingActivityId}
        }

        return $PSO
    }

}