beta/src/PSSailpointBeta/Model/ApprovalDto.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

Payload for changing the fields of an approval.

.PARAMETER Comments
Object representation of a comment on the approval
.PARAMETER ApprovedBy
An array of identities who have approved the approval
.PARAMETER RejectedBy
An array of identities who have rejected the approval
.PARAMETER ReassignFrom
No description available.
.PARAMETER ReassignTo
No description available.
.PARAMETER AdditionalAttributes
Any additional attributes that the approval request may need
.OUTPUTS

ApprovalDto<PSCustomObject>
#>


function Initialize-BetaApprovalDto {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Comments},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${ApprovedBy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${RejectedBy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ReassignFrom},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ReassignTo},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${AdditionalAttributes}
    )

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


        $PSO = [PSCustomObject]@{
            "comments" = ${Comments}
            "approvedBy" = ${ApprovedBy}
            "rejectedBy" = ${RejectedBy}
            "reassignFrom" = ${ReassignFrom}
            "reassignTo" = ${ReassignTo}
            "additionalAttributes" = ${AdditionalAttributes}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to ApprovalDto<PSCustomObject>

.DESCRIPTION

Convert from JSON to ApprovalDto<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ApprovalDto<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BetaApprovalDto
        $AllProperties = ("comments", "approvedBy", "rejectedBy", "reassignFrom", "reassignTo", "additionalAttributes")
        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 "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 "reassignFrom"))) { #optional property not found
            $ReassignFrom = $null
        } else {
            $ReassignFrom = $JsonParameters.PSobject.Properties["reassignFrom"].value
        }

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

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

        $PSO = [PSCustomObject]@{
            "comments" = ${Comments}
            "approvedBy" = ${ApprovedBy}
            "rejectedBy" = ${RejectedBy}
            "reassignFrom" = ${ReassignFrom}
            "reassignTo" = ${ReassignTo}
            "additionalAttributes" = ${AdditionalAttributes}
        }

        return $PSO
    }

}