v3/src/PSSailpoint/Model/ObjectMappingRequest.ps1

#
# Identity Security Cloud V3 API
# 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: 3.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER ObjectType
Type of the object the mapping value applies to, must be one from enum
.PARAMETER JsonPath
JSONPath expression denoting the path within the object where the mapping value should be applied
.PARAMETER SourceValue
Original value at the jsonPath location within the object
.PARAMETER TargetValue
Value to be assigned at the jsonPath location within the object
.PARAMETER Enabled
Whether or not this object mapping is enabled
.OUTPUTS

ObjectMappingRequest<PSCustomObject>
#>


function Initialize-ObjectMappingRequest {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ACCESS_PROFILE", "ACCESS_REQUEST_CONFIG", "ATTR_SYNC_SOURCE_CONFIG", "AUTH_ORG", "CAMPAIGN_FILTER", "ENTITLEMENT", "FORM_DEFINITION", "GOVERNANCE_GROUP", "IDENTITY", "IDENTITY_OBJECT_CONFIG", "IDENTITY_PROFILE", "LIFECYCLE_STATE", "NOTIFICATION_TEMPLATE", "PASSWORD_POLICY", "PASSWORD_SYNC_GROUP", "PUBLIC_IDENTITIES_CONFIG", "ROLE", "RULE", "SEGMENT", "SERVICE_DESK_INTEGRATION", "SOD_POLICY", "SOURCE", "TAG", "TRANSFORM", "TRIGGER_SUBSCRIPTION", "WORKFLOW")]
        [String]
        ${ObjectType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${JsonPath},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SourceValue},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TargetValue},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Enabled} = $false
    )

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "objectType" = ${ObjectType}
            "jsonPath" = ${JsonPath}
            "sourceValue" = ${SourceValue}
            "targetValue" = ${TargetValue}
            "enabled" = ${Enabled}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to ObjectMappingRequest<PSCustomObject>

.DESCRIPTION

Convert from JSON to ObjectMappingRequest<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ObjectMappingRequest<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ObjectMappingRequest
        $AllProperties = ("objectType", "jsonPath", "sourceValue", "targetValue", "enabled")
        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 'objectType' missing."
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "objectType" = ${ObjectType}
            "jsonPath" = ${JsonPath}
            "sourceValue" = ${SourceValue}
            "targetValue" = ${TargetValue}
            "enabled" = ${Enabled}
        }

        return $PSO
    }

}