Model/Bulkapproveentitlementrecommendationitem.ps1

#
# Identity Security Cloud API - Suggested Entitlement Description
# 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

A single item in a bulk entitlement recommendation approval request. The recordType is optional; the backend resolves the type by ID lookup when omitted. Description applies to SED items only; privilegeLevel is required for privilege items.

.PARAMETER Id
The unique identifier of the recommendation record to approve.
.PARAMETER RecordType
The type of the recommendation. When omitted, the backend resolves the type by looking up the ID.
.PARAMETER Description
The approved description text. Required for SED-type items; ignored for privilege items.
.PARAMETER PrivilegeLevel
The approved privilege level. Required for privilege-type items; ignored for SED items.
.OUTPUTS

Bulkapproveentitlementrecommendationitem<PSCustomObject>
#>


function Initialize-Bulkapproveentitlementrecommendationitem {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("SED", "privilege")]
        [String]
        ${RecordType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PrivilegeLevel}
    )

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

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "recordType" = ${RecordType}
            "description" = ${Description}
            "privilegeLevel" = ${PrivilegeLevel}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Bulkapproveentitlementrecommendationitem<PSCustomObject>

.DESCRIPTION

Convert from JSON to Bulkapproveentitlementrecommendationitem<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Bulkapproveentitlementrecommendationitem<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Bulkapproveentitlementrecommendationitem
        $AllProperties = ("id", "recordType", "description", "privilegeLevel")
        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 "recordType"))) { #optional property not found
            $RecordType = $null
        } else {
            $RecordType = $JsonParameters.PSobject.Properties["recordType"].value
        }

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "recordType" = ${RecordType}
            "description" = ${Description}
            "privilegeLevel" = ${PrivilegeLevel}
        }

        return $PSO
    }

}