Model/ReviewItem.ps1

#
# Identity Security Cloud API - Next Generation Certification Campaigns
# 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: v1
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Id
The review item's ID
.PARAMETER Type
No description available.
.PARAMETER Completed
Indicates whether the review item is complete
.PARAMETER NewAccess
Indicates whether the review item is for new access to a source
.PARAMETER Decision
No description available.
.PARAMETER ProposedEndDate
The end date proposed as part of decision to sunset a user's access
.PARAMETER Comments
Comments for this review item
.PARAMETER ReviewData
No description available.
.PARAMETER CertificationSubjectSummary
No description available.
.PARAMETER Actor
No description available.
.PARAMETER AccountName
The name of the account to which this access profile belongs
.PARAMETER SourceName
The name of the source for which this access profile belongs
.PARAMETER ReauthRequired
Indicates whether the review item requires a reauthentication for the approver
.OUTPUTS

ReviewItem<PSCustomObject>
#>


function Initialize-ReviewItem {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ENTITLEMENT", "ACCESS_PROFILE", "ROLE", "ROLE_NAME", "ROLE_DESCRIPTION", "ROLE_CRITERIA", "ROLE_CRITERIA_RULE", "ROLE_CRITERIA_MEMBER")]
        [PSCustomObject]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Completed} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${NewAccess} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ACKNOWLEDGED", "APPROVED", "REVOKED", "UNDECIDED")]
        [PSCustomObject]
        ${Decision},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${ProposedEndDate},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Comments},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ReviewData},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${CertificationSubjectSummary},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Actor},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${AccountName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SourceName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${ReauthRequired} = $false
    )

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "type" = ${Type}
            "completed" = ${Completed}
            "newAccess" = ${NewAccess}
            "decision" = ${Decision}
            "proposedEndDate" = ${ProposedEndDate}
            "comments" = ${Comments}
            "reviewData" = ${ReviewData}
            "certificationSubjectSummary" = ${CertificationSubjectSummary}
            "actor" = ${Actor}
            "accountName" = ${AccountName}
            "sourceName" = ${SourceName}
            "reauthRequired" = ${ReauthRequired}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to ReviewItem<PSCustomObject>

.DESCRIPTION

Convert from JSON to ReviewItem<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ReviewItem<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ReviewItem
        $AllProperties = ("id", "type", "completed", "newAccess", "decision", "proposedEndDate", "comments", "reviewData", "certificationSubjectSummary", "actor", "accountName", "sourceName", "reauthRequired")
        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 "id"))) { #optional property not found
            $Id = $null
        } else {
            $Id = $JsonParameters.PSobject.Properties["id"].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 "completed"))) { #optional property not found
            $Completed = $null
        } else {
            $Completed = $JsonParameters.PSobject.Properties["completed"].value
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "type" = ${Type}
            "completed" = ${Completed}
            "newAccess" = ${NewAccess}
            "decision" = ${Decision}
            "proposedEndDate" = ${ProposedEndDate}
            "comments" = ${Comments}
            "reviewData" = ${ReviewData}
            "certificationSubjectSummary" = ${CertificationSubjectSummary}
            "actor" = ${Actor}
            "accountName" = ${AccountName}
            "sourceName" = ${SourceName}
            "reauthRequired" = ${ReauthRequired}
        }

        return $PSO
    }

}