Model/Jitactivationextendrequest.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

No description available.

.PARAMETER ConnectionId
Entitlement connection identifier for the activation to extend.
.PARAMETER ActivationPeriodExtensionMins
Number of minutes to extend the activation period.
.OUTPUTS

Jitactivationextendrequest<PSCustomObject>
#>


function Initialize-Jitactivationextendrequest {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ConnectionId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Int32]
        ${ActivationPeriodExtensionMins}
    )

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

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

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

        if ($ActivationPeriodExtensionMins -lt 1) {
          throw "invalid value for 'ActivationPeriodExtensionMins', must be greater than or equal to 1."
        }


        $PSO = [PSCustomObject]@{
            "connectionId" = ${ConnectionId}
            "activationPeriodExtensionMins" = ${ActivationPeriodExtensionMins}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Jitactivationextendrequest<PSCustomObject>

.DESCRIPTION

Convert from JSON to Jitactivationextendrequest<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Jitactivationextendrequest<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Jitactivationextendrequest
        $AllProperties = ("connectionId", "activationPeriodExtensionMins")
        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 'connectionId' missing."
        }

        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 "activationPeriodExtensionMins"))) {
            throw "Error! JSON cannot be serialized due to the required property 'activationPeriodExtensionMins' missing."
        } else {
            $ActivationPeriodExtensionMins = $JsonParameters.PSobject.Properties["activationPeriodExtensionMins"].value
        }

        $PSO = [PSCustomObject]@{
            "connectionId" = ${ConnectionId}
            "activationPeriodExtensionMins" = ${ActivationPeriodExtensionMins}
        }

        return $PSO
    }

}