Model/Correlationcondition.ps1

#
# Identity Security Cloud API - Machine Identities
# 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 single condition expression within a correlation rule.

.PARAMETER Id
System-generated unique ID of the condition.
.PARAMETER LeftAttributeName
The left-hand attribute name of the condition.
.PARAMETER OperatorType
The comparison operator applied between the left and right attributes.
.PARAMETER RightAttributeName
The right-hand attribute name. Use an empty string when there is no RHS attribute.
.PARAMETER Transform
Optional transform applied before comparison.
.PARAMETER Ordinal
The position of this condition within the rule.
.OUTPUTS

Correlationcondition<PSCustomObject>
#>


function Initialize-Correlationcondition {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LeftAttributeName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${OperatorType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RightAttributeName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Transform},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Int32]
        ${Ordinal}
    )

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "leftAttributeName" = ${LeftAttributeName}
            "operatorType" = ${OperatorType}
            "rightAttributeName" = ${RightAttributeName}
            "transform" = ${Transform}
            "ordinal" = ${Ordinal}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Correlationcondition<PSCustomObject>

.DESCRIPTION

Convert from JSON to Correlationcondition<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Correlationcondition<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Correlationcondition
        $AllProperties = ("id", "leftAttributeName", "operatorType", "rightAttributeName", "transform", "ordinal")
        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 'leftAttributeName' missing."
        }

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

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "ordinal"))) {
            throw "Error! JSON cannot be serialized due to the required property 'ordinal' missing."
        } else {
            $Ordinal = $JsonParameters.PSobject.Properties["ordinal"].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 "transform"))) { #optional property not found
            $Transform = $null
        } else {
            $Transform = $JsonParameters.PSobject.Properties["transform"].value
        }

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "leftAttributeName" = ${LeftAttributeName}
            "operatorType" = ${OperatorType}
            "rightAttributeName" = ${RightAttributeName}
            "transform" = ${Transform}
            "ordinal" = ${Ordinal}
        }

        return $PSO
    }

}