machine-identities-lifecycle-actions/src/PSSailpoint.MachineIdentitiesLifecycleActions/Model/CancelLifecycleActionResponse.ps1

#
# Identity Security Cloud API - Machine Identity Lifecycle Actions
# Use these APIs to submit, list, retrieve, and cancel machine identity lifecycle actions (for example agent activate and deactivate). 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 RequestId
Lifecycle request identifier.
.PARAMETER Status
Updated lifecycle request status after cancel acceptance.
.PARAMETER Action
No description available.
.PARAMETER TargetId
Internal machine identity UUID for the lifecycle target.
.PARAMETER ResourceId
Connector resource id for the lifecycle target, when present.
.OUTPUTS

CancelLifecycleActionResponse<PSCustomObject>
#>


function Initialize-CancelLifecycleActionResponse {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RequestId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("DEACTIVATE", "ACTIVATE")]
        [PSCustomObject]
        ${Action},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TargetId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ResourceId}
    )

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "requestId" = ${RequestId}
            "status" = ${Status}
            "action" = ${Action}
            "targetId" = ${TargetId}
            "resourceId" = ${ResourceId}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to CancelLifecycleActionResponse<PSCustomObject>

.DESCRIPTION

Convert from JSON to CancelLifecycleActionResponse<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

CancelLifecycleActionResponse<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in CancelLifecycleActionResponse
        $AllProperties = ("requestId", "status", "action", "targetId", "resourceId")
        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 'requestId' missing."
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "requestId" = ${RequestId}
            "status" = ${Status}
            "action" = ${Action}
            "targetId" = ${TargetId}
            "resourceId" = ${ResourceId}
        }

        return $PSO
    }

}