Model/AuthUser.ps1

#
# Identity Security Cloud V3 API
# Use these APIs to interact with the Identity Security Cloud platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs.
# Version: 3.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Tenant
Tenant name.
.PARAMETER Id
Identity ID.
.PARAMETER Uid
Identity's unique identitifier.
.PARAMETER VarProfile
ID of the auth profile associated with the auth user.
.PARAMETER IdentificationNumber
Auth user's employee number.
.PARAMETER Email
Auth user's email.
.PARAMETER Phone
Auth user's phone number.
.PARAMETER WorkPhone
Auth user's work phone number.
.PARAMETER PersonalEmail
Auth user's personal email.
.PARAMETER Firstname
Auth user's first name.
.PARAMETER Lastname
Auth user's last name.
.PARAMETER DisplayName
Auth user's name in displayed format.
.PARAMETER Alias
Auth user's alias.
.PARAMETER LastPasswordChangeDate
Date of last password change.
.PARAMETER LastLoginTimestamp
Timestamp of the last login (long type value).
.PARAMETER CurrentLoginTimestamp
Timestamp of the current login (long type value).
.PARAMETER Capabilities
Array of the auth user's capabilities.
.OUTPUTS

AuthUser<PSCustomObject>
#>


function Initialize-AuthUser {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Tenant},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Uid},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${VarProfile},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${IdentificationNumber},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Email},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Phone},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${WorkPhone},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PersonalEmail},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Firstname},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Lastname},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DisplayName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Alias},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LastPasswordChangeDate},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${LastLoginTimestamp},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${CurrentLoginTimestamp},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("CERT_ADMIN", "CLOUD_GOV_ADMIN", "CLOUD_GOV_USER", "HELPDESK", "ORG_ADMIN", "REPORT_ADMIN", "ROLE_ADMIN", "ROLE_SUBADMIN", "SAAS_MANAGEMENT_ADMIN", "SAAS_MANAGEMENT_READER", "SOURCE_ADMIN", "SOURCE_SUBADMIN", "das:ui-administrator", "das:ui-compliance_manager", "das:ui-auditor", "das:ui-data-scope", "sp:aic-dashboard-read", "sp:aic-dashboard-write", "sp:ui-config-hub-admin", "sp:ui-config-hub-backup-admin", "sp:ui-config-hub-read")]
        [String[]]
        ${Capabilities}
    )

    Process {
        'Creating PSCustomObject: PSSailpoint.V3 => AuthUser' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug


        $PSO = [PSCustomObject]@{
            "tenant" = ${Tenant}
            "id" = ${Id}
            "uid" = ${Uid}
            "profile" = ${VarProfile}
            "identificationNumber" = ${IdentificationNumber}
            "email" = ${Email}
            "phone" = ${Phone}
            "workPhone" = ${WorkPhone}
            "personalEmail" = ${PersonalEmail}
            "firstname" = ${Firstname}
            "lastname" = ${Lastname}
            "displayName" = ${DisplayName}
            "alias" = ${Alias}
            "lastPasswordChangeDate" = ${LastPasswordChangeDate}
            "lastLoginTimestamp" = ${LastLoginTimestamp}
            "currentLoginTimestamp" = ${CurrentLoginTimestamp}
            "capabilities" = ${Capabilities}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to AuthUser<PSCustomObject>

.DESCRIPTION

Convert from JSON to AuthUser<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

AuthUser<PSCustomObject>
#>

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

    Process {
        'Converting JSON to PSCustomObject: PSSailpoint.V3 => AuthUser' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in AuthUser
        $AllProperties = ("tenant", "id", "uid", "profile", "identificationNumber", "email", "phone", "workPhone", "personalEmail", "firstname", "lastname", "displayName", "alias", "lastPasswordChangeDate", "lastLoginTimestamp", "currentLoginTimestamp", "capabilities")
        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 "tenant"))) { #optional property not found
            $Tenant = $null
        } else {
            $Tenant = $JsonParameters.PSobject.Properties["tenant"].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 "uid"))) { #optional property not found
            $Uid = $null
        } else {
            $Uid = $JsonParameters.PSobject.Properties["uid"].value
        }

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

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

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

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

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

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "lastname"))) { #optional property not found
            $Lastname = $null
        } else {
            $Lastname = $JsonParameters.PSobject.Properties["lastname"].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 "alias"))) { #optional property not found
            $Alias = $null
        } else {
            $Alias = $JsonParameters.PSobject.Properties["alias"].value
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "tenant" = ${Tenant}
            "id" = ${Id}
            "uid" = ${Uid}
            "profile" = ${VarProfile}
            "identificationNumber" = ${IdentificationNumber}
            "email" = ${Email}
            "phone" = ${Phone}
            "workPhone" = ${WorkPhone}
            "personalEmail" = ${PersonalEmail}
            "firstname" = ${Firstname}
            "lastname" = ${Lastname}
            "displayName" = ${DisplayName}
            "alias" = ${Alias}
            "lastPasswordChangeDate" = ${LastPasswordChangeDate}
            "lastLoginTimestamp" = ${LastLoginTimestamp}
            "currentLoginTimestamp" = ${CurrentLoginTimestamp}
            "capabilities" = ${Capabilities}
        }

        return $PSO
    }

}