jit-activations/src/PSSailpoint.JitActivations/Model/JITActivationFrictionsResponse.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

Friction state for an activation.

.PARAMETER ActivationId
Identifier of the activation.
.PARAMETER FrictionState
Aggregate friction state of the activation.
.PARAMETER ConnectionId
Identifier of the entitlement connection.
.PARAMETER ActivationInitTime
Time the activation started.
.PARAMETER ExpiryMins
Minutes allowed to complete all frictions.
.PARAMETER Frictions
Friction steps for the activation.
.OUTPUTS

JITActivationFrictionsResponse<PSCustomObject>
#>


function Initialize-JITActivationFrictionsResponse {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivationId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("PENDING", "IN_PROGRESS", "TIMED_OUT", "COMPLETE", "NOT_APPLICABLE")]
        [PSCustomObject]
        ${FrictionState},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ConnectionId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${ActivationInitTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ExpiryMins},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Frictions}
    )

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

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

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


        $PSO = [PSCustomObject]@{
            "activationId" = ${ActivationId}
            "frictionState" = ${FrictionState}
            "connectionId" = ${ConnectionId}
            "activationInitTime" = ${ActivationInitTime}
            "expiryMins" = ${ExpiryMins}
            "frictions" = ${Frictions}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to JITActivationFrictionsResponse<PSCustomObject>

.DESCRIPTION

Convert from JSON to JITActivationFrictionsResponse<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

JITActivationFrictionsResponse<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in JITActivationFrictionsResponse
        $AllProperties = ("activationId", "frictionState", "connectionId", "activationInitTime", "expiryMins", "frictions")
        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 'activationId' missing."
        }

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "activationId" = ${ActivationId}
            "frictionState" = ${FrictionState}
            "connectionId" = ${ConnectionId}
            "activationInitTime" = ${ActivationInitTime}
            "expiryMins" = ${ExpiryMins}
            "frictions" = ${Frictions}
        }

        return $PSO
    }

}