beta/src/PSSailpointBeta/Model/IdentityAttribute.ps1

#
# Identity Security Cloud Beta API
# Use these APIs to interact with the Identity Security Cloud platform to achieve repeatable, automated processes with greater scalability. These APIs are in beta and are subject to change. 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.1.0-beta
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Name
Identity attribute's technical name.
.PARAMETER DisplayName
Identity attribute's business-friendly name.
.PARAMETER Standard
Indicates whether the attribute is 'standard' or 'default'.
.PARAMETER Type
Identity attribute's type.
.PARAMETER Multi
Indicates whether the identity attribute is multi-valued.
.PARAMETER Searchable
Indicates whether the identity attribute is searchable.
.PARAMETER System
Indicates whether the identity attribute is 'system', meaning that it doesn't have a source and isn't configurable.
.PARAMETER Sources
Identity attribute's list of sources - this specifies how the rule's value is derived.
.OUTPUTS

IdentityAttribute<PSCustomObject>
#>


function Initialize-BetaIdentityAttribute {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DisplayName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Standard} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Multi} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Searchable} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${System} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Sources}
    )

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

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


        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "displayName" = ${DisplayName}
            "standard" = ${Standard}
            "type" = ${Type}
            "multi" = ${Multi}
            "searchable" = ${Searchable}
            "system" = ${System}
            "sources" = ${Sources}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to IdentityAttribute<PSCustomObject>

.DESCRIPTION

Convert from JSON to IdentityAttribute<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

IdentityAttribute<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BetaIdentityAttribute
        $AllProperties = ("name", "displayName", "standard", "type", "multi", "searchable", "system", "sources")
        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 'name' missing."
        }

        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 "displayName"))) { #optional property not found
            $DisplayName = $null
        } else {
            $DisplayName = $JsonParameters.PSobject.Properties["displayName"].value
        }

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "displayName" = ${DisplayName}
            "standard" = ${Standard}
            "type" = ${Type}
            "multi" = ${Multi}
            "searchable" = ${Searchable}
            "system" = ${System}
            "sources" = ${Sources}
        }

        return $PSO
    }

}