Model/FormSubmitted.ps1

#
# Identity Security Cloud API - Triggers
# Use these APIs to interact with the Identity Security Cloud platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs.
# Version: v1
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER SubmittedAt
Date and time when the user submitted the form.
.PARAMETER TenantId
ISC tenant's unique identifier.
.PARAMETER FormInstanceId
Form instance's unique identifier.
.PARAMETER FormDefinitionId
Form definition's unique identifier.
.PARAMETER Name
Form's name.
.PARAMETER CreatedBy
No description available.
.PARAMETER SubmittedBy
No description available.
.PARAMETER FormData
Data in the submitted form.
.OUTPUTS

FormSubmitted<PSCustomObject>
#>


function Initialize-FormSubmitted {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.DateTime]
        ${SubmittedAt},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TenantId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${FormInstanceId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${FormDefinitionId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${CreatedBy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${SubmittedBy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${FormData}
    )

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

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

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

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "submittedAt" = ${SubmittedAt}
            "tenantId" = ${TenantId}
            "formInstanceId" = ${FormInstanceId}
            "formDefinitionId" = ${FormDefinitionId}
            "name" = ${Name}
            "createdBy" = ${CreatedBy}
            "submittedBy" = ${SubmittedBy}
            "formData" = ${FormData}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to FormSubmitted<PSCustomObject>

.DESCRIPTION

Convert from JSON to FormSubmitted<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

FormSubmitted<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in FormSubmitted
        $AllProperties = ("submittedAt", "tenantId", "formInstanceId", "formDefinitionId", "name", "createdBy", "submittedBy", "formData")
        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 'submittedAt' missing."
        }

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

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "formDefinitionId"))) {
            throw "Error! JSON cannot be serialized due to the required property 'formDefinitionId' missing."
        } else {
            $FormDefinitionId = $JsonParameters.PSobject.Properties["formDefinitionId"].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 "createdBy"))) {
            throw "Error! JSON cannot be serialized due to the required property 'createdBy' missing."
        } else {
            $CreatedBy = $JsonParameters.PSobject.Properties["createdBy"].value
        }

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

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

        $PSO = [PSCustomObject]@{
            "submittedAt" = ${SubmittedAt}
            "tenantId" = ${TenantId}
            "formInstanceId" = ${FormInstanceId}
            "formDefinitionId" = ${FormDefinitionId}
            "name" = ${Name}
            "createdBy" = ${CreatedBy}
            "submittedBy" = ${SubmittedBy}
            "formData" = ${FormData}
        }

        return $PSO
    }

}