Model/SODViolationCreatedPayload.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 **SODViolationCreated** webhook.

.PARAMETER Created
When the violation record was created.
.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 Status
Violation lifecycle status.
.PARAMETER Target
No description available.
.OUTPUTS

SODViolationCreatedPayload<PSCustomObject>
#>


function Initialize-SODViolationCreatedPayload {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Created},
        [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)]
        [String]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Target}
    )

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


        $PSO = [PSCustomObject]@{
            "created" = ${Created}
            "id" = ${Id}
            "lastEvaluatedDate" = ${LastEvaluatedDate}
            "level" = ${Level}
            "name" = ${Name}
            "owner" = ${Owner}
            "policy" = ${Policy}
            "status" = ${Status}
            "target" = ${Target}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to SODViolationCreatedPayload<PSCustomObject>

.DESCRIPTION

Convert from JSON to SODViolationCreatedPayload<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

SODViolationCreatedPayload<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SODViolationCreatedPayload
        $AllProperties = ("created", "id", "lastEvaluatedDate", "level", "name", "owner", "policy", "status", "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 "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 "status"))) { #optional property not found
            $Status = $null
        } else {
            $Status = $JsonParameters.PSobject.Properties["status"].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}
            "id" = ${Id}
            "lastEvaluatedDate" = ${LastEvaluatedDate}
            "level" = ${Level}
            "name" = ${Name}
            "owner" = ${Owner}
            "policy" = ${Policy}
            "status" = ${Status}
            "target" = ${Target}
        }

        return $PSO
    }

}