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

External source metadata captured for audit and traceability.

.PARAMETER Source
External system that initiated the action.
.PARAMETER ExternalAlertId
External alert or case identifier.
.PARAMETER Reason
Human-readable reason for the action.
.PARAMETER Operator
Operator or analyst who initiated the action.
.OUTPUTS

Responseactioncontext<PSCustomObject>
#>


function Initialize-Responseactioncontext {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("CROWDSTRIKE", "SENTINEL", "SPLUNK", "CUSTOM")]
        [String]
        ${Source},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ExternalAlertId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Reason},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Operator}
    )

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

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

        if ($Source.length -gt 128) {
            throw "invalid value for 'Source', the character length must be smaller than or equal to 128."
        }

        if (!$ExternalAlertId -and $ExternalAlertId.length -gt 256) {
            throw "invalid value for 'ExternalAlertId', the character length must be smaller than or equal to 256."
        }

        if (!$Reason -and $Reason.length -gt 1024) {
            throw "invalid value for 'Reason', the character length must be smaller than or equal to 1024."
        }

        if (!$Operator -and $Operator.length -gt 256) {
            throw "invalid value for 'Operator', the character length must be smaller than or equal to 256."
        }


        $PSO = [PSCustomObject]@{
            "source" = ${Source}
            "externalAlertId" = ${ExternalAlertId}
            "reason" = ${Reason}
            "operator" = ${Operator}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Responseactioncontext<PSCustomObject>

.DESCRIPTION

Convert from JSON to Responseactioncontext<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Responseactioncontext<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Responseactioncontext
        $AllProperties = ("source", "externalAlertId", "reason", "operator")
        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 'source' missing."
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "source" = ${Source}
            "externalAlertId" = ${ExternalAlertId}
            "reason" = ${Reason}
            "operator" = ${Operator}
        }

        return $PSO
    }

}