v2024/src/PSSailpoint.V2024/Model/DraftResponse.ps1

#
# Identity Security Cloud V2024 API
# 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: v2024
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER JobId
Unique id assigned to this job.
.PARAMETER Status
Status of the job.
.PARAMETER Type
Type of the job, will always be CREATE_DRAFT for this type of job.
.PARAMETER Message
Message providing information about the outcome of the draft process.
.PARAMETER RequesterName
The name of user that that initiated the draft process.
.PARAMETER FileExists
Whether or not a file was generated for this draft.
.PARAMETER Created
The time the job was started.
.PARAMETER Modified
The time of the last update to the job.
.PARAMETER Completed
The time the job was completed.
.PARAMETER Name
Name of the draft.
.PARAMETER SourceTenant
Tenant owner of the backup from which the draft was generated.
.PARAMETER SourceBackupId
Id of the backup from which the draft was generated.
.PARAMETER SourceBackupName
Name of the backup from which the draft was generated.
.PARAMETER Mode
Denotes the origin of the source backup from which the draft was generated. - RESTORE - Same tenant. - PROMOTE - Different tenant. - UPLOAD - Uploaded configuration.
.PARAMETER ApprovalStatus
Approval status of the draft used to determine whether or not the draft can be deployed.
.PARAMETER ApprovalComment
List of comments that have been exchanged between an approval requester and an approver.
.OUTPUTS

DraftResponse<PSCustomObject>
#>


function Initialize-V2024DraftResponse {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${JobId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("NOT_STARTED", "IN_PROGRESS", "COMPLETE", "CANCELLED", "FAILED")]
        [String]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("CREATE_DRAFT")]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Message},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RequesterName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${FileExists} = $true,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Created},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Modified},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Completed},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SourceTenant},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SourceBackupId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SourceBackupName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("RESTORE", "PROMOTE", "UPLOAD")]
        [String]
        ${Mode},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("DEFAULT", "PENDING_APPROVAL", "APPROVED", "DENIED")]
        [String]
        ${ApprovalStatus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${ApprovalComment}
    )

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


        $PSO = [PSCustomObject]@{
            "jobId" = ${JobId}
            "status" = ${Status}
            "type" = ${Type}
            "message" = ${Message}
            "requesterName" = ${RequesterName}
            "fileExists" = ${FileExists}
            "created" = ${Created}
            "modified" = ${Modified}
            "completed" = ${Completed}
            "name" = ${Name}
            "sourceTenant" = ${SourceTenant}
            "sourceBackupId" = ${SourceBackupId}
            "sourceBackupName" = ${SourceBackupName}
            "mode" = ${Mode}
            "approvalStatus" = ${ApprovalStatus}
            "approvalComment" = ${ApprovalComment}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to DraftResponse<PSCustomObject>

.DESCRIPTION

Convert from JSON to DraftResponse<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

DraftResponse<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in V2024DraftResponse
        $AllProperties = ("jobId", "status", "type", "message", "requesterName", "fileExists", "created", "modified", "completed", "name", "sourceTenant", "sourceBackupId", "sourceBackupName", "mode", "approvalStatus", "approvalComment")
        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 "jobId"))) { #optional property not found
            $JobId = $null
        } else {
            $JobId = $JsonParameters.PSobject.Properties["jobId"].value
        }

        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 "type"))) { #optional property not found
            $Type = $null
        } else {
            $Type = $JsonParameters.PSobject.Properties["type"].value
        }

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "fileExists"))) { #optional property not found
            $FileExists = $null
        } else {
            $FileExists = $JsonParameters.PSobject.Properties["fileExists"].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
        }

        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 "name"))) { #optional property not found
            $Name = $null
        } else {
            $Name = $JsonParameters.PSobject.Properties["name"].value
        }

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "jobId" = ${JobId}
            "status" = ${Status}
            "type" = ${Type}
            "message" = ${Message}
            "requesterName" = ${RequesterName}
            "fileExists" = ${FileExists}
            "created" = ${Created}
            "modified" = ${Modified}
            "completed" = ${Completed}
            "name" = ${Name}
            "sourceTenant" = ${SourceTenant}
            "sourceBackupId" = ${SourceBackupId}
            "sourceBackupName" = ${SourceBackupName}
            "mode" = ${Mode}
            "approvalStatus" = ${ApprovalStatus}
            "approvalComment" = ${ApprovalComment}
        }

        return $PSO
    }

}