intelligence/src/PSSailpoint.Intelligence/Model/Intelnonhumanidentityownership.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

Non-human identities the human owns, grouped by subtype category. Present only when the tenant has `idn:machine-identity-security`. When present, both `agents` and `applications` always render. Each category is a flat object with optional primaryOwned/secondaryOwned buckets and optional message/reason when upstream ownership fetch fails for that category.

.PARAMETER Agents
Ownership for non-human identities with subtype AI Agent.
.PARAMETER Applications
Ownership for non-human identities with subtype Application.
.OUTPUTS

Intelnonhumanidentityownership<PSCustomObject>
#>


function Initialize-Intelnonhumanidentityownership {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Agents},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Applications}
    )

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

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

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


        $PSO = [PSCustomObject]@{
            "agents" = ${Agents}
            "applications" = ${Applications}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Intelnonhumanidentityownership<PSCustomObject>

.DESCRIPTION

Convert from JSON to Intelnonhumanidentityownership<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Intelnonhumanidentityownership<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Intelnonhumanidentityownership
        $AllProperties = ("agents", "applications")
        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 'agents' missing."
        }

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

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

        $PSO = [PSCustomObject]@{
            "agents" = ${Agents}
            "applications" = ${Applications}
        }

        return $PSO
    }

}