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

#
# SailPoint Identity Security API - Machine Identity Lifecycle Actions
# Use these APIs to submit, list, retrieve, and cancel machine identity lifecycle actions (currently activate and deactivate for Agent machine identities only). 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

Details of the lifecycle request, including its status, approval, comments, and provisioning.

.PARAMETER Status
No description available.
.PARAMETER Action
No description available.
.PARAMETER Approver
No description available.
.PARAMETER ApprovedAt
Time when the request was approved (ISO-8601).
.PARAMETER Canceller
No description available.
.PARAMETER CanceledAt
Time when the request was canceled (ISO-8601).
.PARAMETER CancelComment
Comment provided when the request was canceled.
.PARAMETER Comments
Comments on the lifecycle request, in the order they were added.
.PARAMETER FailurePhase
Stage where the request failed, when applicable.
.PARAMETER FailureReason
Failure reason for the lifecycle request, when applicable.
.PARAMETER Resource
No description available.
.PARAMETER ResourceOwners
Owners of the machine identity at the time the request was submitted.
.PARAMETER SourceOwner
No description available.
.PARAMETER Requester
No description available.
.PARAMETER ApprovalRequestId
ID of the approval request created for this lifecycle request.
.PARAMETER ApprovalSettingsId
ID of the approval settings used for the request.
.PARAMETER Provisioning
No description available.
.OUTPUTS

LifecycleActionRequestDetails<PSCustomObject>
#>


function Initialize-LifecycleActionRequestDetails {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("RECEIVED", "PENDING_APPROVAL", "APPROVED", "REJECTED", "PROVISIONING", "COMPLETED", "FAILED", "CANCELING", "CANCELED")]
        [PSCustomObject]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("DEACTIVATE", "ACTIVATE")]
        [PSCustomObject]
        ${Action},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Approver},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${ApprovedAt},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Canceller},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${CanceledAt},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CancelComment},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Comments},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${FailurePhase},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${FailureReason},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Resource},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${ResourceOwners},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${SourceOwner},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Requester},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ApprovalRequestId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ApprovalSettingsId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Provisioning}
    )

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


        $PSO = [PSCustomObject]@{
            "status" = ${Status}
            "action" = ${Action}
            "approver" = ${Approver}
            "approvedAt" = ${ApprovedAt}
            "canceller" = ${Canceller}
            "canceledAt" = ${CanceledAt}
            "cancelComment" = ${CancelComment}
            "comments" = ${Comments}
            "failurePhase" = ${FailurePhase}
            "failureReason" = ${FailureReason}
            "resource" = ${Resource}
            "resourceOwners" = ${ResourceOwners}
            "sourceOwner" = ${SourceOwner}
            "requester" = ${Requester}
            "approvalRequestId" = ${ApprovalRequestId}
            "approvalSettingsId" = ${ApprovalSettingsId}
            "provisioning" = ${Provisioning}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to LifecycleActionRequestDetails<PSCustomObject>

.DESCRIPTION

Convert from JSON to LifecycleActionRequestDetails<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

LifecycleActionRequestDetails<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in LifecycleActionRequestDetails
        $AllProperties = ("status", "action", "approver", "approvedAt", "canceller", "canceledAt", "cancelComment", "comments", "failurePhase", "failureReason", "resource", "resourceOwners", "sourceOwner", "requester", "approvalRequestId", "approvalSettingsId", "provisioning")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "status" = ${Status}
            "action" = ${Action}
            "approver" = ${Approver}
            "approvedAt" = ${ApprovedAt}
            "canceller" = ${Canceller}
            "canceledAt" = ${CanceledAt}
            "cancelComment" = ${CancelComment}
            "comments" = ${Comments}
            "failurePhase" = ${FailurePhase}
            "failureReason" = ${FailureReason}
            "resource" = ${Resource}
            "resourceOwners" = ${ResourceOwners}
            "sourceOwner" = ${SourceOwner}
            "requester" = ${Requester}
            "approvalRequestId" = ${ApprovalRequestId}
            "approvalSettingsId" = ${ApprovalSettingsId}
            "provisioning" = ${Provisioning}
        }

        return $PSO
    }

}