beta/src/PSSailpointBeta/Model/TriggerInputAccessRequestPostApproval.ps1

#
# IdentityNow Beta API
# Use these APIs to interact with the IdentityNow 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

No description available.

.PARAMETER AccessRequestId
The unique ID of the access request.
.PARAMETER RequestedFor
No description available.
.PARAMETER RequestedItemsStatus
Details on the outcome of each access item.
.PARAMETER RequestedBy
No description available.
.OUTPUTS

TriggerInputAccessRequestPostApproval<PSCustomObject>
#>


function Initialize-BetaTriggerInputAccessRequestPostApproval {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${AccessRequestId},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${RequestedFor},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${RequestedItemsStatus},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${RequestedBy}
    )

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

        if ($null -eq $AccessRequestId) {
            throw "invalid value for 'AccessRequestId', 'AccessRequestId' cannot be null."
        }

        if ($null -eq $RequestedFor) {
            throw "invalid value for 'RequestedFor', 'RequestedFor' cannot be null."
        }

        if ($null -eq $RequestedItemsStatus) {
            throw "invalid value for 'RequestedItemsStatus', 'RequestedItemsStatus' cannot be null."
        }

        if ($null -eq $RequestedBy) {
            throw "invalid value for 'RequestedBy', 'RequestedBy' cannot be null."
        }


        $PSO = [PSCustomObject]@{
            "accessRequestId" = ${AccessRequestId}
            "requestedFor" = ${RequestedFor}
            "requestedItemsStatus" = ${RequestedItemsStatus}
            "requestedBy" = ${RequestedBy}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to TriggerInputAccessRequestPostApproval<PSCustomObject>

.DESCRIPTION

Convert from JSON to TriggerInputAccessRequestPostApproval<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

TriggerInputAccessRequestPostApproval<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BetaTriggerInputAccessRequestPostApproval
        $AllProperties = ("accessRequestId", "requestedFor", "requestedItemsStatus", "requestedBy")
        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 'accessRequestId' missing."
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "accessRequestId" = ${AccessRequestId}
            "requestedFor" = ${RequestedFor}
            "requestedItemsStatus" = ${RequestedItemsStatus}
            "requestedBy" = ${RequestedBy}
        }

        return $PSO
    }

}