v3/src/PSSailpoint/Model/ListCompleteWorkflowLibrary200ResponseInner.ps1

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

JSON object

.OUTPUTS

ListCompleteWorkflowLibrary200ResponseInner<PSCustomObject>
#>

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

    Process {
        $match = 0
        $matchType = $null
        $matchInstance = $null

        if ($match -ne 0) { # no match yet
            # try to match WorkflowLibraryAction defined in the anyOf schemas
            try {
                $matchInstance = ConvertFrom-JsonToWorkflowLibraryAction $Json

                foreach($property in $matchInstance.PsObject.Properties) {
                    if ($null -ne $property.Value) {
                        $matchType = "WorkflowLibraryAction"
                        $match++
                        break
                    }
                }
            } catch {
                # fail to match the schema defined in anyOf, proceed to the next one
                Write-Debug "Failed to match 'WorkflowLibraryAction' defined in anyOf (ListCompleteWorkflowLibrary200ResponseInner). Proceeding to the next one if any."
            }
        }

        if ($match -ne 0) { # no match yet
            # try to match WorkflowLibraryOperator defined in the anyOf schemas
            try {
                $matchInstance = ConvertFrom-JsonToWorkflowLibraryOperator $Json

                foreach($property in $matchInstance.PsObject.Properties) {
                    if ($null -ne $property.Value) {
                        $matchType = "WorkflowLibraryOperator"
                        $match++
                        break
                    }
                }
            } catch {
                # fail to match the schema defined in anyOf, proceed to the next one
                Write-Debug "Failed to match 'WorkflowLibraryOperator' defined in anyOf (ListCompleteWorkflowLibrary200ResponseInner). Proceeding to the next one if any."
            }
        }

        if ($match -ne 0) { # no match yet
            # try to match WorkflowLibraryTrigger defined in the anyOf schemas
            try {
                $matchInstance = ConvertFrom-JsonToWorkflowLibraryTrigger $Json

                foreach($property in $matchInstance.PsObject.Properties) {
                    if ($null -ne $property.Value) {
                        $matchType = "WorkflowLibraryTrigger"
                        $match++
                        break
                    }
                }
            } catch {
                # fail to match the schema defined in anyOf, proceed to the next one
                Write-Debug "Failed to match 'WorkflowLibraryTrigger' defined in anyOf (ListCompleteWorkflowLibrary200ResponseInner). Proceeding to the next one if any."
            }
        }

        if ($match -eq 1) {
            return [PSCustomObject]@{
                "ActualType" = ${matchType}
                "ActualInstance" = ${matchInstance}
                "anyOfSchemas" = @("WorkflowLibraryAction", "WorkflowLibraryOperator", "WorkflowLibraryTrigger")
            }
        } else {
            throw "Error! The JSON payload doesn't matches any type defined in anyOf schemas ([WorkflowLibraryAction, WorkflowLibraryOperator, WorkflowLibraryTrigger]). JSON Payload: $($Json)"
        }
    }
}