Model/ManagePermissionValidationParameter.ps1

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

<#
ManagePermissionValidationParameter<PSCustomObject>
#>


function New-ManagePermissionValidationParameter {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Uri},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IgnoreLock} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsKeepPageUrl} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Office365TenantId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ScopeActivityId}
    )

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

        
        $PSO = [PSCustomObject]@{
            "Uri" = ${Uri}
            "IgnoreLock" = ${IgnoreLock}
            "IsKeepPageUrl" = ${IsKeepPageUrl}
            "Office365TenantId" = ${Office365TenantId}
            "ScopeActivityId" = ${ScopeActivityId}
        }

        return $PSO
    }
}

<#
ManagePermissionValidationParameter<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ManagePermissionValidationParameter
        $AllProperties = $("Uri", "IgnoreLock", "IsKeepPageUrl", "Office365TenantId", "ScopeActivityId")
        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 "IgnoreLock"))) { #optional property not found
            $IgnoreLock = $null
        } else {
            $IgnoreLock = $JsonParameters.PSobject.Properties["IgnoreLock"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "Uri" = ${Uri}
            "IgnoreLock" = ${IgnoreLock}
            "IsKeepPageUrl" = ${IsKeepPageUrl}
            "Office365TenantId" = ${Office365TenantId}
            "ScopeActivityId" = ${ScopeActivityId}
        }

        return $PSO
    }

}