Model/User.ps1

#
# SMServer V6
# Syncplify Server! REST API
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Id
This is the user's USERNAME or [GROUPNAME] if between square brackets
.PARAMETER Email
optional email
.PARAMETER Type
No description available.
.PARAMETER AuthTypes
What authentication types are accepted for this user. At least one item must be specified when adding a new user
.PARAMETER AuthMultiOnSsh
When connection is SSH-2, require the user to authenticate multiple times using ALL of the AuthTypes here above in order
.PARAMETER LdapServerId
ID of the LDAP server to be used for authentication (applicable only if this is an LDAP user/group)
.PARAMETER LdapQuery
No description available.
.PARAMETER Password
No description available.
.PARAMETER SshPubKeys
An optional list of SSH public keys this user is allowed to authenticate with
.PARAMETER Subsystems
No description available.
.PARAMETER Picture
No description available.
.PARAMETER Description
Optional, free-text description or annotation
.PARAMETER VarHome
No description available.
.PARAMETER VirtualFolders
An optional map of virtual folders for this user, the key is the mount point
.PARAMETER PermissionOverride
An optional map of permission override rules for real or virtual folders, the key is the mount point
.PARAMETER SpeedLimits
Optional list of various speed limits to be appied to dofferent client IPs and networks
.PARAMETER EventHandlers
Optional list of global (server-wide) event handlers
.PARAMETER Status
No description available.
.PARAMETER AutoEnable
Is this account to be automatically disabled at a certaind date?
.PARAMETER AutoEnableDate
If the above is TRUE, this is the exact timestamp when the account must be enabled
.PARAMETER AutoDisable
Is this account to be automatically disabled at a certaind date?
.PARAMETER AutoDisableDate
If the above is TRUE, this is the exact timestamp when the account must be disabled
.PARAMETER AllowList
Optional list of allowed sources (IPs and Networks) this user can log in from
.PARAMETER TourTaken
No description available.
.PARAMETER AuthenticatorSecret
No description available.
.PARAMETER AuthenticatorType
No description available.
.OUTPUTS

User<PSCustomObject>
#>


function Initialize-SS6User {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Email},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Type},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${AuthTypes},
        [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AuthMultiOnSsh},
        [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LdapServerId},
        [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${LdapQuery},
        [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Password},
        [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${SshPubKeys},
        [Parameter(Position = 9, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Subsystems},
        [Parameter(Position = 10, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Picture},
        [Parameter(Position = 11, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(Position = 12, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${VarHome},
        [Parameter(Position = 13, ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${VirtualFolders},
        [Parameter(Position = 14, ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${PermissionOverride},
        [Parameter(Position = 15, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${SpeedLimits},
        [Parameter(Position = 16, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${EventHandlers},
        [Parameter(Position = 17, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Status},
        [Parameter(Position = 18, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AutoEnable},
        [Parameter(Position = 19, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${AutoEnableDate},
        [Parameter(Position = 20, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AutoDisable},
        [Parameter(Position = 21, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${AutoDisableDate},
        [Parameter(Position = 22, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${AllowList},
        [Parameter(Position = 23, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${TourTaken},
        [Parameter(Position = 24, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${AuthenticatorSecret},
        [Parameter(Position = 25, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${AuthenticatorType}
    )

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "email" = ${Email}
            "type" = ${Type}
            "authTypes" = ${AuthTypes}
            "authMultiOnSsh" = ${AuthMultiOnSsh}
            "ldapServerId" = ${LdapServerId}
            "ldapQuery" = ${LdapQuery}
            "password" = ${Password}
            "sshPubKeys" = ${SshPubKeys}
            "subsystems" = ${Subsystems}
            "picture" = ${Picture}
            "description" = ${Description}
            "home" = ${VarHome}
            "virtualFolders" = ${VirtualFolders}
            "permissionOverride" = ${PermissionOverride}
            "speedLimits" = ${SpeedLimits}
            "eventHandlers" = ${EventHandlers}
            "status" = ${Status}
            "autoEnable" = ${AutoEnable}
            "autoEnableDate" = ${AutoEnableDate}
            "autoDisable" = ${AutoDisable}
            "autoDisableDate" = ${AutoDisableDate}
            "allowList" = ${AllowList}
            "tourTaken" = ${TourTaken}
            "authenticatorSecret" = ${AuthenticatorSecret}
            "authenticatorType" = ${AuthenticatorType}
        }


        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-SS6JsonToUser {
    Param(
        [AllowEmptyString()]
        [string]$Json
    )

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SS6User
        $AllProperties = ("id", "email", "type", "authTypes", "authMultiOnSsh", "ldapServerId", "ldapQuery", "password", "sshPubKeys", "subsystems", "picture", "description", "home", "virtualFolders", "permissionOverride", "speedLimits", "eventHandlers", "status", "autoEnable", "autoEnableDate", "autoDisable", "autoDisableDate", "allowList", "tourTaken", "authenticatorSecret", "authenticatorType")
        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 "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 "authTypes"))) { #optional property not found
            $AuthTypes = $null
        } else {
            $AuthTypes = $JsonParameters.PSobject.Properties["authTypes"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "email" = ${Email}
            "type" = ${Type}
            "authTypes" = ${AuthTypes}
            "authMultiOnSsh" = ${AuthMultiOnSsh}
            "ldapServerId" = ${LdapServerId}
            "ldapQuery" = ${LdapQuery}
            "password" = ${Password}
            "sshPubKeys" = ${SshPubKeys}
            "subsystems" = ${Subsystems}
            "picture" = ${Picture}
            "description" = ${Description}
            "home" = ${VarHome}
            "virtualFolders" = ${VirtualFolders}
            "permissionOverride" = ${PermissionOverride}
            "speedLimits" = ${SpeedLimits}
            "eventHandlers" = ${EventHandlers}
            "status" = ${Status}
            "autoEnable" = ${AutoEnable}
            "autoEnableDate" = ${AutoEnableDate}
            "autoDisable" = ${AutoDisable}
            "autoDisableDate" = ${AutoDisableDate}
            "allowList" = ${AllowList}
            "tourTaken" = ${TourTaken}
            "authenticatorSecret" = ${AuthenticatorSecret}
            "authenticatorType" = ${AuthenticatorType}
        }

        return $PSO
    }

}