aspera-cli 4.19.0 → 4.21.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.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +46 -0
  4. data/CONTRIBUTING.md +18 -4
  5. data/README.md +886 -510
  6. data/bin/asession +27 -20
  7. data/examples/build_exec +65 -76
  8. data/examples/build_exec_rubyc +40 -0
  9. data/examples/get_proto_file.rb +7 -0
  10. data/lib/aspera/agent/alpha.rb +18 -24
  11. data/lib/aspera/agent/base.rb +2 -18
  12. data/lib/aspera/agent/connect.rb +34 -15
  13. data/lib/aspera/agent/direct.rb +44 -54
  14. data/lib/aspera/agent/httpgw.rb +2 -3
  15. data/lib/aspera/agent/node.rb +11 -21
  16. data/lib/aspera/agent/{trsdk.rb → transferd.rb} +27 -51
  17. data/lib/aspera/api/alee.rb +15 -0
  18. data/lib/aspera/api/aoc.rb +139 -105
  19. data/lib/aspera/api/ats.rb +1 -1
  20. data/lib/aspera/api/cos_node.rb +1 -1
  21. data/lib/aspera/api/httpgw.rb +15 -10
  22. data/lib/aspera/api/node.rb +70 -32
  23. data/lib/aspera/ascmd.rb +56 -48
  24. data/lib/aspera/ascp/installation.rb +166 -70
  25. data/lib/aspera/ascp/management.rb +30 -8
  26. data/lib/aspera/assert.rb +10 -5
  27. data/lib/aspera/cli/formatter.rb +166 -162
  28. data/lib/aspera/cli/hints.rb +2 -1
  29. data/lib/aspera/cli/info.rb +12 -10
  30. data/lib/aspera/cli/main.rb +28 -13
  31. data/lib/aspera/cli/manager.rb +7 -2
  32. data/lib/aspera/cli/plugin.rb +17 -31
  33. data/lib/aspera/cli/plugins/alee.rb +3 -3
  34. data/lib/aspera/cli/plugins/aoc.rb +246 -208
  35. data/lib/aspera/cli/plugins/ats.rb +16 -14
  36. data/lib/aspera/cli/plugins/config.rb +154 -94
  37. data/lib/aspera/cli/plugins/console.rb +3 -3
  38. data/lib/aspera/cli/plugins/cos.rb +1 -0
  39. data/lib/aspera/cli/plugins/faspex.rb +15 -23
  40. data/lib/aspera/cli/plugins/faspex5.rb +64 -50
  41. data/lib/aspera/cli/plugins/faspio.rb +2 -2
  42. data/lib/aspera/cli/plugins/httpgw.rb +1 -1
  43. data/lib/aspera/cli/plugins/node.rb +174 -109
  44. data/lib/aspera/cli/plugins/orchestrator.rb +14 -13
  45. data/lib/aspera/cli/plugins/preview.rb +8 -9
  46. data/lib/aspera/cli/plugins/server.rb +5 -9
  47. data/lib/aspera/cli/plugins/shares.rb +2 -2
  48. data/lib/aspera/cli/sync_actions.rb +2 -2
  49. data/lib/aspera/cli/transfer_agent.rb +12 -14
  50. data/lib/aspera/cli/transfer_progress.rb +37 -17
  51. data/lib/aspera/cli/version.rb +1 -1
  52. data/lib/aspera/command_line_builder.rb +4 -5
  53. data/lib/aspera/coverage.rb +13 -1
  54. data/lib/aspera/environment.rb +75 -25
  55. data/lib/aspera/faspex_gw.rb +2 -2
  56. data/lib/aspera/json_rpc.rb +1 -1
  57. data/lib/aspera/keychain/macos_security.rb +7 -12
  58. data/lib/aspera/log.rb +3 -4
  59. data/lib/aspera/node_simulator.rb +230 -112
  60. data/lib/aspera/oauth/base.rb +64 -83
  61. data/lib/aspera/oauth/factory.rb +52 -6
  62. data/lib/aspera/oauth/generic.rb +4 -8
  63. data/lib/aspera/oauth/jwt.rb +6 -3
  64. data/lib/aspera/oauth/url_json.rb +1 -2
  65. data/lib/aspera/oauth/web.rb +5 -2
  66. data/lib/aspera/persistency_action_once.rb +16 -8
  67. data/lib/aspera/persistency_folder.rb +20 -2
  68. data/lib/aspera/preview/generator.rb +1 -1
  69. data/lib/aspera/preview/utils.rb +11 -17
  70. data/lib/aspera/products/alpha.rb +30 -0
  71. data/lib/aspera/products/connect.rb +48 -0
  72. data/lib/aspera/products/other.rb +82 -0
  73. data/lib/aspera/products/transferd.rb +54 -0
  74. data/lib/aspera/rest.rb +116 -87
  75. data/lib/aspera/secret_hider.rb +2 -2
  76. data/lib/aspera/ssh.rb +31 -24
  77. data/lib/aspera/transfer/faux_file.rb +4 -4
  78. data/lib/aspera/transfer/parameters.rb +16 -17
  79. data/lib/aspera/transfer/spec.rb +12 -12
  80. data/lib/aspera/transfer/spec.yaml +22 -20
  81. data/lib/aspera/transfer/sync.rb +2 -10
  82. data/lib/aspera/transfer/uri.rb +3 -3
  83. data/lib/aspera/uri_reader.rb +1 -1
  84. data/lib/aspera/web_auth.rb +166 -17
  85. data/lib/aspera/web_server_simple.rb +4 -3
  86. data/lib/transferd_pb.rb +86 -0
  87. data/lib/transferd_services_pb.rb +84 -0
  88. data.tar.gz.sig +0 -0
  89. metadata +58 -22
  90. metadata.gz.sig +0 -0
  91. data/lib/aspera/ascp/products.rb +0 -156
@@ -5,6 +5,7 @@
5
5
  require 'aspera/cli/plugins/node'
6
6
  require 'aspera/api/ats'
7
7
  require 'aspera/api/aoc'
8
+ require 'aspera/api/alee'
8
9
  require 'aspera/assert'
9
10
 
10
11
  module Aspera
@@ -24,13 +25,14 @@ module Aspera
24
25
  options.declare(:cloud, 'Cloud provider')
25
26
  options.declare(:region, 'Cloud region')
26
27
  options.parse_options!
28
+ Node.declare_options(options)
27
29
  end
28
30
 
29
31
  def server_by_cloud_region
30
32
  # TODO: provide list ?
31
33
  cloud = options.get_option(:cloud, mandatory: true).upcase
32
34
  region = options.get_option(:region, mandatory: true)
33
- return @ats_api_pub.read("servers/#{cloud}/#{region}")[:data]
35
+ return @ats_api_pub.read("servers/#{cloud}/#{region}")
34
36
  end
35
37
 
36
38
  # require api key only if needed
@@ -84,29 +86,29 @@ module Aspera
84
86
  end
85
87
  end
86
88
  res = ats_api_pub_v1.create('access_keys', params)
87
- return {type: :single_object, data: res[:data]}
89
+ return {type: :single_object, data: res}
88
90
  # TODO : action : modify, with "PUT"
89
91
  when :list
90
92
  params = options.get_option(:params) || {'offset' => 0, 'max_results' => 1000}
91
93
  res = ats_api_pub_v1.read('access_keys', params)
92
- return {type: :object_list, data: res[:data]['data'], fields: ['name', 'id', 'created.at', 'modified.at']}
94
+ return {type: :object_list, data: res['data'], fields: ['name', 'id', 'created.at', 'modified.at']}
93
95
  when :show
94
96
  res = ats_api_pub_v1.read("access_keys/#{access_key_id}")
95
- return {type: :single_object, data: res[:data]}
97
+ return {type: :single_object, data: res}
96
98
  when :modify
97
99
  params = value_create_modify(command: command)
98
100
  params['id'] = access_key_id
99
101
  ats_api_pub_v1.update("access_keys/#{access_key_id}", params)
100
102
  return Main.result_status('modified')
101
103
  when :entitlement
102
- ak = ats_api_pub_v1.read("access_keys/#{access_key_id}")[:data]
104
+ ak = ats_api_pub_v1.read("access_keys/#{access_key_id}")
103
105
  api_bss = Api::Alee.new(ak['license']['entitlement_id'], ak['license']['customer_id'])
104
- return {type: :single_object, data: api_bss.read('entitlement')[:data]}
106
+ return {type: :single_object, data: api_bss.read('entitlement')}
105
107
  when :delete
106
108
  ats_api_pub_v1.delete("access_keys/#{access_key_id}")
107
109
  return Main.result_status("deleted #{access_key_id}")
108
110
  when :node
109
- ak_data = ats_api_pub_v1.read("access_keys/#{access_key_id}")[:data]
111
+ ak_data = ats_api_pub_v1.read("access_keys/#{access_key_id}")
110
112
  server_data = @ats_api_pub.all_servers.find {|i| i['id'].start_with?(ak_data['transfer_server_id'])}
111
113
  raise Cli::Error, 'no such server found' if server_data.nil?
112
114
  node_url = server_data['transfer_setup_url']
@@ -128,7 +130,7 @@ module Aspera
128
130
  username: access_key_id,
129
131
  password: config.lookup_secret(url: ats_url, username: access_key_id)
130
132
  })
131
- return {type: :single_object, data: api_ak_auth.read('servers')[:data]}
133
+ return {type: :single_object, data: api_ak_auth.read('servers')}
132
134
  else Aspera.error_unexpected_value(command)
133
135
  end
134
136
  end
@@ -177,7 +179,7 @@ module Aspera
177
179
  instance = options.get_option(:instance)
178
180
  if instance.nil?
179
181
  # Take the first Aspera on Cloud transfer service instance ID if not provided by user
180
- instance = ats_api_v2_auth_ibm.read('instances')[:data]['data'].first
182
+ instance = ats_api_v2_auth_ibm.read('instances')['data'].first
181
183
  formatter.display_status("using first instance: #{instance}")
182
184
  end
183
185
  rest_add_header = {'X-ATS-Service-Instance-Id' => instance}
@@ -185,18 +187,18 @@ module Aspera
185
187
  ats_ibm_api = ats_api_v2_auth_ibm(rest_add_header)
186
188
  case command
187
189
  when :instances
188
- instances = ats_ibm_api.read('instances')[:data]
190
+ instances = ats_ibm_api.read('instances')
189
191
  Log.log.warn{"more instances remaining: #{instances['remaining']}"} unless instances['remaining'].to_i.eql?(0)
190
192
  return {type: :value_list, data: instances['data'], name: 'instance'}
191
193
  when :create
192
- created_key = ats_ibm_api.create('api_keys', value_create_modify(command: command, default: {}))[:data]
194
+ created_key = ats_ibm_api.create('api_keys', value_create_modify(command: command, default: {}))
193
195
  return {type: :single_object, data: created_key}
194
196
  when :list # list known api keys in ATS (this require an api_key ...)
195
197
  res = ats_ibm_api.read('api_keys', {'offset' => 0, 'max_results' => 1000})
196
- return {type: :value_list, data: res[:data]['data'], name: 'ats_id'}
198
+ return {type: :value_list, data: res['data'], name: 'ats_id'}
197
199
  when :show # show one of api_key in ATS
198
200
  res = ats_ibm_api.read("api_keys/#{concerned_id}")
199
- return {type: :single_object, data: res[:data]}
201
+ return {type: :single_object, data: res}
200
202
  when :delete
201
203
  ats_ibm_api.delete("api_keys/#{concerned_id}")
202
204
  return Main.result_status("deleted #{concerned_id}")
@@ -222,7 +224,7 @@ module Aspera
222
224
  when :api_key # manage credential to access ATS API
223
225
  return execute_action_api_key
224
226
  when :aws_trust_policy
225
- res = ats_api_pub_v1.read('aws/trustpolicy', {region: options.get_option(:region, mandatory: true)})[:data]
227
+ res = ats_api_pub_v1.read('aws/trustpolicy', {region: options.get_option(:region, mandatory: true)})
226
228
  return {type: :single_object, data: res}
227
229
  else Aspera.error_unexpected_value(command)
228
230
  end