Model/OutlierDetected.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

No description available.

.PARAMETER Identity
No description available.
.PARAMETER OutlierType
Identity's outlier type.
.PARAMETER Score
Dissimilarity score that determines whether the identity is an outlier, ranging from `0.0` to `1.0`. The higher the score, the more likely the identity is an outlier.
.OUTPUTS

OutlierDetected<PSCustomObject>
#>


function Initialize-OutlierDetected {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Identity},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("LOW_SIMILARITY")]
        [String]
        ${OutlierType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Decimal]
        ${Score}
    )

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

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

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

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


        $PSO = [PSCustomObject]@{
            "identity" = ${Identity}
            "outlierType" = ${OutlierType}
            "score" = ${Score}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to OutlierDetected<PSCustomObject>

.DESCRIPTION

Convert from JSON to OutlierDetected<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

OutlierDetected<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in OutlierDetected
        $AllProperties = ("identity", "outlierType", "score")
        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 'identity' missing."
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "identity" = ${Identity}
            "outlierType" = ${OutlierType}
            "score" = ${Score}
        }

        return $PSO
    }

}