nerm/src/PSSailpoint.NERM/Model/ProfileType.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 Name
This is the name of the profile type.
.PARAMETER Category
This is the category the profile type falls into.
.PARAMETER BypassDupProtection
Whether or not duplication protection is bypassed.
.PARAMETER Archived
Whether or not the profile type is archived.
.PARAMETER PermittedRoleIds
The role ids that are permitted for this profile type.
.PARAMETER IscSynced
Is this profile type synced with ics
.PARAMETER ProfileTypeDupAttributes
No description available.
.PARAMETER ProfileTypeNamings
No description available.
.OUTPUTS

ProfileType<PSCustomObject>
#>


function Initialize-NERMProfileType {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("employee", "non-employee", "organization", "assignment", "other")]
        [String]
        ${Category},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${BypassDupProtection},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Archived},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${PermittedRoleIds},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IscSynced},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${ProfileTypeDupAttributes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${ProfileTypeNamings}
    )

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


        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "category" = ${Category}
            "bypass_dup_protection" = ${BypassDupProtection}
            "archived" = ${Archived}
            "permitted_role_ids" = ${PermittedRoleIds}
            "isc_synced" = ${IscSynced}
            "profile_type_dup_attributes" = ${ProfileTypeDupAttributes}
            "profile_type_namings" = ${ProfileTypeNamings}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to ProfileType<PSCustomObject>

.DESCRIPTION

Convert from JSON to ProfileType<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ProfileType<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMProfileType
        $AllProperties = ("id", "uid", "name", "category", "bypass_dup_protection", "archived", "permitted_role_ids", "isc_synced", "profile_type_dup_attributes", "profile_type_namings")
        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 "name"))) { #optional property not found
            $Name = $null
        } else {
            $Name = $JsonParameters.PSobject.Properties["name"].value
        }

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "bypass_dup_protection"))) { #optional property not found
            $BypassDupProtection = $null
        } else {
            $BypassDupProtection = $JsonParameters.PSobject.Properties["bypass_dup_protection"].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 "permitted_role_ids"))) { #optional property not found
            $PermittedRoleIds = $null
        } else {
            $PermittedRoleIds = $JsonParameters.PSobject.Properties["permitted_role_ids"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "uid" = ${Uid}
            "name" = ${Name}
            "category" = ${Category}
            "bypass_dup_protection" = ${BypassDupProtection}
            "archived" = ${Archived}
            "permitted_role_ids" = ${PermittedRoleIds}
            "isc_synced" = ${IscSynced}
            "profile_type_dup_attributes" = ${ProfileTypeDupAttributes}
            "profile_type_namings" = ${ProfileTypeNamings}
        }

        return $PSO
    }

}