Model/GetHistoricalIdentityEvents200ResponseInner.ps1

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

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Json

JSON object

.OUTPUTS

GetHistoricalIdentityEvents200ResponseInner<PSCustomObject>
#>

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

    Process {
        $match = 0
        $matchType = $null
        $matchInstance = $null

        if ($match -eq 0) { # no match yet
            # try to match AccessItemAssociated defined in the anyOf schemas
            try {
                $matchInstance = ConvertFrom-V2024JsonToAccessItemAssociated $Json

                foreach($property in $matchInstance.PsObject.Properties) {
                    if ($null -ne $property.Value) {
                        $matchType = "AccessItemAssociated"
                        $match++
                        break
                    }
                }
            } catch {
                # fail to match the schema defined in anyOf, proceed to the next one
                Write-Debug "Failed to match 'AccessItemAssociated' defined in anyOf (V2024GetHistoricalIdentityEvents200ResponseInner). Proceeding to the next one if any."
            }
        }

        if ($match -eq 0) { # no match yet
            # try to match AccessItemRemoved defined in the anyOf schemas
            try {
                $matchInstance = ConvertFrom-V2024JsonToAccessItemRemoved $Json

                foreach($property in $matchInstance.PsObject.Properties) {
                    if ($null -ne $property.Value) {
                        $matchType = "AccessItemRemoved"
                        $match++
                        break
                    }
                }
            } catch {
                # fail to match the schema defined in anyOf, proceed to the next one
                Write-Debug "Failed to match 'AccessItemRemoved' defined in anyOf (V2024GetHistoricalIdentityEvents200ResponseInner). Proceeding to the next one if any."
            }
        }

        if ($match -eq 0) { # no match yet
            # try to match AccessRequested defined in the anyOf schemas
            try {
                $matchInstance = ConvertFrom-V2024JsonToAccessRequested $Json

                foreach($property in $matchInstance.PsObject.Properties) {
                    if ($null -ne $property.Value) {
                        $matchType = "AccessRequested"
                        $match++
                        break
                    }
                }
            } catch {
                # fail to match the schema defined in anyOf, proceed to the next one
                Write-Debug "Failed to match 'AccessRequested' defined in anyOf (V2024GetHistoricalIdentityEvents200ResponseInner). Proceeding to the next one if any."
            }
        }

        if ($match -eq 0) { # no match yet
            # try to match AccountStatusChanged defined in the anyOf schemas
            try {
                $matchInstance = ConvertFrom-V2024JsonToAccountStatusChanged $Json

                foreach($property in $matchInstance.PsObject.Properties) {
                    if ($null -ne $property.Value) {
                        $matchType = "AccountStatusChanged"
                        $match++
                        break
                    }
                }
            } catch {
                # fail to match the schema defined in anyOf, proceed to the next one
                Write-Debug "Failed to match 'AccountStatusChanged' defined in anyOf (V2024GetHistoricalIdentityEvents200ResponseInner). Proceeding to the next one if any."
            }
        }

        if ($match -eq 0) { # no match yet
            # try to match AttributesChanged defined in the anyOf schemas
            try {
                $matchInstance = ConvertFrom-V2024JsonToAttributesChanged $Json

                foreach($property in $matchInstance.PsObject.Properties) {
                    if ($null -ne $property.Value) {
                        $matchType = "AttributesChanged"
                        $match++
                        break
                    }
                }
            } catch {
                # fail to match the schema defined in anyOf, proceed to the next one
                Write-Debug "Failed to match 'AttributesChanged' defined in anyOf (V2024GetHistoricalIdentityEvents200ResponseInner). Proceeding to the next one if any."
            }
        }

        if ($match -eq 0) { # no match yet
            # try to match IdentityCertified defined in the anyOf schemas
            try {
                $matchInstance = ConvertFrom-V2024JsonToIdentityCertified $Json

                foreach($property in $matchInstance.PsObject.Properties) {
                    if ($null -ne $property.Value) {
                        $matchType = "IdentityCertified"
                        $match++
                        break
                    }
                }
            } catch {
                # fail to match the schema defined in anyOf, proceed to the next one
                Write-Debug "Failed to match 'IdentityCertified' defined in anyOf (V2024GetHistoricalIdentityEvents200ResponseInner). Proceeding to the next one if any."
            }
        }

        if ($match -eq 1) {
            return [PSCustomObject]@{
                "ActualType" = ${matchType}
                "ActualInstance" = ${matchInstance}
                "anyOfSchemas" = @("AccessItemAssociated", "AccessItemRemoved", "AccessRequested", "AccountStatusChanged", "AttributesChanged", "IdentityCertified")
            }
        } else {
            throw "Error! The JSON payload doesn't matches any type defined in anyOf schemas ([AccessItemAssociated, AccessItemRemoved, AccessRequested, AccountStatusChanged, AttributesChanged, IdentityCertified]). JSON Payload: $($Json)"
        }
    }
}