Model/CorrelationReprocessStatus.ps1

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

Progress of a correlation reprocess run for one resource on a source.

.PARAMETER SourceId
ID of the source the run applies to.
.PARAMETER ResourceId
ID of the source resource the run applies to.
.PARAMETER Type
Kind of correlation the run reprocesses.
.PARAMETER Status
Status of the run. `STARTED` means the run is planning or processing. `COMPLETED` means every object was evaluated. `COMPLETED_WITH_ERRORS` means the run finished but part of the work could not be processed. `FAILED` means the run could not be planned. `ABORTED_AGGREGATION_STARTED` means the run stopped because an aggregation started on the same resource.
.PARAMETER Total
Number of objects in scope for the run. `null` until planning finishes; after that it does not change, so you can compute progress as `processed` divided by `total`.
.PARAMETER Processed
Number of objects evaluated so far.
.PARAMETER Updated
Number of evaluated objects whose owner changed.
.PARAMETER Errored
Number of objects that could not be processed. Individual errors do not fail the run.
.PARAMETER StartedAt
Date and time when the run was accepted.
.PARAMETER FinishedAt
Date and time when the run reached a final status. `null` while the run is in progress.
.PARAMETER StartedBy
No description available.
.OUTPUTS

CorrelationReprocessStatus<PSCustomObject>
#>


function Initialize-CorrelationReprocessStatus {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SourceId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ResourceId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("OWNER_CORRELATION")]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("STARTED", "COMPLETED", "COMPLETED_WITH_ERRORS", "FAILED", "ABORTED_AGGREGATION_STARTED")]
        [String]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Total},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Processed},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Updated},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Errored},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${StartedAt},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${FinishedAt},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${StartedBy}
    )

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


        $PSO = [PSCustomObject]@{
            "sourceId" = ${SourceId}
            "resourceId" = ${ResourceId}
            "type" = ${Type}
            "status" = ${Status}
            "total" = ${Total}
            "processed" = ${Processed}
            "updated" = ${Updated}
            "errored" = ${Errored}
            "startedAt" = ${StartedAt}
            "finishedAt" = ${FinishedAt}
            "startedBy" = ${StartedBy}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to CorrelationReprocessStatus<PSCustomObject>

.DESCRIPTION

Convert from JSON to CorrelationReprocessStatus<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

CorrelationReprocessStatus<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in CorrelationReprocessStatus
        $AllProperties = ("sourceId", "resourceId", "type", "status", "total", "processed", "updated", "errored", "startedAt", "finishedAt", "startedBy")
        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 "sourceId"))) { #optional property not found
            $SourceId = $null
        } else {
            $SourceId = $JsonParameters.PSobject.Properties["sourceId"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "resourceId"))) { #optional property not found
            $ResourceId = $null
        } else {
            $ResourceId = $JsonParameters.PSobject.Properties["resourceId"].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 "status"))) { #optional property not found
            $Status = $null
        } else {
            $Status = $JsonParameters.PSobject.Properties["status"].value
        }

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "sourceId" = ${SourceId}
            "resourceId" = ${ResourceId}
            "type" = ${Type}
            "status" = ${Status}
            "total" = ${Total}
            "processed" = ${Processed}
            "updated" = ${Updated}
            "errored" = ${Errored}
            "startedAt" = ${StartedAt}
            "finishedAt" = ${FinishedAt}
            "startedBy" = ${StartedBy}
        }

        return $PSO
    }

}