Model/AttributeProperties.ps1

#
# NERM API
# The NERM API accesss and modifies resources in your environment.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Label
The label for the attribute
.PARAMETER Description
A description of the attribute
.PARAMETER ToolTip
The helper text that accompanies the attribute
.PARAMETER Crypt
Whether or not the attribute is encrypted
.PARAMETER Archived
Whether the attribute is archived
.PARAMETER DateFormat
The format of the date input if it is a date input
.PARAMETER SelectableStatus
The status of the profiles that can be selected
.PARAMETER RiskScoreSetting
What setting is used for the risk score
.PARAMETER RiskType
Type of risk that applies to the attribute
.PARAMETER OwnershipDriven
Only shows profiles that the user currently has access to, to be selected
.PARAMETER AllowMultipleSelections
Whether or not multiple selections can be made on something like a contributor search.
.PARAMETER FilteredByNeAttribute
Whether or not the attribute is filtered by another attribute
.PARAMETER FilteringNeAttributeId
The ID of the filtering attribute
.PARAMETER NeAttributeFilterId
The ID of the attribute filter
.PARAMETER ReverseAssociationAttributeId
The ID of the attribute used with reverse association
.PARAMETER ProfileTypeId
The ID of the profile type the attribute applies to
.PARAMETER LegacyId
The legacy ID
.OUTPUTS

AttributeProperties<PSCustomObject>
#>


function Initialize-NERMAttributeProperties {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Label},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ToolTip},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Crypt},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Archived},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("mm/dd/yyyy", "mm-dd-yyyy", "dd/mm/yyyy", "dd-mm-yyyy", "yyyy/mm/dd", "yyyy-mm-dd")]
        [String]
        ${DateFormat},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SelectableStatus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RiskScoreSetting},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RiskType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${OwnershipDriven},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowMultipleSelections},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${FilteredByNeAttribute},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${FilteringNeAttributeId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${NeAttributeFilterId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ReverseAssociationAttributeId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ProfileTypeId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LegacyId}
    )

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


        $PSO = [PSCustomObject]@{
            "label" = ${Label}
            "description" = ${Description}
            "tool_tip" = ${ToolTip}
            "crypt" = ${Crypt}
            "archived" = ${Archived}
            "date_format" = ${DateFormat}
            "selectable_status" = ${SelectableStatus}
            "risk_score_setting" = ${RiskScoreSetting}
            "risk_type" = ${RiskType}
            "ownership_driven" = ${OwnershipDriven}
            "allow_multiple_selections" = ${AllowMultipleSelections}
            "filtered_by_ne_attribute" = ${FilteredByNeAttribute}
            "filtering_ne_attribute_id" = ${FilteringNeAttributeId}
            "ne_attribute_filter_id" = ${NeAttributeFilterId}
            "reverse_association_attribute_id" = ${ReverseAssociationAttributeId}
            "profile_type_id" = ${ProfileTypeId}
            "legacy_id" = ${LegacyId}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to AttributeProperties<PSCustomObject>

.DESCRIPTION

Convert from JSON to AttributeProperties<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

AttributeProperties<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMAttributeProperties
        $AllProperties = ("id", "uid", "label", "description", "tool_tip", "crypt", "archived", "archived_on", "created_at", "updated_at", "date_format", "selectable_status", "risk_score_setting", "risk_type", "ownership_driven", "allow_multiple_selections", "filtered_by_ne_attribute", "filtering_ne_attribute_id", "ne_attribute_filter_id", "reverse_association_attribute_id", "profile_type_id", "legacy_id", "tmp_created_at", "tmp_updated_at")
        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 "id"))) { #optional property not found
            $Id = $null
        } else {
            $Id = $JsonParameters.PSobject.Properties["id"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "uid" = ${Uid}
            "label" = ${Label}
            "description" = ${Description}
            "tool_tip" = ${ToolTip}
            "crypt" = ${Crypt}
            "archived" = ${Archived}
            "archived_on" = ${ArchivedOn}
            "created_at" = ${CreatedAt}
            "updated_at" = ${UpdatedAt}
            "date_format" = ${DateFormat}
            "selectable_status" = ${SelectableStatus}
            "risk_score_setting" = ${RiskScoreSetting}
            "risk_type" = ${RiskType}
            "ownership_driven" = ${OwnershipDriven}
            "allow_multiple_selections" = ${AllowMultipleSelections}
            "filtered_by_ne_attribute" = ${FilteredByNeAttribute}
            "filtering_ne_attribute_id" = ${FilteringNeAttributeId}
            "ne_attribute_filter_id" = ${NeAttributeFilterId}
            "reverse_association_attribute_id" = ${ReverseAssociationAttributeId}
            "profile_type_id" = ${ProfileTypeId}
            "legacy_id" = ${LegacyId}
            "tmp_created_at" = ${TmpCreatedAt}
            "tmp_updated_at" = ${TmpUpdatedAt}
        }

        return $PSO
    }

}