Model/Jitactivationconfigresponse.ps1

#
# Identity Security Cloud API - JIT Access
# 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 Id
Unique identifier of this JIT activation configuration instance (persisted config id).
.PARAMETER EntitlementIds
Entitlement IDs governed by JIT activation policy. May be a single-element array when only one entitlement is in scope.
.PARAMETER MaxActivationPeriodMins
Maximum allowed JIT activation duration for a single grant, in minutes; null if unset.
.PARAMETER MaxActivationPeriodExtensionMins
Maximum allowed extension of an active JIT activation, in minutes; null if unset.
.PARAMETER DefaultMaxActivationPeriodMins
Default activation duration offered when a user requests JIT access, in minutes; null if unset.
.PARAMETER DefaultMaxActivationPeriodExtensionMins
Default extension duration offered for an active JIT activation, in minutes; null if unset.
.PARAMETER NotificationRecipients
Email addresses notified for JIT activation events (for example policy owners or a shared mailbox).
.PARAMETER NotificationTemplate
Name or key of the email template used for JIT activation notifications; null if unset.
.PARAMETER ApplyToFutureAssignments
Whether the policy applies to future entitlement assignments.
.OUTPUTS

Jitactivationconfigresponse<PSCustomObject>
#>


function Initialize-Jitactivationconfigresponse {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${EntitlementIds},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${MaxActivationPeriodMins},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${MaxActivationPeriodExtensionMins},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${DefaultMaxActivationPeriodMins},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${DefaultMaxActivationPeriodExtensionMins},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${NotificationRecipients},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${NotificationTemplate},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Boolean]
        ${ApplyToFutureAssignments}
    )

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

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

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "entitlementIds" = ${EntitlementIds}
            "maxActivationPeriodMins" = ${MaxActivationPeriodMins}
            "maxActivationPeriodExtensionMins" = ${MaxActivationPeriodExtensionMins}
            "defaultMaxActivationPeriodMins" = ${DefaultMaxActivationPeriodMins}
            "defaultMaxActivationPeriodExtensionMins" = ${DefaultMaxActivationPeriodExtensionMins}
            "notificationRecipients" = ${NotificationRecipients}
            "notificationTemplate" = ${NotificationTemplate}
            "applyToFutureAssignments" = ${ApplyToFutureAssignments}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Jitactivationconfigresponse<PSCustomObject>

.DESCRIPTION

Convert from JSON to Jitactivationconfigresponse<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Jitactivationconfigresponse<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Jitactivationconfigresponse
        $AllProperties = ("id", "entitlementIds", "maxActivationPeriodMins", "maxActivationPeriodExtensionMins", "defaultMaxActivationPeriodMins", "defaultMaxActivationPeriodExtensionMins", "notificationRecipients", "notificationTemplate", "applyToFutureAssignments")
        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 'id' missing."
        }

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "entitlementIds" = ${EntitlementIds}
            "maxActivationPeriodMins" = ${MaxActivationPeriodMins}
            "maxActivationPeriodExtensionMins" = ${MaxActivationPeriodExtensionMins}
            "defaultMaxActivationPeriodMins" = ${DefaultMaxActivationPeriodMins}
            "defaultMaxActivationPeriodExtensionMins" = ${DefaultMaxActivationPeriodExtensionMins}
            "notificationRecipients" = ${NotificationRecipients}
            "notificationTemplate" = ${NotificationTemplate}
            "applyToFutureAssignments" = ${ApplyToFutureAssignments}
        }

        return $PSO
    }

}