intelligence/src/PSSailpoint.Intelligence/Model/Intelnonhumanidentityownershipcategory.ps1

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

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

Ownership category for agents or applications. On success, primaryOwned and secondaryOwned carry independently paged buckets. On category-level upstream failure, message and reason are set (reason: UPSTREAM_UNAVAILABLE). The service emits one flat object today, so primaryOwned and secondaryOwned may still appear on the failure path with empty items.

.PARAMETER PrimaryOwned
First page of non-human identities for which this human is the primary owner.
.PARAMETER SecondaryOwned
First page of non-human identities for which this human is a secondary owner.
.PARAMETER Message
Human-readable explanation of the temporary ownership data failure.
.PARAMETER Reason
Machine-readable reason code for the category-level ownership failure.
.OUTPUTS

Intelnonhumanidentityownershipcategory<PSCustomObject>
#>


function Initialize-Intelnonhumanidentityownershipcategory {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${PrimaryOwned},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${SecondaryOwned},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Message},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("UPSTREAM_UNAVAILABLE")]
        [String]
        ${Reason}
    )

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


        $PSO = [PSCustomObject]@{
            "primaryOwned" = ${PrimaryOwned}
            "secondaryOwned" = ${SecondaryOwned}
            "message" = ${Message}
            "reason" = ${Reason}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Intelnonhumanidentityownershipcategory<PSCustomObject>

.DESCRIPTION

Convert from JSON to Intelnonhumanidentityownershipcategory<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Intelnonhumanidentityownershipcategory<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Intelnonhumanidentityownershipcategory
        $AllProperties = ("primaryOwned", "secondaryOwned", "message", "reason")
        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 "primaryOwned"))) { #optional property not found
            $PrimaryOwned = $null
        } else {
            $PrimaryOwned = $JsonParameters.PSobject.Properties["primaryOwned"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "primaryOwned" = ${PrimaryOwned}
            "secondaryOwned" = ${SecondaryOwned}
            "message" = ${Message}
            "reason" = ${Reason}
        }

        return $PSO
    }

}