Model/AutomatedWorkflow.ps1

#
# NERM API
# The NERM API accesss and modifies resources in your environment.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER ProfileTypeId
The profile type the workflow effects.
.PARAMETER Status
Whether or not the workflow is enabled or disabled.
.PARAMETER Uid
The user-specified identifier of the workflow.
.PARAMETER Name
Name of the workflow
.PARAMETER DisableFailureEmailNotifications
When honored at runtime, suppresses failure email notifications for this workflow's sessions.
.PARAMETER ConditionRulesAttributes
The ProfileTypeRule this workflow will be working with.
.OUTPUTS

AutomatedWorkflow<PSCustomObject>
#>


function Initialize-NERMAutomatedWorkflow {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ProfileTypeId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("Enabled", "Disabled")]
        [String]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Uid},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${DisableFailureEmailNotifications},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${ConditionRulesAttributes}
    )

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

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "profile_type_id" = ${ProfileTypeId}
            "status" = ${Status}
            "uid" = ${Uid}
            "name" = ${Name}
            "disable_failure_email_notifications" = ${DisableFailureEmailNotifications}
            "condition_rules_attributes" = ${ConditionRulesAttributes}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to AutomatedWorkflow<PSCustomObject>

.DESCRIPTION

Convert from JSON to AutomatedWorkflow<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

AutomatedWorkflow<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMAutomatedWorkflow
        $AllProperties = ("profile_type_id", "status", "uid", "name", "disable_failure_email_notifications", "condition_rules_attributes")
        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 'profile_type_id' missing."
        }

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

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

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

        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 "condition_rules_attributes"))) {
            throw "Error! JSON cannot be serialized due to the required property 'condition_rules_attributes' missing."
        } else {
            $ConditionRulesAttributes = $JsonParameters.PSobject.Properties["condition_rules_attributes"].value
        }

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

        $PSO = [PSCustomObject]@{
            "profile_type_id" = ${ProfileTypeId}
            "status" = ${Status}
            "uid" = ${Uid}
            "name" = ${Name}
            "disable_failure_email_notifications" = ${DisableFailureEmailNotifications}
            "condition_rules_attributes" = ${ConditionRulesAttributes}
        }

        return $PSO
    }

}