aspera-cli 4.15.0 → 4.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/BUGS.md +29 -3
  4. data/CHANGELOG.md +292 -228
  5. data/CONTRIBUTING.md +69 -18
  6. data/README.md +1102 -952
  7. data/bin/ascli +13 -31
  8. data/bin/asession +3 -1
  9. data/examples/dascli +2 -2
  10. data/lib/aspera/aoc.rb +28 -33
  11. data/lib/aspera/ascmd.rb +3 -6
  12. data/lib/aspera/assert.rb +45 -0
  13. data/lib/aspera/cli/extended_value.rb +5 -5
  14. data/lib/aspera/cli/formatter.rb +26 -13
  15. data/lib/aspera/cli/hints.rb +4 -3
  16. data/lib/aspera/cli/main.rb +16 -3
  17. data/lib/aspera/cli/manager.rb +45 -36
  18. data/lib/aspera/cli/plugin.rb +20 -13
  19. data/lib/aspera/cli/plugins/aoc.rb +103 -73
  20. data/lib/aspera/cli/plugins/ats.rb +4 -3
  21. data/lib/aspera/cli/plugins/config.rb +114 -119
  22. data/lib/aspera/cli/plugins/cos.rb +2 -2
  23. data/lib/aspera/cli/plugins/faspex.rb +23 -19
  24. data/lib/aspera/cli/plugins/faspex5.rb +75 -43
  25. data/lib/aspera/cli/plugins/node.rb +28 -15
  26. data/lib/aspera/cli/plugins/orchestrator.rb +4 -2
  27. data/lib/aspera/cli/plugins/preview.rb +9 -7
  28. data/lib/aspera/cli/plugins/server.rb +6 -3
  29. data/lib/aspera/cli/plugins/shares.rb +30 -26
  30. data/lib/aspera/cli/sync_actions.rb +9 -9
  31. data/lib/aspera/cli/transfer_agent.rb +21 -14
  32. data/lib/aspera/cli/transfer_progress.rb +2 -3
  33. data/lib/aspera/cli/version.rb +1 -1
  34. data/lib/aspera/command_line_builder.rb +13 -11
  35. data/lib/aspera/cos_node.rb +3 -2
  36. data/lib/aspera/coverage.rb +22 -0
  37. data/lib/aspera/data_repository.rb +33 -2
  38. data/lib/aspera/environment.rb +4 -2
  39. data/lib/aspera/fasp/{agent_aspera.rb → agent_alpha.rb} +29 -39
  40. data/lib/aspera/fasp/agent_base.rb +17 -7
  41. data/lib/aspera/fasp/agent_direct.rb +88 -84
  42. data/lib/aspera/fasp/agent_httpgw.rb +4 -3
  43. data/lib/aspera/fasp/agent_node.rb +3 -2
  44. data/lib/aspera/fasp/agent_trsdk.rb +79 -37
  45. data/lib/aspera/fasp/installation.rb +51 -12
  46. data/lib/aspera/fasp/management.rb +11 -6
  47. data/lib/aspera/fasp/parameters.rb +53 -47
  48. data/lib/aspera/fasp/resume_policy.rb +7 -5
  49. data/lib/aspera/fasp/sync.rb +273 -0
  50. data/lib/aspera/fasp/transfer_spec.rb +10 -8
  51. data/lib/aspera/fasp/uri.rb +2 -2
  52. data/lib/aspera/faspex_gw.rb +11 -8
  53. data/lib/aspera/faspex_postproc.rb +6 -5
  54. data/lib/aspera/id_generator.rb +3 -1
  55. data/lib/aspera/json_rpc.rb +10 -8
  56. data/lib/aspera/keychain/encrypted_hash.rb +46 -11
  57. data/lib/aspera/keychain/macos_security.rb +15 -13
  58. data/lib/aspera/log.rb +4 -3
  59. data/lib/aspera/nagios.rb +7 -2
  60. data/lib/aspera/node.rb +17 -16
  61. data/lib/aspera/node_simulator.rb +214 -0
  62. data/lib/aspera/oauth.rb +22 -19
  63. data/lib/aspera/persistency_action_once.rb +13 -14
  64. data/lib/aspera/persistency_folder.rb +3 -2
  65. data/lib/aspera/preview/file_types.rb +53 -267
  66. data/lib/aspera/preview/generator.rb +7 -5
  67. data/lib/aspera/preview/terminal.rb +14 -5
  68. data/lib/aspera/preview/utils.rb +8 -7
  69. data/lib/aspera/proxy_auto_config.rb +6 -3
  70. data/lib/aspera/rest.rb +29 -13
  71. data/lib/aspera/rest_error_analyzer.rb +1 -0
  72. data/lib/aspera/rest_errors_aspera.rb +2 -0
  73. data/lib/aspera/secret_hider.rb +5 -2
  74. data/lib/aspera/ssh.rb +10 -8
  75. data/lib/aspera/temp_file_manager.rb +1 -1
  76. data/lib/aspera/web_server_simple.rb +2 -1
  77. data.tar.gz.sig +0 -0
  78. metadata +96 -45
  79. metadata.gz.sig +0 -0
  80. data/lib/aspera/sync.rb +0 -219
@@ -10,6 +10,7 @@ require 'aspera/aoc'
10
10
  require 'aspera/node'
11
11
  require 'aspera/persistency_action_once'
12
12
  require 'aspera/id_generator'
13
+ require 'aspera/assert'
13
14
  require 'securerandom'
14
15
  require 'date'
15
16
 
@@ -118,7 +119,7 @@ module Aspera
118
119
  end
119
120
  myself = object.aoc_api.read('self')[:data]
120
121
  if auto_set_pub_key
121
- raise Cli::Error, 'Public key is already set in profile (use --override=yes)' unless myself['public_key'].empty? || option_override
122
+ assert(myself['public_key'].empty?, exception_class: Cli::Error){'Public key is already set in profile (use --override=yes)'} unless option_override
122
123
  formatter.display_status('Updating profile with the public key.')
123
124
  aoc_api.update("users/#{myself['id']}", {'public_key' => pub_key_pem})
124
125
  end
@@ -165,7 +166,11 @@ module Aspera
165
166
  client_registration_token
166
167
  client_access_key
167
168
  kms_profile].freeze
168
- PACKAGE_QUERY_DEFAULT = {'archived' => false, 'exclude_dropbox_packages' => true, 'has_content' => true, 'received' => true}.freeze
169
+ PACKAGE_RECEIVED_BASE_QUERY = {
170
+ 'archived' => false,
171
+ 'has_content' => true,
172
+ 'received' => true,
173
+ 'completed' => true}.freeze
169
174
 
170
175
  def initialize(env)
171
176
  super(env)
@@ -209,7 +214,7 @@ module Aspera
209
214
  # @return identifier
210
215
  def get_resource_id_from_args(resource_class_path)
211
216
  return instance_identifier do |field, value|
212
- raise Cli::BadArgument, 'only selection by name is supported' unless field.eql?('name')
217
+ assert(field.eql?('name'), exception_class: Cli::BadArgument){'only selection by name is supported'}
213
218
  aoc_api.lookup_by_name(resource_class_path, value)['id']
214
219
  end
215
220
  end
@@ -218,11 +223,11 @@ module Aspera
218
223
  return "#{resource_class_path}/#{get_resource_id_from_args(resource_class_path)}"
219
224
  end
220
225
 
221
- # Call aoc_api.read with same parameters.
222
- # Use paging if necessary to get all results
223
- # @return [Hash] {list: , total: }
224
- def read_with_paging(resource_class_path, base_query)
225
- raise 'Query must be Hash' unless base_query.is_a?(Hash)
226
+ # Call block with same query using paging and response information
227
+ # @return [Hash] {data: , total: }
228
+ def api_call_paging(base_query={})
229
+ assert_type(base_query, Hash){'query'}
230
+ assert(block_given?)
226
231
  # set default large page if user does not specify own parameters. AoC Caps to 1000 anyway
227
232
  base_query['per_page'] = 1000 unless base_query.key?('per_page')
228
233
  max_items = base_query.delete(MAX_ITEMS)
@@ -235,7 +240,7 @@ module Aspera
235
240
  loop do
236
241
  query = base_query.clone
237
242
  query['page'] = current_page
238
- result = aoc_api.read(resource_class_path, query)
243
+ result = yield(query)
239
244
  total_count = result[:http]['X-Total-Count']
240
245
  page_count += 1
241
246
  current_page += 1
@@ -247,7 +252,36 @@ module Aspera
247
252
  break if !max_pages.nil? && page_count >= max_pages
248
253
  end
249
254
  item_list = item_list[0..max_items - 1] if !max_items.nil? && item_list.count > max_items
250
- return {list: item_list, total: total_count}
255
+ return {data: item_list, total: total_count}
256
+ end
257
+
258
+ # read using the query and paging
259
+ # @return [Hash] {data: , total: }
260
+ def api_read_all(resource_class_path, base_query={})
261
+ return api_call_paging(base_query) do |query|
262
+ aoc_api.read(resource_class_path, query)
263
+ end
264
+ end
265
+
266
+ # list all entities, given additional, default and user's queries
267
+ def result_list(resource_class_path, fields: nil, base_query: {}, default_query: {})
268
+ assert_type(base_query, Hash)
269
+ assert_type(default_query, Hash)
270
+ user_query = query_read_delete(default: default_query)
271
+ # caller may add specific modifications or checks
272
+ yield(user_query) if block_given?
273
+ return {type: :object_list, fields: fields}.merge(api_read_all(resource_class_path, base_query.merge(user_query)))
274
+ end
275
+
276
+ def resolve_dropbox_name_default_ws_id(query)
277
+ if query.key?('dropbox_name')
278
+ # convenience: specify name instead of id
279
+ raise 'not both dropbox_name and dropbox_id' if query.key?('dropbox_id')
280
+ query['dropbox_id'] = aoc_api.lookup_by_name('dropboxes', query['dropbox_name'])['id']
281
+ query.delete('dropbox_name')
282
+ end
283
+ query['workspace_id'] ||= aoc_api.context[:workspace_id] unless aoc_api.context[:workspace_id].eql?(:undefined)
284
+ query['exclude_dropbox_packages'] = true unless query.key?('dropbox_id')
251
285
  end
252
286
 
253
287
  NODE4_EXT_COMMANDS = %i[transfer].concat(Node::COMMANDS_GEN4).freeze
@@ -282,7 +316,7 @@ module Aspera
282
316
  client_direction = Fasp::TransferSpec::DIRECTION_RECEIVE
283
317
  client_folder = transfer.destination_folder(client_direction)
284
318
  server_folder = source_folder
285
- else raise 'internal error'
319
+ else error_unreachable_line
286
320
  end
287
321
  client_apfid = top_node_api.resolve_api_fid(file_id, client_folder)
288
322
  server_apfid = top_node_api.resolve_api_fid(file_id, server_folder)
@@ -303,9 +337,9 @@ module Aspera
303
337
  server_apfid[:file_id],
304
338
  client_direction,
305
339
  add_ts)))
306
- else raise "INTERNAL ERROR: Missing case: #{command_repo}"
340
+ else error_unreachable_line
307
341
  end # command_repo
308
- # raise 'internal error:shall not reach here'
342
+ error_unreachable_line
309
343
  end # execute_nodegen4_command
310
344
 
311
345
  def execute_admin_action
@@ -317,8 +351,7 @@ module Aspera
317
351
  command_auth_prov = options.get_next_command(%i[list update])
318
352
  case command_auth_prov
319
353
  when :list
320
- providers = aoc_api.read('admin/auth_providers')[:data]
321
- return {type: :object_list, data: providers}
354
+ return result_list('admin/auth_providers')
322
355
  when :update
323
356
  raise 'not implemented'
324
357
  end
@@ -402,7 +435,7 @@ module Aspera
402
435
  when :organizations then aoc_api.current_user_info['organization_id']
403
436
  when :users then aoc_api.current_user_info['id']
404
437
  when :nodes then aoc_api.current_user_info['id'] # TODO: consistent ? # rubocop:disable Lint/DuplicateBranch
405
- else raise 'Internal error'
438
+ else error_unreachable_line
406
439
  end
407
440
  filter = options.get_option(:query) || {}
408
441
  filter['limit'] ||= 100
@@ -411,9 +444,13 @@ module Aspera
411
444
  start_date_persistency = PersistencyActionOnce.new(
412
445
  manager: @agents[:persistency],
413
446
  data: saved_date,
414
- ids: IdGenerator.from_list(['aoc_ana_date', options.get_option(:url, mandatory: true), aoc_api.context[:workspace_name]].push(
447
+ id: IdGenerator.from_list([
448
+ 'aoc_ana_date',
449
+ options.get_option(:url, mandatory: true),
450
+ aoc_api.context(:files)[:workspace_name],
415
451
  filter_resource.to_s,
416
- filter_id)))
452
+ filter_id
453
+ ]))
417
454
  start_date_time = saved_date.first
418
455
  stop_date_time = Time.now.utc.strftime('%FT%T.%LZ')
419
456
  # Log.log().error("start: #{start_date_time}")
@@ -484,9 +521,7 @@ module Aspera
484
521
  when :group_membership then default_fields.push(*%w[group_id member_type member_id])
485
522
  when :workspace_membership then default_fields.push(*%w[workspace_id member_type member_id])
486
523
  end
487
- items = read_with_paging(resource_class_path, query_read_delete(default: default_query))
488
- formatter.display_item_count(items[:list].length, items[:total])
489
- return {type: :object_list, data: items[:list], fields: default_fields}
524
+ return result_list(resource_class_path, fields: default_fields, default_query: default_query)
490
525
  when :show
491
526
  object = aoc_api.read(resource_instance_path)[:data]
492
527
  # default: show all, but certificate
@@ -511,12 +546,13 @@ module Aspera
511
546
  return Main.result_success
512
547
  when :do
513
548
  command_repo = options.get_next_command(NODE4_EXT_COMMANDS)
514
- aoc_api.context(:none)
549
+ # init context
550
+ aoc_api.context(:files)
515
551
  return execute_nodegen4_command(command_repo, res_id)
516
- else raise 'unknown command'
552
+ else error_unexpected_value(command)
517
553
  end
518
554
  when :usage_reports
519
- return {type: :object_list, data: aoc_api.read('usage_reports', {workspace_id: aoc_api.context(:none)[:workspace_id]})[:data]}
555
+ return result_list('usage_reports', base_query: {workspace_id: aoc_api.context(:files)[:workspace_id]})
520
556
  end
521
557
  end
522
558
 
@@ -549,15 +585,15 @@ module Aspera
549
585
  when :tier_restrictions
550
586
  return { type: :single_object, data: aoc_api.read('tier_restrictions')[:data] }
551
587
  when :user
552
- case options.get_next_command(%i[workspaces profile])
588
+ case options.get_next_command(%i[workspaces profile preferences])
553
589
  # when :settings
554
590
  # return {type: :object_list,data: aoc_api.read('client_settings/')[:data]}
555
591
  when :workspaces
556
592
  case options.get_next_command(%i[list current])
557
593
  when :list
558
- return {type: :object_list, data: aoc_api.read('workspaces')[:data], fields: %w[id name]}
594
+ return result_list('workspaces', fields: %w[id name])
559
595
  when :current
560
- return { type: :single_object, data: aoc_api.read("workspaces/#{aoc_api.context(:none)[:workspace_id]}")[:data] }
596
+ return { type: :single_object, data: aoc_api.read("workspaces/#{aoc_api.context(:files)[:workspace_id]}")[:data] }
561
597
  end
562
598
  when :profile
563
599
  case options.get_next_command(%i[show modify])
@@ -567,19 +603,25 @@ module Aspera
567
603
  aoc_api.update("users/#{aoc_api.current_user_info(exception: true)['id']}", options.get_next_argument('properties', type: Hash))
568
604
  return Main.result_status('modified')
569
605
  end
606
+ when :preferences
607
+ user_preferences_res = "users/#{aoc_api.current_user_info(exception: true)['id']}/user_interaction_preferences"
608
+ case options.get_next_command(%i[show modify])
609
+ when :show
610
+ return { type: :single_object, data: aoc_api.read(user_preferences_res)[:data] }
611
+ when :modify
612
+ aoc_api.update(user_preferences_res, options.get_next_argument('properties', type: Hash))
613
+ return Main.result_status('modified')
614
+ end
570
615
  end
571
616
  when :packages
572
- package_command = options.get_next_command(%i[shared_inboxes send recv list show delete].concat(Node::NODE4_READ_ACTIONS))
617
+ package_command = options.get_next_command(%i[shared_inboxes send receive list show delete].concat(Node::NODE4_READ_ACTIONS), aliases: {recv: :receive})
573
618
  case package_command
574
619
  when :shared_inboxes
575
620
  case options.get_next_command(%i[list show])
576
621
  when :list
577
- query = query_read_delete
578
- if query.nil?
579
- query = {'embed[]' => 'dropbox', 'aggregate_permissions_by_dropbox' => true, 'sort' => 'dropbox_name'}
580
- query['workspace_id'] = aoc_api.context[:workspace_id] unless aoc_api.context[:workspace_id].eql?(:undefined)
581
- end
582
- return {type: :object_list, data: aoc_api.read('dropbox_memberships', query)[:data], fields: ['dropbox_id', 'dropbox.name']}
622
+ default_query = {'embed[]' => 'dropbox', 'aggregate_permissions_by_dropbox' => true, 'sort' => 'dropbox_name'}
623
+ default_query['workspace_id'] = aoc_api.context[:workspace_id] unless aoc_api.context[:workspace_id].eql?(:undefined)
624
+ return result_list('dropbox_memberships', fields: %w[dropbox_id dropbox.name], default_query: default_query)
583
625
  when :show
584
626
  return {type: :single_object, data: aoc_api.read(get_resource_path_from_args('dropboxes'), query)[:data]}
585
627
  end
@@ -603,7 +645,7 @@ module Aspera
603
645
  Main.result_transfer(transfer.start(created_package[:spec], rest_token: created_package[:node]))
604
646
  # return all info on package (especially package id)
605
647
  return { type: :single_object, data: created_package[:info]}
606
- when :recv
648
+ when :receive
607
649
  ids_to_download = nil
608
650
  if !aoc_api.public_link.nil?
609
651
  aoc_api.assert_public_link_types(['view_received_package'])
@@ -615,6 +657,7 @@ module Aspera
615
657
  skip_ids_data = []
616
658
  skip_ids_persistency = nil
617
659
  if options.get_option(:once_only, mandatory: true)
660
+ # TODO: add query info to id
618
661
  skip_ids_persistency = PersistencyActionOnce.new(
619
662
  manager: @agents[:persistency],
620
663
  data: skip_ids_data,
@@ -624,25 +667,25 @@ module Aspera
624
667
  aoc_api.context[:workspace_id]
625
668
  ].concat(aoc_api.additional_persistence_ids)))
626
669
  end
627
- if ExtendedValue::ALL.eql?(ids_to_download)
628
- query = query_read_delete(default: PACKAGE_QUERY_DEFAULT)
629
- raise 'option query must be Hash' unless query.is_a?(Hash)
630
- if query.key?('dropbox_name')
631
- # convenience: specify name instead of id
632
- raise 'not both dropbox_name and dropbox_id' if query.key?('dropbox_id')
633
- query['dropbox_id'] = aoc_api.lookup_by_name('dropboxes', query['dropbox_name'])['id']
634
- query.delete('dropbox_name')
635
- end
636
- query['workspace_id'] ||= aoc_api.context[:workspace_id] unless aoc_api.context[:workspace_id].eql?(:undefined)
637
- # get list of packages in inbox
638
- package_info = aoc_api.read('packages', query)[:data]
670
+ case ids_to_download
671
+ when ExtendedValue::ALL, ExtendedValue::INIT
672
+ query = query_read_delete(default: PACKAGE_RECEIVED_BASE_QUERY)
673
+ assert_type(query, Hash){'query'}
674
+ resolve_dropbox_name_default_ws_id(query)
639
675
  # remove from list the ones already downloaded
640
- ids_to_download = package_info.map{|e|e['id']}
676
+ all_ids = api_read_all('packages', query)[:data].map{|e|e['id']}
677
+ if ids_to_download.eql?(ExtendedValue::INIT)
678
+ assert(skip_ids_persistency){'Only with option once_only'}
679
+ skip_ids_persistency.data.clear.concat(all_ids)
680
+ skip_ids_persistency.save
681
+ return Main.result_status("Initialized skip for #{skip_ids_persistency.data.count} package(s)")
682
+ end
641
683
  # array here
642
- ids_to_download.reject!{|id|skip_ids_data.include?(id)}
684
+ ids_to_download = all_ids.reject{|id|skip_ids_data.include?(id)}
685
+ else
686
+ ids_to_download = [ids_to_download] unless ids_to_download.is_a?(Array)
643
687
  end # ExtendedValue::ALL
644
688
  # list here
645
- ids_to_download = [ids_to_download] unless ids_to_download.is_a?(Array)
646
689
  result_transfer = []
647
690
  formatter.display_status("found #{ids_to_download.length} package(s).")
648
691
  ids_to_download.each do |package_id|
@@ -673,24 +716,13 @@ module Aspera
673
716
  return { type: :single_object, data: package_info }
674
717
  when :list
675
718
  display_fields = %w[id name bytes_transferred]
676
- query = query_read_delete(default: PACKAGE_QUERY_DEFAULT)
677
- raise 'option query must be Hash' unless query.is_a?(Hash)
678
- if query.key?('dropbox_name')
679
- # convenience: specify name instead of id
680
- raise 'not both dropbox_name and dropbox_id' if query.key?('dropbox_id')
681
- query['dropbox_id'] = aoc_api.lookup_by_name('dropboxes', query['dropbox_name'])['id']
682
- query.delete('dropbox_name')
683
- end
684
- if aoc_api.context[:workspace_id].eql?(:undefined)
685
- display_fields.push('workspace_id')
686
- else
687
- query['workspace_id'] ||= aoc_api.context[:workspace_id]
688
- end
689
- packages = aoc_api.read('packages', query)[:data]
690
- return {type: :object_list, data: packages, fields: display_fields}
719
+ display_fields.push('workspace_id') if aoc_api.context[:workspace_id].eql?(:undefined)
720
+ return result_list('packages', fields: display_fields, base_query: PACKAGE_RECEIVED_BASE_QUERY) do |query|
721
+ resolve_dropbox_name_default_ws_id(query)
722
+ end
691
723
  when :delete
692
724
  return do_bulk_operation(command: package_command, descr: 'identifier', values: identifier) do |id|
693
- raise 'expecting String identifier' unless id.is_a?(String) || id.is_a?(Integer)
725
+ assert_values(id.class, [String, Integer]){'identifier'}
694
726
  aoc_api.delete("packages/#{id}")[:data]
695
727
  end
696
728
  when *Node::NODE4_READ_ACTIONS
@@ -720,7 +752,7 @@ module Aspera
720
752
  purpose = case link_type
721
753
  when :public then 'token_auth_redirection'
722
754
  when :private then 'shared_folder_auth_link'
723
- else raise 'internal error'
755
+ else error_unreachable_line
724
756
  end
725
757
  case short_link_command
726
758
  when :delete
@@ -754,8 +786,7 @@ module Aspera
754
786
  # embed: 'updated_by_user',
755
787
  sort: '-created_at'
756
788
  }
757
- result = aoc_api.read('short_links', list_params)[:data]
758
- return {type: :object_list, data: result, fields: Formatter.all_but('data')}
789
+ return result_list('short_links', fields: Formatter.all_but('data'), base_query: list_params)
759
790
  when :create
760
791
  creation_params = {
761
792
  purpose: purpose,
@@ -846,17 +877,16 @@ module Aspera
846
877
  url = value_create_modify(command: command, type: String)
847
878
  uri = URI.parse(url)
848
879
  server = WebServerSimple.new(uri)
849
- server.mount(uri.path, Faspex4GWServlet, aoc_api, aoc_api.context(:none)[:workspace_id])
880
+ server.mount(uri.path, Faspex4GWServlet, aoc_api, aoc_api.context(:files)[:workspace_id])
850
881
  trap('INT') { server.shutdown }
851
882
  formatter.display_status("Faspex 4 gateway listening on #{url}")
852
883
  Log.log.info("Listening on #{url}")
853
884
  # this is blocking until server exits
854
885
  server.start
855
886
  return Main.result_status('Gateway terminated')
856
- else
857
- raise "internal error: #{command}"
887
+ else error_unreachable_line
858
888
  end # action
859
- raise 'internal error: command shall return'
889
+ error_unreachable_line
860
890
  end
861
891
 
862
892
  private :execute_admin_action
@@ -4,6 +4,7 @@
4
4
 
5
5
  require 'aspera/cli/plugins/node'
6
6
  require 'aspera/ats_api'
7
+ require 'aspera/assert'
7
8
 
8
9
  module Aspera
9
10
  module Cli
@@ -128,7 +129,7 @@ module Aspera
128
129
  }}
129
130
  api_ak_auth = Rest.new(rest_params)
130
131
  return {type: :single_object, data: api_ak_auth.read('servers')[:data]}
131
- else raise 'INTERNAL ERROR'
132
+ else error_unreachable_line
132
133
  end
133
134
  end
134
135
 
@@ -200,7 +201,7 @@ module Aspera
200
201
  when :delete
201
202
  ats_ibm_api.delete("api_keys/#{concerned_id}")
202
203
  return Main.result_status("deleted #{concerned_id}")
203
- else raise 'INTERNAL ERROR'
204
+ else error_unreachable_line
204
205
  end
205
206
  end
206
207
 
@@ -224,7 +225,7 @@ module Aspera
224
225
  when :aws_trust_policy
225
226
  res = ats_api_pub_v1.read('aws/trustpolicy', {region: options.get_option(:region, mandatory: true)})[:data]
226
227
  return {type: :single_object, data: res}
227
- else raise 'ERROR'
228
+ else error_unexpected_value(command)
228
229
  end
229
230
  end
230
231