beta/src/PSSailpointBeta/Model/PasswordOrgConfig.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 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-BetaPasswordOrgConfig {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${CustomInstructionsEnabled} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${DigitTokenEnabled} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${DigitTokenDurationMinutes} = 5,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${DigitTokenLength} = 6
    )

    Process {
        'Creating PSCustomObject: PSSailpointBeta => BetaPasswordOrgConfig' | 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-BetaJsonToPasswordOrgConfig {
    Param(
        [AllowEmptyString()]
        [string]$Json
    )

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BetaPasswordOrgConfig
        $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
    }

}