nerm/src/PSSailpoint.NERM/Model/WorkflowSession.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 WorkflowId
The workflow id.
.PARAMETER RequesterId
The requester's id.
.PARAMETER RequesterType
The requester type.
.PARAMETER ProfileId
The profile this workflow session will be working with. Only Applicable for Update workflows
.PARAMETER ProfileIds
The profiles this workflow session will be working with. Only Applicable for Batch workflows
.PARAMETER Status
The status of the workflow session.
.PARAMETER Attributes
The attributes asscoiated with the workflow session.
.OUTPUTS

WorkflowSession<PSCustomObject>
#>


function Initialize-NERMWorkflowSession {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${WorkflowId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RequesterId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("User", "NeprofileUser", "NeaccessUser")]
        [String]
        ${RequesterType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ProfileId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${ProfileIds},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("api_request_sent", "approved", "assigned", "attempting_to_start_workflow", "AUTH-STATUS1", "AUTH-STATUS2", "AUTH-STATUS3", "AUTH-STATUS4", "AUTH-STATUS5", "AUTH-STATUS6", "AUTH-STATUS7", "AUTH-STATUS8", "AUTH-STATUS9", "auto_assigned", "batch_completed", "checking_for_duplicates", "closed", "completed", "courion_add", "courion_extend", "courion_terminate", "courion_update", "duplicates_resolved", "failed", "fulfilled", "invitation_sent", "ldap_provided", "new", "non_employee_created", "non_employee_updated", "notified", "pending_approval", "pending_assignment", "pending_courion_add", "pending_courion_extend", "pending_courion_terminate", "pending_courion_update", "pending_creation", "pending_fulfillment", "pending_ldap", "pending_notification", "pending_profile_select", "pending_request", "pending_review", "pending_status_change", "pending_stored_procedure", "pending_trigger", "pending_update", "processing", "profile_check_complete", "profiles_selected", "rejected", "requested", "reviewed", "soap_request_sent", "started_workflow", "status_changed", "stored_procedure", "un_assigned", "waiting_on_workflow", "workflow_changed")]
        [String]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${Attributes}
    )

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


        $PSO = [PSCustomObject]@{
            "workflow_id" = ${WorkflowId}
            "requester_id" = ${RequesterId}
            "requester_type" = ${RequesterType}
            "profile_id" = ${ProfileId}
            "profile_ids" = ${ProfileIds}
            "status" = ${Status}
            "attributes" = ${Attributes}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to WorkflowSession<PSCustomObject>

.DESCRIPTION

Convert from JSON to WorkflowSession<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

WorkflowSession<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMWorkflowSession
        $AllProperties = ("id", "uid", "workflow_id", "requester_id", "requester_type", "profile_id", "profile_ids", "status", "attributes")
        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 "uid"))) { #optional property not found
            $Uid = $null
        } else {
            $Uid = $JsonParameters.PSobject.Properties["uid"].value
        }

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "uid" = ${Uid}
            "workflow_id" = ${WorkflowId}
            "requester_id" = ${RequesterId}
            "requester_type" = ${RequesterType}
            "profile_id" = ${ProfileId}
            "profile_ids" = ${ProfileIds}
            "status" = ${Status}
            "attributes" = ${Attributes}
        }

        return $PSO
    }

}