machine-identities-lifecycle-actions/src/PSSailpoint.MachineIdentitiesLifecycleActions/Model/LifecycleActionRequest.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

No description available.

.PARAMETER Id
Lifecycle request identifier.
.PARAMETER TenantId
Tenant identifier for the lifecycle request.
.PARAMETER StatusType
Type of request. Always `LIFECYCLE_ACTIONS_REQUEST` for lifecycle action requests.
.PARAMETER RequestedBy
ID of the identity that submitted the request.
.PARAMETER TargetType
Type of machine identity the request applies to.
.PARAMETER TargetId
ID of the machine identity the request applies to.
.PARAMETER OperationType
No description available.
.PARAMETER WorkflowId
Identifier of the workflow that processes the request.
.PARAMETER Completed
Indicates whether the request has finished. A request is finished when its status is `COMPLETED`, `REJECTED`, `FAILED`, or `CANCELED`.
.PARAMETER Details
No description available.
.PARAMETER Created
Time when the lifecycle request was created (ISO-8601).
.PARAMETER Modified
Time when the lifecycle request was last modified (ISO-8601).
.OUTPUTS

LifecycleActionRequest<PSCustomObject>
#>


function Initialize-LifecycleActionRequest {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TenantId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${StatusType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RequestedBy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("AI_AGENT")]
        [String]
        ${TargetType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TargetId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("DEACTIVATE", "ACTIVATE")]
        [PSCustomObject]
        ${OperationType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${WorkflowId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Completed} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Details},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Created},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Modified}
    )

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "tenantId" = ${TenantId}
            "statusType" = ${StatusType}
            "requestedBy" = ${RequestedBy}
            "targetType" = ${TargetType}
            "targetId" = ${TargetId}
            "operationType" = ${OperationType}
            "workflowId" = ${WorkflowId}
            "completed" = ${Completed}
            "details" = ${Details}
            "created" = ${Created}
            "modified" = ${Modified}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to LifecycleActionRequest<PSCustomObject>

.DESCRIPTION

Convert from JSON to LifecycleActionRequest<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

LifecycleActionRequest<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in LifecycleActionRequest
        $AllProperties = ("id", "tenantId", "statusType", "requestedBy", "targetType", "targetId", "operationType", "workflowId", "completed", "details", "created", "modified")
        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 "id"))) { #optional property not found
            $Id = $null
        } else {
            $Id = $JsonParameters.PSobject.Properties["id"].value
        }

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "tenantId" = ${TenantId}
            "statusType" = ${StatusType}
            "requestedBy" = ${RequestedBy}
            "targetType" = ${TargetType}
            "targetId" = ${TargetId}
            "operationType" = ${OperationType}
            "workflowId" = ${WorkflowId}
            "completed" = ${Completed}
            "details" = ${Details}
            "created" = ${Created}
            "modified" = ${Modified}
        }

        return $PSO
    }

}