Model/PublicIdentityV2.ps1

#
# SailPoint Identity Security API - Public 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

Projected public identity returned by POST /public-identities/v2/search. Root fields are always present (null when unavailable). attributes contains only keys from GET /public-identities/v2/visible-attributes configuredAttributes.

.PARAMETER Id
Identity id
.PARAMETER Name
Alternate unique identifier for the identity (alias / search field name).
.PARAMETER DisplayName
Human-readable display name of the identity.
.PARAMETER Email
Email address of identity.
.PARAMETER IdentityState
The current state of the identity, which determines how SailPoint Identity Security interacts with the identity.
.PARAMETER CloudLifecycleState
The lifecycle status for the identity
.PARAMETER Manager
Manager of this identity, or null when none
.PARAMETER Attributes
Configured public identity attributes only (from visible-attributes configuredAttributes). Missing keys are omitted; present null values are returned as null.
.OUTPUTS

PublicIdentityV2<PSCustomObject>
#>


function Initialize-PublicIdentityV2 {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DisplayName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Email},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ACTIVE", "INACTIVE_SHORT_TERM", "INACTIVE_LONG_TERM", "")]
        [String]
        ${IdentityState},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CloudLifecycleState},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Manager},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${Attributes}
    )

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

        if (!$Attributes) {
            throw "invalid value for 'Attributes', 'Attributes' cannot be null."
        }


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "name" = ${Name}
            "displayName" = ${DisplayName}
            "email" = ${Email}
            "identityState" = ${IdentityState}
            "cloudLifecycleState" = ${CloudLifecycleState}
            "manager" = ${Manager}
            "attributes" = ${Attributes}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to PublicIdentityV2<PSCustomObject>

.DESCRIPTION

Convert from JSON to PublicIdentityV2<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

PublicIdentityV2<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PublicIdentityV2
        $AllProperties = ("id", "name", "displayName", "email", "identityState", "cloudLifecycleState", "manager", "attributes")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

        If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json
            throw "Error! Empty JSON cannot be serialized due to the required property 'id' missing."
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) {
            throw "Error! JSON cannot be serialized due to the required property 'id' missing."
        } else {
            $Id = $JsonParameters.PSobject.Properties["id"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) {
            throw "Error! JSON cannot be serialized due to the required property 'name' missing."
        } else {
            $Name = $JsonParameters.PSobject.Properties["name"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "displayName"))) {
            throw "Error! JSON cannot be serialized due to the required property 'displayName' missing."
        } else {
            $DisplayName = $JsonParameters.PSobject.Properties["displayName"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "email"))) {
            throw "Error! JSON cannot be serialized due to the required property 'email' missing."
        } else {
            $Email = $JsonParameters.PSobject.Properties["email"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "identityState"))) {
            throw "Error! JSON cannot be serialized due to the required property 'identityState' missing."
        } else {
            $IdentityState = $JsonParameters.PSobject.Properties["identityState"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "cloudLifecycleState"))) {
            throw "Error! JSON cannot be serialized due to the required property 'cloudLifecycleState' missing."
        } else {
            $CloudLifecycleState = $JsonParameters.PSobject.Properties["cloudLifecycleState"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "manager"))) {
            throw "Error! JSON cannot be serialized due to the required property 'manager' missing."
        } else {
            $Manager = $JsonParameters.PSobject.Properties["manager"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "attributes"))) {
            throw "Error! JSON cannot be serialized due to the required property 'attributes' missing."
        } else {
            $Attributes = $JsonParameters.PSobject.Properties["attributes"].value
        }

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "name" = ${Name}
            "displayName" = ${DisplayName}
            "email" = ${Email}
            "identityState" = ${IdentityState}
            "cloudLifecycleState" = ${CloudLifecycleState}
            "manager" = ${Manager}
            "attributes" = ${Attributes}
        }

        return $PSO
    }

}