Model/IdentityV2.ps1

#
# SailPoint Identity Security API - Identities
# Use these APIs to interact with the SailPoint Identity Security 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: v1
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

Identity record returned by the search-backed identities v2 API.

.PARAMETER Id
System-generated unique ID of the identity.
.PARAMETER Name
Display name of the identity.
.PARAMETER Alias
Alternate unique identifier of the identity. Equivalent to the account name on the authoritative source.
.PARAMETER Type
The identity type.
.PARAMETER EmailAddress
Email address of the identity.
.PARAMETER IdentityStatus
The identity's status in the system.
.PARAMETER ProcessingState
The processing state of the identity.
.PARAMETER Protected
Whether the identity is protected from accidental deletion or modification.
.PARAMETER Correlated
Whether the identity is correlated to an authoritative account.
.PARAMETER Inactive
Whether the identity is inactive.
.PARAMETER IsManager
Whether this identity is a manager of another identity.
.PARAMETER Locked
Whether the identity is locked.
.PARAMETER Disabled
Whether the identity is disabled.
.PARAMETER Manager
No description available.
.PARAMETER LifecycleState
No description available.
.PARAMETER Created
Creation date of the identity.
.PARAMETER Modified
Last modification date of the identity.
.PARAMETER Synced
Last time the identity was synchronized to search.
.PARAMETER LastRefresh
The last time the identity was refreshed by the system.
.PARAMETER PrivilegeLevel
No description available.
.OUTPUTS

IdentityV2<PSCustomObject>
#>


function Initialize-IdentityV2 {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Alias},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${EmailAddress},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${IdentityStatus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ProcessingState},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Protected} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Correlated} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Inactive} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsManager} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Locked} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Disabled} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Manager},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${LifecycleState},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Created},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Modified},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Synced},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${LastRefresh},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${PrivilegeLevel}
    )

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "name" = ${Name}
            "alias" = ${Alias}
            "type" = ${Type}
            "emailAddress" = ${EmailAddress}
            "identityStatus" = ${IdentityStatus}
            "processingState" = ${ProcessingState}
            "protected" = ${Protected}
            "correlated" = ${Correlated}
            "inactive" = ${Inactive}
            "isManager" = ${IsManager}
            "locked" = ${Locked}
            "disabled" = ${Disabled}
            "manager" = ${Manager}
            "lifecycleState" = ${LifecycleState}
            "created" = ${Created}
            "modified" = ${Modified}
            "synced" = ${Synced}
            "lastRefresh" = ${LastRefresh}
            "privilegeLevel" = ${PrivilegeLevel}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to IdentityV2<PSCustomObject>

.DESCRIPTION

Convert from JSON to IdentityV2<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

IdentityV2<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in IdentityV2
        $AllProperties = ("id", "name", "alias", "type", "emailAddress", "identityStatus", "processingState", "protected", "correlated", "inactive", "isManager", "locked", "disabled", "manager", "lifecycleState", "created", "modified", "synced", "lastRefresh", "privilegeLevel")
        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 "name"))) { #optional property not found
            $Name = $null
        } else {
            $Name = $JsonParameters.PSobject.Properties["name"].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 "type"))) { #optional property not found
            $Type = $null
        } else {
            $Type = $JsonParameters.PSobject.Properties["type"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "name" = ${Name}
            "alias" = ${Alias}
            "type" = ${Type}
            "emailAddress" = ${EmailAddress}
            "identityStatus" = ${IdentityStatus}
            "processingState" = ${ProcessingState}
            "protected" = ${Protected}
            "correlated" = ${Correlated}
            "inactive" = ${Inactive}
            "isManager" = ${IsManager}
            "locked" = ${Locked}
            "disabled" = ${Disabled}
            "manager" = ${Manager}
            "lifecycleState" = ${LifecycleState}
            "created" = ${Created}
            "modified" = ${Modified}
            "synced" = ${Synced}
            "lastRefresh" = ${LastRefresh}
            "privilegeLevel" = ${PrivilegeLevel}
        }

        return $PSO
    }

}