Model/Intelidentityaggregate.ps1

#
# Identity Security Cloud API - Intelligence
# 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: v1
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

Flat identity response with identity attributes hoisted to the top level. The accounts, privilegedAccess, and accessHistory slices are always present. The outliers slice is omitted when the tenant lacks the IDA-outliers license.

.PARAMETER Id
Identity Security Cloud identifier for this identity.
.PARAMETER Type
Identity type for the matched record.
.PARAMETER DisplayName
Preferred display name for the identity across administrative experiences.
.PARAMETER Description
Optional free-text description assigned to the identity profile when present.
.PARAMETER Subtype
NERM classification for the identity.
.PARAMETER Owners
Serialized owner reference information when populated by upstream identity services.
.PARAMETER Attributes
Arbitrary SCIM-style attribute bag returned for the identity context view.
.PARAMETER Created
Timestamp when the identity record was created in Identity Security Cloud.
.PARAMETER Modified
Timestamp when the identity record was last modified in Identity Security Cloud.
.PARAMETER Alias
Primary login or account alias for the identity.
.PARAMETER Email
Primary business email address for the identity.
.PARAMETER IdentityStatus
Current identity lifecycle status label from Identity Security Cloud.
.PARAMETER IsManager
True when the identity is flagged as a people manager in the organization.
.PARAMETER Accounts
First page of accounts for the identity.
.PARAMETER PrivilegedAccess
Full privileged access result for the identity.
.PARAMETER Outliers
Rare access slice; omitted when the tenant lacks the IDA-outliers license.
.PARAMETER AccessHistory
Access-history split into access items and certifications sub-slices.
.OUTPUTS

Intelidentityaggregate<PSCustomObject>
#>


function Initialize-Intelidentityaggregate {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("HUMAN")]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DisplayName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("Employee", "Non Employee", "Cannot Determine")]
        [String]
        ${Subtype},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Owners},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${Attributes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Created},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Modified},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Alias},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Email},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${IdentityStatus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Boolean]
        ${IsManager},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Accounts},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${PrivilegedAccess},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Outliers},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${AccessHistory}
    )

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

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

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "type" = ${Type}
            "displayName" = ${DisplayName}
            "description" = ${Description}
            "subtype" = ${Subtype}
            "owners" = ${Owners}
            "attributes" = ${Attributes}
            "created" = ${Created}
            "modified" = ${Modified}
            "alias" = ${Alias}
            "email" = ${Email}
            "identityStatus" = ${IdentityStatus}
            "isManager" = ${IsManager}
            "accounts" = ${Accounts}
            "privilegedAccess" = ${PrivilegedAccess}
            "outliers" = ${Outliers}
            "accessHistory" = ${AccessHistory}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Intelidentityaggregate<PSCustomObject>

.DESCRIPTION

Convert from JSON to Intelidentityaggregate<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Intelidentityaggregate<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Intelidentityaggregate
        $AllProperties = ("id", "type", "displayName", "description", "subtype", "owners", "attributes", "created", "modified", "alias", "email", "identityStatus", "isManager", "accounts", "privilegedAccess", "outliers", "accessHistory")
        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 "type"))) {
            throw "Error! JSON cannot be serialized due to the required property 'type' missing."
        } else {
            $Type = $JsonParameters.PSobject.Properties["type"].value
        }

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

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "accessHistory"))) {
            throw "Error! JSON cannot be serialized due to the required property 'accessHistory' missing."
        } else {
            $AccessHistory = $JsonParameters.PSobject.Properties["accessHistory"].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 "description"))) { #optional property not found
            $Description = $null
        } else {
            $Description = $JsonParameters.PSobject.Properties["description"].value
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "type" = ${Type}
            "displayName" = ${DisplayName}
            "description" = ${Description}
            "subtype" = ${Subtype}
            "owners" = ${Owners}
            "attributes" = ${Attributes}
            "created" = ${Created}
            "modified" = ${Modified}
            "alias" = ${Alias}
            "email" = ${Email}
            "identityStatus" = ${IdentityStatus}
            "isManager" = ${IsManager}
            "accounts" = ${Accounts}
            "privilegedAccess" = ${PrivilegedAccess}
            "outliers" = ${Outliers}
            "accessHistory" = ${AccessHistory}
        }

        return $PSO
    }

}