aspera-cli 4.13.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 +28 -5
- data/CONTRIBUTING.md +17 -1
- data/README.md +782 -401
- data/examples/dascli +1 -1
- data/examples/rubyc +24 -0
- data/lib/aspera/aoc.rb +21 -32
- data/lib/aspera/ascmd.rb +1 -0
- data/lib/aspera/cli/basic_auth_plugin.rb +6 -6
- data/lib/aspera/cli/formatter.rb +17 -25
- data/lib/aspera/cli/main.rb +21 -27
- data/lib/aspera/cli/manager.rb +128 -114
- data/lib/aspera/cli/plugin.rb +87 -38
- data/lib/aspera/cli/plugins/alee.rb +2 -2
- data/lib/aspera/cli/plugins/aoc.rb +216 -102
- 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 +177 -367
- 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 +17 -18
- data/lib/aspera/cli/plugins/faspex5.rb +332 -216
- data/lib/aspera/cli/plugins/node.rb +171 -142
- data/lib/aspera/cli/plugins/orchestrator.rb +15 -18
- data/lib/aspera/cli/plugins/preview.rb +38 -60
- data/lib/aspera/cli/plugins/server.rb +22 -15
- data/lib/aspera/cli/plugins/shares.rb +24 -33
- data/lib/aspera/cli/plugins/sync.rb +3 -3
- data/lib/aspera/cli/transfer_agent.rb +29 -26
- data/lib/aspera/cli/version.rb +1 -1
- data/lib/aspera/colors.rb +9 -7
- data/lib/aspera/data/6 +0 -0
- data/lib/aspera/environment.rb +7 -3
- data/lib/aspera/fasp/agent_connect.rb +5 -0
- data/lib/aspera/fasp/agent_direct.rb +5 -5
- data/lib/aspera/fasp/agent_httpgw.rb +138 -60
- data/lib/aspera/fasp/agent_trsdk.rb +2 -0
- data/lib/aspera/fasp/error_info.rb +2 -0
- data/lib/aspera/fasp/installation.rb +18 -19
- data/lib/aspera/fasp/parameters.rb +18 -17
- data/lib/aspera/fasp/parameters.yaml +2 -1
- data/lib/aspera/fasp/resume_policy.rb +3 -3
- data/lib/aspera/fasp/transfer_spec.rb +6 -5
- data/lib/aspera/fasp/uri.rb +23 -21
- data/lib/aspera/faspex_postproc.rb +1 -1
- 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 +62 -80
- data/lib/aspera/oauth.rb +1 -1
- data/lib/aspera/persistency_action_once.rb +1 -1
- data/lib/aspera/preview/terminal.rb +61 -15
- data/lib/aspera/preview/utils.rb +3 -3
- data/lib/aspera/proxy_auto_config.js +2 -2
- data/lib/aspera/rest.rb +37 -0
- data/lib/aspera/secret_hider.rb +6 -1
- data/lib/aspera/ssh.rb +1 -1
- data/lib/aspera/sync.rb +2 -0
- data.tar.gz.sig +0 -0
- metadata +3 -4
- metadata.gz.sig +0 -0
- data/docs/test_env.conf +0 -186
- 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
|
@@ -265,7 +264,7 @@ module Aspera
|
|
265
264
|
textify: lambda {|table_data|Faspex.textify_package_list(table_data)}
|
266
265
|
}
|
267
266
|
when :send
|
268
|
-
delivery_info = options.get_option(:delivery_info,
|
267
|
+
delivery_info = options.get_option(:delivery_info, mandatory: true)
|
269
268
|
raise CliBadArgument, 'delivery_info must be hash, refer to doc' unless delivery_info.is_a?(Hash)
|
270
269
|
# actual parameter to faspex API
|
271
270
|
package_create_params = {'delivery' => delivery_info}
|
@@ -308,15 +307,15 @@ module Aspera
|
|
308
307
|
skip_ids_persistency = nil
|
309
308
|
case link_url
|
310
309
|
when nil # usual case: no link
|
311
|
-
if options.get_option(:once_only,
|
310
|
+
if options.get_option(:once_only, mandatory: true)
|
312
311
|
skip_ids_persistency = PersistencyActionOnce.new(
|
313
312
|
manager: @agents[:persistency],
|
314
313
|
data: skip_ids_data,
|
315
314
|
id: IdGenerator.from_list([
|
316
315
|
'faspex_recv',
|
317
|
-
options.get_option(:url,
|
318
|
-
options.get_option(:username,
|
319
|
-
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
|
320
319
|
]))
|
321
320
|
end
|
322
321
|
# get command line parameters
|
@@ -332,7 +331,7 @@ module Aspera
|
|
332
331
|
else
|
333
332
|
# TODO: delivery id is the right one if package was receive by workgroup
|
334
333
|
endpoint =
|
335
|
-
case options.get_option(:box,
|
334
|
+
case options.get_option(:box, mandatory: true)
|
336
335
|
when :inbox, :archive then'received'
|
337
336
|
when :sent then 'sent'
|
338
337
|
end
|
@@ -412,7 +411,7 @@ module Aspera
|
|
412
411
|
# get id and name
|
413
412
|
source_name = source_ids.first['name']
|
414
413
|
# source_id=source_ids.first['id']
|
415
|
-
source_hash = options.get_option(:storage,
|
414
|
+
source_hash = options.get_option(:storage, mandatory: true)
|
416
415
|
# check value of option
|
417
416
|
raise CliError, 'storage option must be a Hash' unless source_hash.is_a?(Hash)
|
418
417
|
source_hash.each do |name, storage|
|