beta/src/PSSailpointBeta/Model/TaskStatus.ps1

#
# Identity Security Cloud Beta API
# Use these APIs to interact with the Identity Security Cloud 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

Details and current status of a specific task

.PARAMETER Id
System-generated unique ID of the task this TaskStatus represents
.PARAMETER Type
Type of task this TaskStatus represents
.PARAMETER UniqueName
Name of the task this TaskStatus represents
.PARAMETER Description
Description of the task this TaskStatus represents
.PARAMETER ParentName
Name of the parent of the task this TaskStatus represents
.PARAMETER Launcher
Service to execute the task this TaskStatus represents
.PARAMETER Target
No description available.
.PARAMETER Created
Creation date of the task this TaskStatus represents
.PARAMETER Modified
Last modification date of the task this TaskStatus represents
.PARAMETER Launched
Launch date of the task this TaskStatus represents
.PARAMETER Completed
Completion date of the task this TaskStatus represents
.PARAMETER CompletionStatus
Completion status of the task this TaskStatus represents
.PARAMETER Messages
Messages associated with the task this TaskStatus represents
.PARAMETER Returns
Return values from the task this TaskStatus represents
.PARAMETER Attributes
Attributes of the task this TaskStatus represents
.PARAMETER Progress
Current progress of the task this TaskStatus represents
.PARAMETER PercentComplete
Current percentage completion of the task this TaskStatus represents
.PARAMETER TaskDefinitionSummary
No description available.
.OUTPUTS

TaskStatus<PSCustomObject>
#>


function Initialize-BetaTaskStatus {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("QUARTZ", "QPOC", "QUEUED_TASK")]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${UniqueName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ParentName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Launcher},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Target},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.DateTime]
        ${Created},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.DateTime]
        ${Modified},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Launched},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Completed},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("SUCCESS", "WARNING", "ERROR", "TERMINATED", "TEMPERROR", "")]
        [String]
        ${CompletionStatus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Messages},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Returns},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${Attributes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Progress},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Int32]
        ${PercentComplete},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${TaskDefinitionSummary}
    )

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

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

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

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

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

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

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

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "type" = ${Type}
            "uniqueName" = ${UniqueName}
            "description" = ${Description}
            "parentName" = ${ParentName}
            "launcher" = ${Launcher}
            "target" = ${Target}
            "created" = ${Created}
            "modified" = ${Modified}
            "launched" = ${Launched}
            "completed" = ${Completed}
            "completionStatus" = ${CompletionStatus}
            "messages" = ${Messages}
            "returns" = ${Returns}
            "attributes" = ${Attributes}
            "progress" = ${Progress}
            "percentComplete" = ${PercentComplete}
            "taskDefinitionSummary" = ${TaskDefinitionSummary}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to TaskStatus<PSCustomObject>

.DESCRIPTION

Convert from JSON to TaskStatus<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

TaskStatus<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BetaTaskStatus
        $AllProperties = ("id", "type", "uniqueName", "description", "parentName", "launcher", "target", "created", "modified", "launched", "completed", "completionStatus", "messages", "returns", "attributes", "progress", "percentComplete", "taskDefinitionSummary")
        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 'id' missing."
        }

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

        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 "uniqueName"))) {
            throw "Error! JSON cannot be serialized due to the required property 'uniqueName' missing."
        } else {
            $UniqueName = $JsonParameters.PSobject.Properties["uniqueName"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "type" = ${Type}
            "uniqueName" = ${UniqueName}
            "description" = ${Description}
            "parentName" = ${ParentName}
            "launcher" = ${Launcher}
            "target" = ${Target}
            "created" = ${Created}
            "modified" = ${Modified}
            "launched" = ${Launched}
            "completed" = ${Completed}
            "completionStatus" = ${CompletionStatus}
            "messages" = ${Messages}
            "returns" = ${Returns}
            "attributes" = ${Attributes}
            "progress" = ${Progress}
            "percentComplete" = ${PercentComplete}
            "taskDefinitionSummary" = ${TaskDefinitionSummary}
        }

        return $PSO
    }

}