morpheus-cli 5.2.4 → 5.3.0.3

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.
@@ -178,7 +178,7 @@ module Morpheus::Cli::OptionSourceHelper
178
178
  # todo: some other common ones, accounts (tenants), etc.
179
179
  # todo: a generic set of parse and find methods like
180
180
  # like this:
181
- def parse_option_source_id_list(option_source, id_list, api_params={}, refresh=false)
181
+ def parse_option_source_id_list(option_source, id_list, api_params={}, refresh=false, allow_any_id=false)
182
182
  option_source_label = option_source.to_s # .capitalize
183
183
  option_data = load_option_source_data(option_source, api_params, refresh)
184
184
  found_ids = []
@@ -189,9 +189,8 @@ module Morpheus::Cli::OptionSourceHelper
189
189
  # never match blank nil or empty strings
190
190
  print_red_alert "#{option_source_label} cannot be not found by with a blank id!"
191
191
  return nil
192
- # elsif record_id.to_s =~ /\A\d{1,}\Z/
193
- # # always allow any ID for now..
194
- # found_ids << record_id
192
+ elsif allow_any_id && record_id.to_s =~ /\A\d{1,}\Z/
193
+ found_ids << record_id.to_i
195
194
  else
196
195
  # search with in a presedence by value, then name, then id (usually same as value)
197
196
  # exact match on value first.
@@ -228,28 +227,28 @@ module Morpheus::Cli::OptionSourceHelper
228
227
  return found_ids
229
228
  end
230
229
 
231
- def parse_cloud_id_list(id_list, api_params={}, refresh=false)
232
- parse_option_source_id_list('clouds', id_list, api_params, refresh)
230
+ def parse_cloud_id_list(id_list, api_params={}, refresh=false, allow_any_id=false)
231
+ parse_option_source_id_list('clouds', id_list, api_params, refresh, allow_any_id)
233
232
  end
234
233
 
235
- def parse_group_id_list(id_list, api_params={}, refresh=false)
236
- parse_option_source_id_list('groups', id_list, api_params, refresh)
234
+ def parse_group_id_list(id_list, api_params={}, refresh=false, allow_any_id=false)
235
+ parse_option_source_id_list('groups', id_list, api_params, refresh, allow_any_id)
237
236
  end
238
237
 
239
- def parse_user_id_list(id_list, api_params={}, refresh=false)
240
- parse_option_source_id_list('users', id_list, api_params, refresh)
238
+ def parse_user_id_list(id_list, api_params={}, refresh=false, allow_any_id=false)
239
+ parse_option_source_id_list('users', id_list, api_params, refresh, allow_any_id)
241
240
  end
242
241
 
243
- def parse_tenant_id_list(id_list, api_params={}, refresh=false)
244
- parse_option_source_id_list('allTenants', id_list, api_params, refresh)
242
+ def parse_tenant_id_list(id_list, api_params={}, refresh=false, allow_any_id=false)
243
+ parse_option_source_id_list('allTenants', id_list, api_params, refresh, allow_any_id)
245
244
  end
246
245
 
247
- # def parse_blueprints_id_list(id_list)
248
- # parse_option_source_id_list('blueprints', id_list, api_params, refresh)
246
+ # def parse_blueprints_id_list(id_list, api_params={}, refresh=false, allow_any_id=false)
247
+ # parse_option_source_id_list('blueprints', id_list, api_params, refresh, allow_any_id)
249
248
  # end
250
249
 
251
- def parse_project_id_list(id_list, api_params={}, refresh=false)
252
- parse_option_source_id_list('projects', id_list, api_params, refresh)
250
+ def parse_project_id_list(id_list, api_params={}, refresh=false, allow_any_id=false)
251
+ parse_option_source_id_list('projects', id_list, api_params, refresh, allow_any_id)
253
252
  end
254
253
 
255
254
  end
@@ -720,6 +720,7 @@ module Morpheus::Cli::PrintHelper
720
720
  columns.each do |column_def|
721
721
  # r << column_def.display_method.respond_to?(:call) ? column_def.display_method.call(row_data) : get_object_value(row_data, column_def.display_method)
722
722
  value = column_def.display_method.call(row_data)
723
+ value = JSON.fast_generate(value) if value.is_a?(Hash) || value.is_a?(Array)
723
724
  row << value
724
725
  end
725
726
  rows << row
@@ -802,6 +803,7 @@ module Morpheus::Cli::PrintHelper
802
803
  columns.each do |column_def|
803
804
  # r << column_def.display_method.respond_to?(:call) ? column_def.display_method.call(row_data) : get_object_value(row_data, column_def.display_method)
804
805
  value = column_def.display_method.call(row_data)
806
+ value = JSON.fast_generate(value) if value.is_a?(Hash) || value.is_a?(Array)
805
807
  row << value
806
808
  end
807
809
  rows << row
@@ -879,6 +881,7 @@ module Morpheus::Cli::PrintHelper
879
881
  label = label.upcase if ALL_LABELS_UPCASE
880
882
  # value = get_object_value(obj, column_def.display_method)
881
883
  value = column_def.display_method.call(obj)
884
+ value = JSON.fast_generate(value) if value.is_a?(Hash) || value.is_a?(Array)
882
885
  if label.size > max_label_width
883
886
  max_label_width = label.size
884
887
  end
@@ -181,7 +181,7 @@ class Morpheus::Cli::NetworkDomainsCommand
181
181
  options['name'] = val
182
182
  end
183
183
  opts.on('--description VALUE', String, "Description for this network domain") do |val|
184
- options['type'] = val
184
+ options['description'] = val
185
185
  end
186
186
  opts.on('--public-zone [on|off]', String, "Public Zone") do |val|
187
187
  options['publicZone'] = val.to_s == 'on' || val.to_s == 'true'
@@ -722,7 +722,7 @@ class Morpheus::Cli::NetworkDomainsCommand
722
722
  payload['networkDomainRecord']['name'] = v_prompt['name'] unless v_prompt['name'].to_s.empty?
723
723
 
724
724
  # Type
725
- v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'content', 'fieldLabel' => 'Type', 'type' => 'select', 'required' => true, 'optionSource' => 'dnsRecordType', 'description' => 'Type for this domain record.', 'defaultValue' => 'A'}], options[:options], @api_client)
725
+ v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'type', 'fieldLabel' => 'Type', 'type' => 'select', 'required' => true, 'optionSource' => 'dnsRecordType', 'description' => 'Type for this domain record.', 'defaultValue' => 'A'}], options[:options], @api_client)
726
726
  payload['networkDomainRecord']['type'] = v_prompt['type'] unless v_prompt['type'].to_s.empty?
727
727
 
728
728
  # Content
@@ -1276,7 +1276,8 @@ EOT
1276
1276
 
1277
1277
  def format_remote_details(appliance, options={})
1278
1278
  columns = {
1279
- "Name" => :name,
1279
+ #"Name" => :name,
1280
+ "Name" => lambda {|it| it[:name].to_s },
1280
1281
  #"Name" => lambda {|it| it[:active] ? "#{it[:name]} #{bold}(current)#{reset}#{cyan}" : it[:name] },
1281
1282
  "URL" => lambda {|it| it[:url] || it[:host] },
1282
1283
  #"Status" => lambda {|it| format_appliance_status(it, cyan) },
@@ -346,7 +346,7 @@ class Morpheus::Cli::ReportsCommand
346
346
  report_result = find_report_result_by_id(args[0])
347
347
  return 1 if report_result.nil?
348
348
 
349
- link = "#{@appliance_url}/login/oauth-redirect?access_token=#{@access_token}\\&redirectUri=/operations/reports/#{report_result['type']['code']}/reportResults/#{report_result['id']}"
349
+ link = "#{@appliance_url}/login/oauth-redirect?access_token=#{@access_token}\\&redirectUri=/operations/reports/#{report_result['type']['code']}/results/#{report_result['id']}%3Fcontext=results"
350
350
 
351
351
  if options[:dry_run]
352
352
  puts Morpheus::Util.open_url_command(link)
@@ -427,7 +427,10 @@ class Morpheus::Cli::ServicePlanCommand
427
427
  # permissions
428
428
  if !options[:no_prompt]
429
429
  perms = prompt_permissions(options, ['plans', 'groupDefaults'])
430
- params['visibility'] = perms.delete('resourcePool')['visibility']
430
+ if perms['resourcePool'] && !perms['resourcePool']['visibility'].nil?
431
+ params['visibility'] = perms['resourcePool']['visibility']
432
+ end
433
+ perms.delete('resourcePool')
431
434
  params['permissions'] = perms
432
435
  end
433
436
  payload = {'servicePlan' => params}
@@ -6,6 +6,7 @@ class Morpheus::Cli::UserSourcesCommand
6
6
  include Morpheus::Cli::AccountsHelper
7
7
 
8
8
  set_command_name :'user-sources'
9
+ set_command_description "View and manage user identity sources"
9
10
 
10
11
  register_subcommands :list, :get, :add, :update, :remove
11
12
  register_subcommands :activate, :deactivate
@@ -43,49 +44,32 @@ class Morpheus::Cli::UserSourcesCommand
43
44
  account_id = val
44
45
  end
45
46
  opts.add_hidden_option('-a, --account') if opts.is_a?(Morpheus::Cli::OptionParser)
46
- # opts.on('--technology VALUE', String, "Filter by technology") do |val|
47
- # params['provisionType'] = val
48
- # end
49
- build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
50
- opts.footer = "List user sources."
47
+ build_standard_list_options(opts, options)
48
+ opts.footer = "List identity sources."
51
49
  end
52
50
  optparse.parse!(args)
53
51
  connect(options)
54
- # instance is required right now.
55
- # account_id = args[0] if !account_id
52
+ # verify_args!(args:args, optparse:optparse, count:0)
56
53
  if args.count > 0
57
- print_error Morpheus::Terminal.angry_prompt
58
- puts_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.inspect}\n#{optparse}"
59
- return 1
54
+ options[:phrase] = args.join(" ")
60
55
  end
61
- begin
62
- # construct payload
63
- if account_id
64
- account = find_account_by_name_or_id(account_id)
65
- return 1 if account.nil?
66
- account_id = account['id']
67
- end
68
-
69
- params.merge!(parse_list_options(options))
70
- @user_sources_interface.setopts(options)
71
- if options[:dry_run]
72
- print_dry_run @user_sources_interface.dry.list(account_id, params)
73
- return
74
- end
75
-
76
- json_response = @user_sources_interface.list(account_id, params)
77
- if options[:json]
78
- puts as_json(json_response, options, "userSources")
79
- return 0
80
- elsif options[:csv]
81
- puts records_as_csv(json_response['userSources'], options)
82
- return 0
83
- elsif options[:yaml]
84
- puts as_yaml(json_response, options, "userSources")
85
- return 0
56
+ if account_id
57
+ account = find_account_by_name_or_id(account_id)
58
+ if account.nil?
59
+ return 1, "Tenant not found for '#{account_id}'"
86
60
  end
87
- user_sources = json_response['userSources']
88
- title = "Morpheus User Sources"
61
+ account_id = account['id']
62
+ end
63
+ params.merge!(parse_list_options(options))
64
+ @user_sources_interface.setopts(options)
65
+ if options[:dry_run]
66
+ print_dry_run @user_sources_interface.dry.list(account_id, params)
67
+ return 0, nil
68
+ end
69
+ json_response = @user_sources_interface.list(account_id, params)
70
+ render_response(json_response, options, "userSources") do
71
+ user_sources = json_response["userSources"]
72
+ title = "Morpheus Identity Sources"
89
73
  subtitles = []
90
74
  if account
91
75
  subtitles << "Tenant: #{account['name']}".strip
@@ -93,82 +77,77 @@ class Morpheus::Cli::UserSourcesCommand
93
77
  subtitles += parse_list_subtitles(options)
94
78
  print_h1 title, subtitles
95
79
  if user_sources.empty?
96
- if account
97
- print cyan,"No user sources found for account #{account['name']}.",reset,"\n"
98
- else
99
- print cyan,"No user sources found.",reset,"\n"
100
- end
80
+ print cyan,"No identity sources found.",reset,"\n"
101
81
  else
102
82
  print_user_sources_table(user_sources, options)
103
- print_results_pagination(json_response, {:label => "user source", :n_label => "user sources"})
83
+ print_results_pagination(json_response)
104
84
  end
105
85
  print reset,"\n"
106
- rescue RestClient::Exception => e
107
- print_rest_exception(e, options)
108
- return 1
109
86
  end
87
+ return 0, nil
88
+
110
89
  end
111
90
 
112
91
  def get(args)
113
- options = {}
114
92
  params = {}
93
+ options = {}
115
94
  optparse = Morpheus::Cli::OptionParser.new do |opts|
116
95
  opts.banner = subcommand_usage("[name]")
117
- build_common_options(opts, options, [:json, :yaml, :csv, :fields, :dry_run, :remote])
118
- opts.footer = "Get details about an user source." + "\n" +
119
- "[name] is required. This is the name or id of an user source."
96
+ # opts.on( '-c', '--config', "Display raw config only. Default is YAML. Combine with -j for JSON instead." ) do
97
+ # options[:show_config] = true
98
+ # end
99
+ # opts.on('--no-config', "Do not display Config YAML." ) do
100
+ # options[:no_config] = true
101
+ # end
102
+ build_standard_get_options(opts, options)
103
+ opts.footer = <<-EOT
104
+ Get details about an identity source.
105
+ [name] is required. This is the name or id of an identity source.
106
+ EOT
120
107
  end
121
108
  optparse.parse!(args)
109
+ verify_args!(args:args, optparse:optparse, min:1)
122
110
  connect(options)
123
- if args.count != 1
124
- print_error Morpheus::Terminal.angry_prompt
125
- puts_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.inspect}\n#{optparse}"
126
- return 1
111
+ id_list = parse_id_list(args)
112
+ return run_command_for_each_arg(id_list) do |arg|
113
+ _get(arg, params, options)
127
114
  end
115
+ end
116
+
117
+ def _get(user_source_id, params, options)
128
118
  account_id = nil
129
119
  account = nil
130
- user_source_id = args[0]
131
120
  # account_id = args[0]
132
121
  # account = find_account_by_name_or_id(account_id)
133
122
  # exit 1 if account.nil?
134
123
  # account_id = account['id']
135
124
  # user_source_id = args[1]
136
- begin
137
- @user_sources_interface.setopts(options)
138
- if options[:dry_run]
139
- if user_source_id.to_s =~ /\A\d{1,}\Z/
140
- print_dry_run @user_sources_interface.dry.get(account_id, user_source_id.to_i)
141
- else
142
- print_dry_run @user_sources_interface.dry.list(account_id, {name:user_source_id})
143
- end
144
- return
145
- end
146
- user_source = find_user_source_by_name_or_id(account_id, user_source_id)
147
- if user_source.nil?
148
- return 1
149
- end
150
- # fetch by id to get config too
151
- json_response = nil
125
+
126
+ @user_sources_interface.setopts(options)
127
+ if options[:dry_run]
152
128
  if user_source_id.to_s =~ /\A\d{1,}\Z/
153
- json_response = {'userSource' => user_source}
129
+ print_dry_run @user_sources_interface.dry.get(account_id, user_source_id.to_i)
154
130
  else
155
- json_response = @user_sources_interface.get(account_id, user_source['id'])
156
- user_source = json_response['userSource']
131
+ print_dry_run @user_sources_interface.dry.list(account_id, {name:user_source_id})
157
132
  end
133
+ return
134
+ end
135
+ user_source = find_user_source_by_name_or_id(account_id, user_source_id)
136
+ if user_source.nil?
137
+ return 1
138
+ end
139
+ # fetch by id to get config too
140
+ json_response = nil
141
+ if user_source_id.to_s =~ /\A\d{1,}\Z/
142
+ json_response = {'userSource' => user_source}
143
+ else
144
+ json_response = @user_sources_interface.get(account_id, user_source['id'])
145
+ user_source = json_response['userSource']
146
+ end
158
147
 
159
- #user_source = json_response['userSource']
160
- if options[:json]
161
- puts as_json(json_response, options, "userSource")
162
- return 0
163
- elsif options[:yaml]
164
- puts as_yaml(json_response, options, "userSource")
165
- return 0
166
- elsif options[:csv]
167
- puts records_as_csv([json_response['userSource']], options)
168
- return 0
169
- end
170
-
171
- print_h1 "User Source Details"
148
+ #user_source = json_response['userSource']
149
+ render_response(json_response, options, "userSource") do
150
+ print_h1 "Identity Source Details"
172
151
  print cyan
173
152
  description_cols = {
174
153
  "ID" => lambda {|it| it['id'] },
@@ -187,7 +166,7 @@ class Morpheus::Cli::UserSourcesCommand
187
166
 
188
167
  # show config settings...
189
168
  user_source_config = user_source['config']
190
- print_h2 "User Source Config (#{user_source['type']})"
169
+ print_h2 "Configuration"
191
170
  if user_source_config
192
171
  columns = user_source_config.keys #.sort
193
172
  print_description_list(columns, user_source_config)
@@ -208,15 +187,27 @@ class Morpheus::Cli::UserSourcesCommand
208
187
  {"SOURCE ROLE FQN" => lambda {|it| it['sourceRoleFqn'] } },
209
188
  ]
210
189
  print as_pretty_table(role_mappings, role_mapping_columns)
190
+ else
191
+ print cyan,"No role mappings found for this identity source.","\n",reset
192
+ end
193
+
194
+ provider_settings = user_source['providerSettings']
195
+ if provider_settings && !provider_settings.empty?
196
+ print_h2 "Provider Settings"
197
+ print_description_list({
198
+ "Entity ID" => lambda {|it| it['entityId'] },
199
+ "ACS URL" => lambda {|it| it['acsUrl'] }
200
+ }, provider_settings)
201
+ print_h2 "SP Metadata"
202
+ print cyan
203
+ print provider_settings['spMetadata']
211
204
  print "\n",reset
212
205
  else
213
- print cyan,"No role mappings found for this user source.","\n",reset
206
+ # print cyan,"No provider settings found.","\n",reset
214
207
  end
215
- return 0
216
- rescue RestClient::Exception => e
217
- print_rest_exception(e, options)
218
- return 1
208
+ print "\n",reset
219
209
  end
210
+ return 0, nil
220
211
  end
221
212
 
222
213
  def add(args)
@@ -229,17 +220,17 @@ class Morpheus::Cli::UserSourcesCommand
229
220
  default_role_id = nil
230
221
  optparse = Morpheus::Cli::OptionParser.new do|opts|
231
222
  opts.banner = subcommand_usage("[account] [name]")
232
- opts.on( '--tenant TENANT', String, "Tenant Name or ID the user source will belong to, default is your own." ) do |val|
223
+ opts.on( '--tenant TENANT', String, "Tenant Name or ID the identity source will belong to, default is your own." ) do |val|
233
224
  account_id = val
234
225
  end
235
- opts.on( '-a', '--account ACCOUNT', "Tenant Name or ID the user source will belong to, default is your own." ) do |val|
226
+ opts.on( '-a', '--account ACCOUNT', "Tenant Name or ID the identity source will belong to, default is your own." ) do |val|
236
227
  account_id = val
237
228
  end
238
229
  opts.add_hidden_option('-a, --account') if opts.is_a?(Morpheus::Cli::OptionParser)
239
- opts.on('--type CODE', String, "User Source Type") do |val|
230
+ opts.on('--type CODE', String, "Identity Source Type") do |val|
240
231
  type_code = val
241
232
  end
242
- opts.on('--name VALUE', String, "Name for this user source") do |val|
233
+ opts.on('--name VALUE', String, "Name for this identity source") do |val|
243
234
  params['name'] = val
244
235
  end
245
236
  opts.on('--description VALUE', String, "Description") do |val|
@@ -276,7 +267,7 @@ class Morpheus::Cli::UserSourcesCommand
276
267
  end
277
268
  #build_option_type_options(opts, options, add_user_source_option_types())
278
269
  build_standard_add_options(opts, options)
279
- opts.footer = "Create a new user source." + "\n" +
270
+ opts.footer = "Create a new identity source." + "\n" +
280
271
  "[account] is required. This is the name or id of an account."
281
272
  end
282
273
  optparse.parse!(args)
@@ -313,10 +304,10 @@ class Morpheus::Cli::UserSourcesCommand
313
304
  else
314
305
  payload.deep_merge!({'userSource' => parse_passed_options(options)})
315
306
 
316
- # User Source Type
307
+ # Identity Source Type
317
308
  user_source_types = @user_sources_interface.list_types({userSelectable: true})['userSourceTypes']
318
309
  if user_source_types.empty?
319
- print_red_alert "No available User Source Types found"
310
+ print_red_alert "No available Identity Source Types found"
320
311
  return 1
321
312
  end
322
313
  user_source_type = nil
@@ -328,7 +319,7 @@ class Morpheus::Cli::UserSourcesCommand
328
319
  user_source_type = user_source_types.find { |it| it['type'] == type_code }
329
320
 
330
321
  if user_source_type.nil?
331
- print_red_alert "User Source Type not found for '#{type_code}'"
322
+ print_red_alert "Identity Source Type not found for '#{type_code}'"
332
323
  return 1
333
324
  end
334
325
 
@@ -393,7 +384,7 @@ class Morpheus::Cli::UserSourcesCommand
393
384
  return 0
394
385
  end
395
386
  user_source = json_response['userSource']
396
- print_green_success "Added User Source #{user_source['name']}"
387
+ print_green_success "Added Identity Source #{user_source['name']}"
397
388
  get([user_source['id']] + (options[:remote] ? ["-r",options[:remote]] : []))
398
389
  return 0
399
390
  end
@@ -406,7 +397,7 @@ class Morpheus::Cli::UserSourcesCommand
406
397
  role_mapping_names = nil
407
398
  optparse = Morpheus::Cli::OptionParser.new do|opts|
408
399
  opts.banner = subcommand_usage("[name] [options]")
409
- opts.on('--name VALUE', String, "Name for this user source") do |val|
400
+ opts.on('--name VALUE', String, "Name for this identity source") do |val|
410
401
  params['name'] = val
411
402
  end
412
403
  opts.on('--description VALUE', String, "Description") do |val|
@@ -438,8 +429,8 @@ class Morpheus::Cli::UserSourcesCommand
438
429
  end
439
430
  end
440
431
  build_standard_update_options(opts, options)
441
- opts.footer = "Update a user source." + "\n" +
442
- "[name] is required. This is the name or id of a user source."
432
+ opts.footer = "Update an identity source." + "\n" +
433
+ "[name] is required. This is the name or id of an identity source."
443
434
  end
444
435
  optparse.parse!(args)
445
436
  if args.count < 1
@@ -494,7 +485,7 @@ class Morpheus::Cli::UserSourcesCommand
494
485
  return
495
486
  end
496
487
 
497
- print_green_success "Updated User Source #{params['name'] || user_source['name']}"
488
+ print_green_success "Updated Identity Source #{params['name'] || user_source['name']}"
498
489
  get([user_source['id']] + (options[:remote] ? ["-r",options[:remote]] : []))
499
490
  rescue RestClient::Exception => e
500
491
  print_rest_exception(e, options)
@@ -511,8 +502,8 @@ class Morpheus::Cli::UserSourcesCommand
511
502
  optparse = Morpheus::Cli::OptionParser.new do|opts|
512
503
  opts.banner = subcommand_usage("[name]")
513
504
  build_common_options(opts, options, [:options, :json, :dry_run, :remote])
514
- opts.footer = "Activate a user source." + "\n" +
515
- "[name] is required. This is the name or id of a user source."
505
+ opts.footer = "Activate an identity source." + "\n" +
506
+ "[name] is required. This is the name or id of an identity source."
516
507
  end
517
508
  optparse.parse!(args)
518
509
  if args.count < 1
@@ -544,7 +535,7 @@ class Morpheus::Cli::UserSourcesCommand
544
535
  return
545
536
  end
546
537
 
547
- print_green_success "Activated User Source #{user_source['name']}"
538
+ print_green_success "Activated Identity Source #{user_source['name']}"
548
539
  get([user_source['id']] + (options[:remote] ? ["-r",options[:remote]] : []))
549
540
  rescue RestClient::Exception => e
550
541
  print_rest_exception(e, options)
@@ -561,8 +552,8 @@ class Morpheus::Cli::UserSourcesCommand
561
552
  optparse = Morpheus::Cli::OptionParser.new do|opts|
562
553
  opts.banner = subcommand_usage("[name]")
563
554
  build_common_options(opts, options, [:options, :json, :dry_run, :remote])
564
- opts.footer = "Deactivate a user source." + "\n" +
565
- "[name] is required. This is the name or id of a user source."
555
+ opts.footer = "Deactivate an identity source." + "\n" +
556
+ "[name] is required. This is the name or id of an identity source."
566
557
  end
567
558
  optparse.parse!(args)
568
559
  if args.count < 1
@@ -594,7 +585,7 @@ class Morpheus::Cli::UserSourcesCommand
594
585
  return
595
586
  end
596
587
 
597
- print_green_success "Activated User Source #{user_source['name']}"
588
+ print_green_success "Activated Identity Source #{user_source['name']}"
598
589
  get([user_source['id']] + (options[:remote] ? ["-r",options[:remote]] : []))
599
590
  rescue RestClient::Exception => e
600
591
  print_rest_exception(e, options)
@@ -608,12 +599,12 @@ class Morpheus::Cli::UserSourcesCommand
608
599
  account_id = nil
609
600
  optparse = Morpheus::Cli::OptionParser.new do|opts|
610
601
  opts.banner = subcommand_usage("[name]")
611
- opts.on('--subdomain VALUE', String, "New subdomain for this user source") do |val|
602
+ opts.on('--subdomain VALUE', String, "New subdomain for this identity source") do |val|
612
603
  params['subdomain'] = (val == 'null') ? nil : val
613
604
  end
614
605
  build_common_options(opts, options, [:options, :json, :dry_run, :remote])
615
- opts.footer = "Update subdomain for a user source." + "\n" +
616
- "[name] is required. This is the name or id of a user source."
606
+ opts.footer = "Update subdomain for an identity source." + "\n" +
607
+ "[name] is required. This is the name or id of an identity source."
617
608
  end
618
609
  optparse.parse!(args)
619
610
  if args.count < 1
@@ -645,8 +636,8 @@ class Morpheus::Cli::UserSourcesCommand
645
636
  puts JSON.pretty_generate(json_response)
646
637
  return
647
638
  end
648
- # JD: uhh this updates the account too, it cannot be set per user source ...yet
649
- print_green_success "Updated User Source #{user_source['name']} subdomain to '#{payload['subdomain']}'"
639
+ # JD: uhh this updates the account too, it cannot be set per identity source ...yet
640
+ print_green_success "Updated Identity Source #{user_source['name']} subdomain to '#{payload['subdomain']}'"
650
641
  get([user_source['id']] + (options[:remote] ? ["-r",options[:remote]] : []))
651
642
  rescue RestClient::Exception => e
652
643
  print_rest_exception(e, options)
@@ -672,7 +663,7 @@ class Morpheus::Cli::UserSourcesCommand
672
663
  user_source = find_user_source_by_name_or_id(nil, args[0])
673
664
  exit 1 if user_source.nil?
674
665
 
675
- unless Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the user source #{user_source['name']}?", options)
666
+ unless Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the identity source #{user_source['name']}?", options)
676
667
  exit
677
668
  end
678
669
  @user_sources_interface.setopts(options)
@@ -687,7 +678,7 @@ class Morpheus::Cli::UserSourcesCommand
687
678
  return
688
679
  end
689
680
 
690
- print_green_success "Removed User Source #{user_source['name']}"
681
+ print_green_success "Removed Identity Source #{user_source['name']}"
691
682
  #list([])
692
683
  rescue RestClient::Exception => e
693
684
  print_rest_exception(e, options)
@@ -703,7 +694,7 @@ class Morpheus::Cli::UserSourcesCommand
703
694
  optparse = Morpheus::Cli::OptionParser.new do |opts|
704
695
  opts.banner = subcommand_usage()
705
696
  build_common_options(opts, options, [:list, :json, :yaml, :csv, :fields, :dry_run, :remote])
706
- opts.footer = "List user source types."
697
+ opts.footer = "List identity source types."
707
698
  end
708
699
  optparse.parse!(args)
709
700
  connect(options)
@@ -735,7 +726,7 @@ class Morpheus::Cli::UserSourcesCommand
735
726
  return 0
736
727
  end
737
728
  user_source_types = json_response['userSourceTypes']
738
- title = "Morpheus User Source Types"
729
+ title = "Morpheus Identity Source Types"
739
730
  subtitles = []
740
731
  subtitles += parse_list_subtitles(options)
741
732
  print_h1 title, subtitles
@@ -760,7 +751,7 @@ class Morpheus::Cli::UserSourcesCommand
760
751
  optparse = Morpheus::Cli::OptionParser.new do |opts|
761
752
  opts.banner = subcommand_usage("[type]")
762
753
  build_common_options(opts, options, [:json, :yaml, :csv, :fields, :dry_run, :remote])
763
- opts.footer = "Get details about a user source type." + "\n" +
754
+ opts.footer = "Get details about an identity source type." + "\n" +
764
755
  "[type] is required. This is the type identifier."
765
756
  end
766
757
  optparse.parse!(args)
@@ -776,13 +767,6 @@ class Morpheus::Cli::UserSourcesCommand
776
767
  begin
777
768
  user_source_type_id = args[0]
778
769
 
779
- # all_user_source_types = @user_sources_interface.dry.list_types({})['userSourceTypes']
780
- # user_source_type = all_user_source_types.find {|it| it['type'] == user_source_type_id }
781
- # if !user_source_type
782
- # print_red_alert "User Source Type not found by id '#{user_source_type_id}'"
783
- # return 1
784
- # end
785
-
786
770
  # construct payload
787
771
  @user_sources_interface.setopts(options)
788
772
  if options[:dry_run]
@@ -801,7 +785,7 @@ class Morpheus::Cli::UserSourcesCommand
801
785
  puts records_as_csv([user_source_type], options)
802
786
  return 0
803
787
  end
804
- title = "User Source Type"
788
+ title = "Identity Source Type"
805
789
  subtitles = []
806
790
  print_h1 title, subtitles
807
791
  print cyan
@@ -860,7 +844,7 @@ class Morpheus::Cli::UserSourcesCommand
860
844
  return json_response['userSource']
861
845
  rescue RestClient::Exception => e
862
846
  if e.response && e.response.code == 404
863
- print_red_alert "User Source not found by id #{id}"
847
+ print_red_alert "Identity Source not found by id #{id}"
864
848
  else
865
849
  raise e
866
850
  end
@@ -870,10 +854,10 @@ class Morpheus::Cli::UserSourcesCommand
870
854
  def find_user_source_by_name(account_id, name)
871
855
  user_sources = @user_sources_interface.list(account_id, {name: name.to_s})['userSources']
872
856
  if user_sources.empty?
873
- print_red_alert "User Source not found by name #{name}"
857
+ print_red_alert "Identity Source not found by name #{name}"
874
858
  return nil
875
859
  elsif user_sources.size > 1
876
- print_red_alert "#{user_sources.size} user sources found by name #{name}"
860
+ print_red_alert "#{user_sources.size} identity sources found by name #{name}"
877
861
  print_user_sources_table(user_sources, {color: red})
878
862
  print_red_alert "Try using ID instead"
879
863
  print reset,"\n"
@@ -979,7 +963,7 @@ class Morpheus::Cli::UserSourcesCommand
979
963
  {'fieldContext' => 'config', 'fieldName' => 'encryptionKey', 'type' => 'text', 'fieldLabel' => 'Encryption Key', 'required' => true, 'description' => ''},
980
964
  ]
981
965
  else
982
- print "unknown user source type: #{type_code}"
966
+ print "unknown identity source type: #{type_code}"
983
967
  []
984
968
  end
985
969
  end