capabilities/src/PSSailpoint.Capabilities/Model/CapabilityOwners.ps1

#
# Identity Security Cloud API - Capabilities
# 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

Owner configuration for a capability. A single primary (human IDENTITY) owner plus additional owners that are either up to ten human (IDENTITY) references or exactly one GOVERNANCE_GROUP reference - not both.

.PARAMETER Primary
No description available.
.PARAMETER Secondary
Additional owners. Entries are either up to ten human (IDENTITY) references or exactly one GOVERNANCE_GROUP reference - not both. Governance-group owners appear here with type GOVERNANCE_GROUP.
.OUTPUTS

CapabilityOwners<PSCustomObject>
#>


function Initialize-CapabilityOwners {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Primary},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Secondary}
    )

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

        if (!$Secondary -and $Secondary.length -gt 10) {
            throw "invalid value for 'Secondary', number of items must be less than or equal to 10."
        }


        $PSO = [PSCustomObject]@{
            "primary" = ${Primary}
            "secondary" = ${Secondary}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to CapabilityOwners<PSCustomObject>

.DESCRIPTION

Convert from JSON to CapabilityOwners<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

CapabilityOwners<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in CapabilityOwners
        $AllProperties = ("primary", "secondary")
        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 "primary"))) { #optional property not found
            $Primary = $null
        } else {
            $Primary = $JsonParameters.PSobject.Properties["primary"].value
        }

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

        $PSO = [PSCustomObject]@{
            "primary" = ${Primary}
            "secondary" = ${Secondary}
        }

        return $PSO
    }

}