Model/Promptinsight.ps1

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

A prompt security insight event.

.PARAMETER Timestamp
Event time in UTC.
.PARAMETER User
User identifier or display name.
.PARAMETER Agent
The AI agent that processed the prompt.
.PARAMETER PolicyDecision
The policy decision applied to the prompt.
.PARAMETER Category
The category of the prompt security finding.
.PARAMETER Severity
The severity of the prompt security finding.
.PARAMETER Reason
Human-readable or structured reason for the policy decision.
.PARAMETER Rule
The rule that matched the prompt.
.PARAMETER Policy
The policy that matched the prompt.
.OUTPUTS

Promptinsight<PSCustomObject>
#>


function Initialize-Promptinsight {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Timestamp},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${User},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Agent},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ALLOWED", "REDACTED")]
        [String]
        ${PolicyDecision},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ANOMALIES", "DATA_UPLOADS", "MCP_TOOL_CALLS")]
        [String]
        ${Category},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("LOW", "MEDIUM", "HIGH", "CRITICAL")]
        [String]
        ${Severity},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Reason},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Rule},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Policy}
    )

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


        $PSO = [PSCustomObject]@{
            "timestamp" = ${Timestamp}
            "user" = ${User}
            "agent" = ${Agent}
            "policyDecision" = ${PolicyDecision}
            "category" = ${Category}
            "severity" = ${Severity}
            "reason" = ${Reason}
            "rule" = ${Rule}
            "policy" = ${Policy}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Promptinsight<PSCustomObject>

.DESCRIPTION

Convert from JSON to Promptinsight<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Promptinsight<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Promptinsight
        $AllProperties = ("timestamp", "user", "agent", "policyDecision", "category", "severity", "reason", "rule", "policy")
        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 "timestamp"))) { #optional property not found
            $Timestamp = $null
        } else {
            $Timestamp = $JsonParameters.PSobject.Properties["timestamp"].value
        }

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

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

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "severity"))) { #optional property not found
            $Severity = $null
        } else {
            $Severity = $JsonParameters.PSobject.Properties["severity"].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 "rule"))) { #optional property not found
            $Rule = $null
        } else {
            $Rule = $JsonParameters.PSobject.Properties["rule"].value
        }

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

        $PSO = [PSCustomObject]@{
            "timestamp" = ${Timestamp}
            "user" = ${User}
            "agent" = ${Agent}
            "policyDecision" = ${PolicyDecision}
            "category" = ${Category}
            "severity" = ${Severity}
            "reason" = ${Reason}
            "rule" = ${Rule}
            "policy" = ${Policy}
        }

        return $PSO
    }

}