Model/FormAttributes.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 FormId
The id of the form
.PARAMETER NeAttributeId
The id of the attribute
.PARAMETER AttrType
The attribute type
.PARAMETER Order
The ordinal position of the attribute on the Form. The order value determines the order or sequence the Form values are presented in the user interface. Each FormAttribute on a Form must have a unique order value. Order valuess can start at zero (0), but often start at one (1). The FormAttribute with order 1 is presented before the FormAttribute with order 2, and so on. Gaps in the order can exist and the system ignores them.
.OUTPUTS

FormAttributes<PSCustomObject>
#>


function Initialize-NERMFormAttributes {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${FormId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${NeAttributeId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ne_attribute", "break")]
        [String]
        ${AttrType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Order}
    )

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


        $PSO = [PSCustomObject]@{
            "form_id" = ${FormId}
            "ne_attribute_id" = ${NeAttributeId}
            "attr_type" = ${AttrType}
            "order" = ${Order}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to FormAttributes<PSCustomObject>

.DESCRIPTION

Convert from JSON to FormAttributes<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

FormAttributes<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMFormAttributes
        $AllProperties = ("form_id", "ne_attribute_id", "attr_type", "order")
        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 "form_id"))) { #optional property not found
            $FormId = $null
        } else {
            $FormId = $JsonParameters.PSobject.Properties["form_id"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "form_id" = ${FormId}
            "ne_attribute_id" = ${NeAttributeId}
            "attr_type" = ${AttrType}
            "order" = ${Order}
        }

        return $PSO
    }

}