mfa-configuration/src/PSSailpoint.MfaConfiguration/Model/MfaClear1Config.ps1

#
# SailPoint Identity Security API - MFA Configuration
# Use these APIs to interact with the SailPoint Identity Security 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: v1
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

Configuration of the CLEAR1 MFA method. At least one of `knownUserKeyFlowConfig` or `establishedIdentityFlowConfig` must be configured.

.PARAMETER MfaMethod
Mfa method name
.PARAMETER Enabled
If MFA method is enabled.
.PARAMETER ApiKey
The API key for authenticating requests to the CLEAR1 provider. This field is always required, regardless of whether the MFA method is enabled. This value is masked in responses.
.PARAMETER KnownUserKeyFlowConfig
No description available.
.PARAMETER EstablishedIdentityFlowConfig
No description available.
.OUTPUTS

MfaClear1Config<PSCustomObject>
#>


function Initialize-MfaClear1Config {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${MfaMethod},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Enabled} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ApiKey},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${KnownUserKeyFlowConfig},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${EstablishedIdentityFlowConfig}
    )

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

        if (!$MfaMethod) {
            throw "invalid value for 'MfaMethod', 'MfaMethod' cannot be null."
        }

        if (!$ApiKey) {
            throw "invalid value for 'ApiKey', 'ApiKey' cannot be null."
        }


        $PSO = [PSCustomObject]@{
            "mfaMethod" = ${MfaMethod}
            "enabled" = ${Enabled}
            "apiKey" = ${ApiKey}
            "knownUserKeyFlowConfig" = ${KnownUserKeyFlowConfig}
            "establishedIdentityFlowConfig" = ${EstablishedIdentityFlowConfig}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to MfaClear1Config<PSCustomObject>

.DESCRIPTION

Convert from JSON to MfaClear1Config<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

MfaClear1Config<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in MfaClear1Config
        $AllProperties = ("mfaMethod", "enabled", "apiKey", "knownUserKeyFlowConfig", "establishedIdentityFlowConfig")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

        If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json
            throw "Error! Empty JSON cannot be serialized due to the required property 'mfaMethod' missing."
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "mfaMethod"))) {
            throw "Error! JSON cannot be serialized due to the required property 'mfaMethod' missing."
        } else {
            $MfaMethod = $JsonParameters.PSobject.Properties["mfaMethod"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "apiKey"))) {
            throw "Error! JSON cannot be serialized due to the required property 'apiKey' missing."
        } else {
            $ApiKey = $JsonParameters.PSobject.Properties["apiKey"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "mfaMethod" = ${MfaMethod}
            "enabled" = ${Enabled}
            "apiKey" = ${ApiKey}
            "knownUserKeyFlowConfig" = ${KnownUserKeyFlowConfig}
            "establishedIdentityFlowConfig" = ${EstablishedIdentityFlowConfig}
        }

        return $PSO
    }

}