morpheus-cli 6.2.0 → 6.2.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b786730f8b5d75b4fd3de84dbb6ab27b91a65302ac7d5a9087d5a2a6c69f4d27
4
- data.tar.gz: e4750a00de745628f98534029f776e497263e14cc228435c0f27d24f9a4203bd
3
+ metadata.gz: 7c3a197cce2be26fa8c5920d9dcfb367edab10b100b645c02b171ce830e2eb7f
4
+ data.tar.gz: f8467d902d52c8238d3edeae9cf2c6a57eab41e693b76a2742230a9635aa7403
5
5
  SHA512:
6
- metadata.gz: ab990dbe303e1bc744dde6b02c30bab0431f5a7d87a731c758173132973d3dad1b0b61937156a2d378075ee1d9088b55c63887bff673fc78d7bded01f390c943
7
- data.tar.gz: e56666973915b9020de7715fe42cadaf62391af1c9bbecd50c06b125ddfe16beb6e86f07d4610ceefe961c97b215e8f7c790c24c0eda6d72b72bd3158d80afe1
6
+ metadata.gz: 74ffa8dc07f0960f05790ae69568fbf9ae0b1afbe68bf7b8fea8dd532bd79a6cbafad4e1893c899b41fdef2c48fcb063d539f475b976ec72419279b77e312ce6
7
+ data.tar.gz: 7f512bfd99104a127d8e2f67976ad3f221ae9a3c35cf6dd70f7c6002f5b0fe494c961570cdb40ace71abbc3ccff2d09b3a3b582089fc83355da4d95f1fddf9d4
data/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
1
  FROM ruby:2.7.5
2
2
 
3
- RUN gem install morpheus-cli -v 6.2.0
3
+ RUN gem install morpheus-cli -v 6.2.1.1
4
4
 
5
5
  ENTRYPOINT ["morpheus"]
@@ -18,8 +18,4 @@ class Morpheus::MonitoringSettingsInterface < Morpheus::APIClient
18
18
  execute(method: :put, url: "#{base_path}/service-now", payload: payload, params: params, headers: headers)
19
19
  end
20
20
 
21
- def update_new_relic(payload, params={}, headers={})
22
- execute(method: :put, url: "#{base_path}/new-relic", payload: payload, params: params, headers: headers)
23
- end
24
-
25
21
  end
@@ -46,22 +46,22 @@ class Morpheus::ServiceCatalogInterface < Morpheus::APIClient
46
46
  end
47
47
 
48
48
  # update cart (set cart name)
49
- def update_cart(payload, params={})
49
+ def update_cart(params, payload)
50
50
  execute(method: :put, url: "#{base_path}/cart", params: params, payload: payload.to_json)
51
51
  end
52
52
 
53
53
  # validate a new item, can be used before before adding it
54
- def validate_cart_item(payload, params={})
54
+ def validate_cart_item(params, payload)
55
55
  execute(method: :post, url: "#{base_path}/cart/items/validate", params: params, payload: payload.to_json)
56
56
  end
57
57
 
58
58
  # add item to cart
59
- def create_cart_item(payload, params={})
59
+ def create_cart_item(params, payload)
60
60
  execute(method: :post, url: "#{base_path}/cart/items", params: params, payload: payload.to_json)
61
61
  end
62
62
 
63
63
  # update item in the cart
64
- def update_cart_item(id, payload, params={})
64
+ def update_cart_item(id, params, payload)
65
65
  validate_id!(id)
66
66
  execute(method: :put, url: "#{base_path}/cart/items/#{id}", params: params, payload: payload.to_json)
67
67
  end
@@ -73,7 +73,7 @@ class Morpheus::ServiceCatalogInterface < Morpheus::APIClient
73
73
  end
74
74
 
75
75
  # place order with cart
76
- def checkout(payload, params={})
76
+ def checkout(params, payload)
77
77
  execute(method: :post, url: "#{base_path}/checkout", params: params, payload: payload.to_json)
78
78
  end
79
79
 
@@ -83,7 +83,7 @@ class Morpheus::ServiceCatalogInterface < Morpheus::APIClient
83
83
  end
84
84
 
85
85
  # create an order from scratch, without using a cart
86
- def create_order(payload, params={})
86
+ def create_order(params, payload)
87
87
  execute(method: :post, url: "#{base_path}/orders", params: params, payload: payload.to_json)
88
88
  end
89
89
  end
@@ -1552,7 +1552,10 @@ module Morpheus
1552
1552
  payloads.each do |payload|
1553
1553
  apply_options(payload, options, object_key) unless options[:apply_options] == false
1554
1554
  end
1555
- else
1555
+ #else
1556
+ # should always do this, but a lot of methods rely on this returning nil right now, not {}
1557
+ # so for now only do it if block is given
1558
+ elsif block_given?
1556
1559
  # yield to block to construct the payload,
1557
1560
  # this is typically where prompting for inputs with optionTypes happens
1558
1561
  payload = {}
@@ -259,7 +259,8 @@ EOT
259
259
  connect(options)
260
260
  backup_job = find_backup_job_by_name_or_id(args[0])
261
261
  return 1 if backup_job.nil?
262
- parse_payload(options)
262
+ parse_payload(options) do |payload|
263
+ end
263
264
  execute_api(@backup_jobs_interface, :execute_job, [backup_job['id']], options, 'job') do |json_response|
264
265
  print_green_success "Executing backup job #{backup_job['name']}"
265
266
  # should get the result maybe, or could even support refreshing until it is complete...
@@ -305,7 +305,8 @@ EOT
305
305
  connect(options)
306
306
  backup = find_backup_by_name_or_id(args[0])
307
307
  return 1 if backup.nil?
308
- parse_payload(options)
308
+ parse_payload(options) do |payload|
309
+ end
309
310
  execute_api(@backups_interface, :execute_backup, [backup['id']], options, 'backup') do |json_response|
310
311
  print_green_success "Executing backup #{backup['name']}"
311
312
  # should get the result maybe, or could even support refreshing until it is complete...
@@ -39,7 +39,6 @@ class Morpheus::Cli::MonitoringSettings
39
39
  render_response(json_response, options, 'monitoringSettings') do
40
40
  monitoring_settings = json_response['monitoringSettings']
41
41
  service_now_settings = monitoring_settings['serviceNow']
42
- new_relic_settings = monitoring_settings['newRelic']
43
42
  print_h1 "Monitoring Settings"
44
43
  print cyan
45
44
  description_cols = {
@@ -61,13 +60,6 @@ class Morpheus::Cli::MonitoringSettings
61
60
  "Critical Mapping" => lambda {|it| format_service_now_mapping(it['criticalMapping']) },
62
61
  }
63
62
  print_description_list(description_cols, service_now_settings)
64
-
65
- print_h2 "New Relic Settings", options.merge(:border_style => :thin)
66
- description_cols = {
67
- "Enabled" => lambda {|it| format_boolean(it['enabled']) },
68
- "License Key" => lambda {|it| it['licenseKey'] },
69
- }
70
- print_description_list(description_cols, new_relic_settings, options)
71
63
 
72
64
  print reset, "\n"
73
65
  end
@@ -139,14 +131,6 @@ class Morpheus::Cli::MonitoringSettings
139
131
  params['serviceNow'] ||= {}
140
132
  params['serviceNow']['criticalMapping'] = val
141
133
  end
142
- opts.on('--new-relic-enabled [on|off]', String, "New Relic: Enabled (on) or disabled (off)") do |val|
143
- params['newRelic'] ||= {}
144
- params['newRelic']['enabled'] = val.to_s == 'on' || val.to_s == 'true' || val.to_s == '1' || val.to_s == ''
145
- end
146
- opts.on("--new-relic-license-key [VALUE]", String, "New Relic: License Key") do |val|
147
- params['newRelic'] ||= {}
148
- params['newRelic']['licenseKey'] = val
149
- end
150
134
  build_standard_update_options(opts, options)
151
135
  opts.footer = "Update monitoring settings."
152
136
  end
@@ -65,7 +65,8 @@ EOT
65
65
  verify_args!(args:args, optparse:optparse, count:0)
66
66
  connect(options)
67
67
  params.merge!(parse_query_options(options))
68
- payload = parse_payload(options)
68
+ payload = parse_payload(options) do |data|
69
+ end
69
70
  @plugins_interface.setopts(options)
70
71
  if options[:dry_run]
71
72
  print_dry_run @plugins_interface.dry.check_updates(payload, params)
@@ -1206,7 +1206,7 @@ EOT
1206
1206
  role = find_role_by_name_or_id(account_id, name)
1207
1207
  exit 1 if role.nil?
1208
1208
 
1209
- role_json = @roles_interface.get(account_id, role['id'])
1209
+ role_json = @roles_interface.get(account_id, role['id'], {'includeDefaultAccess' => true})
1210
1210
 
1211
1211
  cloud = nil
1212
1212
  if !do_all
@@ -1355,7 +1355,7 @@ EOT
1355
1355
  role = find_role_by_name_or_id(account_id, name)
1356
1356
  return 1 if role.nil?
1357
1357
 
1358
- role_json = @roles_interface.get(account_id, role['id'])
1358
+ role_json = @roles_interface.get(account_id, role['id'], {'includeDefaultAccess' => true})
1359
1359
  instance_type = nil
1360
1360
  if !do_all
1361
1361
  instance_type = find_instance_type_by_name(instance_type_name)
@@ -1504,7 +1504,7 @@ EOT
1504
1504
  role = find_role_by_name_or_id(account_id, name)
1505
1505
  return 1 if role.nil?
1506
1506
 
1507
- role_json = @roles_interface.get(account_id, role['id'])
1507
+ role_json = @roles_interface.get(account_id, role['id'], {'includeDefaultAccess' => true})
1508
1508
  blueprint_global_access = role_json['globalAppTemplateAccess'] || role_json['globalBlueprintAccess']
1509
1509
  blueprint_permissions = role_json['appTemplatePermissions'] || role_json['blueprintPermissions'] || []
1510
1510
 
@@ -1666,7 +1666,7 @@ EOT
1666
1666
  role = find_role_by_name_or_id(account_id, name)
1667
1667
  return 1 if role.nil?
1668
1668
 
1669
- role_json = @roles_interface.get(account_id, role['id'])
1669
+ role_json = @roles_interface.get(account_id, role['id'], {'includeDefaultAccess' => true})
1670
1670
  catalog_item_type_global_access = role_json['globalCatalogItemTypeAccess']
1671
1671
  catalog_item_type_permissions = role_json['catalogItemTypePermissions'] || role_json['catalogItemTypes'] []
1672
1672
 
@@ -1821,7 +1821,7 @@ Update default persona access for a role.
1821
1821
  role = find_role_by_name_or_id(account_id, name)
1822
1822
  return 1 if role.nil?
1823
1823
 
1824
- role_json = @roles_interface.get(account_id, role['id'])
1824
+ role_json = @roles_interface.get(account_id, role['id'], {'includeDefaultAccess' => true})
1825
1825
 
1826
1826
  # no lookup right now, pass the code serviceCatalog|standard
1827
1827
  persona_code = persona_id
@@ -1963,7 +1963,7 @@ EOT
1963
1963
  role = find_role_by_name_or_id(account_id, name)
1964
1964
  return 1 if role.nil?
1965
1965
 
1966
- role_json = @roles_interface.get(account_id, role['id'])
1966
+ role_json = @roles_interface.get(account_id, role['id'], {'includeDefaultAccess' => true})
1967
1967
  vdi_pool_global_access = role_json['globalVdiPoolAccess']
1968
1968
  vdi_pool_permissions = role_json['vdiPoolPermissions'] || role_json['vdiPools'] || []
1969
1969
 
@@ -2119,7 +2119,7 @@ EOT
2119
2119
  role = find_role_by_name_or_id(account_id, name)
2120
2120
  return 1 if role.nil?
2121
2121
 
2122
- role_json = @roles_interface.get(account_id, role['id'])
2122
+ role_json = @roles_interface.get(account_id, role['id'], {'includeDefaultAccess' => true})
2123
2123
  report_type_global_access = role_json['globalReportTypeAccess']
2124
2124
  report_type_permissions = role_json['reportTypePermissions'] || role_json['reportTypes'] || []
2125
2125
 
@@ -2273,7 +2273,7 @@ Update default task access for a role.
2273
2273
  role = find_role_by_name_or_id(account_id, name)
2274
2274
  return 1 if role.nil?
2275
2275
 
2276
- role_json = @roles_interface.get(account_id, role['id'])
2276
+ role_json = @roles_interface.get(account_id, role['id'], {'includeDefaultAccess' => true})
2277
2277
  task_permissions = role_json['taskPermissions'] || role_json['tasks'] || []
2278
2278
 
2279
2279
  # hacky, but support name or code lookup via the list returned in the show payload
@@ -2425,7 +2425,7 @@ Update default workflow access for a role.
2425
2425
  role = find_role_by_name_or_id(account_id, name)
2426
2426
  return 1 if role.nil?
2427
2427
 
2428
- role_json = @roles_interface.get(account_id, role['id'])
2428
+ role_json = @roles_interface.get(account_id, role['id'], {'includeDefaultAccess' => true})
2429
2429
  workflow_permissions = role_json['taskSetPermissions'] || role_json['taskSets'] || []
2430
2430
 
2431
2431
  # hacky, but support name or code lookup via the list returned in the show payload
@@ -871,7 +871,7 @@ EOT
871
871
 
872
872
  @service_catalog_interface.setopts(options)
873
873
  if options[:dry_run]
874
- print_dry_run @service_catalog_interface.dry.checkout(payload)
874
+ print_dry_run @service_catalog_interface.dry.checkout(params, payload)
875
875
  return
876
876
  end
877
877
 
@@ -889,7 +889,7 @@ EOT
889
889
  unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to checkout and place an order?")
890
890
  return 9, "aborted command"
891
891
  end
892
- json_response = @service_catalog_interface.checkout(payload, params)
892
+ json_response = @service_catalog_interface.checkout(params, payload)
893
893
  render_response(json_response, options) do
894
894
  print_green_success "Order placed"
895
895
  # ok so this is delayed because list does not return all statuses right now..
@@ -158,7 +158,8 @@ EOT
158
158
  "Login URL" => lambda {|it| it['loginURL'] },
159
159
  "Default Role" => lambda {|it| it['defaultAccountRole'] ? it['defaultAccountRole']['authority'] : '' },
160
160
  "External Login" => lambda {|it| format_boolean it['externalLogin'] },
161
- "Allow Custom Mappings" => lambda {|it| format_boolean it['allowCustomMappings'] },
161
+ "Enable Role Mapping Permission" => lambda {|it| format_boolean it['allowCustomMappings'] },
162
+ "Manual Role Assignment" => lambda {|it| it['manualRoleAssignment'].nil? ? '' : format_boolean(it['manualRoleAssignment']) },
162
163
  "Active" => lambda {|it| format_boolean it['active'] },
163
164
  }
164
165
  print_description_list(description_cols, user_source)
@@ -235,13 +236,27 @@ EOT
235
236
  opts.on('--description VALUE', String, "Description") do |val|
236
237
  params['description'] = val
237
238
  end
238
- opts.on("--allow-custom-mappings [on|off]", ['on','off'], "Allow Custom Mappings, Enable Role Mapping Permissions") do |val|
239
+ opts.on("--allow-custom-mappings [on|off]", ['on','off'], "Enable Role Mapping Permissions") do |val|
239
240
  params['allowCustomMappings'] = val.to_s == 'on' || val.to_s == 'true' || val.to_s == '1' || val.to_s == ''
240
241
  end
241
- opts.on("--allowCustomMappings [on|off]", ['on','off'], "Allow Custom Mappings, Enable Role Mapping Permissions") do |val|
242
+ opts.on("--allowCustomMappings [on|off]", ['on','off'], "Enable Role Mapping Permissions") do |val|
242
243
  params['allowCustomMappings'] = val.to_s == 'on' || val.to_s == 'true' || val.to_s == '1' || val.to_s == ''
243
244
  end
244
245
  opts.add_hidden_option('--allowCustomMappings')
246
+ opts.on("--manual-role-assignment [on|off]", ['on','off'], "Manual Role Assignment") do |val|
247
+ params['manualRoleAssignment'] = val.to_s == 'on' || val.to_s == 'true' || val.to_s == '1' || val.to_s == ''
248
+ end
249
+ opts.on("--manualRoleAssignment [on|off]", ['on','off'], "Manual Role Assignment") do |val|
250
+ params['manualRoleAssignment'] = val.to_s == 'on' || val.to_s == 'true' || val.to_s == '1' || val.to_s == ''
251
+ end
252
+ opts.add_hidden_option('--manualRoleAssignment')
253
+ opts.on("--manual-role-assignment [on|off]", ['on','off'], "Manual Role Assignment") do |val|
254
+ params['manualRoleAssignment'] = val.to_s == 'on' || val.to_s == 'true' || val.to_s == '1' || val.to_s == ''
255
+ end
256
+ opts.on("--manualRoleAssignment [on|off]", ['on','off'], "Manual Role Assignment") do |val|
257
+ params['manualRoleAssignment'] = val.to_s == 'on' || val.to_s == 'true' || val.to_s == '1' || val.to_s == ''
258
+ end
259
+ opts.add_hidden_option('--manualRoleAssignment')
245
260
  opts.on('--role-mappings MAPPINGS', String, "Role Mappings FQN in the format id1:FQN1,id2:FQN2") do |val|
246
261
  role_mappings = {}
247
262
  val.split(',').collect {|it| it.strip.split(':') }.each do |pair|
@@ -386,14 +401,22 @@ EOT
386
401
  end
387
402
  payload['userSource']['defaultAccountRole'] = {'id' => default_role_id }
388
403
 
389
- # Allow Custom Mappings
404
+ # Enable Role Mapping Permissions
390
405
  if !params['allowCustomMappings'].nil?
391
406
  payload['userSource']['allowCustomMappings'] = ["on","true"].include?(params['allowCustomMappings'].to_s)
392
407
  else
393
- v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'allowCustomMappings', 'type' => 'checkbox', 'fieldLabel' => 'Allow Custom Mappings', 'defaultValue' => false}], options[:options])
408
+ v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'allowCustomMappings', 'type' => 'checkbox', 'fieldLabel' => 'Enable Role Mapping Permissions', 'defaultValue' => false}], options[:options])
394
409
  payload['userSource']['allowCustomMappings'] = ["on","true"].include?(v_prompt['allowCustomMappings'].to_s)
395
410
  end
396
411
 
412
+ # Manual Role Assignment
413
+ if !params['manualRoleAssignment'].nil?
414
+ payload['userSource']['manualRoleAssignment'] = ["on","true"].include?(params['allowCustomMappings'].to_s)
415
+ else
416
+ v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'manualRoleAssignment', 'type' => 'checkbox', 'fieldLabel' => 'Manual Role Assignment', 'defaultValue' => false}], options[:options])
417
+ payload['userSource']['manualRoleAssignment'] = ["on","true"].include?(v_prompt['manualRoleAssignment'].to_s)
418
+ end
419
+
397
420
  if role_mappings
398
421
  payload['roleMappings'] = role_mappings
399
422
  end
@@ -435,10 +458,10 @@ EOT
435
458
  opts.on('--description VALUE', String, "Description") do |val|
436
459
  params['description'] = val
437
460
  end
438
- opts.on("--allow-custom-mappings [on|off]", ['on','off'], "Allow Custom Mappings, Enable Role Mapping Permissions") do |val|
461
+ opts.on("--allow-custom-mappings [on|off]", ['on','off'], "Enable Role Mapping Permissions") do |val|
439
462
  params['allowCustomMappings'] = val.to_s == 'on' || val.to_s == 'true' || val.to_s == '1' || val.to_s == ''
440
463
  end
441
- opts.on("--allowCustomMappings [on|off]", ['on','off'], "Allow Custom Mappings, Enable Role Mapping Permissions") do |val|
464
+ opts.on("--allowCustomMappings [on|off]", ['on','off'], "Enable Role Mapping Permissions") do |val|
442
465
  params['allowCustomMappings'] = val.to_s == 'on' || val.to_s == 'true' || val.to_s == '1' || val.to_s == ''
443
466
  end
444
467
  opts.add_hidden_option('--allowCustomMappings')
@@ -493,11 +516,16 @@ EOT
493
516
  payload['userSource']['description'] = params['description']
494
517
  end
495
518
 
496
- # Allow Custom Mappings
519
+ # Enable Role Mapping Permissions
497
520
  if !params['allowCustomMappings'].nil?
498
521
  payload['userSource']['allowCustomMappings'] = params['allowCustomMappings']
499
522
  end
500
523
 
524
+ # Manual Role Assignment
525
+ if !params['manualRoleAssignment'].nil?
526
+ payload['userSource']['manualRoleAssignment'] = params['manualRoleAssignment']
527
+ end
528
+
501
529
  if role_mappings
502
530
  payload['roleMappings'] = role_mappings
503
531
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "6.2.0"
4
+ VERSION = "6.2.1.1"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morpheus-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.0
4
+ version: 6.2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Estes
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2023-07-17 00:00:00.000000000 Z
14
+ date: 2023-09-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler