Model/UpdateWorkflow.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 ProfileStatus
The status of the profiles the workflow will effect.
.PARAMETER DisableFailureEmailNotifications
When honored at runtime, suppresses failure email notifications for this workflow's sessions.
.OUTPUTS

UpdateWorkflow<PSCustomObject>
#>


function Initialize-NERMUpdateWorkflow {
    [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)]
        [String]
        ${ProfileStatus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${DisableFailureEmailNotifications}
    )

    Process {
        'Creating PSCustomObject: PSSailpoint.NERM => NERMUpdateWorkflow' | 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 (!$ProfileStatus) {
            throw "invalid value for 'ProfileStatus', 'ProfileStatus' cannot be null."
        }


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

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to UpdateWorkflow<PSCustomObject>

.DESCRIPTION

Convert from JSON to UpdateWorkflow<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

UpdateWorkflow<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMUpdateWorkflow
        $AllProperties = ("profile_type_id", "status", "uid", "name", "profile_status", "disable_failure_email_notifications")
        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 "profile_status"))) {
            throw "Error! JSON cannot be serialized due to the required property 'profile_status' missing."
        } else {
            $ProfileStatus = $JsonParameters.PSobject.Properties["profile_status"].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}
            "profile_status" = ${ProfileStatus}
            "disable_failure_email_notifications" = ${DisableFailureEmailNotifications}
        }

        return $PSO
    }

}