Model/ReportResults.ps1

#
# Identity Security Cloud V3 API
# 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: 3.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

Details about report result or current state.

.PARAMETER ReportType
Use this property to define what report should be processed in the RDE service.
.PARAMETER TaskDefName
Name of the task definition which is started to process requesting report. Usually the same as report name
.PARAMETER Id
Unique task definition identifier.
.PARAMETER Created
Report processing start date
.PARAMETER Status
Report current state or result status.
.PARAMETER Duration
Report processing time in ms.
.PARAMETER Rows
Report size in rows.
.PARAMETER AvailableFormats
Output report file formats. This are formats for calling get endpoint as a query parameter 'fileFormat'. In case report won't have this argument there will be ['CSV', 'PDF'] as default.
.OUTPUTS

ReportResults<PSCustomObject>
#>


function Initialize-ReportResults {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ACCOUNTS", "IDENTITIES_DETAILS", "IDENTITIES", "IDENTITY_PROFILE_IDENTITY_ERROR", "ORPHAN_IDENTITIES", "SEARCH_EXPORT", "UNCORRELATED_ACCOUNTS")]
        [String]
        ${ReportType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TaskDefName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Created},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("SUCCESS", "FAILURE", "WARNING", "TERMINATED")]
        [String]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Duration},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Rows},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("CSV", "PDF")]
        [String[]]
        ${AvailableFormats}
    )

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


        $PSO = [PSCustomObject]@{
            "reportType" = ${ReportType}
            "taskDefName" = ${TaskDefName}
            "id" = ${Id}
            "created" = ${Created}
            "status" = ${Status}
            "duration" = ${Duration}
            "rows" = ${Rows}
            "availableFormats" = ${AvailableFormats}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to ReportResults<PSCustomObject>

.DESCRIPTION

Convert from JSON to ReportResults<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ReportResults<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ReportResults
        $AllProperties = ("reportType", "taskDefName", "id", "created", "status", "duration", "rows", "availableFormats")
        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 "reportType"))) { #optional property not found
            $ReportType = $null
        } else {
            $ReportType = $JsonParameters.PSobject.Properties["reportType"].value
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "reportType" = ${ReportType}
            "taskDefName" = ${TaskDefName}
            "id" = ${Id}
            "created" = ${Created}
            "status" = ${Status}
            "duration" = ${Duration}
            "rows" = ${Rows}
            "availableFormats" = ${AvailableFormats}
        }

        return $PSO
    }

}