aspera-cli 4.25.6 → 4.26.0

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 (40) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +74 -47
  4. data/CONTRIBUTING.md +1 -1
  5. data/lib/aspera/api/aoc.rb +118 -78
  6. data/lib/aspera/api/node.rb +101 -49
  7. data/lib/aspera/ascp/installation.rb +94 -30
  8. data/lib/aspera/cli/extended_value.rb +1 -0
  9. data/lib/aspera/cli/formatter.rb +47 -40
  10. data/lib/aspera/cli/manager.rb +30 -4
  11. data/lib/aspera/cli/plugins/aoc.rb +214 -136
  12. data/lib/aspera/cli/plugins/ats.rb +3 -3
  13. data/lib/aspera/cli/plugins/base.rb +17 -42
  14. data/lib/aspera/cli/plugins/config.rb +5 -3
  15. data/lib/aspera/cli/plugins/console.rb +3 -3
  16. data/lib/aspera/cli/plugins/faspex.rb +5 -5
  17. data/lib/aspera/cli/plugins/faspex5.rb +20 -18
  18. data/lib/aspera/cli/plugins/node.rb +66 -70
  19. data/lib/aspera/cli/plugins/oauth.rb +5 -12
  20. data/lib/aspera/cli/plugins/orchestrator.rb +13 -13
  21. data/lib/aspera/cli/plugins/preview.rb +116 -80
  22. data/lib/aspera/cli/plugins/server.rb +2 -10
  23. data/lib/aspera/cli/plugins/shares.rb +7 -7
  24. data/lib/aspera/cli/version.rb +1 -1
  25. data/lib/aspera/dot_container.rb +7 -3
  26. data/lib/aspera/environment.rb +3 -2
  27. data/lib/aspera/log.rb +1 -1
  28. data/lib/aspera/preview/file_types.rb +1 -1
  29. data/lib/aspera/preview/generator.rb +146 -91
  30. data/lib/aspera/preview/options.rb +4 -1
  31. data/lib/aspera/preview/terminal.rb +50 -20
  32. data/lib/aspera/preview/utils.rb +76 -34
  33. data/lib/aspera/products/transferd.rb +1 -1
  34. data/lib/aspera/rest.rb +1 -0
  35. data/lib/aspera/rest_list.rb +23 -16
  36. data/lib/aspera/secret_hider.rb +3 -1
  37. data/lib/aspera/uri_reader.rb +17 -2
  38. data.tar.gz.sig +0 -0
  39. metadata +5 -5
  40. metadata.gz.sig +0 -0
@@ -143,12 +143,12 @@ module Aspera
143
143
 
144
144
  SPECIAL_ACTIONS = %i[health events info slash license].freeze
145
145
 
146
- # actions available in v3 in gen4
147
- V3_IN_V4_ACTIONS = %i[access_keys].concat(BASE_ACTIONS).concat(SPECIAL_ACTIONS).freeze
148
-
149
- # actions used commonly when a node is involved
146
+ # commands for : `execute_simple_common`: actions used commonly when a node is involved
150
147
  COMMON_ACTIONS = %i[access_keys].concat(BASE_ACTIONS).concat(SPECIAL_ACTIONS).freeze
151
148
 
149
+ # actions available in v3 in gen4
150
+ V3_IN_V4_ACTIONS = %i[transfer].concat(COMMON_ACTIONS).freeze
151
+
152
152
  private_constant :CENTRAL_SOAP_API_TEST, :SEARCH_REMOVE_FIELDS, :BASE_ACTIONS, :SPECIAL_ACTIONS, :V3_IN_V4_ACTIONS, :COMMON_ACTIONS
153
153
 
154
154
  # used in aoc
@@ -162,6 +162,7 @@ module Aspera
162
162
  COMMANDS_SHARES = (BASE_ACTIONS - %i[search]).freeze
163
163
  COMMANDS_FASPEX = COMMON_ACTIONS
164
164
 
165
+ # `browse` display fields for gen4
165
166
  GEN4_LS_FIELDS = %w[name type recursive_size size modified_time access_level].freeze
166
167
 
167
168
  # @param api [Rest] an existing API object for the Node API
@@ -397,9 +398,9 @@ module Aspera
397
398
  when *COMMANDS_GEN3
398
399
  execute_command_gen3(command)
399
400
  when :access_keys
400
- ak_command = options.get_next_command(%i[do set_bearer_key].concat(ALL_OPS))
401
+ ak_command = options.get_next_command(%i[do set_bearer_key].concat(Operations::ALL))
401
402
  case ak_command
402
- when *ALL_OPS
403
+ when *Operations::ALL
403
404
  return entity_execute(
404
405
  api: @api_node,
405
406
  entity: 'access_keys',
@@ -476,14 +477,14 @@ module Aspera
476
477
  end
477
478
 
478
479
  # Allows to specify a file by its path or by its id on the node in command line
479
- # @return [Hash] api and main file id for given path or id in next argument
480
+ # @return [NodeFileId] api and main file id for given path or id in next argument
480
481
  def apifid_from_next_arg(top_file_id)
481
- file_path = instance_identifier(description: 'path or %id:<id> or %id:') do |attribute, value|
482
+ file_path = options.instance_identifier(description: 'path or %id:<id> or %id:') do |attribute, value|
482
483
  raise BadArgument, 'Only selection "id" is supported (file id)' unless attribute.eql?('id')
483
- # directly return result for method
484
- return {api: @api_node, file_id: value}
484
+ # Directly return result for method
485
+ return Api::NodeFileId.new(@api_node, value)
485
486
  end
486
- # there was no selector, so it is a path
487
+ # There was no selector, so it is a path
487
488
  return @api_node.resolve_api_fid(top_file_id, file_path)
488
489
  end
489
490
 
@@ -497,40 +498,37 @@ module Aspera
497
498
  command_legacy = options.get_next_command(V3_IN_V4_ACTIONS)
498
499
  # TODO: shall we support all methods here ? what if there is a link ?
499
500
  apifid = @api_node.resolve_api_fid(top_file_id, '')
500
- return Node.new(context: context, api: apifid[:api]).execute_action(command_legacy)
501
+ return Node.new(context: context, api: apifid.node_api).execute_action(command_legacy)
501
502
  when :node_info, :bearer_token_node
502
503
  apifid = apifid_from_next_arg(top_file_id)
503
504
  result = {
504
- url: apifid[:api].base_url,
505
- root_id: apifid[:file_id]
505
+ url: apifid.node_api.base_url,
506
+ root_id: apifid.file_id
506
507
  }
507
- Aspera.assert_values(apifid[:api].auth_params[:type], %i[basic oauth2])
508
- case apifid[:api].auth_params[:type]
508
+ case apifid.node_api.auth_params[:type]
509
509
  when :basic
510
- result[:username] = apifid[:api].auth_params[:username]
511
- result[:password] = apifid[:api].auth_params[:password]
510
+ result[:username] = apifid.node_api.auth_params[:username]
511
+ result[:password] = apifid.node_api.auth_params[:password]
512
512
  when :oauth2
513
- result[:username] = apifid[:api].params[:headers][Api::Node::HEADER_X_ASPERA_ACCESS_KEY]
514
- result[:password] = apifid[:api].oauth.authorization
515
- else Aspera.error_unreachable_line
513
+ result[:username] = apifid.node_api.params[:headers][Api::Node::HEADER_X_ASPERA_ACCESS_KEY]
514
+ result[:password] = apifid.node_api.oauth.authorization
515
+ else Aspera.error_unexpected_value(apifid.node_api.auth_params[:type]){'Node API Auth type'}
516
516
  end
517
517
  return Main.result_single_object(result) if command_repo.eql?(:node_info)
518
518
  Log.dump(:result, result)
519
- raise BadArgument, "Cannot get bearer token if authenticating with secret (#{apifid[:api].auth_params[:type]})" unless apifid[:api].auth_params[:type].eql?(:oauth2)
519
+ raise BadArgument, "Cannot get bearer token if authenticating with secret (#{apifid.node_api.auth_params[:type]})" unless apifid.node_api.auth_params[:type].eql?(:oauth2)
520
520
  Aspera.assert(OAuth::Factory.bearer_auth?(result[:password])){'Not using bearer token auth'}
521
521
  return Main.result_text(result[:password])
522
522
  when :browse
523
523
  apifid = apifid_from_next_arg(top_file_id)
524
- file_info = apifid[:api].read("files/#{apifid[:file_id]}", headers: Api::Node.add_cache_control)
525
- unless file_info['type'].eql?('folder')
526
- # a single file
527
- return Main.result_object_list([file_info], fields: GEN4_LS_FIELDS)
528
- end
529
- return Main.result_object_list(apifid[:api].list_files(apifid[:file_id], query: query_read_delete), fields: GEN4_LS_FIELDS)
524
+ file_info = apifid.node_api.read("files/#{apifid.file_id}", headers: Api::Node.add_cache_control)
525
+ # a single file
526
+ return Main.result_object_list([file_info], fields: GEN4_LS_FIELDS) unless file_info['type'].eql?('folder')
527
+ return Main.result_object_list(apifid.node_api.list_files(apifid.file_id, query: query_read_delete), fields: GEN4_LS_FIELDS)
530
528
  when :find
531
529
  apifid = apifid_from_next_arg(top_file_id)
532
530
  find_lambda = Api::Node.file_matcher_from_argument(options)
533
- return Main.result_object_list(@api_node.find_files(apifid[:file_id], find_lambda), fields: ['path'])
531
+ return Main.result_object_list(@api_node.find_files(apifid.file_id, find_lambda), fields: ['path'])
534
532
  when :mkdir, :mklink, :mkfile
535
533
  containing_folder_path, new_item = Api::Node.split_folder(options.get_next_argument('path'))
536
534
  apifid = @api_node.resolve_api_fid(top_file_id, containing_folder_path, true)
@@ -542,12 +540,12 @@ module Aspera
542
540
  target = query.delete('target')
543
541
  if target
544
542
  target_apifid = @api_node.resolve_api_fid(top_file_id, target, true)
545
- payload[:target_id] = target_apifid[:file_id]
543
+ payload[:target_id] = target_apifid.file_id
546
544
  end
547
545
  payload.merge!(query.symbolize_keys)
548
546
  end
549
547
  if check_exists
550
- folder_content = apifid[:api].read("files/#{apifid[:file_id]}/files")
548
+ folder_content = apifid.node_api.read("files/#{apifid.file_id}/files")
551
549
  link_name = ".#{new_item}.asp-lnk"
552
550
  found = folder_content.find{ |i| i['name'].eql?(new_item) || i['name'].eql?(link_name)}
553
551
  raise "A #{found['type']} already exists with name #{new_item}" if found
@@ -563,26 +561,23 @@ module Aspera
563
561
  payload[:type] = :file
564
562
  payload[:contents] = Base64.strict_encode64(options.get_next_argument('contents'))
565
563
  end
566
- result = apifid[:api].create("files/#{apifid[:file_id]}/files", payload)
564
+ result = apifid.node_api.create("files/#{apifid.file_id}/files", payload)
567
565
  return Main.result_single_object(result)
568
566
  when :rename
569
567
  file_path = options.get_next_argument('source path')
570
568
  apifid = @api_node.resolve_api_fid(top_file_id, file_path)
571
569
  newname = options.get_next_argument('new name')
572
- result = apifid[:api].update("files/#{apifid[:file_id]}", {name: newname})
570
+ result = apifid.node_api.update("files/#{apifid.file_id}", {name: newname})
573
571
  return Main.result_status("renamed to #{newname}")
574
572
  when :delete
575
573
  return do_bulk_operation(command: command_repo, descr: 'path', values: String, id_result: 'path') do |l_path|
576
- apifid = if (m = Base.percent_selector(l_path))
574
+ apifid = if (m = Manager.percent_selector(l_path))
577
575
  Aspera.assert_values(m[:field], ['id'], type: BadIdentifier)
578
- {
579
- api: @api_node,
580
- file_id: m[:value]
581
- }
576
+ Api::NodeFileId.new(@api_node, m[:value])
582
577
  else
583
578
  @api_node.resolve_api_fid(top_file_id, l_path)
584
579
  end
585
- result = apifid[:api].delete("files/#{apifid[:file_id]}")
580
+ result = apifid.node_api.delete("files/#{apifid.file_id}")
586
581
  {'path' => l_path}
587
582
  end
588
583
  when :sync
@@ -596,66 +591,67 @@ module Aspera
596
591
  end
597
592
  # remote is specified by option: `to_folder`
598
593
  apifid = @api_node.resolve_api_fid(top_file_id, remote_path)
599
- apifid[:api].transfer_spec_gen4(apifid[:file_id], ts_direction)
594
+ apifid.node_api.transfer_spec_gen4(apifid.file_id, ts_direction)
600
595
  end
601
596
  when :upload
602
597
  apifid = @api_node.resolve_api_fid(top_file_id, transfer.destination_folder(Transfer::Spec::DIRECTION_SEND), true)
603
- return Main.result_transfer(transfer.start(apifid[:api].transfer_spec_gen4(apifid[:file_id], Transfer::Spec::DIRECTION_SEND)))
598
+ return Main.result_transfer(transfer.start(apifid.node_api.transfer_spec_gen4(apifid.file_id, Transfer::Spec::DIRECTION_SEND)))
604
599
  when :download
605
600
  apifid, source_paths = @api_node.resolve_api_fid_paths(top_file_id, transfer.ts_source_paths)
606
- return Main.result_transfer(transfer.start(apifid[:api].transfer_spec_gen4(apifid[:file_id], Transfer::Spec::DIRECTION_RECEIVE, {'paths'=>source_paths})))
601
+ return Main.result_transfer(transfer.start(apifid.node_api.transfer_spec_gen4(apifid.file_id, Transfer::Spec::DIRECTION_RECEIVE, {'paths'=>source_paths})))
607
602
  when :cat
608
603
  apifid = apifid_from_next_arg(top_file_id)
609
- http = apifid[:api].read("files/#{apifid[:file_id]}/content", ret: :resp)
604
+ http = apifid.node_api.read("files/#{apifid.file_id}/content", ret: :resp)
610
605
  return Main.result_text(http.body)
611
606
  when :show
612
607
  apifid = apifid_from_next_arg(top_file_id)
613
- items = apifid[:api].read("files/#{apifid[:file_id]}")
608
+ items = apifid.node_api.read("files/#{apifid.file_id}")
614
609
  return Main.result_single_object(items)
615
610
  when :modify
616
611
  apifid = apifid_from_next_arg(top_file_id)
617
612
  update_param = options.get_next_argument('update data', validation: Hash)
618
- apifid[:api].update("files/#{apifid[:file_id]}", update_param)
613
+ apifid.node_api.update("files/#{apifid.file_id}", update_param)
619
614
  return Main.result_status('Done')
620
615
  when :thumbnail
621
616
  apifid = apifid_from_next_arg(top_file_id)
622
- http = apifid[:api].read("files/#{apifid[:file_id]}/preview", headers: {'Accept' => 'image/png'}, ret: :resp)
617
+ http = apifid.node_api.read("files/#{apifid.file_id}/preview", headers: {'Accept' => 'image/png'}, ret: :resp)
623
618
  return Main.result_image(http.body)
624
619
  when :permission
625
620
  apifid = apifid_from_next_arg(top_file_id)
626
- command_perm = options.get_next_command(%i[list show create delete])
621
+ command_perm = options.get_next_command(%i[list show create delete modify])
627
622
  case command_perm
623
+ when :modify
624
+ apifid.node_api.update("permissions/#{options.instance_identifier}", value_create_modify(command: 'permission modify'))
625
+ return Main.result_status('Updated')
628
626
  when :list
629
627
  list_query = query_read_delete(default: Rest.php_style({'include' => %w[access_level permission_count]}))
630
- # specify file to get permissions for unless not specified
631
- list_query['file_id'] = apifid[:file_id] unless apifid[:file_id].to_s.empty?
628
+ # Specify file to get permissions for unless not specified (then, get all permissions)
629
+ list_query['file_id'] = apifid.file_id unless apifid.file_id.to_s.empty?
632
630
  list_query['inherited'] = false if list_query.key?('file_id') && !list_query.key?('inherited')
633
- # NOTE: supports per_page and page and header X-Total-Count
634
- items = apifid[:api].read('permissions', list_query)
631
+ items = apifid.node_api.read_with_pages('permissions', list_query)
635
632
  return Main.result_object_list(items)
636
633
  when :show
637
- perm_id = instance_identifier
638
- return Main.result_single_object(apifid[:api].read("permissions/#{perm_id}"))
634
+ return Main.result_single_object(apifid.node_api.read("permissions/#{options.instance_identifier}"))
639
635
  when :delete
640
636
  return do_bulk_operation(command: command_perm, values: :identifier) do |one_id|
641
- apifid[:api].delete("permissions/#{one_id}")
637
+ apifid.node_api.delete("permissions/#{one_id}")
642
638
  # notify application of deletion
643
- the_app = apifid[:api].app_info
644
- the_app&.[](:api)&.permissions_send_event(event_data: {}, app_info: the_app, types: ['permission.deleted'])
639
+ the_app = apifid.node_api.app_info
640
+ the_app&.api&.permissions_send_event(event_data: {}, app_info: the_app, types: ['permission.deleted'])
645
641
  {'id' => one_id}
646
642
  end
647
643
  when :create
648
644
  create_param = options.get_next_argument('creation data', validation: Hash)
649
645
  raise Cli::BadArgument, 'no file_id' if create_param.key?('file_id')
650
- create_param['file_id'] = apifid[:file_id]
646
+ create_param['file_id'] = apifid.file_id
651
647
  create_param['access_levels'] = Api::Node::ACCESS_LEVELS unless create_param.key?('access_levels')
652
648
  # add application specific tags (AoC)
653
- the_app = apifid[:api].app_info
654
- the_app&.[](:api)&.permissions_set_create_params(perm_data: create_param, app_info: the_app)
649
+ the_app = apifid.node_api.app_info
650
+ the_app&.api&.permissions_set_create_params(perm_data: create_param, app_info: the_app)
655
651
  # create permission
656
- created_data = apifid[:api].create('permissions', create_param)
652
+ created_data = apifid.node_api.create('permissions', create_param)
657
653
  # notify application of creation
658
- the_app&.[](:api)&.permissions_send_event(event_data: created_data, app_info: the_app)
654
+ the_app&.api&.permissions_send_event(event_data: created_data, app_info: the_app)
659
655
  return Main.result_single_object(created_data)
660
656
  else Aspera.error_unreachable_line
661
657
  end
@@ -682,7 +678,7 @@ module Aspera
682
678
  def execute_async
683
679
  command = options.get_next_command(%i[list delete files show counters bandwidth])
684
680
  unless command.eql?(:list)
685
- async_id = instance_identifier{ |field, value| async_lookup(field, value)}
681
+ async_id = options.instance_identifier{ |field, value| async_lookup(field, value)}
686
682
  if async_id.eql?(SpecialValues::ALL)
687
683
  raise Cli::BadArgument, 'ALL only for show and delete' unless %i[show delete].include?(command)
688
684
  async_ids = @api_node.read('async/list')['sync_ids']
@@ -770,7 +766,7 @@ module Aspera
770
766
  res_class_path = 'v3/watchfolders'
771
767
  command = options.get_next_command(WATCH_FOLDER_MUL + WATCH_FOLDER_SING)
772
768
  if WATCH_FOLDER_SING.include?(command)
773
- one_res_id = instance_identifier
769
+ one_res_id = options.instance_identifier
774
770
  one_res_path = "#{res_class_path}/#{one_res_id}"
775
771
  end
776
772
  # hum, to avoid: Unable to convert 2016_09_14 configuration
@@ -818,9 +814,9 @@ module Aspera
818
814
  when :async then return execute_async # former API
819
815
  when :ssync
820
816
  # Node API: /asyncs (newer)
821
- sync_command = options.get_next_command(%i[start stop bandwidth counters files state summary] + ALL_OPS - %i[modify])
817
+ sync_command = options.get_next_command(%i[start stop bandwidth counters files state summary] + Operations::ALL - %i[modify])
822
818
  case sync_command
823
- when *ALL_OPS
819
+ when *Operations::ALL
824
820
  return entity_execute(
825
821
  api: @api_node,
826
822
  entity: :asyncs,
@@ -828,7 +824,7 @@ module Aspera
828
824
  items_key: 'ids'
829
825
  ){ |field, value| ssync_lookup(field, value)}
830
826
  else
831
- asyncs_id = instance_identifier{ |field, value| ssync_lookup(field, value)}
827
+ asyncs_id = options.instance_identifier{ |field, value| ssync_lookup(field, value)}
832
828
  if %i[start stop].include?(sync_command)
833
829
  @api_node.call(
834
830
  operation: 'POST',
@@ -900,13 +896,13 @@ module Aspera
900
896
  end
901
897
  return Main.result_object_list(sessions, fields: %w[id status start_time end_time target_rate_kbps])
902
898
  when :cancel
903
- @api_node.cancel("ops/transfers/#{instance_identifier}")
899
+ @api_node.cancel("ops/transfers/#{options.instance_identifier}")
904
900
  return Main.result_status('Cancelled')
905
901
  when :show
906
- resp = @api_node.read("ops/transfers/#{instance_identifier}")
902
+ resp = @api_node.read("ops/transfers/#{options.instance_identifier}")
907
903
  return Main.result_single_object(resp)
908
904
  when :modify
909
- @api_node.update("ops/transfers/#{instance_identifier}", options.get_next_argument('update value', validation: Hash))
905
+ @api_node.update("ops/transfers/#{options.instance_identifier}", options.get_next_argument('update value', validation: Hash))
910
906
  return Main.result_status('Modified')
911
907
  when :bandwidth_average
912
908
  transfers_data = @api_node.read('ops/transfers', query_read_delete)
@@ -955,7 +951,7 @@ module Aspera
955
951
  end
956
952
  when :service
957
953
  command = options.get_next_command(%i[list create delete])
958
- service_id = instance_identifier if [:delete].include?(command)
954
+ service_id = options.instance_identifier if [:delete].include?(command)
959
955
  case command
960
956
  when :list
961
957
  resp = @api_node.read('rund/services')
@@ -8,21 +8,14 @@ module Aspera
8
8
  # base class for applications supporting OAuth 2.0 authentication
9
9
  class Oauth < BasicAuth
10
10
  class << self
11
- # Get command line options specified by `AUTH_OPTIONS` and `defaults.keys` (value is default).
12
- # Adds those not nil to the `kwargs`.
13
- # Instantiate the provided `klass` with those `kwargs`.
14
- # `defaults` can specify a default value (not `nil`)
15
- # @param options [Cli::Manager] Object to get command line options.
16
- # @param kwargs [Hash] Object creation arguments
17
- # @param defaults [Hash] Additional options, key=symbol, value=default value or nil
18
- # @return [Object] instance of `klass`
11
+ # Get command line `options` specified by `AUTH_OPTIONS`
12
+ # @param options [Cli::Manager] Object to get command line options.
13
+ # @return [Hash{Symbol => Object}] Options
19
14
  # @raise [Cli::Error] if a required option is missing
20
- def args_from_options(options, defaults: nil, **kwargs)
21
- defaults ||= {}
22
- (AUTH_OPTIONS + defaults.keys).each_with_object(kwargs) do |i, m|
15
+ def kwargs_from_options(options)
16
+ AUTH_OPTIONS.each_with_object({}) do |i, m|
23
17
  v = options.get_option(i)
24
18
  m[i] = v unless v.nil?
25
- m[i] = defaults[i] if m[i].nil? && !defaults[i].nil?
26
19
  end
27
20
  rescue ::ArgumentError => e
28
21
  if (m = e.message.match(/missing keyword: :(.*)$/))
@@ -169,7 +169,7 @@ module Aspera
169
169
  data: nil
170
170
  }
171
171
  call_params = {format: :json}
172
- wf_id = instance_identifier
172
+ wf_id = options.instance_identifier
173
173
  # get external parameters if any
174
174
  options.get_next_argument('external_parameters', mandatory: false, validation: Hash, default: {}).each do |name, value|
175
175
  call_params["external_parameters[#{name}]"] = value
@@ -192,28 +192,28 @@ module Aspera
192
192
  return result
193
193
  # 3. Fetch input specification for a workflow
194
194
  when :inputs
195
- result = call_ao("workflow_inputs_spec/#{instance_identifier}")
195
+ result = call_ao("workflow_inputs_spec/#{options.instance_identifier}")
196
196
  return Main.result_single_object(result['workflow_inputs_spec'])
197
197
  # 4. Check the running status for all workflows
198
198
  # 5. Check the running status for a particular workflow
199
199
  when :status
200
- wf_id = instance_identifier
200
+ wf_id = options.instance_identifier
201
201
  result = call_ao(wf_id.eql?(SpecialValues::ALL) ? 'workflows_status' : "workflows_status/#{wf_id}")
202
202
  return Main.result_object_list(result['workflows']['workflow'])
203
203
  # 6. Check the detailed running status for a particular workflow
204
204
  when :details
205
- result = call_ao("workflow_details/#{instance_identifier}")
205
+ result = call_ao("workflow_details/#{options.instance_identifier}")
206
206
  return Main.result_object_list(result['workflows']['workflow']['statuses'])
207
207
  # 15. Fetch output specification for a particular work flow
208
208
  when :outputs
209
- result = call_ao("workflow_outputs_spec/#{instance_identifier}")
209
+ result = call_ao("workflow_outputs_spec/#{options.instance_identifier}")
210
210
  return Main.result_object_list(result['workflow_outputs_spec']['output'])
211
211
  # 19.Fetch all workorders from a workflow
212
212
  when :workorders
213
- result = call_ao("work_orders_list/#{instance_identifier}")
213
+ result = call_ao("work_orders_list/#{options.instance_identifier}")
214
214
  return Main.result_object_list(result['work_orders'])
215
215
  when :export
216
- result = call_ao("export_workflow/#{instance_identifier}", format: nil, http: true)
216
+ result = call_ao("export_workflow/#{options.instance_identifier}", format: nil, http: true)
217
217
  return Main.result_text(result.body)
218
218
  end
219
219
  when :workorders
@@ -221,22 +221,22 @@ module Aspera
221
221
  case command
222
222
  # 7. Check the status for a particular work order
223
223
  when :status
224
- wo_id = instance_identifier
224
+ wo_id = options.instance_identifier
225
225
  result = call_ao("work_order_status/#{wo_id}")
226
226
  return Main.result_single_object(result['work_order'])
227
227
  # 9. Cancel a Work Order
228
228
  when :cancel
229
- wo_id = instance_identifier
229
+ wo_id = options.instance_identifier
230
230
  result = call_ao("work_order_cancel/#{wo_id}")
231
231
  return Main.result_single_object(result['work_order'])
232
232
  # 11. Reset a Work order
233
233
  when :reset
234
- wo_id = instance_identifier
234
+ wo_id = options.instance_identifier
235
235
  result = call_ao("work_order_reset/#{wo_id}")
236
236
  return Main.result_single_object(result['work_order'])
237
237
  # 16. Fetch output of a work order
238
238
  when :output
239
- wo_id = instance_identifier
239
+ wo_id = options.instance_identifier
240
240
  result = call_ao("work_order_output/#{wo_id}", format: 'xml')
241
241
  return Main.result_object_list(result['variable'])
242
242
  end
@@ -245,12 +245,12 @@ module Aspera
245
245
  case command
246
246
  # 8. Check the status of a Step
247
247
  when :status
248
- ws_id = instance_identifier
248
+ ws_id = options.instance_identifier
249
249
  result = call_ao("work_step_status/#{ws_id}")
250
250
  return Main.result_single_object(result)
251
251
  # 10. Cancel a Work Step
252
252
  when :cancel
253
- ws_id = instance_identifier
253
+ ws_id = options.instance_identifier
254
254
  result = call_ao("work_step_cancel/#{ws_id}")
255
255
  return Main.result_single_object(result)
256
256
  end