v3/src/PSSailpoint/Model/PasswordOrgConfig.ps1

#
# IdentityNow V3 API
# Use these APIs to interact with the IdentityNow platform to achieve repeatable, automated processes with greater scalability. 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.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER CustomInstructionsEnabled
Indicator whether custom password instructions feature is enabled. The default value is false.
.PARAMETER DigitTokenEnabled
Indicator whether ""digit token"" feature is enabled. The default value is false.
.PARAMETER DigitTokenDurationMinutes
The duration of ""digit token"" in minutes. The default value is 5.
.PARAMETER DigitTokenLength
The length of ""digit token"". The default value is 6.
.OUTPUTS

PasswordOrgConfig<PSCustomObject>
#>


function Initialize-PasswordOrgConfig {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${CustomInstructionsEnabled} = $false,
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${DigitTokenEnabled} = $false,
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${DigitTokenDurationMinutes} = 5,
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${DigitTokenLength} = 6
    )

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

        if ($DigitTokenDurationMinutes -and $DigitTokenDurationMinutes -gt 60) {
          throw "invalid value for 'DigitTokenDurationMinutes', must be smaller than or equal to 60."
        }

        if ($DigitTokenDurationMinutes -and $DigitTokenDurationMinutes -lt 1) {
          throw "invalid value for 'DigitTokenDurationMinutes', must be greater than or equal to 1."
        }

        if ($DigitTokenLength -and $DigitTokenLength -gt 18) {
          throw "invalid value for 'DigitTokenLength', must be smaller than or equal to 18."
        }

        if ($DigitTokenLength -and $DigitTokenLength -lt 6) {
          throw "invalid value for 'DigitTokenLength', must be greater than or equal to 6."
        }


        $PSO = [PSCustomObject]@{
            "customInstructionsEnabled" = ${CustomInstructionsEnabled}
            "digitTokenEnabled" = ${DigitTokenEnabled}
            "digitTokenDurationMinutes" = ${DigitTokenDurationMinutes}
            "digitTokenLength" = ${DigitTokenLength}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to PasswordOrgConfig<PSCustomObject>

.DESCRIPTION

Convert from JSON to PasswordOrgConfig<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

PasswordOrgConfig<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PasswordOrgConfig
        $AllProperties = ("customInstructionsEnabled", "digitTokenEnabled", "digitTokenDurationMinutes", "digitTokenLength")
        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 "customInstructionsEnabled"))) { #optional property not found
            $CustomInstructionsEnabled = $null
        } else {
            $CustomInstructionsEnabled = $JsonParameters.PSobject.Properties["customInstructionsEnabled"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "customInstructionsEnabled" = ${CustomInstructionsEnabled}
            "digitTokenEnabled" = ${DigitTokenEnabled}
            "digitTokenDurationMinutes" = ${DigitTokenDurationMinutes}
            "digitTokenLength" = ${DigitTokenLength}
        }

        return $PSO
    }

}