Model/ProfileAttributeRuleString1.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 Type
No description available.
.PARAMETER ConditionObjectType
No description available.
.PARAMETER ConditionObjectId
No description available.
.PARAMETER ComparisonOperator
No description available.
.PARAMETER Value
No description available.
.OUTPUTS

ProfileAttributeRuleString1<PSCustomObject>
#>


function Initialize-NERMProfileAttributeRuleString1 {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ProfileAttributeRule")]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("TextFieldAttribute", "TextAreaAttribute")]
        [String]
        ${ConditionObjectType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ConditionObjectId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("==", "!=", ">", "<", "start_with?", "end_with?", "include?")]
        [String]
        ${ComparisonOperator},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Value}
    )

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

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "type" = ${Type}
            "condition_object_type" = ${ConditionObjectType}
            "condition_object_id" = ${ConditionObjectId}
            "comparison_operator" = ${ComparisonOperator}
            "value" = ${Value}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to ProfileAttributeRuleString1<PSCustomObject>

.DESCRIPTION

Convert from JSON to ProfileAttributeRuleString1<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ProfileAttributeRuleString1<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

        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_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 "condition_object_id"))) {
            throw "Error! JSON cannot be serialized due to the required property 'condition_object_id' missing."
        } else {
            $ConditionObjectId = $JsonParameters.PSobject.Properties["condition_object_id"].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 "value"))) {
            throw "Error! JSON cannot be serialized due to the required property 'value' missing."
        } else {
            $Value = $JsonParameters.PSobject.Properties["value"].value
        }

        $PSO = [PSCustomObject]@{
            "type" = ${Type}
            "condition_object_type" = ${ConditionObjectType}
            "condition_object_id" = ${ConditionObjectId}
            "comparison_operator" = ${ComparisonOperator}
            "value" = ${Value}
        }

        return $PSO
    }

}