Model/ConvertEntitlementConnectionResponse.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 converted entitlement connection.
.PARAMETER Type
The current assignment type of the entitlement connection, not the target type.
.PARAMETER State
The current state of the entitlement connection. Conversion starts as PENDING.
.OUTPUTS

ConvertEntitlementConnectionResponse<PSCustomObject>
#>


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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "connectionId" = ${ConnectionId}
            "type" = ${Type}
            "state" = ${State}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to ConvertEntitlementConnectionResponse<PSCustomObject>

.DESCRIPTION

Convert from JSON to ConvertEntitlementConnectionResponse<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ConvertEntitlementConnectionResponse<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

        $PSO = [PSCustomObject]@{
            "connectionId" = ${ConnectionId}
            "type" = ${Type}
            "state" = ${State}
        }

        return $PSO
    }

}