beta/src/PSSailpointBeta/Model/FormElement.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

No description available.

.PARAMETER Id
Form element identifier.
.PARAMETER ElementType
FormElementType value. TEXT FormElementTypeText TOGGLE FormElementTypeToggle TEXTAREA FormElementTypeTextArea HIDDEN FormElementTypeHidden PHONE FormElementTypePhone EMAIL FormElementTypeEmail SELECT FormElementTypeSelect DATE FormElementTypeDate SECTION FormElementTypeSection COLUMNS FormElementTypeColumns
.PARAMETER Config
Config object.
.PARAMETER Key
Technical key.
.PARAMETER Validations
Set of FormElementValidation items.
.OUTPUTS

FormElement<PSCustomObject>
#>


function Initialize-BetaFormElement {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("TEXT", "TOGGLE", "TEXTAREA", "HIDDEN", "PHONE", "EMAIL", "SELECT", "DATE", "SECTION", "COLUMNS")]
        [String]
        ${ElementType},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${Config},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Key},
        [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Validations}
    )

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "elementType" = ${ElementType}
            "config" = ${Config}
            "key" = ${Key}
            "validations" = ${Validations}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to FormElement<PSCustomObject>

.DESCRIPTION

Convert from JSON to FormElement<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

FormElement<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BetaFormElement
        $AllProperties = ("id", "elementType", "config", "key", "validations")
        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 "id"))) { #optional property not found
            $Id = $null
        } else {
            $Id = $JsonParameters.PSobject.Properties["id"].value
        }

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "config"))) { #optional property not found
            $Config = $null
        } else {
            $Config = $JsonParameters.PSobject.Properties["config"].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 "validations"))) { #optional property not found
            $Validations = $null
        } else {
            $Validations = $JsonParameters.PSobject.Properties["validations"].value
        }

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "elementType" = ${ElementType}
            "config" = ${Config}
            "key" = ${Key}
            "validations" = ${Validations}
        }

        return $PSO
    }

}