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

Data submitted for a friction step.

.PARAMETER Justification
Justification text.
.PARAMETER Bypass
Whether this step was bypassed.
.PARAMETER TicketId
Ticketing system identifier.
.PARAMETER ReauthSuccessful
Whether reauthentication succeeded.
.PARAMETER ReauthDate
Time of reauthentication.
.OUTPUTS

FrictionSubmittedData<PSCustomObject>
#>


function Initialize-FrictionSubmittedData {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Justification},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Bypass} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TicketId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${ReauthSuccessful} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidatePattern("^$|^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2})?(\.\d+)?(Z|[+-]\d{2}(:?\d{2})?)?)?$")]
        [String]
        ${ReauthDate}
    )

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

        if (!$Justification -and $Justification.length -gt 2000) {
            throw "invalid value for 'Justification', the character length must be smaller than or equal to 2000."
        }

        if (!$TicketId -and $TicketId.length -gt 128) {
            throw "invalid value for 'TicketId', the character length must be smaller than or equal to 128."
        }


        $PSO = [PSCustomObject]@{
            "justification" = ${Justification}
            "bypass" = ${Bypass}
            "ticketId" = ${TicketId}
            "reauthSuccessful" = ${ReauthSuccessful}
            "reauthDate" = ${ReauthDate}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to FrictionSubmittedData<PSCustomObject>

.DESCRIPTION

Convert from JSON to FrictionSubmittedData<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

FrictionSubmittedData<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in FrictionSubmittedData
        $AllProperties = ("justification", "bypass", "ticketId", "isValidTicket", "attempts", "reauthSuccessful", "reauthDate", "integrationDisabled")
        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 "justification"))) { #optional property not found
            $Justification = $null
        } else {
            $Justification = $JsonParameters.PSobject.Properties["justification"].value
        }

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "justification" = ${Justification}
            "bypass" = ${Bypass}
            "ticketId" = ${TicketId}
            "isValidTicket" = ${IsValidTicket}
            "attempts" = ${Attempts}
            "reauthSuccessful" = ${ReauthSuccessful}
            "reauthDate" = ${ReauthDate}
            "integrationDisabled" = ${IntegrationDisabled}
        }

        return $PSO
    }

}