jit-activations/src/PSSailpoint.JitActivations/Model/JITActivationFrictionResponse.ps1

#
# Identity Security Cloud API - JIT Activations
# Use these APIs to interact with the Identity Security Cloud 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

One friction step on an activation.

.PARAMETER Type
Kind of friction step.
.PARAMETER Status
Lifecycle of this friction step.
.PARAMETER SubmittedData
Data submitted for this friction step.
.PARAMETER BypassAllowed
Whether this step may be bypassed.
.PARAMETER MinWords
Minimum word count for a justification step.
.OUTPUTS

JITActivationFrictionResponse<PSCustomObject>
#>


function Initialize-JITActivationFrictionResponse {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("TICKET", "JUSTIFICATION", "REAUTHENTICATION")]
        [PSCustomObject]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("PENDING", "ACTIVE", "TIMED_OUT", "COMPLETE", "NOT_APPLICABLE", "CANCELLED", "FAILED")]
        [PSCustomObject]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${SubmittedData},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Boolean]
        ${BypassAllowed},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${MinWords}
    )

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

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


        $PSO = [PSCustomObject]@{
            "type" = ${Type}
            "status" = ${Status}
            "submittedData" = ${SubmittedData}
            "bypassAllowed" = ${BypassAllowed}
            "minWords" = ${MinWords}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to JITActivationFrictionResponse<PSCustomObject>

.DESCRIPTION

Convert from JSON to JITActivationFrictionResponse<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

JITActivationFrictionResponse<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in JITActivationFrictionResponse
        $AllProperties = ("type", "status", "submittedData", "bypassAllowed", "minWords")
        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 'type' missing."
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "type" = ${Type}
            "status" = ${Status}
            "submittedData" = ${SubmittedData}
            "bypassAllowed" = ${BypassAllowed}
            "minWords" = ${MinWords}
        }

        return $PSO
    }

}