Model/PublicIdentitiesNestedQuerySet.ps1

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

Query set nested inside a COMPOSITE entry. TEXT entries combined with AND (matchAny false) or OR (matchAny true).

.PARAMETER MatchAny
When true, entries are OR'd; when false, entries are AND'd.
.PARAMETER Entries
One or more TEXT entries.
.OUTPUTS

PublicIdentitiesNestedQuerySet<PSCustomObject>
#>


function Initialize-PublicIdentitiesNestedQuerySet {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Boolean]
        ${MatchAny},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Entries}
    )

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

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

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

        if ($Entries.length -lt 1) {
            throw "invalid value for 'Entries', number of items must be greater than or equal to 1."
        }


        $PSO = [PSCustomObject]@{
            "matchAny" = ${MatchAny}
            "entries" = ${Entries}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to PublicIdentitiesNestedQuerySet<PSCustomObject>

.DESCRIPTION

Convert from JSON to PublicIdentitiesNestedQuerySet<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

PublicIdentitiesNestedQuerySet<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

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

        $PSO = [PSCustomObject]@{
            "matchAny" = ${MatchAny}
            "entries" = ${Entries}
        }

        return $PSO
    }

}