Model/Attribute.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 the attribute is encrypted
.PARAMETER Archived
Whether the attribute is archived
.PARAMETER ArchivedOn
When the attribute was archived
.PARAMETER CreatedAt
When the attribute was created
.PARAMETER UpdatedAt
When the attribute was updated
.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 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 ReverseAssociationAttribute
No description available.
.PARAMETER ProfileTypeId
The ID of the profile type the attribute applies to
.PARAMETER DataType
The type of data that applies to the attribute
.PARAMETER Type
The attribute's type
.OUTPUTS

Attribute<PSCustomObject>
#>


function Initialize-NERMAttribute {
    [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)]
        [System.Nullable[System.DateTime]]
        ${ArchivedOn},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${CreatedAt},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${UpdatedAt},
        [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]
        ${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)]
        [PSCustomObject]
        ${ReverseAssociationAttribute},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ProfileTypeId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("text field", "text area", "drop-down", "radio buttons", "check boxes", "date", "tags", "attachment", "profile select", "profile search", "owner select", "owner search", "contributor select", "contributor search")]
        [String]
        ${DataType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("AttachmentAttribute", "CheckBoxesAttribute", "ContributorSearchAttribute", "ContributorSelectAttribute", "DateAttribute", "DropDownAttribute", "OwnerSearchAttribute", "OwnerSelectAttribute", "ProfileSearchAttribute", "ProfileSelectAttribute", "RadioButtonsAttribute", "TagsAttribute", "TextAreaAttribute", "TextFieldAttribute")]
        [String]
        ${Type}
    )

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


        $PSO = [PSCustomObject]@{
            "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_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" = ${ReverseAssociationAttribute}
            "profile_type_id" = ${ProfileTypeId}
            "data_type" = ${DataType}
            "type" = ${Type}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Attribute<PSCustomObject>

.DESCRIPTION

Convert from JSON to Attribute<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Attribute<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "type"))) { #optional property not found
            $Type = $null
        } else {
            $Type = $JsonParameters.PSobject.Properties["type"].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_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" = ${ReverseAssociationAttribute}
            "profile_type_id" = ${ProfileTypeId}
            "data_type" = ${DataType}
            "type" = ${Type}
        }

        return $PSO
    }

}