aspera-cli 4.17.0 → 4.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -4
- data/CHANGELOG.md +33 -0
- data/CONTRIBUTING.md +15 -1
- data/README.md +711 -432
- data/bin/ascli +5 -0
- data/bin/asession +2 -2
- data/examples/build_package.sh +28 -0
- data/lib/aspera/agent/alpha.rb +10 -8
- data/lib/aspera/agent/base.rb +9 -6
- data/lib/aspera/agent/connect.rb +7 -8
- data/lib/aspera/agent/direct.rb +56 -37
- data/lib/aspera/agent/httpgw.rb +23 -324
- data/lib/aspera/agent/node.rb +19 -20
- data/lib/aspera/agent/trsdk.rb +19 -20
- data/lib/aspera/api/aoc.rb +17 -14
- data/lib/aspera/api/cos_node.rb +4 -4
- data/lib/aspera/api/httpgw.rb +342 -0
- data/lib/aspera/api/node.rb +135 -89
- data/lib/aspera/ascmd.rb +4 -3
- data/lib/aspera/ascp/installation.rb +15 -7
- data/lib/aspera/ascp/management.rb +2 -2
- data/lib/aspera/ascp/products.rb +1 -1
- data/lib/aspera/cli/basic_auth_plugin.rb +5 -9
- data/lib/aspera/cli/extended_value.rb +35 -16
- data/lib/aspera/cli/formatter.rb +161 -70
- data/lib/aspera/cli/hints.rb +18 -0
- data/lib/aspera/cli/main.rb +32 -39
- data/lib/aspera/cli/manager.rb +151 -119
- data/lib/aspera/cli/plugin.rb +27 -21
- data/lib/aspera/cli/plugin_factory.rb +31 -20
- data/lib/aspera/cli/plugins/alee.rb +14 -2
- data/lib/aspera/cli/plugins/aoc.rb +152 -141
- data/lib/aspera/cli/plugins/ats.rb +1 -1
- data/lib/aspera/cli/plugins/config.rb +72 -65
- data/lib/aspera/cli/plugins/console.rb +8 -5
- data/lib/aspera/cli/plugins/faspex.rb +32 -23
- data/lib/aspera/cli/plugins/faspex5.rb +232 -156
- data/lib/aspera/cli/plugins/faspio.rb +85 -0
- data/lib/aspera/cli/plugins/httpgw.rb +55 -0
- data/lib/aspera/cli/plugins/node.rb +129 -64
- data/lib/aspera/cli/plugins/orchestrator.rb +33 -30
- data/lib/aspera/cli/plugins/preview.rb +7 -3
- data/lib/aspera/cli/plugins/server.rb +6 -6
- data/lib/aspera/cli/plugins/shares.rb +16 -14
- data/lib/aspera/cli/special_values.rb +13 -0
- data/lib/aspera/cli/sync_actions.rb +10 -10
- data/lib/aspera/cli/transfer_agent.rb +7 -6
- data/lib/aspera/cli/version.rb +1 -1
- data/lib/aspera/environment.rb +70 -9
- data/lib/aspera/faspex_gw.rb +5 -4
- data/lib/aspera/faspex_postproc.rb +2 -2
- data/lib/aspera/log.rb +6 -3
- data/lib/aspera/node_simulator.rb +2 -2
- data/lib/aspera/oauth/base.rb +31 -19
- data/lib/aspera/oauth/factory.rb +12 -13
- data/lib/aspera/oauth/generic.rb +1 -0
- data/lib/aspera/oauth/jwt.rb +18 -15
- data/lib/aspera/oauth/url_json.rb +8 -6
- data/lib/aspera/oauth/web.rb +2 -2
- data/lib/aspera/persistency_folder.rb +2 -2
- data/lib/aspera/preview/generator.rb +3 -3
- data/lib/aspera/preview/options.rb +3 -3
- data/lib/aspera/preview/terminal.rb +4 -4
- data/lib/aspera/preview/utils.rb +3 -3
- data/lib/aspera/proxy_auto_config.rb +5 -1
- data/lib/aspera/rest.rb +105 -88
- data/lib/aspera/rest_call_error.rb +1 -1
- data/lib/aspera/rest_error_analyzer.rb +2 -2
- data/lib/aspera/rest_errors_aspera.rb +1 -1
- data/lib/aspera/resumer.rb +1 -1
- data/lib/aspera/secret_hider.rb +2 -4
- data/lib/aspera/ssh.rb +1 -1
- data/lib/aspera/transfer/parameters.rb +39 -36
- data/lib/aspera/transfer/spec.rb +2 -0
- data/lib/aspera/transfer/sync.rb +2 -1
- data/lib/aspera/transfer/uri.rb +1 -1
- data/lib/aspera/uri_reader.rb +5 -4
- data/lib/aspera/web_auth.rb +1 -1
- data/lib/aspera/web_server_simple.rb +4 -3
- data.tar.gz.sig +0 -0
- metadata +7 -4
- metadata.gz.sig +0 -0
- data/lib/aspera/cli/plugins/bss.rb +0 -71
- data/lib/aspera/open_application.rb +0 -71
@@ -22,12 +22,10 @@ module Aspera
|
|
22
22
|
# Agents shown in manual for parameters (sub list)
|
23
23
|
SUPPORTED_AGENTS = %i[direct node connect trsdk httpgw].freeze
|
24
24
|
# Short names of columns in manual
|
25
|
-
SUPPORTED_AGENTS_SHORT = SUPPORTED_AGENTS.map{|
|
25
|
+
SUPPORTED_AGENTS_SHORT = SUPPORTED_AGENTS.map{|agent_sym|agent_sym.to_s[0].to_sym}
|
26
26
|
FILE_LIST_OPTIONS = ['--file-list', '--file-pair-list'].freeze
|
27
|
-
# options that can be provided to the constructor, and then in @options
|
28
|
-
SUPPORTED_OPTIONS = %i[ascp_args wss check_ignore_cb quiet trusted_certs].freeze
|
29
27
|
|
30
|
-
private_constant :SUPPORTED_AGENTS, :FILE_LIST_OPTIONS
|
28
|
+
private_constant :SUPPORTED_AGENTS, :FILE_LIST_OPTIONS
|
31
29
|
|
32
30
|
class << self
|
33
31
|
# Temp folder for file lists, must contain only file lists
|
@@ -35,18 +33,18 @@ module Aspera
|
|
35
33
|
# this could be refined, as , for instance, on macos, temp folder is already user specific
|
36
34
|
@file_list_folder = TempFileManager.instance.new_file_path_global('asession_filelists') # cspell:disable-line
|
37
35
|
|
38
|
-
# @param
|
36
|
+
# @param formatter [Cli::Formatter] formatter to use
|
39
37
|
# @return a table suitable to display in manual
|
40
|
-
def man_table
|
38
|
+
def man_table(formatter)
|
41
39
|
result = []
|
42
40
|
Spec::DESCRIPTION.each do |name, options|
|
43
41
|
param = {name: name, type: [options[:accepted_types]].flatten.join(','), description: options[:desc]}
|
44
42
|
# add flags for supported agents in doc
|
45
|
-
SUPPORTED_AGENTS.each do |
|
46
|
-
param[
|
43
|
+
SUPPORTED_AGENTS.each do |agent_sym|
|
44
|
+
param[agent_sym.to_s[0].to_sym] = Cli::Formatter.tick(options[:agents].nil? || options[:agents].include?(agent_sym))
|
47
45
|
end
|
48
46
|
# only keep lines that are usable in supported agents
|
49
|
-
next if SUPPORTED_AGENTS_SHORT.inject(true){|
|
47
|
+
next if SUPPORTED_AGENTS_SHORT.inject(true){|memory, agent_short_sym|memory && param[agent_short_sym].empty?}
|
50
48
|
param[:cli] =
|
51
49
|
case options[:cli][:type]
|
52
50
|
when :envvar then 'env:' + options[:cli][:variable]
|
@@ -63,8 +61,8 @@ module Aspera
|
|
63
61
|
end.map{|n|"{#{n}}"}.join('|')
|
64
62
|
conversion_tag = options[:cli].key?(:convert) ? '(conversion)' : ''
|
65
63
|
"#{options[:cli][:switch]} #{conversion_tag}#{values}"
|
66
|
-
when :special then
|
67
|
-
when :ignore then
|
64
|
+
when :special then formatter.special_format('special')
|
65
|
+
when :ignore then formatter.special_format('ignored')
|
68
66
|
else
|
69
67
|
param[:d].eql?(tick_yes) ? '' : 'n/a'
|
70
68
|
end
|
@@ -75,17 +73,17 @@ module Aspera
|
|
75
73
|
param[:description] = param[:description].gsub('/', '\\')
|
76
74
|
result.push(param)
|
77
75
|
end
|
78
|
-
return result.sort_by { |
|
76
|
+
return result.sort_by { |parameter_info| parameter_info[:name] }
|
79
77
|
end
|
80
78
|
|
81
79
|
# special encoding methods used in YAML (key: :convert)
|
82
|
-
def convert_remove_hyphen(
|
80
|
+
def convert_remove_hyphen(value); value.tr('-', ''); end
|
83
81
|
|
84
82
|
# special encoding methods used in YAML (key: :convert)
|
85
|
-
def convert_json64(
|
83
|
+
def convert_json64(value); Base64.strict_encode64(JSON.generate(value)); end
|
86
84
|
|
87
85
|
# special encoding methods used in YAML (key: :convert)
|
88
|
-
def convert_base64(
|
86
|
+
def convert_base64(value); Base64.strict_encode64(value); end
|
89
87
|
|
90
88
|
# file list is provided directly with ascp arguments
|
91
89
|
# @param ascp_args [Array,NilClass] ascp arguments
|
@@ -94,8 +92,8 @@ module Aspera
|
|
94
92
|
end
|
95
93
|
|
96
94
|
# temp file list files are created here
|
97
|
-
def file_list_folder=(
|
98
|
-
@file_list_folder =
|
95
|
+
def file_list_folder=(value)
|
96
|
+
@file_list_folder = value
|
99
97
|
return if @file_list_folder.nil?
|
100
98
|
FileUtils.mkdir_p(@file_list_folder)
|
101
99
|
TempFileManager.instance.cleanup_expired(@file_list_folder)
|
@@ -103,28 +101,33 @@ module Aspera
|
|
103
101
|
|
104
102
|
# static methods
|
105
103
|
attr_reader :file_list_folder
|
106
|
-
end
|
104
|
+
end
|
107
105
|
|
108
106
|
# @param options [Hash] key: :wss: bool, :ascp_args: array of strings
|
109
|
-
def initialize(
|
110
|
-
|
111
|
-
|
107
|
+
def initialize(
|
108
|
+
job_spec,
|
109
|
+
ascp_args:,
|
110
|
+
wss:,
|
111
|
+
quiet:,
|
112
|
+
trusted_certs:,
|
113
|
+
check_ignore_cb:
|
114
|
+
)
|
112
115
|
@job_spec = job_spec
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
@
|
117
|
-
|
118
|
-
|
119
|
-
Aspera.assert_type(@
|
120
|
-
Aspera.assert(@
|
116
|
+
@ascp_args = ascp_args
|
117
|
+
@wss = wss
|
118
|
+
@quiet = quiet
|
119
|
+
@trusted_certs = trusted_certs
|
120
|
+
@check_ignore_cb = check_ignore_cb
|
121
|
+
Aspera.assert_type(job_spec, Hash)
|
122
|
+
Aspera.assert_type(@ascp_args, Array){'ascp_args'}
|
123
|
+
Aspera.assert(@ascp_args.all?(String)){'ascp arguments must be Strings'}
|
121
124
|
@builder = CommandLineBuilder.new(@job_spec, Spec::DESCRIPTION)
|
122
125
|
end
|
123
126
|
|
124
127
|
# either place source files on command line, or add file list file
|
125
128
|
def process_file_list
|
126
129
|
# is the file list provided through ascp parameters?
|
127
|
-
ascp_file_list_provided = self.class.ascp_args_file_list?(@
|
130
|
+
ascp_file_list_provided = self.class.ascp_args_file_list?(@ascp_args)
|
128
131
|
# set if paths is mandatory in ts
|
129
132
|
@builder.params_definition['paths'][:mandatory] = !@job_spec.key?('keepalive') && !ascp_file_list_provided # cspell:words keepalive
|
130
133
|
# get paths in transfer spec (after setting if it is mandatory)
|
@@ -162,7 +165,7 @@ module Aspera
|
|
162
165
|
def remote_certificates
|
163
166
|
certificates_to_use = []
|
164
167
|
# use web socket secure for session ?
|
165
|
-
if @builder.read_param('wss_enabled') && (@
|
168
|
+
if @builder.read_param('wss_enabled') && (@wss || !@job_spec.key?('fasp_port'))
|
166
169
|
# by default use web socket session if available, unless removed by user
|
167
170
|
@builder.add_command_line_options(['--ws-connect'])
|
168
171
|
# TODO: option to give order ssh,ws (legacy http is implied by ssh)
|
@@ -171,9 +174,9 @@ module Aspera
|
|
171
174
|
@job_spec.delete('fasp_port')
|
172
175
|
@job_spec.delete('sshfp')
|
173
176
|
# set location for CA bundle to be the one of Ruby, see env var SSL_CERT_FILE / SSL_CERT_DIR
|
174
|
-
certificates_to_use.concat(@
|
177
|
+
certificates_to_use.concat(@trusted_certs) if @trusted_certs.is_a?(Array)
|
175
178
|
# ignore cert for wss ?
|
176
|
-
if @
|
179
|
+
if @check_ignore_cb&.call(@job_spec['remote_host'], @job_spec['wss_port'])
|
177
180
|
wss_cert_file = TempFileManager.instance.new_file_path_global('wss_cert')
|
178
181
|
wss_url = "https://#{@job_spec['remote_host']}:#{@job_spec['wss_port']}"
|
179
182
|
File.write(wss_cert_file, Rest.remote_certificate_chain(wss_url))
|
@@ -228,7 +231,7 @@ module Aspera
|
|
228
231
|
# destination will be base64 encoded, put this before source path arguments
|
229
232
|
@builder.add_command_line_options(['--dest64']) if base64_destination
|
230
233
|
# optional arguments, at the end to override previous ones (to allow override)
|
231
|
-
@builder.add_command_line_options(@
|
234
|
+
@builder.add_command_line_options(@ascp_args)
|
232
235
|
# get list of source files to transfer and build arg for ascp
|
233
236
|
process_file_list
|
234
237
|
# process destination folder
|
@@ -238,7 +241,7 @@ module Aspera
|
|
238
241
|
# destination MUST be last command line argument to ascp
|
239
242
|
@builder.add_command_line_options([destination_folder])
|
240
243
|
@builder.add_env_args(env_args)
|
241
|
-
env_args[:args].unshift('-q') if @
|
244
|
+
env_args[:args].unshift('-q') if @quiet
|
242
245
|
# add fallback cert and key as arguments if needed
|
243
246
|
if ['1', 1, true, 'force'].include?(@job_spec['http_fallback'])
|
244
247
|
env_args[:args].unshift('-Y', Ascp::Installation.instance.path(:fallback_private_key))
|
@@ -247,6 +250,6 @@ module Aspera
|
|
247
250
|
Log.log.debug{"ascp args: #{env_args}"}
|
248
251
|
return env_args
|
249
252
|
end
|
250
|
-
end
|
253
|
+
end
|
251
254
|
end
|
252
255
|
end
|
data/lib/aspera/transfer/spec.rb
CHANGED
@@ -17,6 +17,8 @@ module Aspera
|
|
17
17
|
'ssh_port' => SSH_PORT,
|
18
18
|
'fasp_port' => UDP_PORT
|
19
19
|
}.freeze
|
20
|
+
# fields for transport
|
21
|
+
TRANSPORT_FIELDS = %w[remote_host remote_user ssh_port fasp_port wss_enabled wss_port].freeze
|
20
22
|
# reserved tag for Aspera
|
21
23
|
TAG_RESERVED = 'aspera'
|
22
24
|
class << self
|
data/lib/aspera/transfer/sync.rb
CHANGED
@@ -48,7 +48,8 @@ module Aspera
|
|
48
48
|
'cooloff' => { cli: { type: :opt_with_arg}, accepted_types: :int},
|
49
49
|
'pending_max' => { cli: { type: :opt_with_arg}, accepted_types: :int},
|
50
50
|
'scan_intensity' => { cli: { type: :opt_with_arg}, accepted_types: :string},
|
51
|
-
'cipher' => { cli: { type: :opt_with_arg, convert: 'Aspera::Transfer::Parameters.convert_remove_hyphen'},
|
51
|
+
'cipher' => { cli: { type: :opt_with_arg, convert: 'Aspera::Transfer::Parameters.convert_remove_hyphen'},
|
52
|
+
accepted_types: :string, ts: true},
|
52
53
|
'transfer_threads' => { cli: { type: :opt_with_arg}, accepted_types: :int},
|
53
54
|
'preserve_time' => { cli: { type: :opt_without_arg}, ts: :preserve_times},
|
54
55
|
'preserve_access_time' => { cli: { type: :opt_without_arg}, ts: nil},
|
data/lib/aspera/transfer/uri.rb
CHANGED
@@ -24,7 +24,7 @@ module Aspera
|
|
24
24
|
result_ts['ssh_port'] = @fasp_uri.port
|
25
25
|
result_ts['paths'] = [{'source' => URI.decode_www_form_component(@fasp_uri.path)}]
|
26
26
|
# faspex 4 does not encode trailing base64 padding, fix that to be able to decode properly
|
27
|
-
fixed_query = @fasp_uri.query.gsub(/(=+)$/){|
|
27
|
+
fixed_query = @fasp_uri.query.gsub(/(=+)$/){|trail_equals|'%3D' * trail_equals.length}
|
28
28
|
|
29
29
|
Rest.decode_query(fixed_query).each do |name, value|
|
30
30
|
case name
|
data/lib/aspera/uri_reader.rb
CHANGED
@@ -4,21 +4,22 @@ require 'uri'
|
|
4
4
|
require 'aspera/rest'
|
5
5
|
|
6
6
|
module Aspera
|
7
|
+
# read some content from some URI, support file: , http: and https: schemes
|
7
8
|
module UriReader
|
8
9
|
class << self
|
9
10
|
# read some content from some URI, support file: , http: and https: schemes
|
10
11
|
def read(uri_to_read)
|
11
|
-
|
12
|
-
case
|
12
|
+
uri = URI.parse(uri_to_read)
|
13
|
+
case uri.scheme
|
13
14
|
when 'http', 'https'
|
14
15
|
return Rest.new(base_url: uri_to_read, redirect_max: 5).call(operation: 'GET', subpath: '', headers: {'Accept' => 'text/plain'})[:data]
|
15
16
|
when 'file', NilClass
|
16
|
-
local_file_path =
|
17
|
+
local_file_path = uri.path
|
17
18
|
raise 'URL shall have a path, check syntax' if local_file_path.nil?
|
18
19
|
local_file_path = File.expand_path(local_file_path.gsub(%r{^/}, '')) if %r{^/(~|.|..)/}.match?(local_file_path)
|
19
20
|
return File.read(local_file_path)
|
20
21
|
else
|
21
|
-
raise "unknown scheme: [#{
|
22
|
+
raise "unknown scheme: [#{uri.scheme}] for [#{uri_to_read}]"
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
data/lib/aspera/web_auth.rb
CHANGED
@@ -28,7 +28,7 @@ module Aspera
|
|
28
28
|
response.body = '<html><head><title>Ok</title></head><body><h1>Thank you !</h1><p>You can close this window.</p></body></html>'
|
29
29
|
return nil
|
30
30
|
end
|
31
|
-
end
|
31
|
+
end
|
32
32
|
|
33
33
|
# start a local web server, then start a browser that will callback the local server upon authentication
|
34
34
|
class WebAuth < WebServerSimple
|
@@ -7,6 +7,7 @@ require 'aspera/assert'
|
|
7
7
|
require 'openssl'
|
8
8
|
|
9
9
|
module Aspera
|
10
|
+
# Simple WEBrick server with HTTPS support
|
10
11
|
class WebServerSimple < WEBrick::HTTPServer
|
11
12
|
CERT_PARAMETERS = %i[key cert chain].freeze
|
12
13
|
GENERIC_ISSUER = '/C=FR/O=Test/OU=Test/CN=Test'
|
@@ -18,8 +19,8 @@ module Aspera
|
|
18
19
|
# generates and adds self signed cert to provided webrick options
|
19
20
|
def fill_self_signed_cert(cert, key, digest = 'SHA256')
|
20
21
|
cert.subject = cert.issuer = OpenSSL::X509::Name.parse(GENERIC_ISSUER)
|
21
|
-
cert.not_before = Time.now
|
22
|
-
cert.not_after
|
22
|
+
cert.not_before = cert.not_after = Time.now
|
23
|
+
cert.not_after += ONE_YEAR_SECONDS
|
23
24
|
cert.public_key = key.public_key
|
24
25
|
cert.serial = 0x0
|
25
26
|
cert.version = 2
|
@@ -56,7 +57,7 @@ module Aspera
|
|
56
57
|
else
|
57
58
|
Aspera.assert_type(certificate, Hash)
|
58
59
|
certificate = certificate.symbolize_keys
|
59
|
-
raise "unexpected key in certificate config: only: #{CERT_PARAMETERS.join(', ')}" if certificate.keys.any?{|
|
60
|
+
raise "unexpected key in certificate config: only: #{CERT_PARAMETERS.join(', ')}" if certificate.keys.any?{|key|!CERT_PARAMETERS.include?(key)}
|
60
61
|
webrick_options[:SSLPrivateKey] = if certificate.key?(:key)
|
61
62
|
OpenSSL::PKey::RSA.new(File.read(certificate[:key]))
|
62
63
|
else
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aspera-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent Martin
|
@@ -37,7 +37,7 @@ cert_chain:
|
|
37
37
|
eTf9kxhVM40wGQOECVNA8UsEEZHD48eF+csUYZtAJOF5oxTI8UyV9T/o6CgO0c9/
|
38
38
|
Gzz+Qm5ULOUcPiJLjSpaiTrkiIVYiDGnqNSr6R1Hb1c=
|
39
39
|
-----END CERTIFICATE-----
|
40
|
-
date: 2024-
|
40
|
+
date: 2024-08-21 00:00:00.000000000 Z
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: blankslate
|
@@ -390,6 +390,7 @@ files:
|
|
390
390
|
- README.md
|
391
391
|
- bin/ascli
|
392
392
|
- bin/asession
|
393
|
+
- examples/build_package.sh
|
393
394
|
- examples/dascli
|
394
395
|
- examples/proxy.pac
|
395
396
|
- examples/rubyc
|
@@ -403,6 +404,7 @@ files:
|
|
403
404
|
- lib/aspera/api/aoc.rb
|
404
405
|
- lib/aspera/api/ats.rb
|
405
406
|
- lib/aspera/api/cos_node.rb
|
407
|
+
- lib/aspera/api/httpgw.rb
|
406
408
|
- lib/aspera/api/node.rb
|
407
409
|
- lib/aspera/ascmd.rb
|
408
410
|
- lib/aspera/ascp/installation.rb
|
@@ -422,17 +424,19 @@ files:
|
|
422
424
|
- lib/aspera/cli/plugins/alee.rb
|
423
425
|
- lib/aspera/cli/plugins/aoc.rb
|
424
426
|
- lib/aspera/cli/plugins/ats.rb
|
425
|
-
- lib/aspera/cli/plugins/bss.rb
|
426
427
|
- lib/aspera/cli/plugins/config.rb
|
427
428
|
- lib/aspera/cli/plugins/console.rb
|
428
429
|
- lib/aspera/cli/plugins/cos.rb
|
429
430
|
- lib/aspera/cli/plugins/faspex.rb
|
430
431
|
- lib/aspera/cli/plugins/faspex5.rb
|
432
|
+
- lib/aspera/cli/plugins/faspio.rb
|
433
|
+
- lib/aspera/cli/plugins/httpgw.rb
|
431
434
|
- lib/aspera/cli/plugins/node.rb
|
432
435
|
- lib/aspera/cli/plugins/orchestrator.rb
|
433
436
|
- lib/aspera/cli/plugins/preview.rb
|
434
437
|
- lib/aspera/cli/plugins/server.rb
|
435
438
|
- lib/aspera/cli/plugins/shares.rb
|
439
|
+
- lib/aspera/cli/special_values.rb
|
436
440
|
- lib/aspera/cli/sync_actions.rb
|
437
441
|
- lib/aspera/cli/transfer_agent.rb
|
438
442
|
- lib/aspera/cli/transfer_progress.rb
|
@@ -466,7 +470,6 @@ files:
|
|
466
470
|
- lib/aspera/oauth/jwt.rb
|
467
471
|
- lib/aspera/oauth/url_json.rb
|
468
472
|
- lib/aspera/oauth/web.rb
|
469
|
-
- lib/aspera/open_application.rb
|
470
473
|
- lib/aspera/persistency_action_once.rb
|
471
474
|
- lib/aspera/persistency_folder.rb
|
472
475
|
- lib/aspera/preview/file_types.rb
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,71 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'aspera/rest'
|
4
|
-
|
5
|
-
module Aspera
|
6
|
-
module Cli
|
7
|
-
module Plugins
|
8
|
-
class Bss < Cli::BasicAuthPlugin
|
9
|
-
ACTIONS = %i[subscription].freeze
|
10
|
-
|
11
|
-
FIELDS = {
|
12
|
-
'bssSubscriptions' => %w[id name termVolumeGb termMonths trial startDate endDate plan renewalType chargeAgreementNumber customerName]
|
13
|
-
}.freeze
|
14
|
-
|
15
|
-
def initialize(**env)
|
16
|
-
super
|
17
|
-
end
|
18
|
-
|
19
|
-
def all_fields(name)
|
20
|
-
return FIELDS[name].join(' ')
|
21
|
-
end
|
22
|
-
|
23
|
-
def execute_action
|
24
|
-
if @api_bss.nil?
|
25
|
-
key = options.get_option(:password, mandatory: true)
|
26
|
-
@api_bss = Rest.new(
|
27
|
-
base_url: 'https://dashboard.bss.asperasoft.com/platform',
|
28
|
-
headers: {cookie: "_dashboard_key=#{key}"})
|
29
|
-
end
|
30
|
-
command = options.get_next_command(ACTIONS)
|
31
|
-
case command
|
32
|
-
when :subscription
|
33
|
-
command = options.get_next_command(%i[find show instances])
|
34
|
-
object = 'bssSubscriptions'
|
35
|
-
case command
|
36
|
-
when :find
|
37
|
-
query = options.get_option(:query, mandatory: true) # AOC_ORGANIZATION_QUERY AOC_USER_EMAIL
|
38
|
-
value = value_create_modify(command: command)
|
39
|
-
request = {
|
40
|
-
'variables' => {'filter' => {'key' => query, 'value' => value}},
|
41
|
-
'query' => "query($filter: BssSubscriptionFilter!) {#{object}(filter: $filter) { #{all_fields('bssSubscriptions')} } }"
|
42
|
-
}
|
43
|
-
result = @api_bss.create('graphql', request)[:data]
|
44
|
-
# give fields to keep order
|
45
|
-
return {type: :object_list, data: result['data'][object], fields: FIELDS['bssSubscriptions']}
|
46
|
-
when :show
|
47
|
-
id = instance_identifier
|
48
|
-
request = {
|
49
|
-
'variables' => {'id' => id},
|
50
|
-
'query' => "query($id: ID!) {#{object}(id: $id) { #{all_fields('bssSubscriptions')} roleAssignments(uniqueSubjectId: true) { id subjectId } " \
|
51
|
-
'instances { id state planId serviceId ssmSubscriptionId entitlement { id } aocOrganization { id subdomainName name status tier urlId trialExpiresAt ' \
|
52
|
-
'users(organizationAdmin: true) { id name email atsAdmin subscriptionAdmin } } } } }'
|
53
|
-
}
|
54
|
-
result = @api_bss.create('graphql', request)[:data]['data'][object].first
|
55
|
-
result.delete('instances')
|
56
|
-
return {type: :single_object, data: result}
|
57
|
-
when :instances
|
58
|
-
id = instance_identifier
|
59
|
-
request = {
|
60
|
-
'variables' => {'id' => id},
|
61
|
-
'query' => "query($id: ID!) {#{object}(id: $id) { aocOrganization { id subdomainName name status tier urlId trialExpiresAt } } } }"
|
62
|
-
}
|
63
|
-
result = @api_bss.create('graphql', request)[:data]['data'][object].first
|
64
|
-
return {type: :object_list, data: result['instances']}
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end # Bss
|
69
|
-
end # Plugins
|
70
|
-
end # Cli
|
71
|
-
end # Aspera
|
@@ -1,71 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'aspera/log'
|
4
|
-
require 'aspera/environment'
|
5
|
-
require 'rbconfig'
|
6
|
-
require 'singleton'
|
7
|
-
|
8
|
-
module Aspera
|
9
|
-
# Allows a user to open a Url
|
10
|
-
# if method is "text", then URL is displayed on terminal
|
11
|
-
# if method is "graphical", then the URL will be opened with the default browser.
|
12
|
-
class OpenApplication
|
13
|
-
include Singleton
|
14
|
-
class << self
|
15
|
-
USER_INTERFACES = %i[text graphical].freeze
|
16
|
-
# User Interfaces
|
17
|
-
def user_interfaces; USER_INTERFACES; end
|
18
|
-
|
19
|
-
def default_gui_mode
|
20
|
-
return :graphical if [Environment::OS_WINDOWS, Environment::OS_X].include?(Environment.os)
|
21
|
-
# unix family
|
22
|
-
return :graphical if ENV.key?('DISPLAY') && !ENV['DISPLAY'].empty?
|
23
|
-
return :text
|
24
|
-
end
|
25
|
-
|
26
|
-
# command must be non blocking
|
27
|
-
def uri_graphical(uri)
|
28
|
-
case Environment.os
|
29
|
-
when Environment::OS_X then return system('open', uri.to_s)
|
30
|
-
when Environment::OS_WINDOWS then return system('start', 'explorer', %Q{"#{uri}"})
|
31
|
-
when Environment::OS_LINUX then return system('xdg-open', uri.to_s)
|
32
|
-
else
|
33
|
-
raise "no graphical open method for #{Environment.os}"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def editor(file_path)
|
38
|
-
if ENV.key?('EDITOR')
|
39
|
-
system(ENV['EDITOR'], file_path.to_s)
|
40
|
-
elsif Environment.os.eql?(Environment::OS_WINDOWS)
|
41
|
-
system('notepad.exe', %Q{"#{file_path}"})
|
42
|
-
else
|
43
|
-
uri_graphical(file_path.to_s)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end # self
|
47
|
-
|
48
|
-
attr_accessor :url_method
|
49
|
-
|
50
|
-
def initialize
|
51
|
-
@url_method = self.class.default_gui_mode
|
52
|
-
end
|
53
|
-
|
54
|
-
# this is non blocking
|
55
|
-
def uri(the_url)
|
56
|
-
case @url_method
|
57
|
-
when :graphical
|
58
|
-
self.class.uri_graphical(the_url)
|
59
|
-
when :text
|
60
|
-
case the_url.to_s
|
61
|
-
when /^http/
|
62
|
-
puts "USER ACTION: please enter this url in a browser:\n#{the_url.to_s.red}\n"
|
63
|
-
else
|
64
|
-
puts "USER ACTION: open this:\n#{the_url.to_s.red}\n"
|
65
|
-
end
|
66
|
-
else
|
67
|
-
raise StandardError, "unsupported url open method: #{@url_method}"
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end # OpenApplication
|
71
|
-
end # Aspera
|