aspera-cli 4.11.0 → 4.12.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/BUGS.md +0 -1
- data/CHANGELOG.md +71 -52
- data/CONTRIBUTING.md +31 -6
- data/README.md +404 -259
- data/bin/asession +2 -2
- data/docs/test_env.conf +1 -0
- data/examples/aoc.rb +2 -2
- data/examples/dascli +11 -11
- data/examples/faspex4.rb +7 -7
- data/examples/node.rb +1 -1
- data/examples/proxy.pac +2 -2
- data/examples/server.rb +3 -3
- data/lib/aspera/aoc.rb +105 -40
- data/lib/aspera/cli/extended_value.rb +4 -4
- data/lib/aspera/cli/{formater.rb → formatter.rb} +7 -7
- data/lib/aspera/cli/listener/progress.rb +1 -1
- data/lib/aspera/cli/listener/progress_multi.rb +2 -2
- data/lib/aspera/cli/main.rb +18 -18
- data/lib/aspera/cli/manager.rb +5 -5
- data/lib/aspera/cli/plugin.rb +23 -20
- data/lib/aspera/cli/plugins/aoc.rb +75 -112
- data/lib/aspera/cli/plugins/ats.rb +6 -6
- data/lib/aspera/cli/plugins/config.rb +84 -83
- data/lib/aspera/cli/plugins/cos.rb +1 -1
- data/lib/aspera/cli/plugins/faspex.rb +38 -38
- data/lib/aspera/cli/plugins/faspex5.rb +187 -43
- data/lib/aspera/cli/plugins/node.rb +30 -37
- data/lib/aspera/cli/plugins/orchestrator.rb +7 -4
- data/lib/aspera/cli/plugins/preview.rb +10 -9
- data/lib/aspera/cli/plugins/server.rb +1 -1
- data/lib/aspera/cli/plugins/shares.rb +67 -43
- data/lib/aspera/cli/transfer_agent.rb +16 -16
- data/lib/aspera/cli/version.rb +2 -1
- data/lib/aspera/command_line_builder.rb +70 -66
- data/lib/aspera/cos_node.rb +9 -9
- data/lib/aspera/fasp/agent_base.rb +3 -1
- data/lib/aspera/fasp/agent_connect.rb +23 -23
- data/lib/aspera/fasp/agent_direct.rb +13 -14
- data/lib/aspera/fasp/agent_httpgw.rb +20 -19
- data/lib/aspera/fasp/agent_node.rb +13 -15
- data/lib/aspera/fasp/agent_trsdk.rb +1 -1
- data/lib/aspera/fasp/installation.rb +5 -5
- data/lib/aspera/fasp/listener.rb +1 -1
- data/lib/aspera/fasp/parameters.rb +49 -41
- data/lib/aspera/fasp/parameters.yaml +311 -212
- data/lib/aspera/fasp/resume_policy.rb +2 -2
- data/lib/aspera/fasp/transfer_spec.rb +0 -13
- data/lib/aspera/faspex_gw.rb +80 -161
- data/lib/aspera/faspex_postproc.rb +77 -0
- data/lib/aspera/log.rb +7 -7
- data/lib/aspera/nagios.rb +6 -6
- data/lib/aspera/node.rb +24 -19
- data/lib/aspera/oauth.rb +50 -47
- data/lib/aspera/proxy_auto_config.js +22 -22
- data/lib/aspera/proxy_auto_config.rb +3 -3
- data/lib/aspera/rest.rb +12 -10
- data/lib/aspera/rest_error_analyzer.rb +5 -5
- data/lib/aspera/secret_hider.rb +4 -3
- data/lib/aspera/ssh.rb +4 -4
- data/lib/aspera/sync.rb +37 -36
- data/lib/aspera/web_auth.rb +7 -59
- data/lib/aspera/web_server_simple.rb +76 -0
- data.tar.gz.sig +0 -0
- metadata +6 -4
- metadata.gz.sig +0 -0
@@ -51,6 +51,7 @@ module Aspera
|
|
51
51
|
client_access_key
|
52
52
|
kms_profile].freeze
|
53
53
|
ENTITY_NAME_SPECIFIER = 'name'
|
54
|
+
PACKAGE_QUERY_DEFAULT = {'archived' => false, 'exclude_dropbox_packages' => true, 'has_content' => true, 'received' => true}.freeze
|
54
55
|
|
55
56
|
def initialize(env)
|
56
57
|
super(env)
|
@@ -59,8 +60,8 @@ module Aspera
|
|
59
60
|
@cache_api_aoc = nil
|
60
61
|
options.add_opt_list(:auth, Oauth::STD_AUTH_TYPES, 'OAuth type of authentication')
|
61
62
|
options.add_opt_list(:operation, %i[push pull], 'client operation for transfers')
|
62
|
-
options.add_opt_simple(:client_id, 'OAuth API client identifier
|
63
|
-
options.add_opt_simple(:client_secret, 'OAuth API client
|
63
|
+
options.add_opt_simple(:client_id, 'OAuth API client identifier')
|
64
|
+
options.add_opt_simple(:client_secret, 'OAuth API client secret')
|
64
65
|
options.add_opt_simple(:redirect_uri, 'OAuth API client redirect URI')
|
65
66
|
options.add_opt_simple(:private_key, 'OAuth JWT RSA private key PEM value (prefix file path with @file:)')
|
66
67
|
options.add_opt_simple(:scope, 'OAuth scope for AoC API calls')
|
@@ -101,7 +102,7 @@ module Aspera
|
|
101
102
|
def current_workspace_info
|
102
103
|
return @cache_workspace_info unless @cache_workspace_info.nil?
|
103
104
|
default_workspace_id = if aoc_api.url_token_data.nil?
|
104
|
-
aoc_api.
|
105
|
+
aoc_api.current_user_info['default_workspace_id']
|
105
106
|
else
|
106
107
|
aoc_api.url_token_data['data']['workspace_id']
|
107
108
|
end
|
@@ -127,7 +128,7 @@ module Aspera
|
|
127
128
|
Log.dump(:current_workspace_info, @cache_workspace_info)
|
128
129
|
# display workspace
|
129
130
|
default_flag = @cache_workspace_info['id'] == default_workspace_id ? ' (default)' : ''
|
130
|
-
|
131
|
+
formatter.display_status("Current Workspace: #{@cache_workspace_info['name'].to_s.red}#{default_flag}")
|
131
132
|
return @cache_workspace_info
|
132
133
|
end
|
133
134
|
|
@@ -169,24 +170,6 @@ module Aspera
|
|
169
170
|
return "#{resource_class_path}/#{get_resource_id_from_args(resource_class_path)}"
|
170
171
|
end
|
171
172
|
|
172
|
-
def normalize_metadata(pkg_data)
|
173
|
-
case pkg_data['metadata']
|
174
|
-
when Array, NilClass # no action
|
175
|
-
when Hash
|
176
|
-
api_meta = []
|
177
|
-
pkg_data['metadata'].each do |k, v|
|
178
|
-
api_meta.push({
|
179
|
-
# 'input_type' => 'single-dropdown',
|
180
|
-
'name' => k,
|
181
|
-
'values' => v.is_a?(Array) ? v : [v]
|
182
|
-
})
|
183
|
-
end
|
184
|
-
pkg_data['metadata'] = api_meta
|
185
|
-
else raise "metadata field if not of expected type: #{pkg_meta.class}"
|
186
|
-
end
|
187
|
-
return nil
|
188
|
-
end
|
189
|
-
|
190
173
|
def assert_public_link_types(expected)
|
191
174
|
raise CliBadArgument, "public link type is #{aoc_api.url_token_data['purpose']} but action requires one of #{expected.join(',')}" \
|
192
175
|
unless expected.include?(aoc_api.url_token_data['purpose'])
|
@@ -194,7 +177,7 @@ module Aspera
|
|
194
177
|
|
195
178
|
# Call aoc_api.read with same parameters.
|
196
179
|
# Use paging if necessary to get all results
|
197
|
-
# @return {list: , total: }
|
180
|
+
# @return [Hash] {list: , total: }
|
198
181
|
def read_with_paging(resource_class_path, base_query)
|
199
182
|
raise 'Query must be Hash' unless base_query.is_a?(Hash)
|
200
183
|
# set default large page if user does not specify own parameters. AoC Caps to 1000 anyway
|
@@ -231,11 +214,7 @@ module Aspera
|
|
231
214
|
# @param file_id [String] root file id for the operation (can be AK root, or other, e.g. package, or link)
|
232
215
|
# @param scope [String] node scope, or nil (admin)
|
233
216
|
def execute_nodegen4_command(command_repo, node_id, file_id: nil, scope: nil)
|
234
|
-
top_node_api = aoc_api.
|
235
|
-
node_id: node_id,
|
236
|
-
plugin: self,
|
237
|
-
scope: scope
|
238
|
-
)
|
217
|
+
top_node_api = aoc_api.node_api_from(node_id: node_id, workspace_info: current_workspace_info, scope: scope)
|
239
218
|
file_id = top_node_api.read("access_keys/#{top_node_api.app_info[:node_info]['access_key']}")[:data]['root_file_id'] if file_id.nil?
|
240
219
|
node_plugin = Node.new(@agents.merge(
|
241
220
|
skip_basic_auth_options: true,
|
@@ -251,12 +230,12 @@ module Aspera
|
|
251
230
|
# default is push
|
252
231
|
case options.get_option(:operation, is_type: :mandatory)
|
253
232
|
when :push
|
254
|
-
|
233
|
+
client_direction = Fasp::TransferSpec::DIRECTION_SEND
|
255
234
|
client_folder = options.get_option(:from_folder, is_type: :mandatory)
|
256
|
-
server_folder = transfer.destination_folder(
|
235
|
+
server_folder = transfer.destination_folder(client_direction)
|
257
236
|
when :pull
|
258
|
-
|
259
|
-
client_folder = transfer.destination_folder(
|
237
|
+
client_direction = Fasp::TransferSpec::DIRECTION_RECEIVE
|
238
|
+
client_folder = transfer.destination_folder(client_direction)
|
260
239
|
server_folder = options.get_option(:from_folder, is_type: :mandatory)
|
261
240
|
end
|
262
241
|
client_apfid = top_node_api.resolve_api_fid(file_id, client_folder)
|
@@ -276,7 +255,7 @@ module Aspera
|
|
276
255
|
}
|
277
256
|
return Main.result_transfer(transfer.start(server_apfid[:api].transfer_spec_gen4(
|
278
257
|
server_apfid[:file_id],
|
279
|
-
|
258
|
+
client_direction,
|
280
259
|
add_ts)))
|
281
260
|
else raise "INTERNAL ERROR: Missing case: #{command_repo}"
|
282
261
|
end # command_repo
|
@@ -285,7 +264,7 @@ module Aspera
|
|
285
264
|
|
286
265
|
def execute_admin_action
|
287
266
|
# upgrade scope to admin
|
288
|
-
aoc_api.oauth.
|
267
|
+
aoc_api.oauth.generic_parameters[:scope] = AoC::SCOPE_FILES_ADMIN
|
289
268
|
command_admin = options.get_next_command(%i[ats resource usage_reports analytics subscription auth_providers])
|
290
269
|
case command_admin
|
291
270
|
when :auth_providers
|
@@ -365,16 +344,16 @@ module Aspera
|
|
365
344
|
case command_analytics
|
366
345
|
when :application_events
|
367
346
|
event_type = command_analytics.to_s
|
368
|
-
events = analytics_api.read("organizations/#{aoc_api.
|
347
|
+
events = analytics_api.read("organizations/#{aoc_api.current_user_info['organization_id']}/#{event_type}")[:data][event_type]
|
369
348
|
return {type: :object_list, data: events}
|
370
349
|
when :transfers
|
371
350
|
event_type = command_analytics.to_s
|
372
351
|
filter_resource = options.get_option(:name) || 'organizations'
|
373
352
|
filter_id = options.get_option(:id) ||
|
374
353
|
case filter_resource
|
375
|
-
when 'organizations' then aoc_api.
|
376
|
-
when 'users' then aoc_api.
|
377
|
-
when 'nodes' then aoc_api.
|
354
|
+
when 'organizations' then aoc_api.current_user_info['organization_id']
|
355
|
+
when 'users' then aoc_api.current_user_info['id']
|
356
|
+
when 'nodes' then aoc_api.current_user_info['id'] # TODO: consistent ? # rubocop:disable Lint/DuplicateBranch
|
378
357
|
else raise 'organizations or users for option --name'
|
379
358
|
end
|
380
359
|
filter = options.get_option(:query) || {}
|
@@ -382,22 +361,22 @@ module Aspera
|
|
382
361
|
filter['limit'] ||= 100
|
383
362
|
if options.get_option(:once_only, is_type: :mandatory)
|
384
363
|
saved_date = []
|
385
|
-
|
364
|
+
start_date_persistency = PersistencyActionOnce.new(
|
386
365
|
manager: @agents[:persistency],
|
387
366
|
data: saved_date,
|
388
367
|
ids: IdGenerator.from_list(['aoc_ana_date', options.get_option(:url, is_type: :mandatory), current_workspace_info['name']].push(
|
389
368
|
filter_resource,
|
390
369
|
filter_id)))
|
391
|
-
|
392
|
-
|
393
|
-
# Log.log().error("start: #{
|
394
|
-
# Log.log().error("end: #{
|
395
|
-
saved_date[0] =
|
396
|
-
filter['start_time'] =
|
397
|
-
filter['stop_time'] =
|
370
|
+
start_date_time = saved_date.first
|
371
|
+
stop_date_time = Time.now.utc.strftime('%FT%T.%LZ')
|
372
|
+
# Log.log().error("start: #{start_date_time}")
|
373
|
+
# Log.log().error("end: #{stop_date_time}")
|
374
|
+
saved_date[0] = stop_date_time
|
375
|
+
filter['start_time'] = start_date_time unless start_date_time.nil?
|
376
|
+
filter['stop_time'] = stop_date_time
|
398
377
|
end
|
399
378
|
events = analytics_api.read("#{filter_resource}/#{filter_id}/#{event_type}", option_url_query(filter))[:data][event_type]
|
400
|
-
|
379
|
+
start_date_persistency&.save
|
401
380
|
if !options.get_option(:notif_to).nil?
|
402
381
|
events.each do |tr_event|
|
403
382
|
config.send_email_template(values: {ev: tr_event})
|
@@ -463,7 +442,7 @@ module Aspera
|
|
463
442
|
items = read_with_paging(resource_class_path, option_url_query(default_query))
|
464
443
|
count_msg = "Items: #{items[:list].length}/#{items[:total]}"
|
465
444
|
count_msg = count_msg.bg_red unless items[:list].length.eql?(items[:total].to_i)
|
466
|
-
|
445
|
+
formatter.display_status(count_msg)
|
467
446
|
return {type: :object_list, data: items[:list], fields: default_fields}
|
468
447
|
when :show
|
469
448
|
object = aoc_api.read(resource_instance_path)[:data]
|
@@ -527,9 +506,9 @@ module Aspera
|
|
527
506
|
when :profile
|
528
507
|
case options.get_next_command(%i[show modify])
|
529
508
|
when :show
|
530
|
-
return { type: :single_object, data: aoc_api.
|
509
|
+
return { type: :single_object, data: aoc_api.current_user_info(exception: true) }
|
531
510
|
when :modify
|
532
|
-
aoc_api.update("users/#{aoc_api.
|
511
|
+
aoc_api.update("users/#{aoc_api.current_user_info(exception: true)['id']}", options.get_next_argument('modified parameters (hash)'))
|
533
512
|
return Main.result_status('modified')
|
534
513
|
end
|
535
514
|
end
|
@@ -551,46 +530,24 @@ module Aspera
|
|
551
530
|
when :send
|
552
531
|
package_data = options.get_option(:value, is_type: :mandatory)
|
553
532
|
raise CliBadArgument, 'value must be hash, refer to doc' unless package_data.is_a?(Hash)
|
533
|
+
new_user_option = options.get_option(:new_user_option)
|
534
|
+
option_validate = options.get_option(:validate_metadata)
|
535
|
+
# works for both normal usr auth and link auth
|
536
|
+
package_data['workspace_id'] ||= current_workspace_info['id']
|
554
537
|
|
555
538
|
if !aoc_api.url_token_data.nil?
|
556
539
|
assert_public_link_types(%w[send_package_to_user send_package_to_dropbox])
|
557
540
|
box_type = aoc_api.url_token_data['purpose'].split('_').last
|
558
541
|
package_data['recipients'] = [{'id' => aoc_api.url_token_data['data']["#{box_type}_id"], 'type' => box_type}]
|
559
|
-
#
|
560
|
-
|
542
|
+
# enforce workspace id from link (should be already ok, but in case user wanted to override)
|
543
|
+
package_data['workspace_id'] = aoc_api.url_token_data['data']['workspace_id']
|
561
544
|
end
|
562
545
|
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
#
|
567
|
-
|
568
|
-
# lookup users
|
569
|
-
new_user_option = options.get_option(:new_user_option)
|
570
|
-
aoc_api.resolve_package_recipients(package_data, current_workspace_info['id'], 'recipients', new_user_option)
|
571
|
-
aoc_api.resolve_package_recipients(package_data, current_workspace_info['id'], 'bcc_recipients', new_user_option)
|
572
|
-
normalize_metadata(package_data)
|
573
|
-
aoc_api.validate_metadata(package_data) if options.get_option(:validate_metadata)
|
574
|
-
|
575
|
-
# create a new package container
|
576
|
-
package_info = aoc_api.create('packages', package_data)[:data]
|
577
|
-
|
578
|
-
# tell AoC what to expect in package: 1 transfer (can also be done after transfer)
|
579
|
-
# TODO: if multisession was used we should probably tell
|
580
|
-
# also, currently no "multi-source" , i.e. only from client-side files, unless "node" agent is used
|
581
|
-
aoc_api.update("packages/#{package_info['id']}", {'sent' => true, 'transfers_expected' => 1})[:data]
|
582
|
-
package_node_api = aoc_api.node_id_to_api(
|
583
|
-
node_id: package_info['node_id'],
|
584
|
-
plugin: self,
|
585
|
-
package_info: package_info,
|
586
|
-
scope: AoC::SCOPE_NODE_USER
|
587
|
-
)
|
588
|
-
# raise error if necessary (but not return, package info is returned on success)
|
589
|
-
Main.result_transfer(transfer.start(package_node_api.transfer_spec_gen4(
|
590
|
-
package_info['contents_file_id'],
|
591
|
-
Fasp::TransferSpec::DIRECTION_SEND)))
|
592
|
-
# return all info on package
|
593
|
-
return { type: :single_object, data: package_info}
|
546
|
+
# transfer may raise an error
|
547
|
+
created_package = aoc_api.create_package_simple(package_data, option_validate, new_user_option)
|
548
|
+
Main.result_transfer(transfer.start(created_package[:spec], rest_token: created_package[:node]))
|
549
|
+
# return all info on package (especially package id)
|
550
|
+
return { type: :single_object, data: created_package[:info]}
|
594
551
|
when :recv
|
595
552
|
if !aoc_api.url_token_data.nil?
|
596
553
|
assert_public_link_types(['view_received_package'])
|
@@ -608,35 +565,36 @@ module Aspera
|
|
608
565
|
current_workspace_info['id']].concat(aoc_api.additional_persistence_ids)))
|
609
566
|
end
|
610
567
|
if VAL_ALL.eql?(ids_to_download)
|
568
|
+
query = option_url_query(PACKAGE_QUERY_DEFAULT)
|
569
|
+
raise 'option query must be Hash' unless query.is_a?(Hash)
|
570
|
+
if query.key?('dropbox_name')
|
571
|
+
# convenience: specify name instead of id
|
572
|
+
raise 'not both dropbox_name and dropbox_id' if query.key?('dropbox_id')
|
573
|
+
query['dropbox_id'] = aoc_api.lookup_entity_by_name('dropboxes', query['dropbox_name'])['id']
|
574
|
+
query.delete('dropbox_name')
|
575
|
+
end
|
576
|
+
query['workspace_id'] ||= current_workspace_info['id'] unless current_workspace_info['id'].eql?(:undefined)
|
611
577
|
# get list of packages in inbox
|
612
|
-
package_info = aoc_api.read('packages',
|
613
|
-
'archived' => false,
|
614
|
-
'exclude_dropbox_packages' => true,
|
615
|
-
'has_content' => true,
|
616
|
-
'received' => true,
|
617
|
-
'workspace_id' => current_workspace_info['id']})[:data]
|
578
|
+
package_info = aoc_api.read('packages', query)[:data]
|
618
579
|
# remove from list the ones already downloaded
|
619
580
|
ids_to_download = package_info.map{|e|e['id']}
|
620
581
|
# array here
|
621
582
|
ids_to_download.reject!{|id|skip_ids_data.include?(id)}
|
622
|
-
end #
|
583
|
+
end # VAL_ALL
|
623
584
|
# list here
|
624
585
|
ids_to_download = [ids_to_download] unless ids_to_download.is_a?(Array)
|
625
586
|
result_transfer = []
|
626
|
-
|
587
|
+
formatter.display_status("found #{ids_to_download.length} package(s).")
|
627
588
|
ids_to_download.each do |package_id|
|
628
589
|
package_info = aoc_api.read("packages/#{package_id}")[:data]
|
629
|
-
|
630
|
-
package_node_api = aoc_api.
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
package_info['contents_file_id'],
|
638
|
-
Fasp::TransferSpec::DIRECTION_RECEIVE,
|
639
|
-
{'paths'=> [{'source' => '.'}]}))
|
590
|
+
formatter.display_status("downloading package: #{package_info['name']}")
|
591
|
+
package_node_api = aoc_api.node_api_from(package_info: package_info, scope: AoC::SCOPE_NODE_USER)
|
592
|
+
statuses = transfer.start(
|
593
|
+
package_node_api.transfer_spec_gen4(
|
594
|
+
package_info['contents_file_id'],
|
595
|
+
Fasp::TransferSpec::DIRECTION_RECEIVE,
|
596
|
+
{'paths'=> [{'source' => '.'}]}),
|
597
|
+
rest_token: package_node_api)
|
640
598
|
result_transfer.push({'package' => package_id, Main::STATUS_FIELD => statuses})
|
641
599
|
# update skip list only if all transfer sessions completed
|
642
600
|
if TransferAgent.session_status(statuses).eql?(:success)
|
@@ -651,14 +609,14 @@ module Aspera
|
|
651
609
|
return { type: :single_object, data: package_info }
|
652
610
|
when :list
|
653
611
|
display_fields = %w[id name bytes_transferred]
|
654
|
-
query = option_url_query(
|
612
|
+
query = option_url_query(PACKAGE_QUERY_DEFAULT)
|
613
|
+
raise 'option query must be Hash' unless query.is_a?(Hash)
|
655
614
|
if query.key?('dropbox_name')
|
656
615
|
# convenience: specify name instead of id
|
657
616
|
raise 'not both dropbox_name and dropbox_id' if query.key?('dropbox_id')
|
658
617
|
query['dropbox_id'] = aoc_api.lookup_entity_by_name('dropboxes', query['dropbox_name'])['id']
|
659
618
|
query.delete('dropbox_name')
|
660
619
|
end
|
661
|
-
raise 'option must be Hash' unless query.is_a?(Hash)
|
662
620
|
if current_workspace_info['id'].eql?(:undefined)
|
663
621
|
display_fields.push('workspace_id')
|
664
622
|
else
|
@@ -695,11 +653,7 @@ module Aspera
|
|
695
653
|
create_params = nil
|
696
654
|
shared_apfid = nil
|
697
655
|
if !folder_dest.nil?
|
698
|
-
home_node_api = aoc_api.
|
699
|
-
node_id: home_info[:node_id],
|
700
|
-
plugin: self,
|
701
|
-
scope: AoC::SCOPE_NODE_USER
|
702
|
-
)
|
656
|
+
home_node_api = aoc_api.node_api_from(node_id: home_info[:node_id], workspace_info: current_workspace_info, scope: AoC::SCOPE_NODE_USER)
|
703
657
|
shared_apfid = home_node_api.resolve_api_fid(home_info[:file_id], folder_dest)
|
704
658
|
create_params = {
|
705
659
|
file_id: shared_apfid[:file_id],
|
@@ -741,8 +695,8 @@ module Aspera
|
|
741
695
|
'workspace_id' => current_workspace_info['id'],
|
742
696
|
'workspace_name' => current_workspace_info['name'],
|
743
697
|
'folder_name' => 'my folder',
|
744
|
-
'created_by_name' => aoc_api.
|
745
|
-
'created_by_email' => aoc_api.
|
698
|
+
'created_by_name' => aoc_api.current_user_info['name'],
|
699
|
+
'created_by_email' => aoc_api.current_user_info['email'],
|
746
700
|
'access_key' => shared_apfid[:api].app_info[:node_info]['access_key'],
|
747
701
|
'node' => shared_apfid[:api].app_info[:node_info]['host']
|
748
702
|
}
|
@@ -789,7 +743,16 @@ module Aspera
|
|
789
743
|
return execute_admin_action
|
790
744
|
when :gateway
|
791
745
|
require 'aspera/faspex_gw'
|
792
|
-
|
746
|
+
url = options.get_option(:value, is_type: :mandatory)
|
747
|
+
uri = URI.parse(url)
|
748
|
+
server = WebServerSimple.new(uri)
|
749
|
+
server.mount(uri.path, Faspex4GWServlet, aoc_api, current_workspace_info['id'])
|
750
|
+
trap('INT') { server.shutdown }
|
751
|
+
formatter.display_status("Faspex 4 gateway listening on #{url}")
|
752
|
+
Log.log.info("Listening on #{url}")
|
753
|
+
# this is blocking until server exits
|
754
|
+
server.start
|
755
|
+
return Main.result_status('Gateway terminated')
|
793
756
|
else
|
794
757
|
raise "internal error: #{command}"
|
795
758
|
end # action
|
@@ -44,7 +44,7 @@ module Aspera
|
|
44
44
|
def execute_action_access_key
|
45
45
|
commands = %i[create list show modify delete node cluster entitlement]
|
46
46
|
command = options.get_next_command(commands)
|
47
|
-
# those
|
47
|
+
# those do not require access key id
|
48
48
|
access_key_id = instance_identifier unless %i[create list].include?(command)
|
49
49
|
case command
|
50
50
|
when :create
|
@@ -154,11 +154,11 @@ module Aspera
|
|
154
154
|
base_url: AtsApi.base_url + '/v2',
|
155
155
|
headers: rest_add_headers,
|
156
156
|
auth: {
|
157
|
-
type:
|
158
|
-
base_url:
|
157
|
+
type: :oauth2,
|
158
|
+
base_url: 'https://iam.bluemix.net/identity',
|
159
159
|
# does not work: base_url: 'https://iam.cloud.ibm.com/identity',
|
160
|
-
|
161
|
-
generic:
|
160
|
+
grant_method: :generic,
|
161
|
+
generic: {
|
162
162
|
grant_type: 'urn:ibm:params:oauth:grant-type:apikey',
|
163
163
|
response_type: 'cloud_iam',
|
164
164
|
apikey: options.get_option(:ibm_api_key, is_type: :mandatory)
|
@@ -176,7 +176,7 @@ module Aspera
|
|
176
176
|
if instance.nil?
|
177
177
|
# Take the first Aspera on Cloud transfer service instance ID if not provided by user
|
178
178
|
instance = ats_api_v2_auth_ibm.read('instances')[:data]['data'].first
|
179
|
-
|
179
|
+
formatter.display_status("using first instance: #{instance}")
|
180
180
|
end
|
181
181
|
rest_add_header = {'X-ATS-Service-Instance-Id' => instance}
|
182
182
|
end
|