intelligence/src/PSSailpoint.Intelligence/Model/Intelaccessitemhistoryevent.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

Access-item history event. Supported eventTypes are AccessItemAssociated, AccessItemRemoved, and AccountStatusChanged.

.PARAMETER EventType
Type of access-item history event.
.PARAMETER DateTime
Event timestamp.
.OUTPUTS

Intelaccessitemhistoryevent<PSCustomObject>
#>


function Initialize-Intelaccessitemhistoryevent {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("AccessItemAssociated", "AccessItemRemoved", "AccountStatusChanged")]
        [String]
        ${EventType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${DateTime}
    )

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

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


        $PSO = [PSCustomObject]@{
            "eventType" = ${EventType}
            "dateTime" = ${DateTime}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Intelaccessitemhistoryevent<PSCustomObject>

.DESCRIPTION

Convert from JSON to Intelaccessitemhistoryevent<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Intelaccessitemhistoryevent<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json
        $IntelaccessitemhistoryeventAdditionalProperties = @{}

        # check if Json contains properties not defined in Intelaccessitemhistoryevent
        $AllProperties = ("eventType", "dateTime")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            # store undefined properties in additionalProperties
            if (!($AllProperties.Contains($name))) {
                $IntelaccessitemhistoryeventAdditionalProperties[$name] = $JsonParameters.PSobject.Properties[$name].value
            }
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "eventType" = ${EventType}
            "dateTime" = ${DateTime}
            "AdditionalProperties" = $IntelaccessitemhistoryeventAdditionalProperties
        }

        return $PSO
    }

}