Model/ManagePermissionSiteAdminModel.ps1

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

<#
ManagePermissionSiteAdminModel<PSCustomObject>
#>


function New-ManagePermissionSiteAdminModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ObjectId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LogonName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SharePointLogonName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DisplayName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Title},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsBuildInRole} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Type} = "None",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsActive} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsBlock} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsPrimaryAdmin} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${TemporaryPermissionSetting}
    )

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

        
        $PSO = [PSCustomObject]@{
            "Id" = ${Id}
            "ObjectId" = ${ObjectId}
            "LogonName" = ${LogonName}
            "SharePointLogonName" = ${SharePointLogonName}
            "DisplayName" = ${DisplayName}
            "Title" = ${Title}
            "IsBuildInRole" = ${IsBuildInRole}
            "Type" = ${Type}
            "IsActive" = ${IsActive}
            "IsBlock" = ${IsBlock}
            "IsPrimaryAdmin" = ${IsPrimaryAdmin}
            "TemporaryPermissionSetting" = ${TemporaryPermissionSetting}
        }

        return $PSO
    }
}

<#
ManagePermissionSiteAdminModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ManagePermissionSiteAdminModel
        $AllProperties = $("Id", "ObjectId", "LogonName", "SharePointLogonName", "DisplayName", "Title", "IsBuildInRole", "Type", "IsActive", "IsBlock", "IsPrimaryAdmin", "TemporaryPermissionSetting")
        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 "Id"))) { #optional property not found
            $Id = $null
        } else {
            $Id = $JsonParameters.PSobject.Properties["Id"].value
        }

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "Id" = ${Id}
            "ObjectId" = ${ObjectId}
            "LogonName" = ${LogonName}
            "SharePointLogonName" = ${SharePointLogonName}
            "DisplayName" = ${DisplayName}
            "Title" = ${Title}
            "IsBuildInRole" = ${IsBuildInRole}
            "Type" = ${Type}
            "IsActive" = ${IsActive}
            "IsBlock" = ${IsBlock}
            "IsPrimaryAdmin" = ${IsPrimaryAdmin}
            "TemporaryPermissionSetting" = ${TemporaryPermissionSetting}
        }

        return $PSO
    }

}