Model/GenericRequestApprovalConfig.ps1

#
# Identity Security Cloud API - Generic Request Approval Config
# 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

The approval configuration for one scope, with one entry per action the scope's target type supports.

.PARAMETER Id
The approval configuration ID. Use it with the update API.
.PARAMETER TargetType
The kind of scope.
.PARAMETER TargetId
The scope target: the source resource ID for RESOURCE, the subtype ID for SUBTYPE, the source ID for SOURCE, and the tenant ID for GLOBAL.
.PARAMETER ApprovalConfig
The approval setting for each action, keyed by action name (ACTIVATE, DEACTIVATE, CREATE, or DELETE, depending on the target type). An empty object means the action inherits the organization-level approval configuration.
.OUTPUTS

GenericRequestApprovalConfig<PSCustomObject>
#>


function Initialize-GenericRequestApprovalConfig {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("RESOURCE", "SUBTYPE", "SOURCE", "GLOBAL")]
        [String]
        ${TargetType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TargetId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${ApprovalConfig}
    )

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "targetType" = ${TargetType}
            "targetId" = ${TargetId}
            "approvalConfig" = ${ApprovalConfig}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to GenericRequestApprovalConfig<PSCustomObject>

.DESCRIPTION

Convert from JSON to GenericRequestApprovalConfig<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

GenericRequestApprovalConfig<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in GenericRequestApprovalConfig
        $AllProperties = ("id", "targetType", "targetId", "approvalConfig")
        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 "targetType"))) { #optional property not found
            $TargetType = $null
        } else {
            $TargetType = $JsonParameters.PSobject.Properties["targetType"].value
        }

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "targetType" = ${TargetType}
            "targetId" = ${TargetId}
            "approvalConfig" = ${ApprovalConfig}
        }

        return $PSO
    }

}