aspera-cli 4.12.0 → 4.14.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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +45 -5
- data/CONTRIBUTING.md +113 -22
- data/README.md +1289 -754
- data/bin/ascli +3 -3
- data/examples/dascli +1 -1
- data/examples/rubyc +24 -0
- data/lib/aspera/aoc.rb +63 -74
- data/lib/aspera/ascmd.rb +5 -3
- data/lib/aspera/cli/basic_auth_plugin.rb +6 -6
- data/lib/aspera/cli/extended_value.rb +24 -37
- data/lib/aspera/cli/formatter.rb +23 -25
- data/lib/aspera/cli/info.rb +2 -4
- data/lib/aspera/cli/main.rb +27 -27
- data/lib/aspera/cli/manager.rb +143 -120
- data/lib/aspera/cli/plugin.rb +88 -43
- data/lib/aspera/cli/plugins/alee.rb +2 -2
- data/lib/aspera/cli/plugins/aoc.rb +235 -104
- data/lib/aspera/cli/plugins/ats.rb +16 -18
- data/lib/aspera/cli/plugins/bss.rb +3 -3
- data/lib/aspera/cli/plugins/config.rb +190 -373
- data/lib/aspera/cli/plugins/console.rb +4 -6
- data/lib/aspera/cli/plugins/cos.rb +12 -13
- data/lib/aspera/cli/plugins/faspex.rb +21 -21
- data/lib/aspera/cli/plugins/faspex5.rb +399 -150
- data/lib/aspera/cli/plugins/node.rb +260 -174
- data/lib/aspera/cli/plugins/orchestrator.rb +15 -18
- data/lib/aspera/cli/plugins/preview.rb +40 -62
- data/lib/aspera/cli/plugins/server.rb +33 -16
- data/lib/aspera/cli/plugins/shares.rb +24 -33
- data/lib/aspera/cli/plugins/sync.rb +6 -6
- data/lib/aspera/cli/transfer_agent.rb +47 -30
- data/lib/aspera/cli/version.rb +2 -1
- data/lib/aspera/colors.rb +9 -7
- data/lib/aspera/command_line_builder.rb +2 -1
- data/lib/aspera/cos_node.rb +1 -1
- data/lib/aspera/data/6 +0 -0
- data/lib/aspera/environment.rb +7 -3
- data/lib/aspera/fasp/agent_connect.rb +6 -1
- data/lib/aspera/fasp/agent_direct.rb +17 -17
- data/lib/aspera/fasp/agent_httpgw.rb +138 -60
- data/lib/aspera/fasp/agent_node.rb +14 -4
- data/lib/aspera/fasp/agent_trsdk.rb +2 -0
- data/lib/aspera/fasp/error_info.rb +2 -0
- data/lib/aspera/fasp/installation.rb +19 -19
- data/lib/aspera/fasp/parameters.rb +29 -20
- data/lib/aspera/fasp/parameters.yaml +5 -2
- data/lib/aspera/fasp/resume_policy.rb +3 -3
- data/lib/aspera/fasp/transfer_spec.rb +8 -5
- data/lib/aspera/fasp/uri.rb +23 -21
- data/lib/aspera/faspex_gw.rb +1 -0
- data/lib/aspera/faspex_postproc.rb +3 -3
- data/lib/aspera/hash_ext.rb +12 -2
- data/lib/aspera/keychain/macos_security.rb +13 -13
- data/lib/aspera/log.rb +1 -0
- data/lib/aspera/node.rb +73 -84
- data/lib/aspera/oauth.rb +4 -3
- data/lib/aspera/persistency_action_once.rb +1 -1
- data/lib/aspera/preview/file_types.rb +8 -6
- data/lib/aspera/preview/generator.rb +23 -11
- data/lib/aspera/preview/options.rb +3 -2
- data/lib/aspera/preview/terminal.rb +80 -0
- data/lib/aspera/preview/utils.rb +11 -11
- data/lib/aspera/proxy_auto_config.js +2 -2
- data/lib/aspera/rest.rb +42 -4
- data/lib/aspera/rest_call_error.rb +3 -1
- data/lib/aspera/secret_hider.rb +10 -5
- data/lib/aspera/ssh.rb +1 -1
- data/lib/aspera/sync.rb +41 -33
- data/lib/aspera/web_server_simple.rb +22 -18
- data.tar.gz.sig +0 -0
- metadata +40 -48
- metadata.gz.sig +0 -0
- data/docs/test_env.conf +0 -179
- data/examples/aoc.rb +0 -30
- data/examples/faspex4.rb +0 -94
- data/examples/node.rb +0 -96
- data/examples/server.rb +0 -93
- data/lib/aspera/data/7 +0 -0
@@ -11,11 +11,9 @@ module Aspera
|
|
11
11
|
private_constant :DEFAULT_FILTER_AGE_SECONDS
|
12
12
|
def initialize(env)
|
13
13
|
super(env)
|
14
|
-
options.add_opt_date(:filter_from, 'only after date')
|
15
|
-
options.add_opt_date(:filter_to, 'only before date')
|
16
14
|
time_now = Time.now
|
17
|
-
options.
|
18
|
-
options.
|
15
|
+
options.declare(:filter_from, 'Only after date', values: :date, default: Manager.time_to_string(time_now - DEFAULT_FILTER_AGE_SECONDS))
|
16
|
+
options.declare(:filter_to, 'Only before date', values: :date, default: Manager.time_to_string(time_now))
|
19
17
|
options.parse_options!
|
20
18
|
end
|
21
19
|
|
@@ -54,8 +52,8 @@ module Aspera
|
|
54
52
|
return {
|
55
53
|
type: :object_list,
|
56
54
|
data: api_console.read('transfers', {
|
57
|
-
'from' => options.get_option(:filter_from,
|
58
|
-
'to' => options.get_option(:filter_to,
|
55
|
+
'from' => options.get_option(:filter_from, mandatory: true),
|
56
|
+
'to' => options.get_option(:filter_to, mandatory: true)
|
59
57
|
})[:data],
|
60
58
|
fields: %w[id contact name status]}
|
61
59
|
end
|
@@ -11,14 +11,13 @@ module Aspera
|
|
11
11
|
def initialize(env)
|
12
12
|
super(env)
|
13
13
|
@service_creds = nil
|
14
|
-
options.
|
15
|
-
options.
|
16
|
-
options.
|
17
|
-
options.
|
18
|
-
options.
|
19
|
-
options.
|
20
|
-
options.
|
21
|
-
options.set_option(:identity, CosNode::IBM_CLOUD_TOKEN_URL)
|
14
|
+
options.declare(:bucket, 'Bucket name')
|
15
|
+
options.declare(:endpoint, 'Storage endpoint url')
|
16
|
+
options.declare(:apikey, 'Storage API key')
|
17
|
+
options.declare(:crn, 'Resource instance id')
|
18
|
+
options.declare(:service_credentials, 'IBM Cloud service credentials', types: Hash)
|
19
|
+
options.declare(:region, 'Storage region')
|
20
|
+
options.declare(:identity, "Authentication url (#{CosNode::IBM_CLOUD_TOKEN_URL})", default: CosNode::IBM_CLOUD_TOKEN_URL)
|
22
21
|
options.parse_options!
|
23
22
|
end
|
24
23
|
|
@@ -28,22 +27,22 @@ module Aspera
|
|
28
27
|
command = options.get_next_command(ACTIONS)
|
29
28
|
case command
|
30
29
|
when :node
|
31
|
-
bucket_name = options.get_option(:bucket,
|
30
|
+
bucket_name = options.get_option(:bucket, mandatory: true)
|
32
31
|
# get service credentials, Hash, e.g. @json:@file:...
|
33
32
|
service_credentials = options.get_option(:service_credentials)
|
34
33
|
storage_endpoint = options.get_option(:endpoint)
|
35
34
|
raise CliBadArgument, 'one of: endpoint or service_credentials is required' if service_credentials.nil? && storage_endpoint.nil?
|
36
35
|
raise CliBadArgument, 'endpoint and service_credentials are mutually exclusive' unless service_credentials.nil? || storage_endpoint.nil?
|
37
36
|
if service_credentials.nil?
|
38
|
-
service_api_key = options.get_option(:apikey,
|
39
|
-
instance_id = options.get_option(:crn,
|
37
|
+
service_api_key = options.get_option(:apikey, mandatory: true)
|
38
|
+
instance_id = options.get_option(:crn, mandatory: true)
|
40
39
|
else
|
41
|
-
params = CosNode.parameters_from_svc_creds(service_credentials, options.get_option(:region,
|
40
|
+
params = CosNode.parameters_from_svc_creds(service_credentials, options.get_option(:region, mandatory: true))
|
42
41
|
storage_endpoint = params[:storage_endpoint]
|
43
42
|
service_api_key = params[:service_api_key]
|
44
43
|
instance_id = params[:instance_id]
|
45
44
|
end
|
46
|
-
api_node = CosNode.new(bucket_name, storage_endpoint, instance_id, service_api_key, options.get_option(:identity,
|
45
|
+
api_node = CosNode.new(bucket_name, storage_endpoint, instance_id, service_api_key, options.get_option(:identity, mandatory: true))
|
47
46
|
node_plugin = Node.new(@agents.merge(skip_basic_auth_options: true, node_api: api_node))
|
48
47
|
command = options.get_next_command(Node::COMMANDS_COS)
|
49
48
|
return node_plugin.execute_action(command)
|
@@ -102,13 +102,12 @@ module Aspera
|
|
102
102
|
@api_v3 = nil
|
103
103
|
@api_v4 = nil
|
104
104
|
super(env)
|
105
|
-
options.
|
106
|
-
options.
|
107
|
-
options.
|
108
|
-
options.
|
109
|
-
options.
|
110
|
-
options.
|
111
|
-
options.set_option(:box, :inbox)
|
105
|
+
options.declare(:link, 'Public link for specific operation')
|
106
|
+
options.declare(:delivery_info, 'Package delivery information', types: Hash)
|
107
|
+
options.declare(:source_name, 'Create package from remote source (by name)')
|
108
|
+
options.declare(:storage, 'Faspex local storage definition')
|
109
|
+
options.declare(:recipient, 'Use if recipient is a dropbox (with *)')
|
110
|
+
options.declare(:box, 'Package box', values: ATOM_MAILBOXES, default: :inbox)
|
112
111
|
options.parse_options!
|
113
112
|
end
|
114
113
|
|
@@ -121,13 +120,13 @@ module Aspera
|
|
121
120
|
|
122
121
|
def api_v4
|
123
122
|
if @api_v4.nil?
|
124
|
-
faspex_api_base = options.get_option(:url,
|
123
|
+
faspex_api_base = options.get_option(:url, mandatory: true)
|
125
124
|
@api_v4 = Rest.new({
|
126
125
|
base_url: faspex_api_base + '/api',
|
127
126
|
auth: {
|
128
127
|
type: :oauth2,
|
129
128
|
base_url: faspex_api_base + '/auth/oauth2',
|
130
|
-
auth: {type: :basic, username: options.get_option(:username,
|
129
|
+
auth: {type: :basic, username: options.get_option(:username, mandatory: true), password: options.get_option(:password, mandatory: true)},
|
131
130
|
grant_method: :generic,
|
132
131
|
generic: {grant_type: 'password'},
|
133
132
|
scope: 'admin'
|
@@ -138,11 +137,11 @@ module Aspera
|
|
138
137
|
|
139
138
|
# query supports : {"startIndex":10,"count":1,"page":109,"max":2,"pmax":1}
|
140
139
|
def mailbox_filtered_entries(stop_at_id: nil)
|
141
|
-
recipient_names = [options.get_option(:recipient) || options.get_option(:username,
|
140
|
+
recipient_names = [options.get_option(:recipient) || options.get_option(:username, mandatory: true)]
|
142
141
|
# some workgroup messages have no star in recipient name
|
143
142
|
recipient_names.push(recipient_names.first[1..-1]) if recipient_names.first.start_with?('*')
|
144
143
|
# mailbox is in ATOM_MAILBOXES
|
145
|
-
mailbox = options.get_option(:box,
|
144
|
+
mailbox = options.get_option(:box, mandatory: true)
|
146
145
|
# parameters
|
147
146
|
mailbox_query = options.get_option(:query)
|
148
147
|
max_items = nil
|
@@ -170,6 +169,7 @@ module Aspera
|
|
170
169
|
stop_condition = false
|
171
170
|
# results will be sorted in reverse id
|
172
171
|
items.reverse_each do |package|
|
172
|
+
# create the package id, based on recipient's box
|
173
173
|
package[PACKAGE_MATCH_FIELD] =
|
174
174
|
case mailbox
|
175
175
|
when :inbox, :archive
|
@@ -180,7 +180,7 @@ module Aspera
|
|
180
180
|
end
|
181
181
|
# if we look for a specific package
|
182
182
|
stop_condition = true if !stop_at_id.nil? && stop_at_id.eql?(package[PACKAGE_MATCH_FIELD])
|
183
|
-
# keep only those for the specified recipient
|
183
|
+
# keep only those for the specified recipient
|
184
184
|
result.push(package) unless package[PACKAGE_MATCH_FIELD].nil?
|
185
185
|
end
|
186
186
|
break if stop_condition
|
@@ -264,7 +264,7 @@ module Aspera
|
|
264
264
|
textify: lambda {|table_data|Faspex.textify_package_list(table_data)}
|
265
265
|
}
|
266
266
|
when :send
|
267
|
-
delivery_info = options.get_option(:delivery_info,
|
267
|
+
delivery_info = options.get_option(:delivery_info, mandatory: true)
|
268
268
|
raise CliBadArgument, 'delivery_info must be hash, refer to doc' unless delivery_info.is_a?(Hash)
|
269
269
|
# actual parameter to faspex API
|
270
270
|
package_create_params = {'delivery' => delivery_info}
|
@@ -307,15 +307,15 @@ module Aspera
|
|
307
307
|
skip_ids_persistency = nil
|
308
308
|
case link_url
|
309
309
|
when nil # usual case: no link
|
310
|
-
if options.get_option(:once_only,
|
310
|
+
if options.get_option(:once_only, mandatory: true)
|
311
311
|
skip_ids_persistency = PersistencyActionOnce.new(
|
312
312
|
manager: @agents[:persistency],
|
313
313
|
data: skip_ids_data,
|
314
314
|
id: IdGenerator.from_list([
|
315
315
|
'faspex_recv',
|
316
|
-
options.get_option(:url,
|
317
|
-
options.get_option(:username,
|
318
|
-
options.get_option(:box,
|
316
|
+
options.get_option(:url, mandatory: true),
|
317
|
+
options.get_option(:username, mandatory: true),
|
318
|
+
options.get_option(:box, mandatory: true).to_s
|
319
319
|
]))
|
320
320
|
end
|
321
321
|
# get command line parameters
|
@@ -331,7 +331,7 @@ module Aspera
|
|
331
331
|
else
|
332
332
|
# TODO: delivery id is the right one if package was receive by workgroup
|
333
333
|
endpoint =
|
334
|
-
case options.get_option(:box,
|
334
|
+
case options.get_option(:box, mandatory: true)
|
335
335
|
when :inbox, :archive then'received'
|
336
336
|
when :sent then 'sent'
|
337
337
|
end
|
@@ -378,13 +378,13 @@ module Aspera
|
|
378
378
|
# NOTE: only external users have token in faspe: link !
|
379
379
|
if !transfer_spec.key?('token')
|
380
380
|
sanitized = id_uri[:uri].gsub('&', '&')
|
381
|
-
|
381
|
+
xml_payload =
|
382
382
|
%Q(<?xml version="1.0" encoding="UTF-8"?><url-list xmlns="http://schemas.asperasoft.com/xml/url-list"><url href="#{sanitized}"/></url-list>)
|
383
383
|
transfer_spec['token'] = api_v3.call({
|
384
384
|
operation: 'POST',
|
385
385
|
subpath: 'issue-token?direction=down',
|
386
386
|
headers: {'Accept' => 'text/plain', 'Content-Type' => 'application/vnd.aspera.url-list+xml'},
|
387
|
-
text_body_params:
|
387
|
+
text_body_params: xml_payload})[:http].body
|
388
388
|
end
|
389
389
|
transfer_spec['direction'] = Fasp::TransferSpec::DIRECTION_RECEIVE
|
390
390
|
statuses = transfer.start(transfer_spec)
|
@@ -411,7 +411,7 @@ module Aspera
|
|
411
411
|
# get id and name
|
412
412
|
source_name = source_ids.first['name']
|
413
413
|
# source_id=source_ids.first['id']
|
414
|
-
source_hash = options.get_option(:storage,
|
414
|
+
source_hash = options.get_option(:storage, mandatory: true)
|
415
415
|
# check value of option
|
416
416
|
raise CliError, 'storage option must be a Hash' unless source_hash.is_a?(Hash)
|
417
417
|
source_hash.each do |name, storage|
|