reminder-escalations/src/PSSailpoint.ReminderEscalations/Model/Reminderescalationtarget.ps1

#
# SailPoint Identity Security API - Reminder Escalations
# Use these APIs to interact with the SailPoint Identity Security 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

Escalation recipient. `identityId` is required for every `targetType` except `MANAGER_OF`, where it is optional. * `MANAGER_OF` without `identityId` resolves the manager of each current assignee. * `MANAGER_OF` with `identityId` resolves the manager of that identity.

.PARAMETER TargetType
Kind of recipient this target resolves to.
.PARAMETER IdentityId
Identity the target applies to. Empty for a dynamic `MANAGER_OF` target.
.OUTPUTS

Reminderescalationtarget<PSCustomObject>
#>


function Initialize-Reminderescalationtarget {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("MANAGER_OF", "IDENTITY", "GOVERNANCE_GROUP", "ENTITLEMENT_OWNER", "SOURCE_OWNER")]
        [String]
        ${TargetType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${IdentityId} = ""
    )

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

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


        $PSO = [PSCustomObject]@{
            "targetType" = ${TargetType}
            "identityId" = ${IdentityId}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Reminderescalationtarget<PSCustomObject>

.DESCRIPTION

Convert from JSON to Reminderescalationtarget<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Reminderescalationtarget<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

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

        $PSO = [PSCustomObject]@{
            "targetType" = ${TargetType}
            "identityId" = ${IdentityId}
        }

        return $PSO
    }

}