beta/src/PSSailpointBeta/Model/Approval.ps1

#
# Identity Security Cloud Beta API
# Use these APIs to interact with the Identity Security Cloud platform to achieve repeatable, automated processes with greater scalability. These APIs are in beta and are subject to change. 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: 3.1.0-beta
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

Approval Object

.PARAMETER ApprovalId
The Approval ID
.PARAMETER Approvers
Object representation of an approver of an approval
.PARAMETER CreatedDate
Date the approval was created
.PARAMETER Type
Type of approval
.PARAMETER Name
The name of the approval for a given locale
.PARAMETER BatchRequest
The name of the approval for a given locale
.PARAMETER Description
The description of the approval for a given locale
.PARAMETER Priority
The priority of the approval
.PARAMETER Requester
Object representation of the requester of the approval
.PARAMETER Comments
Object representation of a comment on the approval
.PARAMETER ApprovedBy
Array of approvers who have approved the approval
.PARAMETER RejectedBy
Array of approvers who have rejected the approval
.PARAMETER CompletedDate
Date the approval was completed
.PARAMETER ApprovalCriteria
Criteria that needs to be met for an approval to be marked as approved
.PARAMETER Status
The current status of the approval
.PARAMETER AdditionalAttributes
Json string representing additional attributes known about the object to be approved.
.PARAMETER ReferenceData
Reference data related to the approval
.OUTPUTS

Approval<PSCustomObject>
#>


function Initialize-BetaApproval {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ApprovalId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Approvers},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CreatedDate},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${BatchRequest},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("HIGH", "MEDIUM", "LOW")]
        [String]
        ${Priority},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Requester},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Comments},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${ApprovedBy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${RejectedBy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CompletedDate},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("SINGLE", "DOUBLE", "TRIPLE", "QUARTER", "HALF", "ALL")]
        [String]
        ${ApprovalCriteria},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("PENDING", "APPROVED", "REJECTED")]
        [String]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${AdditionalAttributes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${ReferenceData}
    )

    Process {
        'Creating PSCustomObject: PSSailpointBeta => BetaApproval' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug


        $PSO = [PSCustomObject]@{
            "approvalId" = ${ApprovalId}
            "approvers" = ${Approvers}
            "createdDate" = ${CreatedDate}
            "type" = ${Type}
            "name" = ${Name}
            "batchRequest" = ${BatchRequest}
            "description" = ${Description}
            "priority" = ${Priority}
            "requester" = ${Requester}
            "comments" = ${Comments}
            "approvedBy" = ${ApprovedBy}
            "rejectedBy" = ${RejectedBy}
            "completedDate" = ${CompletedDate}
            "approvalCriteria" = ${ApprovalCriteria}
            "status" = ${Status}
            "additionalAttributes" = ${AdditionalAttributes}
            "referenceData" = ${ReferenceData}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Approval<PSCustomObject>

.DESCRIPTION

Convert from JSON to Approval<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Approval<PSCustomObject>
#>

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

    Process {
        'Converting JSON to PSCustomObject: PSSailpointBeta => BetaApproval' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BetaApproval
        $AllProperties = ("approvalId", "approvers", "createdDate", "type", "name", "batchRequest", "description", "priority", "requester", "comments", "approvedBy", "rejectedBy", "completedDate", "approvalCriteria", "status", "additionalAttributes", "referenceData")
        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 "approvalId"))) { #optional property not found
            $ApprovalId = $null
        } else {
            $ApprovalId = $JsonParameters.PSobject.Properties["approvalId"].value
        }

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "approvalId" = ${ApprovalId}
            "approvers" = ${Approvers}
            "createdDate" = ${CreatedDate}
            "type" = ${Type}
            "name" = ${Name}
            "batchRequest" = ${BatchRequest}
            "description" = ${Description}
            "priority" = ${Priority}
            "requester" = ${Requester}
            "comments" = ${Comments}
            "approvedBy" = ${ApprovedBy}
            "rejectedBy" = ${RejectedBy}
            "completedDate" = ${CompletedDate}
            "approvalCriteria" = ${ApprovalCriteria}
            "status" = ${Status}
            "additionalAttributes" = ${AdditionalAttributes}
            "referenceData" = ${ReferenceData}
        }

        return $PSO
    }

}