v3/src/PSSailpoint/Model/ReviewDecision.ps1

#
# IdentityNow V3 API
# Use these APIs to interact with the IdentityNow 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: 3.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Id
The id of the review decision
.PARAMETER Decision
No description available.
.PARAMETER ProposedEndDate
The date at which a user's access should be taken away. Should only be set for `REVOKE` decisions.
.PARAMETER Bulk
Indicates whether decision should be marked as part of a larger bulk decision
.PARAMETER Recommendation
No description available.
.PARAMETER Comments
Comments recorded when the decision was made
.OUTPUTS

ReviewDecision<PSCustomObject>
#>


function Initialize-ReviewDecision {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("APPROVE", "REVOKE")]
        [PSCustomObject]
        ${Decision},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${ProposedEndDate},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Boolean]
        ${Bulk},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Recommendation},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Comments}
    )

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

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

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

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "decision" = ${Decision}
            "proposedEndDate" = ${ProposedEndDate}
            "bulk" = ${Bulk}
            "recommendation" = ${Recommendation}
            "comments" = ${Comments}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to ReviewDecision<PSCustomObject>

.DESCRIPTION

Convert from JSON to ReviewDecision<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ReviewDecision<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ReviewDecision
        $AllProperties = ("id", "decision", "proposedEndDate", "bulk", "recommendation", "comments")
        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 'id' missing."
        }

        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 "decision"))) {
            throw "Error! JSON cannot be serialized due to the required property 'decision' missing."
        } else {
            $Decision = $JsonParameters.PSobject.Properties["decision"].value
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "decision" = ${Decision}
            "proposedEndDate" = ${ProposedEndDate}
            "bulk" = ${Bulk}
            "recommendation" = ${Recommendation}
            "comments" = ${Comments}
        }

        return $PSO
    }

}