v3/src/PSSailpoint/Model/Aggregation.ps1

#
# IdentityNow V3 API
# Use these APIs to interact with the IdentityNow 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

Aggregation

.PARAMETER Id
No description available.
.PARAMETER Name
No description available.
.PARAMETER Type
No description available.
.PARAMETER Status
No description available.
.PARAMETER Duration
No description available.
.PARAMETER AvgDuration
No description available.
.PARAMETER ChangedAccounts
No description available.
.PARAMETER NextScheduled
A date-time in ISO-8601 format
.PARAMETER StartTime
A date-time in ISO-8601 format
.PARAMETER SourceOwner
John Doe
.OUTPUTS

Aggregation<PSCustomObject>
#>


function Initialize-Aggregation {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("accessprofile", "accountactivity", "account", "aggregation", "entitlement", "event", "identity", "role")]
        [PSCustomObject]
        ${Type},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Status},
        [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Duration},
        [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${AvgDuration},
        [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${ChangedAccounts},
        [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${NextScheduled},
        [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${StartTime},
        [Parameter(Position = 9, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SourceOwner}
    )

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

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

        if ($null -eq $Name) {
            throw "invalid value for 'Name', 'Name' cannot be null."
        }

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "name" = ${Name}
            "_type" = ${Type}
            "status" = ${Status}
            "duration" = ${Duration}
            "avgDuration" = ${AvgDuration}
            "changedAccounts" = ${ChangedAccounts}
            "nextScheduled" = ${NextScheduled}
            "startTime" = ${StartTime}
            "sourceOwner" = ${SourceOwner}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Aggregation<PSCustomObject>

.DESCRIPTION

Convert from JSON to Aggregation<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Aggregation<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Aggregation
        $AllProperties = ("id", "name", "_type", "status", "duration", "avgDuration", "changedAccounts", "nextScheduled", "startTime", "sourceOwner")
        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 "name"))) {
            throw "Error! JSON cannot be serialized due to the required property 'name' missing."
        } else {
            $Name = $JsonParameters.PSobject.Properties["name"].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 "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 "avgDuration"))) { #optional property not found
            $AvgDuration = $null
        } else {
            $AvgDuration = $JsonParameters.PSobject.Properties["avgDuration"].value
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "name" = ${Name}
            "_type" = ${Type}
            "status" = ${Status}
            "duration" = ${Duration}
            "avgDuration" = ${AvgDuration}
            "changedAccounts" = ${ChangedAccounts}
            "nextScheduled" = ${NextScheduled}
            "startTime" = ${StartTime}
            "sourceOwner" = ${SourceOwner}
        }

        return $PSO
    }

}