Model/Intelcertificationhistoryevent.ps1

#
# Identity Security Cloud API - Intelligence
# 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

Certification history event. Supported eventType is IdentityCertified.

.PARAMETER EventType
Type of certification history event.
.PARAMETER DateTime
Event timestamp.
.PARAMETER CertificationId
Identifier of the certification.
.PARAMETER CertificationName
Display name of the certification.
.PARAMETER SignedDate
Timestamp when the certification was signed.
.OUTPUTS

Intelcertificationhistoryevent<PSCustomObject>
#>


function Initialize-Intelcertificationhistoryevent {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("IdentityCertified")]
        [String]
        ${EventType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${DateTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CertificationId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CertificationName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${SignedDate}
    )

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

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


        $PSO = [PSCustomObject]@{
            "eventType" = ${EventType}
            "dateTime" = ${DateTime}
            "certificationId" = ${CertificationId}
            "certificationName" = ${CertificationName}
            "signedDate" = ${SignedDate}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Intelcertificationhistoryevent<PSCustomObject>

.DESCRIPTION

Convert from JSON to Intelcertificationhistoryevent<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Intelcertificationhistoryevent<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json
        $IntelcertificationhistoryeventAdditionalProperties = @{}

        # check if Json contains properties not defined in Intelcertificationhistoryevent
        $AllProperties = ("eventType", "dateTime", "certificationId", "certificationName", "signedDate")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            # store undefined properties in additionalProperties
            if (!($AllProperties.Contains($name))) {
                $IntelcertificationhistoryeventAdditionalProperties[$name] = $JsonParameters.PSobject.Properties[$name].value
            }
        }

        If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json
            throw "Error! Empty JSON cannot be serialized due to the required property 'eventType' missing."
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "eventType" = ${EventType}
            "dateTime" = ${DateTime}
            "certificationId" = ${CertificationId}
            "certificationName" = ${CertificationName}
            "signedDate" = ${SignedDate}
            "AdditionalProperties" = $IntelcertificationhistoryeventAdditionalProperties
        }

        return $PSO
    }

}