aspera-cli 4.14.0 → 4.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +54 -3
  4. data/CONTRIBUTING.md +7 -7
  5. data/README.md +1457 -880
  6. data/bin/ascli +18 -9
  7. data/bin/asession +12 -14
  8. data/examples/proxy.pac +1 -1
  9. data/lib/aspera/aoc.rb +198 -127
  10. data/lib/aspera/ascmd.rb +24 -14
  11. data/lib/aspera/cli/basic_auth_plugin.rb +9 -6
  12. data/lib/aspera/cli/error.rb +17 -0
  13. data/lib/aspera/cli/extended_value.rb +47 -12
  14. data/lib/aspera/cli/formatter.rb +260 -171
  15. data/lib/aspera/cli/hints.rb +80 -0
  16. data/lib/aspera/cli/main.rb +101 -147
  17. data/lib/aspera/cli/manager.rb +160 -124
  18. data/lib/aspera/cli/plugin.rb +70 -59
  19. data/lib/aspera/cli/plugins/alee.rb +0 -1
  20. data/lib/aspera/cli/plugins/aoc.rb +239 -273
  21. data/lib/aspera/cli/plugins/ats.rb +8 -5
  22. data/lib/aspera/cli/plugins/bss.rb +2 -2
  23. data/lib/aspera/cli/plugins/config.rb +516 -375
  24. data/lib/aspera/cli/plugins/console.rb +40 -0
  25. data/lib/aspera/cli/plugins/cos.rb +4 -5
  26. data/lib/aspera/cli/plugins/faspex.rb +99 -84
  27. data/lib/aspera/cli/plugins/faspex5.rb +179 -148
  28. data/lib/aspera/cli/plugins/node.rb +219 -153
  29. data/lib/aspera/cli/plugins/orchestrator.rb +52 -17
  30. data/lib/aspera/cli/plugins/preview.rb +46 -32
  31. data/lib/aspera/cli/plugins/server.rb +57 -17
  32. data/lib/aspera/cli/plugins/shares.rb +34 -12
  33. data/lib/aspera/cli/sync_actions.rb +68 -0
  34. data/lib/aspera/cli/transfer_agent.rb +45 -55
  35. data/lib/aspera/cli/transfer_progress.rb +74 -0
  36. data/lib/aspera/cli/version.rb +1 -1
  37. data/lib/aspera/colors.rb +3 -1
  38. data/lib/aspera/command_line_builder.rb +14 -11
  39. data/lib/aspera/cos_node.rb +3 -2
  40. data/lib/aspera/environment.rb +17 -6
  41. data/lib/aspera/fasp/agent_aspera.rb +126 -0
  42. data/lib/aspera/fasp/agent_base.rb +31 -77
  43. data/lib/aspera/fasp/agent_connect.rb +21 -22
  44. data/lib/aspera/fasp/agent_direct.rb +88 -102
  45. data/lib/aspera/fasp/agent_httpgw.rb +196 -192
  46. data/lib/aspera/fasp/agent_node.rb +41 -34
  47. data/lib/aspera/fasp/agent_trsdk.rb +75 -34
  48. data/lib/aspera/fasp/error_info.rb +2 -2
  49. data/lib/aspera/fasp/faux_file.rb +52 -0
  50. data/lib/aspera/fasp/installation.rb +43 -184
  51. data/lib/aspera/fasp/management.rb +244 -0
  52. data/lib/aspera/fasp/parameters.rb +59 -26
  53. data/lib/aspera/fasp/parameters.yaml +75 -8
  54. data/lib/aspera/fasp/products.rb +162 -0
  55. data/lib/aspera/fasp/transfer_spec.rb +1 -1
  56. data/lib/aspera/fasp/uri.rb +4 -4
  57. data/lib/aspera/faspex_gw.rb +2 -2
  58. data/lib/aspera/faspex_postproc.rb +2 -2
  59. data/lib/aspera/hash_ext.rb +2 -2
  60. data/lib/aspera/json_rpc.rb +49 -0
  61. data/lib/aspera/line_logger.rb +23 -0
  62. data/lib/aspera/log.rb +57 -16
  63. data/lib/aspera/node.rb +97 -14
  64. data/lib/aspera/oauth.rb +36 -18
  65. data/lib/aspera/open_application.rb +4 -4
  66. data/lib/aspera/persistency_folder.rb +2 -2
  67. data/lib/aspera/preview/file_types.rb +4 -2
  68. data/lib/aspera/preview/generator.rb +22 -35
  69. data/lib/aspera/preview/options.rb +2 -0
  70. data/lib/aspera/preview/terminal.rb +24 -13
  71. data/lib/aspera/preview/utils.rb +19 -26
  72. data/lib/aspera/rest.rb +103 -72
  73. data/lib/aspera/rest_call_error.rb +1 -1
  74. data/lib/aspera/rest_error_analyzer.rb +15 -14
  75. data/lib/aspera/rest_errors_aspera.rb +37 -34
  76. data/lib/aspera/secret_hider.rb +14 -16
  77. data/lib/aspera/ssh.rb +4 -1
  78. data/lib/aspera/sync.rb +128 -122
  79. data/lib/aspera/temp_file_manager.rb +10 -3
  80. data/lib/aspera/web_auth.rb +10 -7
  81. data/lib/aspera/web_server_simple.rb +9 -4
  82. data.tar.gz.sig +0 -0
  83. metadata +33 -15
  84. metadata.gz.sig +0 -0
  85. data/lib/aspera/cli/listener/line_dump.rb +0 -19
  86. data/lib/aspera/cli/listener/logger.rb +0 -22
  87. data/lib/aspera/cli/listener/progress.rb +0 -50
  88. data/lib/aspera/cli/listener/progress_multi.rb +0 -84
  89. data/lib/aspera/cli/plugins/sync.rb +0 -44
  90. data/lib/aspera/fasp/listener.rb +0 -13
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # cspell:ignore trustpolicy
4
+
3
5
  require 'aspera/cli/plugins/node'
4
6
  require 'aspera/ats_api'
5
7
 
@@ -9,6 +11,7 @@ module Aspera
9
11
  # Access Aspera Transfer Service
10
12
  # https://developer.ibm.com/aspera/docs/ats-api-reference/creating-ats-api-keys/
11
13
  class Ats < Aspera::Cli::Plugin
14
+ CLOUD_TABLE = %w[id name].freeze
12
15
  def initialize(env)
13
16
  super(env)
14
17
  options.declare(:ibm_api_key, 'IBM API key, see https://cloud.ibm.com/iam/apikeys')
@@ -89,7 +92,7 @@ module Aspera
89
92
  res = ats_api_pub_v1.read("access_keys/#{access_key_id}")
90
93
  return {type: :single_object, data: res[:data]}
91
94
  when :modify
92
- params = value_create_modify(command: command, type: Hash)
95
+ params = value_create_modify(command: command)
93
96
  params['id'] = access_key_id
94
97
  ats_api_pub_v1.update("access_keys/#{access_key_id}", params)
95
98
  return Main.result_status('modified')
@@ -103,7 +106,7 @@ module Aspera
103
106
  when :node
104
107
  ak_data = ats_api_pub_v1.read("access_keys/#{access_key_id}")[:data]
105
108
  server_data = @ats_api_pub.all_servers.find {|i| i['id'].start_with?(ak_data['transfer_server_id'])}
106
- raise CliError, 'no such server found' if server_data.nil?
109
+ raise Cli::Error, 'no such server found' if server_data.nil?
107
110
  node_url = server_data['transfer_setup_url']
108
111
  api_node = Aspera::Node.new(params: {
109
112
  base_url: node_url,
@@ -113,7 +116,7 @@ module Aspera
113
116
  password: @agents[:config].lookup_secret(url: node_url, username: access_key_id)
114
117
  }})
115
118
  command = options.get_next_command(Node::COMMANDS_GEN4)
116
- return Node.new(@agents.merge(skip_basic_auth_options: true, node_api: api_node)).execute_command_gen4(command, ak_data['root_file_id'])
119
+ return Node.new(@agents, api: api_node).execute_command_gen4(command, ak_data['root_file_id'])
117
120
  when :cluster
118
121
  ats_url = ats_api_pub_v1.params[:base_url]
119
122
  rest_params = {
@@ -133,7 +136,7 @@ module Aspera
133
136
  command = options.get_next_command(%i[clouds list show])
134
137
  case command
135
138
  when :clouds
136
- return {type: :single_object, data: @ats_api_pub.cloud_names, columns: %w[id name]}
139
+ return {type: :object_list, data: @ats_api_pub.cloud_names.map { |k, v| CLOUD_TABLE.zip([k, v]).to_h }}
137
140
  when :list
138
141
  return {type: :object_list, data: @ats_api_pub.all_servers, fields: %w[id cloud region]}
139
142
  when :show
@@ -186,7 +189,7 @@ module Aspera
186
189
  Log.log.warn{"more instances remaining: #{instances['remaining']}"} unless instances['remaining'].to_i.eql?(0)
187
190
  return {type: :value_list, data: instances['data'], name: 'instance'}
188
191
  when :create
189
- created_key = ats_ibm_api.create('api_keys', value_create_modify(command: command, default: {}, type: Hash))[:data]
192
+ created_key = ats_ibm_api.create('api_keys', value_create_modify(command: command, default: {}))[:data]
190
193
  return {type: :single_object, data: created_key}
191
194
  when :list # list known api keys in ATS (this require an api_key ...)
192
195
  res = ats_ibm_api.read('api_keys', {'offset' => 0, 'max_results' => 1000})
@@ -48,8 +48,8 @@ module Aspera
48
48
  id = instance_identifier
49
49
  request = {
50
50
  'variables' => {'id' => id},
51
- 'query' => "query($id: ID!) {#{object}(id: $id) { #{all_fields('bssSubscriptions')} roleAssignments(uniqueSubjectId: true) { id subjectId } "\
52
- 'instances { id state planId serviceId ssmSubscriptionId entitlement { id } aocOrganization { id subdomainName name status tier urlId trialExpiresAt '\
51
+ 'query' => "query($id: ID!) {#{object}(id: $id) { #{all_fields('bssSubscriptions')} roleAssignments(uniqueSubjectId: true) { id subjectId } " \
52
+ 'instances { id state planId serviceId ssmSubscriptionId entitlement { id } aocOrganization { id subdomainName name status tier urlId trialExpiresAt ' \
53
53
  'users(organizationAdmin: true) { id name email atsAdmin subscriptionAdmin } } } } }'
54
54
  }
55
55
  result = @api_bss.create('graphql', request)[:data]['data'][object].first