beta/src/PSSailpointBeta/Model/WorkflowBody.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 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

WorkflowBody<PSCustomObject>
#>


function Initialize-BetaWorkflowBody {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Owner},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Definition},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Enabled} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Trigger}
    )

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


        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "owner" = ${Owner}
            "description" = ${Description}
            "definition" = ${Definition}
            "enabled" = ${Enabled}
            "trigger" = ${Trigger}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to WorkflowBody<PSCustomObject>

.DESCRIPTION

Convert from JSON to WorkflowBody<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

WorkflowBody<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BetaWorkflowBody
        $AllProperties = ("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 "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]@{
            "name" = ${Name}
            "owner" = ${Owner}
            "description" = ${Description}
            "definition" = ${Definition}
            "enabled" = ${Enabled}
            "trigger" = ${Trigger}
        }

        return $PSO
    }

}