morpheus-cli 5.3.0.3 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +1 -1
  3. data/README.md +1 -3
  4. data/lib/morpheus/api/api_client.rb +48 -14
  5. data/lib/morpheus/api/certificate_types_interface.rb +14 -0
  6. data/lib/morpheus/api/certificates_interface.rb +9 -0
  7. data/lib/morpheus/api/integration_types_interface.rb +14 -0
  8. data/lib/morpheus/api/integrations_interface.rb +7 -22
  9. data/lib/morpheus/api/network_services_interface.rb +14 -0
  10. data/lib/morpheus/api/read_interface.rb +23 -0
  11. data/lib/morpheus/api/rest_interface.rb +12 -10
  12. data/lib/morpheus/api/roles_interface.rb +7 -0
  13. data/lib/morpheus/api/servers_interface.rb +7 -0
  14. data/lib/morpheus/api/user_settings_interface.rb +38 -18
  15. data/lib/morpheus/api/vdi_allocations_interface.rb +9 -0
  16. data/lib/morpheus/api/vdi_apps_interface.rb +9 -0
  17. data/lib/morpheus/api/vdi_gateways_interface.rb +9 -0
  18. data/lib/morpheus/api/vdi_interface.rb +28 -0
  19. data/lib/morpheus/api/vdi_pools_interface.rb +19 -0
  20. data/lib/morpheus/cli.rb +9 -2
  21. data/lib/morpheus/cli/apps.rb +59 -75
  22. data/lib/morpheus/cli/catalog_item_types_command.rb +13 -13
  23. data/lib/morpheus/cli/certificates_command.rb +575 -0
  24. data/lib/morpheus/cli/cli_command.rb +61 -6
  25. data/lib/morpheus/cli/clouds.rb +1 -0
  26. data/lib/morpheus/cli/clusters.rb +1 -1
  27. data/lib/morpheus/cli/commands/standard/man_command.rb +4 -5
  28. data/lib/morpheus/cli/hosts.rb +245 -224
  29. data/lib/morpheus/cli/instances.rb +150 -167
  30. data/lib/morpheus/cli/integrations_command.rb +588 -41
  31. data/lib/morpheus/cli/login.rb +7 -0
  32. data/lib/morpheus/cli/mixins/print_helper.rb +33 -18
  33. data/lib/morpheus/cli/mixins/provisioning_helper.rb +3 -3
  34. data/lib/morpheus/cli/mixins/vdi_helper.rb +246 -0
  35. data/lib/morpheus/cli/network_routers_command.rb +22 -9
  36. data/lib/morpheus/cli/networks_command.rb +2 -2
  37. data/lib/morpheus/cli/option_types.rb +34 -33
  38. data/lib/morpheus/cli/remote.rb +1 -1
  39. data/lib/morpheus/cli/reports_command.rb +4 -1
  40. data/lib/morpheus/cli/roles.rb +215 -55
  41. data/lib/morpheus/cli/subnets_command.rb +11 -2
  42. data/lib/morpheus/cli/user_settings_command.rb +268 -57
  43. data/lib/morpheus/cli/vdi_allocations_command.rb +159 -0
  44. data/lib/morpheus/cli/vdi_apps_command.rb +317 -0
  45. data/lib/morpheus/cli/vdi_command.rb +359 -0
  46. data/lib/morpheus/cli/vdi_gateways_command.rb +290 -0
  47. data/lib/morpheus/cli/vdi_pools_command.rb +571 -0
  48. data/lib/morpheus/cli/version.rb +1 -1
  49. data/lib/morpheus/rest_client.rb +30 -0
  50. data/lib/morpheus/terminal.rb +15 -7
  51. metadata +18 -2
@@ -349,8 +349,8 @@ class Morpheus::Cli::SubnetsCommand
349
349
  subnet_type_option_types = subnet_type['optionTypes']
350
350
  if subnet_type_option_types && subnet_type_option_types.size > 0
351
351
  # prompt for option types
352
- subnet_type_params = Morpheus::Cli::OptionTypes.prompt(subnet_type_option_types,options[:options],@api_client, {networkId: network['id']})
353
- payload['subnet'].deep_merge!(subnet_type_params)
352
+ subnet_type_params = Morpheus::Cli::OptionTypes.prompt(subnet_type_option_types,options[:options],@api_client, {networkId: network['id'], zoneId: network['zone']['id']})
353
+ payload['subnet'].deep_merge!(subnet_type_params['subnet'])
354
354
 
355
355
  else
356
356
  # DEFAULT INPUTS
@@ -365,6 +365,14 @@ class Morpheus::Cli::SubnetsCommand
365
365
 
366
366
  end
367
367
 
368
+ # CIDR
369
+ if options['cidr']
370
+ payload['subnet']['cidr'] = options['cidr']
371
+ elsif !subnet_type['code'].include? 'azure'
372
+ v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'cidr', 'fieldLabel' => 'CIDR', 'type' => 'text', 'required' => true, 'description' => ''}], options)
373
+ payload['subnet']['cidr'] = v_prompt['cidr']
374
+ end
375
+
368
376
  # DHCP
369
377
  if options['dhcpServer']
370
378
  payload['subnet']['dhcpServer'] = options['dhcpServer']
@@ -432,6 +440,7 @@ class Morpheus::Cli::SubnetsCommand
432
440
  print_dry_run @subnets_interface.dry.create(network['id'], payload)
433
441
  return
434
442
  end
443
+
435
444
  json_response = @subnets_interface.create(network['id'], payload)
436
445
  if options[:json]
437
446
  puts as_json(json_response, options)
@@ -6,7 +6,7 @@ class Morpheus::Cli::UserSettingsCommand
6
6
 
7
7
  set_command_name :'user-settings'
8
8
 
9
- register_subcommands :get, :update, :'update-avatar', :'view-avatar', :'regenerate-access-token', :'clear-access-token', :'list-clients'
9
+ register_subcommands :get, :update, :'update-avatar', :'remove-avatar', :'view-avatar', :'update-desktop-background', :'remove-desktop-background', :'view-desktop-background', :'regenerate-access-token', :'clear-access-token', :'list-clients'
10
10
 
11
11
  set_default_subcommand :get
12
12
 
@@ -51,29 +51,20 @@ EOT
51
51
  return 1
52
52
  end
53
53
 
54
- begin
55
- if options[:user]
56
- user = find_user_by_username_or_id(nil, options[:user], {global:true})
57
- return 1 if user.nil?
58
- params['userId'] = user['id']
59
- end
60
- params.merge!(parse_list_options(options))
61
- @user_settings_interface.setopts(options)
62
- if options[:dry_run]
63
- print_dry_run @user_settings_interface.dry.get(params)
64
- return
65
- end
66
- json_response = @user_settings_interface.get(params)
67
- if options[:json]
68
- puts as_json(json_response, options, "user")
69
- return 0
70
- elsif options[:yaml]
71
- puts as_yaml(json_response, options, "user")
72
- return 0
73
- elsif options[:csv]
74
- puts records_as_csv([json_response['user']], options)
75
- return 0
76
- end
54
+ if options[:user]
55
+ user = find_user_by_username_or_id(nil, options[:user], {global:true})
56
+ return 1 if user.nil?
57
+ params['userId'] = user['id']
58
+ end
59
+ params.merge!(parse_list_options(options))
60
+ @user_settings_interface.setopts(options)
61
+ if options[:dry_run]
62
+ print_dry_run @user_settings_interface.dry.get(params)
63
+ return
64
+ end
65
+ json_response = @user_settings_interface.get(params)
66
+
67
+ render_response(json_response, options) do
77
68
 
78
69
  user_settings = json_response['user'] || json_response['userSettings']
79
70
  access_tokens = user_settings['accessTokens'] || json_response['accessTokens'] || json_response['apiAccessTokens'] || []
@@ -94,7 +85,11 @@ EOT
94
85
  "Linux Key Pair" => lambda {|it| it['linuxKeyPairId'] },
95
86
  "Windows Username" => lambda {|it| it['windowsUsername'] },
96
87
  "Windows Password" => lambda {|it| it['windowsPassword'] },
88
+ "Default Group" => lambda {|it| it['defaultGroup'] ? it['defaultGroup']['name'] : '' },
89
+ "Default Cloud" => lambda {|it| it['defaultCloud'] ? it['defaultCloud']['name'] : '' },
97
90
  "Default Persona" => lambda {|it| it['defaultPersona'] ? it['defaultPersona']['name'] : '' },
91
+ "Desktop Background" => lambda {|it| it['desktopBackground'] ? it['desktopBackground'].split('/').last : '' },
92
+ "2FA Enabled" => lambda {|it| it['isUsing2FA'].nil? ? '' : format_boolean(it['isUsing2FA']) },
98
93
  }
99
94
  print_description_list(description_cols, user_settings)
100
95
 
@@ -117,18 +112,15 @@ EOT
117
112
  end
118
113
 
119
114
  print reset #, "\n"
120
- return 0
121
- rescue RestClient::Exception => e
122
- print_rest_exception(e, options)
123
- return 1
124
115
  end
116
+ return 0, nil
125
117
  end
126
118
 
127
119
 
128
120
  def update(args)
129
- raw_args = args
130
121
  options = {}
131
122
  params = {}
123
+ query_params = {}
132
124
  optparse = Morpheus::Cli::OptionParser.new do |opts|
133
125
  opts.banner = subcommand_usage("[options]")
134
126
  opts.on("-u", "--user USER", "User username or ID") do |val|
@@ -138,7 +130,8 @@ EOT
138
130
  params['userId'] = val.to_s
139
131
  end
140
132
  #opts.add_hidden_option('--user-id')
141
- build_common_options(opts, options, [:payload, :options, :json, :dry_run, :quiet, :remote])
133
+ build_option_type_options(opts, options, update_user_settings_option_types)
134
+ build_standard_update_options(opts, options)
142
135
  opts.footer = <<-EOT
143
136
  Update user settings.
144
137
  Done for the current user by default, unless a user is specified with the --user option.
@@ -152,29 +145,161 @@ EOT
152
145
  return 1
153
146
  end
154
147
 
148
+ if options[:user]
149
+ user = find_user_by_username_or_id(nil, options[:user], {global:true})
150
+ return 1 if user.nil?
151
+ params['userId'] = user['id']
152
+ end
153
+
154
+ payload = {}
155
+ if options[:payload]
156
+ payload = options[:payload]
157
+ payload.deep_merge!({'user' => parse_passed_options(options)})
158
+ else
159
+ params.deep_merge!(parse_passed_options(options))
160
+ # do not prompt on update
161
+ v_prompt = Morpheus::Cli::OptionTypes.no_prompt(update_user_settings_option_types, options[:options], @api_client, options[:params])
162
+ v_prompt.deep_compact!
163
+ params.deep_merge!(v_prompt)
164
+ # convert checkbox "on" and "off" to true and false
165
+ params.booleanize!
166
+ # upload requires multipart instead of json
167
+ if params['avatar']
168
+ params['avatar'] = File.new(File.expand_path(params['avatar']), 'rb')
169
+ payload[:multipart] = true
170
+ end
171
+ if params['desktopBackground']
172
+ params['desktopBackground'] = File.new(File.expand_path(params['desktopBackground']), 'rb')
173
+ payload[:multipart] = true
174
+ end
175
+ # userId goes in query string, not payload...
176
+ query_params['userId'] = params.delete('userId') if params.key?('userId')
177
+ payload.deep_merge!({'user' => params})
178
+ if payload['user'].empty? # || options[:no_prompt]
179
+ raise_command_error "Specify at least one option to update.\n#{optparse}"
180
+ end
181
+ end
182
+
183
+ @user_settings_interface.setopts(options)
184
+ if options[:dry_run]
185
+ print_dry_run @user_settings_interface.dry.update(payload, query_params)
186
+ return
187
+ end
188
+ json_response = @user_settings_interface.update(payload, query_params)
189
+ render_response(json_response, options) do
190
+ print_green_success "Updated user settings"
191
+ get_args = [] + (options[:remote] ? ["-r",options[:remote]] : []) + (query_params['userId'] ? ['--user-id', query_params['userId'].to_s] : [])
192
+ get(get_args)
193
+ end
194
+ return 0, nil
195
+
196
+ end
197
+
198
+ def update_avatar(args)
199
+ options = {}
200
+ params = {}
201
+ optparse = Morpheus::Cli::OptionParser.new do |opts|
202
+ opts.banner = subcommand_usage("[file]")
203
+ opts.on("-u", "--user USER", "User username or ID") do |val|
204
+ options[:user] = val.to_s
205
+ end
206
+ opts.on("--user-id ID", String, "User ID") do |val|
207
+ params['userId'] = val.to_s
208
+ end
209
+ #opts.add_hidden_option('--user-id')
210
+ build_common_options(opts, options, [:json, :dry_run, :quiet, :remote])
211
+ opts.footer = <<-EOT
212
+ Update avatar profile image.
213
+ [file] is required. This is the local path of a file to upload [png|jpg|svg].
214
+ Done for the current user by default, unless a user is specified with the --user option.
215
+ EOT
216
+ end
217
+ optparse.parse!(args)
218
+ connect(options)
219
+ if args.count != 1
220
+ print_error Morpheus::Terminal.angry_prompt
221
+ puts_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.inspect}\n#{optparse}"
222
+ return 1
223
+ end
224
+ filename = File.expand_path(args[0].to_s)
225
+ image_file = nil
226
+ if filename && File.file?(filename)
227
+ # maybe validate it's an image file? [.png|jpg|svg]
228
+ image_file = File.new(filename, 'rb')
229
+ else
230
+ # print_red_alert "File not found: #{filename}"
231
+ puts_error "#{Morpheus::Terminal.angry_prompt}File not found: #{filename}"
232
+ return 1
233
+ end
234
+
155
235
  begin
156
236
  if options[:user]
157
237
  user = find_user_by_username_or_id(nil, options[:user], {global:true})
158
238
  return 1 if user.nil?
159
239
  params['userId'] = user['id']
160
240
  end
161
- payload = {}
162
- if options[:payload]
163
- payload = options[:payload]
164
- else
165
-
241
+ @user_settings_interface.setopts(options)
242
+ if options[:dry_run]
243
+ print_dry_run @user_settings_interface.dry.update_avatar(image_file, params)
244
+ return
245
+ end
246
+ json_response = @user_settings_interface.update_avatar(image_file, params)
247
+ if options[:quiet]
248
+ return 0
249
+ elsif options[:json]
250
+ puts as_json(json_response, options)
251
+ return 0
166
252
  end
167
253
 
168
- if options[:options]
169
- payload['user'] ||= {}
170
- payload['user'].deep_merge!(options[:options].reject {|k,v| k.is_a?(Symbol) })
254
+ print_green_success "Updated avatar"
255
+ get_args = [] + (options[:remote] ? ["-r",options[:remote]] : []) + (params['userId'] ? ['--user-id', params['userId'].to_s] : [])
256
+ get(get_args)
257
+ return 0
258
+ rescue RestClient::Exception => e
259
+ print_rest_exception(e, options)
260
+ return 1
261
+ end
262
+ end
263
+
264
+ def remove_avatar(args)
265
+ options = {}
266
+ params = {}
267
+ optparse = Morpheus::Cli::OptionParser.new do |opts|
268
+ opts.banner = subcommand_usage()
269
+ opts.on("-u", "--user USER", "User username or ID") do |val|
270
+ options[:user] = val.to_s
271
+ end
272
+ opts.on("--user-id ID", String, "User ID") do |val|
273
+ params['userId'] = val.to_s
274
+ end
275
+ #opts.add_hidden_option('--user-id')
276
+ build_common_options(opts, options, [:json, :dry_run, :quiet, :remote])
277
+ opts.footer = <<-EOT
278
+ Remove avatar profile image.
279
+ [file] is required. This is the local path of a file to upload [png|jpg|svg].
280
+ Done for the current user by default, unless a user is specified with the --user option.
281
+ EOT
282
+ end
283
+ optparse.parse!(args)
284
+ connect(options)
285
+ if args.count != 0
286
+ print_error Morpheus::Terminal.angry_prompt
287
+ puts_error "wrong number of arguments, expected 0 and got (#{args.count}) #{args.inspect}\n#{optparse}"
288
+ return 1
289
+ end
290
+
291
+ begin
292
+ if options[:user]
293
+ user = find_user_by_username_or_id(nil, options[:user], {global:true})
294
+ return 1 if user.nil?
295
+ params['userId'] = user['id']
171
296
  end
172
297
  @user_settings_interface.setopts(options)
173
298
  if options[:dry_run]
174
- print_dry_run @user_settings_interface.dry.update(params, payload)
299
+ print_dry_run @user_settings_interface.dry.remove_avatar(params)
175
300
  return
176
301
  end
177
- json_response = @user_settings_interface.update(params, payload)
302
+ json_response = @user_settings_interface.remove_avatar(params)
178
303
  if options[:quiet]
179
304
  return 0
180
305
  elsif options[:json]
@@ -182,7 +307,7 @@ EOT
182
307
  return 0
183
308
  end
184
309
 
185
- print_green_success "Updated user settings"
310
+ print_green_success "Removed avatar"
186
311
  get_args = [] + (options[:remote] ? ["-r",options[:remote]] : []) + (params['userId'] ? ['--user-id', params['userId'].to_s] : [])
187
312
  get(get_args)
188
313
  return 0
@@ -192,7 +317,65 @@ EOT
192
317
  end
193
318
  end
194
319
 
195
- def update_avatar(args)
320
+ def view_avatar(args)
321
+ raw_args = args
322
+ options = {}
323
+ params = {}
324
+ optparse = Morpheus::Cli::OptionParser.new do |opts|
325
+ opts.banner = subcommand_usage()
326
+ opts.on("-u", "--user USER", "User username or ID") do |val|
327
+ options[:user] = val.to_s
328
+ end
329
+ opts.on("--user-id ID", String, "User ID") do |val|
330
+ params['userId'] = val.to_s
331
+ end
332
+ #opts.add_hidden_option('--user-id')
333
+ build_common_options(opts, options, [:remote])
334
+ opts.footer = <<-EOT
335
+ View avatar profile image.
336
+ This opens the avatar image url with a web browser.
337
+ Done for the current user by default, unless a user is specified with the --user option.
338
+ EOT
339
+ end
340
+ optparse.parse!(args)
341
+ connect(options)
342
+ if args.count != 0
343
+ print_error Morpheus::Terminal.angry_prompt
344
+ puts_error "wrong number of arguments, expected 0 and got (#{args.count}) #{args.inspect}\n#{optparse}"
345
+ return 1
346
+ end
347
+
348
+ begin
349
+ if options[:user]
350
+ user = find_user_by_username_or_id(nil, options[:user], {global:true})
351
+ return 1 if user.nil?
352
+ params['userId'] = user['id']
353
+ end
354
+ json_response = @user_settings_interface.get(params)
355
+ user_settings = json_response['user'] || json_response['userSettings']
356
+
357
+ if user_settings['avatar']
358
+ link = user_settings['avatar']
359
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
360
+ system "start #{link}"
361
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin/
362
+ system "open #{link}"
363
+ elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
364
+ system "xdg-open #{link}"
365
+ end
366
+ return 0, nil
367
+ else
368
+ print_error red,"No avatar image found.",reset,"\n"
369
+ return 1
370
+ end
371
+
372
+ rescue RestClient::Exception => e
373
+ print_rest_exception(e, options)
374
+ return 1
375
+ end
376
+ end
377
+
378
+ def update_desktop_background(args)
196
379
  options = {}
197
380
  params = {}
198
381
  optparse = Morpheus::Cli::OptionParser.new do |opts|
@@ -206,7 +389,7 @@ EOT
206
389
  #opts.add_hidden_option('--user-id')
207
390
  build_common_options(opts, options, [:json, :dry_run, :quiet, :remote])
208
391
  opts.footer = <<-EOT
209
- Update avatar profile image.
392
+ Update desktop background image used in the VDI persona.
210
393
  [file] is required. This is the local path of a file to upload [png|jpg|svg].
211
394
  Done for the current user by default, unless a user is specified with the --user option.
212
395
  EOT
@@ -237,10 +420,10 @@ EOT
237
420
  end
238
421
  @user_settings_interface.setopts(options)
239
422
  if options[:dry_run]
240
- print_dry_run @user_settings_interface.dry.update_avatar(image_file, params)
423
+ print_dry_run @user_settings_interface.dry.update_desktop_background(image_file, params)
241
424
  return
242
425
  end
243
- json_response = @user_settings_interface.update_avatar(image_file, params)
426
+ json_response = @user_settings_interface.update_desktop_background(image_file, params)
244
427
  if options[:quiet]
245
428
  return 0
246
429
  elsif options[:json]
@@ -248,7 +431,7 @@ EOT
248
431
  return 0
249
432
  end
250
433
 
251
- print_green_success "Updated avatar"
434
+ print_green_success "Updated desktop background"
252
435
  get_args = [] + (options[:remote] ? ["-r",options[:remote]] : []) + (params['userId'] ? ['--user-id', params['userId'].to_s] : [])
253
436
  get(get_args)
254
437
  return 0
@@ -258,7 +441,7 @@ EOT
258
441
  end
259
442
  end
260
443
 
261
- def remove_avatar(args)
444
+ def remove_desktop_background(args)
262
445
  options = {}
263
446
  params = {}
264
447
  optparse = Morpheus::Cli::OptionParser.new do |opts|
@@ -272,7 +455,7 @@ EOT
272
455
  #opts.add_hidden_option('--user-id')
273
456
  build_common_options(opts, options, [:json, :dry_run, :quiet, :remote])
274
457
  opts.footer = <<-EOT
275
- Remove avatar profile image.
458
+ Remove desktop background image.
276
459
  [file] is required. This is the local path of a file to upload [png|jpg|svg].
277
460
  Done for the current user by default, unless a user is specified with the --user option.
278
461
  EOT
@@ -293,10 +476,10 @@ EOT
293
476
  end
294
477
  @user_settings_interface.setopts(options)
295
478
  if options[:dry_run]
296
- print_dry_run @user_settings_interface.dry.remove_avatar(params)
479
+ print_dry_run @user_settings_interface.dry.remove_desktop_background(params)
297
480
  return
298
481
  end
299
- json_response = @user_settings_interface.remove_avatar(params)
482
+ json_response = @user_settings_interface.remove_desktop_background(params)
300
483
  if options[:quiet]
301
484
  return 0
302
485
  elsif options[:json]
@@ -304,7 +487,7 @@ EOT
304
487
  return 0
305
488
  end
306
489
 
307
- print_green_success "Removed avatar"
490
+ print_green_success "Removed desktop background"
308
491
  get_args = [] + (options[:remote] ? ["-r",options[:remote]] : []) + (params['userId'] ? ['--user-id', params['userId'].to_s] : [])
309
492
  get(get_args)
310
493
  return 0
@@ -314,7 +497,7 @@ EOT
314
497
  end
315
498
  end
316
499
 
317
- def view_avatar(args)
500
+ def view_desktop_background(args)
318
501
  raw_args = args
319
502
  options = {}
320
503
  params = {}
@@ -329,8 +512,8 @@ EOT
329
512
  #opts.add_hidden_option('--user-id')
330
513
  build_common_options(opts, options, [:remote])
331
514
  opts.footer = <<-EOT
332
- View avatar profile image.
333
- This opens the avatar image url with a web browser.
515
+ View desktop background image.
516
+ This opens the desktop background image url with a web browser.
334
517
  Done for the current user by default, unless a user is specified with the --user option.
335
518
  EOT
336
519
  end
@@ -351,8 +534,8 @@ EOT
351
534
  json_response = @user_settings_interface.get(params)
352
535
  user_settings = json_response['user'] || json_response['userSettings']
353
536
 
354
- if user_settings['avatar']
355
- link = user_settings['avatar']
537
+ if user_settings['desktopBackground']
538
+ link = user_settings['desktopBackground']
356
539
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
357
540
  system "start #{link}"
358
541
  elsif RbConfig::CONFIG['host_os'] =~ /darwin/
@@ -362,7 +545,7 @@ EOT
362
545
  end
363
546
  return 0, nil
364
547
  else
365
- print_error red,"No avatar image found.",reset,"\n"
548
+ print_error red,"No desktop background image found.",reset,"\n"
366
549
  return 1
367
550
  end
368
551
 
@@ -600,4 +783,32 @@ EOT
600
783
  end
601
784
  end
602
785
 
786
+ protected
787
+
788
+ def update_user_settings_option_types
789
+ [
790
+ # todo: rest of the available user settings!
791
+ {'switch' => 'change-username', 'fieldName' => 'username', 'fieldLabel' => 'Username', 'type' => 'text', 'description' => 'Change user credentials to use a new username'},
792
+ {'switch' => 'change-password', 'fieldName' => 'password', 'fieldLabel' => 'Password', 'type' => 'password', 'description' => 'Change user credentials to use a new password'},
793
+ {'fieldName' => 'email', 'fieldLabel' => 'Email', 'type' => 'text'},
794
+ {'fieldName' => 'firstName', 'fieldLabel' => 'First Name', 'type' => 'text'},
795
+ {'fieldName' => 'lastName', 'fieldLabel' => 'Last Name', 'type' => 'text'},
796
+ {'fieldName' => 'email', 'fieldLabel' => 'Email', 'type' => 'text'},
797
+ {'fieldName' => 'receiveNotifications', 'fieldLabel' => 'Receive Notifications', 'type' => 'checkbox'},
798
+ {'fieldName' => 'linuxUsername', 'fieldLabel' => 'Linux Username', 'type' => 'text'},
799
+ {'fieldName' => 'linuxPassword', 'fieldLabel' => 'Linux Password', 'type' => 'password'},
800
+ {'fieldName' => 'linuxKeyPairId', 'fieldLabel' => 'Linux Key Pair ID', 'type' => 'password'},
801
+ {'fieldName' => 'windowsUsername', 'fieldLabel' => 'Windows Username', 'type' => 'text'},
802
+ {'fieldName' => 'windowsPassword', 'fieldLabel' => 'Windows Password', 'type' => 'password'},
803
+ {'fieldName' => 'defaultGroup', 'fieldLabel' => 'Default Group ID', 'type' => 'text'},
804
+ {'fieldName' => 'defaultCloud', 'fieldLabel' => 'Default Cloud ID', 'type' => 'text'},
805
+ {'fieldName' => 'defaultPersona', 'fieldLabel' => 'Default Persona Name or Code or ID', 'type' => 'text'},
806
+ {'switch' => 'change-password', 'fieldName' => 'password', 'fieldLabel' => 'Password', 'type' => 'password', 'description' => 'Change user credentials to use a new password'},
807
+ {'fieldName' => 'avatar', 'fieldLabel' => 'Avatar', 'type' => 'file', 'description' => 'Local filepath of image file to upload as user avatar'},
808
+ {'fieldName' => 'desktopBackground', 'fieldLabel' => 'Desktop Background', 'type' => 'file', 'description' => 'Local filepath of image file to upload as user desktop background'},
809
+ # api cannot yet modify isUsing2fa
810
+ # {'switch' => '2fa', 'fieldName' => 'isUsing2fa', 'fieldLabel' => '2FA Enabled', 'type' => 'checkbox', 'description' => 'Enable or Disable 2FA for your user.'}
811
+ ]
812
+ end
813
+
603
814
  end