Model/SODViolationClosedPayload.ps1

#
# Identity Security Cloud API - Triggers
# 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

JSON body delivered for the **SODViolationClosed** webhook.

.PARAMETER Created
When the violation record was created.
.PARAMETER Modified
When the violation was last modified.
.PARAMETER Id
Violation ID.
.PARAMETER LastEvaluatedDate
When the violation was last evaluated.
.PARAMETER Level
Violation severity level.
.PARAMETER Name
Human-readable violation name.
.PARAMETER Owner
No description available.
.PARAMETER Policy
No description available.
.PARAMETER PreviousStatus
Violation status before closure (**Open** or **Mitigated**).
.PARAMETER CurrentStatus
Violation status after the event (always **Closed** for this webhook).
.PARAMETER Target
No description available.
.OUTPUTS

SODViolationClosedPayload<PSCustomObject>
#>


function Initialize-SODViolationClosedPayload {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Created},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Modified},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${LastEvaluatedDate},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Level},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Owner},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Policy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("Open", "Mitigated")]
        [String]
        ${PreviousStatus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("Closed")]
        [String]
        ${CurrentStatus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Target}
    )

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


        $PSO = [PSCustomObject]@{
            "created" = ${Created}
            "modified" = ${Modified}
            "id" = ${Id}
            "lastEvaluatedDate" = ${LastEvaluatedDate}
            "level" = ${Level}
            "name" = ${Name}
            "owner" = ${Owner}
            "policy" = ${Policy}
            "previousStatus" = ${PreviousStatus}
            "currentStatus" = ${CurrentStatus}
            "target" = ${Target}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to SODViolationClosedPayload<PSCustomObject>

.DESCRIPTION

Convert from JSON to SODViolationClosedPayload<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

SODViolationClosedPayload<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SODViolationClosedPayload
        $AllProperties = ("created", "modified", "id", "lastEvaluatedDate", "level", "name", "owner", "policy", "previousStatus", "currentStatus", "target")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

        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 "id"))) { #optional property not found
            $Id = $null
        } else {
            $Id = $JsonParameters.PSobject.Properties["id"].value
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "created" = ${Created}
            "modified" = ${Modified}
            "id" = ${Id}
            "lastEvaluatedDate" = ${LastEvaluatedDate}
            "level" = ${Level}
            "name" = ${Name}
            "owner" = ${Owner}
            "policy" = ${Policy}
            "previousStatus" = ${PreviousStatus}
            "currentStatus" = ${CurrentStatus}
            "target" = ${Target}
        }

        return $PSO
    }

}