beta/src/PSSailpointBeta/Model/Workflow.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 Id
Workflow ID. This is a UUID generated upon creation.
.PARAMETER ExecutionCount
The number of times this workflow has been executed
.PARAMETER FailureCount
The number of times this workflow has failed during execution
.PARAMETER Created
The date and time the workflow was created
.PARAMETER Creator
The identity that created the workflow.
.PARAMETER Name
The name of the workflow
.PARAMETER Owner
No description available.
.PARAMETER Description
Description of what the workflow accomplishes
.PARAMETER Definition
No description available.
.PARAMETER Enabled
Enable or disable the workflow. Workflows cannot be created in an enabled state.
.PARAMETER Trigger
No description available.
.OUTPUTS

Workflow<PSCustomObject>
#>


function Initialize-BetaWorkflow {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${ExecutionCount},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${FailureCount},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Created},
        [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Creator},
        [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Owner},
        [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Definition},
        [Parameter(Position = 9, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Enabled} = $false,
        [Parameter(Position = 10, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Trigger}
    )

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "executionCount" = ${ExecutionCount}
            "failureCount" = ${FailureCount}
            "created" = ${Created}
            "creator" = ${Creator}
            "name" = ${Name}
            "owner" = ${Owner}
            "description" = ${Description}
            "definition" = ${Definition}
            "enabled" = ${Enabled}
            "trigger" = ${Trigger}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Workflow<PSCustomObject>

.DESCRIPTION

Convert from JSON to Workflow<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Workflow<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BetaWorkflow
        $AllProperties = ("id", "executionCount", "failureCount", "created", "creator", "name", "owner", "description", "definition", "enabled", "trigger")
        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 "executionCount"))) { #optional property not found
            $ExecutionCount = $null
        } else {
            $ExecutionCount = $JsonParameters.PSobject.Properties["executionCount"].value
        }

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

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

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "owner"))) { #optional property not found
            $Owner = $null
        } else {
            $Owner = $JsonParameters.PSobject.Properties["owner"].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 "definition"))) { #optional property not found
            $Definition = $null
        } else {
            $Definition = $JsonParameters.PSobject.Properties["definition"].value
        }

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "executionCount" = ${ExecutionCount}
            "failureCount" = ${FailureCount}
            "created" = ${Created}
            "creator" = ${Creator}
            "name" = ${Name}
            "owner" = ${Owner}
            "description" = ${Description}
            "definition" = ${Definition}
            "enabled" = ${Enabled}
            "trigger" = ${Trigger}
        }

        return $PSO
    }

}