Model/AuditEvent.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 CreatedAt
No description available.
.PARAMETER SubjectType
Categorization of audit event.
.PARAMETER Type
The type of audit event
.PARAMETER SubjectId
Identifier of the subject
.PARAMETER VarData
No description available.
.OUTPUTS

AuditEvent<PSCustomObject>
#>


function Initialize-NERMAuditEvent {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${CreatedAt},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("Profile", "WorkflowSession", "Email", "FormAttributeForm", "FormAttribute", "Form", "IdentityProofingResult", "IdproxyPermission", "NeAttributeOption", "NeAttribute", "Notification", "WorkflowPage", "ProfilePage", "Permission", "PortalRegistrationWorkflow", "Portal", "ProfileTypeRole", "ProfileType", "RoleProfile", "NeprofileRole", "NeaccessRole", "IdproxyRole", "SecurityQuestion", "UserManager", "UserProfile", "UserRole", "User", "Validation", "VerificationEmail", "WorkflowAction", "CreateWorkflow", "UpdateWorkflow", "AutomatedWorkflow", "BatchWorkflow", "ExpirationWorkflow", "InvitationWorkflow", "LoginWorkflow", "PasswordResetWorkflow", "RegistrationWorkflow", "Get", "Post", "Patch", "Delete", "ApprovalAction", "AutomatedUser", "DelegateUser", "NeaccessUser", "NeprofileUser", "Page", "Role", "SamlConfiguration", "SchemaMapping", "SchemaMappingField", "Workflow")]
        [String]
        ${SubjectType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("AuditableProfileCreate", "AuditableProfileUpdate", "AuditableProfileDestroy", "AuditableBulkProfileUpdate", "AuditableProfileContributorAdd", "AuditableProfileContributorRemove", "AuditableProfileContributorRoleAdd", "AuditableProfileContributorRoleRemove", "AuditableProfileOwnerUpdate", "AuditableProfileWorkflowEvent", "AuditableWorkflowActionSkippedEvent", "AuditableWorkflowApprovedEvent", "AuditableWorkflowApprovedEvent", "AuditableWorkflowAssignedEvent", "AuditableWorkflowAutoAssignedEvent", "AuditableWorkflowBatchCompleteEvent", "AuditableWorkflowClosedEvent", "AuditableWorkflowDuplicateCheckStartEvent", "AuditableWorkflowDuplicateResolutionEvent", "AuditableWorkflowFailedEvent", "AuditableWorkflowIdentityProofedEvent", "AuditableWorkflowInvitationSentEvent", "AuditableWorkflowLdapProvidedEvent", "AuditableWorkflowNotificationSentEvent", "AuditableWorkflowPendingApprovalEvent", "AuditableWorkflowPendingAssignmentEvent", "AuditableWorkflowPendingFulfillmentEvent", "AuditableWorkflowFulfilledEvent", "AuditableWorkflowPendingIdentityProofEvent", "AuditableWorkflowPendingLdapEvent", "AuditableWorkflowPendingRequestEvent", "AuditableWorkflowPendingReviewEvent", "AuditableWorkflowProfileCreatedEvent", "AuditableWorkflowProfileSelectEvent", "AuditableWorkflowProfileUpdatedEvent", "AuditableWorkflowRejectedEvent", "AuditableWorkflowRequestMadeEvent", "AuditableWorkflowRestApiEvent", "AuditableWorkflowReviewedEvent", "AuditableWorkflowRunningWorkflowEvent", "AuditableWorkflowSoapApiEvent", "AuditableWorkflowStatusChangedEvent", "AuditableWorkflowStoredProcedureEvent", "AuditableWorkflowUnassignEvent", "AuditableWorkflowWaitingForWorkflowEvent", "AuditableWorkflowWorkflowChangedEvent", "ActiveRecordCreate", "ActiveRecordUpdate", "ActiveRecordDestroy", "AuditableApiEvent")]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SubjectId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${VarData}
    )

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


        $PSO = [PSCustomObject]@{
            "created_at" = ${CreatedAt}
            "subject_type" = ${SubjectType}
            "type" = ${Type}
            "subject_id" = ${SubjectId}
            "data" = ${VarData}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to AuditEvent<PSCustomObject>

.DESCRIPTION

Convert from JSON to AuditEvent<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

AuditEvent<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMAuditEvent
        $AllProperties = ("created_at", "subject_type", "type", "subject_id", "data")
        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 "created_at"))) { #optional property not found
            $CreatedAt = $null
        } else {
            $CreatedAt = $JsonParameters.PSobject.Properties["created_at"].value
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "created_at" = ${CreatedAt}
            "subject_type" = ${SubjectType}
            "type" = ${Type}
            "subject_id" = ${SubjectId}
            "data" = ${VarData}
        }

        return $PSO
    }

}