Model/ConvertEntitlementConnectionRequest.ps1

#
# Identity Security Cloud API - JIT Activation Convert
# 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
The ID of the entitlement connection to convert.
.PARAMETER TargetType
The assignment type to convert the entitlement connection to.
.OUTPUTS

ConvertEntitlementConnectionRequest<PSCustomObject>
#>


function Initialize-ConvertEntitlementConnectionRequest {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ConnectionId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("JIT", "STANDING")]
        [String]
        ${TargetType}
    )

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

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

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


        $PSO = [PSCustomObject]@{
            "connectionId" = ${ConnectionId}
            "targetType" = ${TargetType}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to ConvertEntitlementConnectionRequest<PSCustomObject>

.DESCRIPTION

Convert from JSON to ConvertEntitlementConnectionRequest<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ConvertEntitlementConnectionRequest<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ConvertEntitlementConnectionRequest
        $AllProperties = ("connectionId", "targetType")
        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 "targetType"))) {
            throw "Error! JSON cannot be serialized due to the required property 'targetType' missing."
        } else {
            $TargetType = $JsonParameters.PSobject.Properties["targetType"].value
        }

        $PSO = [PSCustomObject]@{
            "connectionId" = ${ConnectionId}
            "targetType" = ${TargetType}
        }

        return $PSO
    }

}