v3/src/PSSailpoint/Model/CreateWorkflowRequest.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 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

CreateWorkflowRequest<PSCustomObject>
#>


function Initialize-CreateWorkflowRequest {
    [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: PSSailpoint => CreateWorkflowRequest' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

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

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


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

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to CreateWorkflowRequest<PSCustomObject>

.DESCRIPTION

Convert from JSON to CreateWorkflowRequest<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

CreateWorkflowRequest<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in CreateWorkflowRequest
        $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 ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json
            throw "Error! Empty JSON cannot be serialized due to the required property 'name' missing."
        }

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "owner"))) {
            throw "Error! JSON cannot be serialized due to the required property 'owner' missing."
        } 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
    }

}