Model/AccountUpdated.ps1

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

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER VarEvent
No description available.
.PARAMETER Source
No description available.
.PARAMETER Account
No description available.
.PARAMETER Identity
No description available.
.PARAMETER AccountChangeTypes
The types of changes that occurred to the account.
.PARAMETER SingleValueAttributeChanges
Details about the single-value attribute changes that occurred to the account.
.PARAMETER MultiValueAttributeChanges
Details about the multi-value attribute changes that occurred to the account.
.PARAMETER EntitlementChanges
Details about the entitlement changes that occurred to the account.
.OUTPUTS

AccountUpdated<PSCustomObject>
#>


function Initialize-V2025AccountUpdated {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${VarEvent},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Source},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Account},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Identity},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ATTRIBUTES_CHANGED", "ENTITLEMENTS_ADDED", "ENTITLEMENTS_REMOVED")]
        [String[]]
        ${AccountChangeTypes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${SingleValueAttributeChanges},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${MultiValueAttributeChanges},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${EntitlementChanges}
    )

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

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "event" = ${VarEvent}
            "source" = ${Source}
            "account" = ${Account}
            "identity" = ${Identity}
            "accountChangeTypes" = ${AccountChangeTypes}
            "singleValueAttributeChanges" = ${SingleValueAttributeChanges}
            "multiValueAttributeChanges" = ${MultiValueAttributeChanges}
            "entitlementChanges" = ${EntitlementChanges}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to AccountUpdated<PSCustomObject>

.DESCRIPTION

Convert from JSON to AccountUpdated<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

AccountUpdated<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in V2025AccountUpdated
        $AllProperties = ("event", "source", "account", "identity", "accountChangeTypes", "singleValueAttributeChanges", "multiValueAttributeChanges", "entitlementChanges")
        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 'event' missing."
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "event" = ${VarEvent}
            "source" = ${Source}
            "account" = ${Account}
            "identity" = ${Identity}
            "accountChangeTypes" = ${AccountChangeTypes}
            "singleValueAttributeChanges" = ${SingleValueAttributeChanges}
            "multiValueAttributeChanges" = ${MultiValueAttributeChanges}
            "entitlementChanges" = ${EntitlementChanges}
        }

        return $PSO
    }

}