Model/Attribute1ValidationsAttributes.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 ValidationMethod
The type of validation to be applied
.PARAMETER Value
The value of the validator
.PARAMETER Destroy
If the validator should be removed
.OUTPUTS

Attribute1ValidationsAttributes<PSCustomObject>
#>


function Initialize-NERMAttribute1ValidationsAttributes {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("required", "unique", "date_format", "days", "characters", "extension", "numericality", "email_format", "custom_format", "no_special_chars")]
        [String]
        ${ValidationMethod},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Value},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Destroy}
    )

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


        $PSO = [PSCustomObject]@{
            "validation_method" = ${ValidationMethod}
            "value" = ${Value}
            "_destroy" = ${Destroy}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Attribute1ValidationsAttributes<PSCustomObject>

.DESCRIPTION

Convert from JSON to Attribute1ValidationsAttributes<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Attribute1ValidationsAttributes<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMAttribute1ValidationsAttributes
        $AllProperties = ("validation_method", "value", "_destroy")
        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 "validation_method"))) { #optional property not found
            $ValidationMethod = $null
        } else {
            $ValidationMethod = $JsonParameters.PSobject.Properties["validation_method"].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 "_destroy"))) { #optional property not found
            $Destroy = $null
        } else {
            $Destroy = $JsonParameters.PSobject.Properties["_destroy"].value
        }

        $PSO = [PSCustomObject]@{
            "validation_method" = ${ValidationMethod}
            "value" = ${Value}
            "_destroy" = ${Destroy}
        }

        return $PSO
    }

}