nerm/src/PSSailpoint.NERM/Model/AuditEventData.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 ProfileId
The profile id associated with the event
.PARAMETER WorkflowId
The workflow id associated with the event
.PARAMETER WorkflowName
The workflow name associated with the event
.PARAMETER WorkflowUid
The workflow uid associated with the event
.PARAMETER ProfileTypeId
The profile type associated with the event
.PARAMETER WorkflowVersionId
The workflow version a change belongs to. Can be used for both Workflow configurations and Workflow Session events.
.PARAMETER Version
The workflow version SHA.
.PARAMETER StepId
The id of the workflow action or condition the step event refers to.
.PARAMETER StepLabel
The name associated to an action configuration.
.PARAMETER Source
What triggered the versioning change.
.OUTPUTS

AuditEventData<PSCustomObject>
#>


function Initialize-NERMAuditEventData {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ProfileId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${WorkflowId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${WorkflowName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${WorkflowUid},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ProfileTypeId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${WorkflowVersionId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Version},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${StepId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${StepLabel},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ui", "import", "fork", "cleanup_worker", "delete_worker")]
        [String]
        ${Source}
    )

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


        $PSO = [PSCustomObject]@{
            "profile_id" = ${ProfileId}
            "workflow_id" = ${WorkflowId}
            "workflow_name" = ${WorkflowName}
            "workflow_uid" = ${WorkflowUid}
            "profile_type_id" = ${ProfileTypeId}
            "workflow_version_id" = ${WorkflowVersionId}
            "version" = ${Version}
            "step_id" = ${StepId}
            "step_label" = ${StepLabel}
            "source" = ${Source}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to AuditEventData<PSCustomObject>

.DESCRIPTION

Convert from JSON to AuditEventData<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

AuditEventData<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMAuditEventData
        $AllProperties = ("profile_id", "workflow_id", "workflow_name", "workflow_uid", "profile_type_id", "workflow_version_id", "version", "step_id", "step_label", "source")
        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 "profile_id"))) { #optional property not found
            $ProfileId = $null
        } else {
            $ProfileId = $JsonParameters.PSobject.Properties["profile_id"].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 "workflow_name"))) { #optional property not found
            $WorkflowName = $null
        } else {
            $WorkflowName = $JsonParameters.PSobject.Properties["workflow_name"].value
        }

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "profile_id" = ${ProfileId}
            "workflow_id" = ${WorkflowId}
            "workflow_name" = ${WorkflowName}
            "workflow_uid" = ${WorkflowUid}
            "profile_type_id" = ${ProfileTypeId}
            "workflow_version_id" = ${WorkflowVersionId}
            "version" = ${Version}
            "step_id" = ${StepId}
            "step_label" = ${StepLabel}
            "source" = ${Source}
        }

        return $PSO
    }

}