Model/AutomatedWorkflowConditionRulesAttributesInner.ps1

#
# NERM API
# The NERM API accesss and modifies resources in your environment.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER LogicalOperator
The type of condition rule.
.PARAMETER ComparisonOperator
The operator used by the condition rule.
.PARAMETER ConditionObjectId
UUID for object targeted by the condition.
.PARAMETER ConditionObjectType
Type of object targeted by the condition.
.PARAMETER SecondaryValue
Used for time_frame comparison.
.PARAMETER TertiaryValue
Represents the days of a temporal comparison.
.PARAMETER Value
The value being compared against.
.PARAMETER Order
If there are multiple rules against one workflow, this is the order that they are ran in.
.PARAMETER Type
The type of condition rule.
.OUTPUTS

AutomatedWorkflowConditionRulesAttributesInner<PSCustomObject>
#>


function Initialize-NERMAutomatedWorkflowConditionRulesAttributesInner {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("AND", "OR")]
        [String]
        ${LogicalOperator},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("<", ">", "==", "before", "include?", "absent?", "after")]
        [String]
        ${ComparisonOperator},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ConditionObjectId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ConditionObjectType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SecondaryValue},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TertiaryValue},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Value},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Order},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("RiskRule", "ProfileIdRule", "ProfileTypeRule", "ProfileExistsRule", "ProfileStatusRule", "SessionAttributeRule", "ProfileAttributeRule", "ProfileDoesNotExistRule", "IdentityProofingRule")]
        [String]
        ${Type}
    )

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "logical_operator" = ${LogicalOperator}
            "comparison_operator" = ${ComparisonOperator}
            "condition_object_id" = ${ConditionObjectId}
            "condition_object_type" = ${ConditionObjectType}
            "secondary_value" = ${SecondaryValue}
            "tertiary_value" = ${TertiaryValue}
            "value" = ${Value}
            "order" = ${Order}
            "type" = ${Type}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to AutomatedWorkflowConditionRulesAttributesInner<PSCustomObject>

.DESCRIPTION

Convert from JSON to AutomatedWorkflowConditionRulesAttributesInner<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

AutomatedWorkflowConditionRulesAttributesInner<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMAutomatedWorkflowConditionRulesAttributesInner
        $AllProperties = ("logical_operator", "comparison_operator", "condition_object_id", "condition_object_type", "secondary_value", "tertiary_value", "value", "order", "type")
        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 'logical_operator' missing."
        }

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "logical_operator" = ${LogicalOperator}
            "comparison_operator" = ${ComparisonOperator}
            "condition_object_id" = ${ConditionObjectId}
            "condition_object_type" = ${ConditionObjectType}
            "secondary_value" = ${SecondaryValue}
            "tertiary_value" = ${TertiaryValue}
            "value" = ${Value}
            "order" = ${Order}
            "type" = ${Type}
        }

        return $PSO
    }

}