nerm/src/PSSailpoint.NERM/Model/User.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 Id
ID of the object to retrieve or update
.PARAMETER Uid
UID of the user
.PARAMETER Name
The name
.PARAMETER Email
The email
.PARAMETER Type
Type of user
.PARAMETER Title
The title
.PARAMETER Status
Status of the user
.PARAMETER Login
The login
.PARAMETER PreferredLanguage
The locale the user prefers to use
.PARAMETER Locale
The locale the user prefers to use
.PARAMETER GroupStrings
Group strings configured on the customer's Active Directory configuration, provided by the IDP at the moment on authentication.
.PARAMETER SailpointIdentityId
The identity ID of the user in ISC
.OUTPUTS

User<PSCustomObject>
#>


function Initialize-NERMUser {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Uid},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Email},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("NeprofileUser", "NeaccessUser")]
        [String]
        ${Type} = "NeprofileUser",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Title},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("Active", "Pending", "Disabled")]
        [String]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Login},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PreferredLanguage},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Locale},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${GroupStrings},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SailpointIdentityId}
    )

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "uid" = ${Uid}
            "name" = ${Name}
            "email" = ${Email}
            "type" = ${Type}
            "title" = ${Title}
            "status" = ${Status}
            "login" = ${Login}
            "preferred_language" = ${PreferredLanguage}
            "locale" = ${Locale}
            "group_strings" = ${GroupStrings}
            "sailpoint_identity_id" = ${SailpointIdentityId}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to User<PSCustomObject>

.DESCRIPTION

Convert from JSON to User<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

User<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMUser
        $AllProperties = ("id", "uid", "name", "email", "type", "title", "status", "login", "last_login", "cookies_accepted_at", "preferred_language", "locale", "group_strings", "sailpoint_identity_id")
        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 "email"))) { #optional property not found
            $Email = $null
        } else {
            $Email = $JsonParameters.PSobject.Properties["email"].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 "title"))) { #optional property not found
            $Title = $null
        } else {
            $Title = $JsonParameters.PSobject.Properties["title"].value
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "uid" = ${Uid}
            "name" = ${Name}
            "email" = ${Email}
            "type" = ${Type}
            "title" = ${Title}
            "status" = ${Status}
            "login" = ${Login}
            "last_login" = ${LastLogin}
            "cookies_accepted_at" = ${CookiesAcceptedAt}
            "preferred_language" = ${PreferredLanguage}
            "locale" = ${Locale}
            "group_strings" = ${GroupStrings}
            "sailpoint_identity_id" = ${SailpointIdentityId}
        }

        return $PSO
    }

}