v2024/src/PSSailpoint.V2024/Model/ApprovalComment.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 Comment
Comment provided either by the approval requester or the approver.
.PARAMETER Timestamp
The time when this comment was provided.
.PARAMETER User
Name of the user that provided this comment.
.PARAMETER Id
Id of the user that provided this comment.
.PARAMETER ChangedToStatus
Status transition of the draft.
.OUTPUTS

ApprovalComment<PSCustomObject>
#>


function Initialize-V2024ApprovalComment {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Comment},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.DateTime]
        ${Timestamp},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${User},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("PENDING_APPROVAL", "APPROVED", "REJECTED")]
        [String]
        ${ChangedToStatus}
    )

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

        if (!$Comment) {
            throw "invalid value for 'Comment', 'Comment' cannot be null."
        }

        if (!$Timestamp) {
            throw "invalid value for 'Timestamp', 'Timestamp' cannot be null."
        }

        if (!$User) {
            throw "invalid value for 'User', 'User' cannot be null."
        }

        if (!$Id) {
            throw "invalid value for 'Id', 'Id' cannot be null."
        }

        if (!$ChangedToStatus) {
            throw "invalid value for 'ChangedToStatus', 'ChangedToStatus' cannot be null."
        }


        $PSO = [PSCustomObject]@{
            "comment" = ${Comment}
            "timestamp" = ${Timestamp}
            "user" = ${User}
            "id" = ${Id}
            "changedToStatus" = ${ChangedToStatus}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to ApprovalComment<PSCustomObject>

.DESCRIPTION

Convert from JSON to ApprovalComment<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ApprovalComment<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in V2024ApprovalComment
        $AllProperties = ("comment", "timestamp", "user", "id", "changedToStatus")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

        If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json
            throw "Error! Empty JSON cannot be serialized due to the required property 'comment' missing."
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "comment"))) {
            throw "Error! JSON cannot be serialized due to the required property 'comment' missing."
        } else {
            $Comment = $JsonParameters.PSobject.Properties["comment"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "timestamp"))) {
            throw "Error! JSON cannot be serialized due to the required property 'timestamp' missing."
        } else {
            $Timestamp = $JsonParameters.PSobject.Properties["timestamp"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "user"))) {
            throw "Error! JSON cannot be serialized due to the required property 'user' missing."
        } else {
            $User = $JsonParameters.PSobject.Properties["user"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) {
            throw "Error! JSON cannot be serialized due to the required property 'id' missing."
        } else {
            $Id = $JsonParameters.PSobject.Properties["id"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "changedToStatus"))) {
            throw "Error! JSON cannot be serialized due to the required property 'changedToStatus' missing."
        } else {
            $ChangedToStatus = $JsonParameters.PSobject.Properties["changedToStatus"].value
        }

        $PSO = [PSCustomObject]@{
            "comment" = ${Comment}
            "timestamp" = ${Timestamp}
            "user" = ${User}
            "id" = ${Id}
            "changedToStatus" = ${ChangedToStatus}
        }

        return $PSO
    }

}