beta/src/PSSailpointBeta/Model/RoleCriteriaLevel2.ps1

#
# IdentityNow Beta API
# Use these APIs to interact with the IdentityNow platform to achieve repeatable, automated processes with greater scalability. These APIs are in beta and are subject to change. 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: 3.1.0-beta
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

Defines STANDARD type Role membership

.PARAMETER Operation
No description available.
.PARAMETER Key
No description available.
.PARAMETER StringValue
String value to test the Identity attribute, Account attribute, or Entitlement specified in the key w/r/t the specified operation. If this criteria is a leaf node, that is, if the operation is one of EQUALS, NOT_EQUALS, CONTAINS, STARTS_WITH, or ENDS_WITH, this field is required. Otherwise, specifying it is an error.
.PARAMETER Children
Array of child criteria. Required if the operation is AND or OR, otherwise it must be left null. A maximum of three levels of criteria are supported, including leaf nodes. Additionally, AND nodes can only be children or OR nodes and vice-versa.
.OUTPUTS

RoleCriteriaLevel2<PSCustomObject>
#>


function Initialize-BetaRoleCriteriaLevel2 {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("EQUALS", "NOT_EQUALS", "CONTAINS", "STARTS_WITH", "ENDS_WITH", "AND", "OR")]
        [PSCustomObject]
        ${Operation},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Key},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${StringValue},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Children}
    )

    Process {
        'Creating PSCustomObject: PSSailpointBeta => BetaRoleCriteriaLevel2' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug


        $PSO = [PSCustomObject]@{
            "operation" = ${Operation}
            "key" = ${Key}
            "stringValue" = ${StringValue}
            "children" = ${Children}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to RoleCriteriaLevel2<PSCustomObject>

.DESCRIPTION

Convert from JSON to RoleCriteriaLevel2<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

RoleCriteriaLevel2<PSCustomObject>
#>

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

    Process {
        'Converting JSON to PSCustomObject: PSSailpointBeta => BetaRoleCriteriaLevel2' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BetaRoleCriteriaLevel2
        $AllProperties = ("operation", "key", "stringValue", "children")
        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 "operation"))) { #optional property not found
            $Operation = $null
        } else {
            $Operation = $JsonParameters.PSobject.Properties["operation"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "operation" = ${Operation}
            "key" = ${Key}
            "stringValue" = ${StringValue}
            "children" = ${Children}
        }

        return $PSO
    }

}