beta/src/PSSailpointBeta/Model/TaskStatusMessage.ps1

#
# IdentityNow Beta API
# Use these APIs to interact with the IdentityNow platform to achieve repeatable, automated processes with greater scalability. These APIs are in beta and are subject to change. 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: 3.1.0-beta
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

TaskStatus Message

.PARAMETER Type
Type of the message
.PARAMETER LocalizedText
No description available.
.PARAMETER Key
Key of the message
.PARAMETER Parameters
Message parameters for internationalization
.OUTPUTS

TaskStatusMessage<PSCustomObject>
#>


function Initialize-BetaTaskStatusMessage {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("INFO", "WARN", "ERROR")]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${LocalizedText},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Key},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Parameters}
    )

    Process {
        'Creating PSCustomObject: PSSailpointBeta => BetaTaskStatusMessage' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

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

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

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

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


        $PSO = [PSCustomObject]@{
            "type" = ${Type}
            "localizedText" = ${LocalizedText}
            "key" = ${Key}
            "parameters" = ${Parameters}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to TaskStatusMessage<PSCustomObject>

.DESCRIPTION

Convert from JSON to TaskStatusMessage<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

TaskStatusMessage<PSCustomObject>
#>

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

    Process {
        'Converting JSON to PSCustomObject: PSSailpointBeta => BetaTaskStatusMessage' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BetaTaskStatusMessage
        $AllProperties = ("type", "localizedText", "key", "parameters")
        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 'type' missing."
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "type" = ${Type}
            "localizedText" = ${LocalizedText}
            "key" = ${Key}
            "parameters" = ${Parameters}
        }

        return $PSO
    }

}