aspera-cli 4.5.0 → 4.8.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 +1 -0
- data/README.md +1894 -1574
- data/bin/ascli +21 -1
- data/bin/asession +38 -34
- data/docs/test_env.conf +14 -3
- data/examples/aoc.rb +17 -15
- data/examples/dascli +26 -0
- data/examples/faspex4.rb +42 -35
- data/examples/proxy.pac +1 -1
- data/examples/transfer.rb +38 -37
- data/lib/aspera/aoc.rb +245 -205
- data/lib/aspera/ascmd.rb +111 -90
- data/lib/aspera/ats_api.rb +16 -14
- data/lib/aspera/cli/basic_auth_plugin.rb +19 -18
- data/lib/aspera/cli/extended_value.rb +50 -39
- data/lib/aspera/cli/formater.rb +161 -135
- data/lib/aspera/cli/info.rb +18 -0
- data/lib/aspera/cli/listener/line_dump.rb +4 -2
- data/lib/aspera/cli/listener/logger.rb +3 -1
- data/lib/aspera/cli/listener/progress.rb +20 -21
- data/lib/aspera/cli/listener/progress_multi.rb +29 -31
- data/lib/aspera/cli/main.rb +194 -183
- data/lib/aspera/cli/manager.rb +213 -206
- data/lib/aspera/cli/plugin.rb +71 -49
- data/lib/aspera/cli/plugins/alee.rb +8 -7
- data/lib/aspera/cli/plugins/aoc.rb +675 -558
- data/lib/aspera/cli/plugins/ats.rb +116 -109
- data/lib/aspera/cli/plugins/bss.rb +35 -34
- data/lib/aspera/cli/plugins/config.rb +722 -542
- data/lib/aspera/cli/plugins/console.rb +28 -22
- data/lib/aspera/cli/plugins/cos.rb +28 -37
- data/lib/aspera/cli/plugins/faspex.rb +281 -227
- data/lib/aspera/cli/plugins/faspex5.rb +129 -84
- data/lib/aspera/cli/plugins/node.rb +426 -232
- data/lib/aspera/cli/plugins/orchestrator.rb +106 -98
- data/lib/aspera/cli/plugins/preview.rb +196 -191
- data/lib/aspera/cli/plugins/server.rb +131 -126
- data/lib/aspera/cli/plugins/shares.rb +49 -36
- data/lib/aspera/cli/plugins/sync.rb +27 -28
- data/lib/aspera/cli/transfer_agent.rb +84 -79
- data/lib/aspera/cli/version.rb +3 -1
- data/lib/aspera/colors.rb +37 -28
- data/lib/aspera/command_line_builder.rb +84 -63
- data/lib/aspera/cos_node.rb +68 -34
- data/lib/aspera/data_repository.rb +4 -2
- data/lib/aspera/environment.rb +61 -46
- data/lib/aspera/fasp/agent_base.rb +36 -31
- data/lib/aspera/fasp/agent_connect.rb +44 -37
- data/lib/aspera/fasp/agent_direct.rb +101 -104
- data/lib/aspera/fasp/agent_httpgw.rb +91 -90
- data/lib/aspera/fasp/agent_node.rb +36 -33
- data/lib/aspera/fasp/agent_trsdk.rb +28 -31
- data/lib/aspera/fasp/error.rb +3 -1
- data/lib/aspera/fasp/error_info.rb +81 -54
- data/lib/aspera/fasp/installation.rb +171 -151
- data/lib/aspera/fasp/listener.rb +2 -0
- data/lib/aspera/fasp/parameters.rb +105 -111
- data/lib/aspera/fasp/parameters.yaml +305 -249
- data/lib/aspera/fasp/resume_policy.rb +20 -20
- data/lib/aspera/fasp/transfer_spec.rb +27 -0
- data/lib/aspera/fasp/uri.rb +31 -29
- data/lib/aspera/faspex_gw.rb +95 -118
- data/lib/aspera/hash_ext.rb +12 -13
- data/lib/aspera/id_generator.rb +11 -9
- data/lib/aspera/keychain/encrypted_hash.rb +73 -57
- data/lib/aspera/keychain/macos_security.rb +27 -29
- data/lib/aspera/log.rb +40 -39
- data/lib/aspera/nagios.rb +24 -22
- data/lib/aspera/node.rb +38 -30
- data/lib/aspera/oauth.rb +217 -248
- data/lib/aspera/open_application.rb +9 -7
- data/lib/aspera/persistency_action_once.rb +15 -14
- data/lib/aspera/persistency_folder.rb +15 -18
- data/lib/aspera/preview/file_types.rb +266 -270
- data/lib/aspera/preview/generator.rb +94 -92
- data/lib/aspera/preview/image_error.png +0 -0
- data/lib/aspera/preview/options.rb +20 -17
- data/lib/aspera/preview/utils.rb +99 -102
- data/lib/aspera/preview/video_error.png +0 -0
- data/lib/aspera/{proxy_auto_config.erb.js → proxy_auto_config.js} +23 -31
- data/lib/aspera/proxy_auto_config.rb +114 -21
- data/lib/aspera/rest.rb +144 -142
- data/lib/aspera/rest_call_error.rb +3 -2
- data/lib/aspera/rest_error_analyzer.rb +31 -31
- data/lib/aspera/rest_errors_aspera.rb +18 -16
- data/lib/aspera/secret_hider.rb +68 -0
- data/lib/aspera/ssh.rb +20 -16
- data/lib/aspera/sync.rb +57 -54
- data/lib/aspera/temp_file_manager.rb +20 -14
- data/lib/aspera/timer_limiter.rb +10 -8
- data/lib/aspera/uri_reader.rb +14 -15
- data/lib/aspera/web_auth.rb +85 -80
- data.tar.gz.sig +0 -0
- metadata +169 -40
- metadata.gz.sig +2 -0
- data/bin/dascli +0 -13
- data/docs/Makefile +0 -63
- data/docs/README.erb.md +0 -4221
- data/docs/README.md +0 -13
- data/docs/diagrams.txt +0 -49
- data/docs/doc_tools.rb +0 -58
- data/lib/aspera/cli/plugins/shares2.rb +0 -114
- data/lib/aspera/fasp/default.rb +0 -17
data/lib/aspera/cli/plugin.rb
CHANGED
@@ -1,97 +1,120 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Aspera
|
2
4
|
module Cli
|
3
5
|
# base class for plugins modules
|
4
6
|
class Plugin
|
5
7
|
# operation without id
|
6
|
-
GLOBAL_OPS=[
|
8
|
+
GLOBAL_OPS = %i[create list].freeze
|
7
9
|
# operation on specific instance
|
8
|
-
INSTANCE_OPS=[
|
9
|
-
ALL_OPS=[GLOBAL_OPS,INSTANCE_OPS].flatten
|
10
|
+
INSTANCE_OPS = %i[modify delete show].freeze
|
11
|
+
ALL_OPS = [GLOBAL_OPS,INSTANCE_OPS].flatten.freeze
|
10
12
|
# max number of items for list command
|
11
|
-
MAX_ITEMS='max'
|
13
|
+
MAX_ITEMS = 'max'
|
12
14
|
# max number of pages for list command
|
13
|
-
MAX_PAGES='pmax'
|
15
|
+
MAX_PAGES = 'pmax'
|
16
|
+
|
17
|
+
#AGENTS=%i[options transfer config formater persistency].freeze
|
14
18
|
|
15
|
-
|
19
|
+
# global for inherited classes
|
20
|
+
@@options_created = false # rubocop:disable Style/ClassVars
|
16
21
|
|
17
22
|
def initialize(env)
|
18
|
-
|
19
|
-
raise
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
23
|
+
raise 'must be Hash' unless env.is_a?(Hash)
|
24
|
+
#env.each_key {|k| raise "wrong agent key #{k}" unless AGENTS.include?(k)}
|
25
|
+
@agents = env
|
26
|
+
# check presence in descendant of mandatory method and constant
|
27
|
+
raise StandardError,"missing method 'execute_action' in #{self.class}" unless respond_to?(:execute_action)
|
28
|
+
raise StandardError,'ACTIONS shall be redefined by subclass' unless self.class.constants.include?(:ACTIONS)
|
29
|
+
options.parser.separator('')
|
30
|
+
options.parser.separator("COMMAND: #{self.class.name.split('::').last.downcase}")
|
31
|
+
options.parser.separator("SUBCOMMANDS: #{self.class.const_get(:ACTIONS).map(&:to_s).join(' ')}")
|
32
|
+
options.parser.separator('OPTIONS:')
|
33
|
+
return if @@options_created
|
34
|
+
options.add_opt_simple(:value,'extended value for create, update, list filter')
|
35
|
+
options.add_opt_simple(:property,'name of property to set')
|
36
|
+
options.add_opt_simple(:id,"resource identifier (#{INSTANCE_OPS.join(',')})")
|
37
|
+
options.parse_options!
|
38
|
+
@@options_created = true # rubocop:disable Style/ClassVars
|
34
39
|
end
|
35
40
|
|
36
41
|
# must be called AFTER the instance action
|
37
|
-
def instance_identifier
|
38
|
-
res_id=
|
39
|
-
res_id=
|
42
|
+
def instance_identifier
|
43
|
+
res_id = options.get_option(:id)
|
44
|
+
res_id = options.get_next_argument('identifier') if res_id.nil?
|
40
45
|
return res_id
|
41
46
|
end
|
42
47
|
|
43
|
-
|
44
|
-
|
48
|
+
# TODO
|
49
|
+
def get_next_id_command(instance_ops: INSTANCE_OPS,global_ops: GLOBAL_OPS)
|
50
|
+
return get_next_argument('command',expected: command_list)
|
51
|
+
end
|
52
|
+
|
53
|
+
# @param command [Symbol] command to execute: create show list modify delete
|
54
|
+
# @param rest_api [Rest] api to use
|
55
|
+
# @param res_class_path [String] sub path in URL to resource relative to base url
|
56
|
+
# @param display_fields [Array] fields to display by default
|
57
|
+
# @param id_default [String] default identifier to use for existing entity commands (show, modify)
|
58
|
+
# @param item_list_key [String] result is in a subkey of the json
|
59
|
+
def entity_command(command,rest_api,res_class_path,display_fields: nil,id_default: nil,item_list_key: false)
|
45
60
|
if INSTANCE_OPS.include?(command)
|
46
61
|
begin
|
47
|
-
one_res_id=instance_identifier
|
48
|
-
rescue => e
|
62
|
+
one_res_id = instance_identifier
|
63
|
+
rescue StandardError => e
|
49
64
|
raise e if id_default.nil?
|
50
|
-
one_res_id=id_default
|
65
|
+
one_res_id = id_default
|
51
66
|
end
|
52
|
-
one_res_path="#{res_class_path}/#{one_res_id}"
|
67
|
+
one_res_path = "#{res_class_path}/#{one_res_id}"
|
53
68
|
end
|
54
69
|
# parameters mandatory for create/modify
|
55
|
-
if [
|
56
|
-
parameters=
|
70
|
+
if %i[create modify].include?(command)
|
71
|
+
parameters = options.get_option(:value,is_type: :mandatory)
|
57
72
|
end
|
58
73
|
# parameters optional for list
|
59
74
|
if [:list].include?(command)
|
60
|
-
parameters=
|
75
|
+
parameters = options.get_option(:value)
|
61
76
|
end
|
62
77
|
case command
|
63
78
|
when :create
|
64
|
-
return {:
|
79
|
+
return {type: :single_object, data: rest_api.create(res_class_path,parameters)[:data], fields: display_fields}
|
65
80
|
when :show
|
66
|
-
return {:
|
81
|
+
return {type: :single_object, data: rest_api.read(one_res_path)[:data], fields: display_fields}
|
67
82
|
when :list
|
68
|
-
resp=rest_api.read(res_class_path,parameters)
|
69
|
-
data=resp[:data]
|
83
|
+
resp = rest_api.read(res_class_path,parameters)
|
84
|
+
data = resp[:data]
|
70
85
|
# TODO: not generic : which application is this for ?
|
71
86
|
if resp[:http]['Content-Type'].start_with?('application/vnd.api+json')
|
72
|
-
data=data[res_class_path]
|
87
|
+
data = data[res_class_path]
|
73
88
|
end
|
74
|
-
|
75
|
-
|
89
|
+
if item_list_key
|
90
|
+
item_list=data[item_list_key]
|
91
|
+
total_count=data['total_count']
|
92
|
+
if !total_count.nil?
|
93
|
+
count_msg = "Items: #{item_list.length}/#{total_count}"
|
94
|
+
count_msg = count_msg.bg_red unless item_list.length.eql?(total_count.to_i)
|
95
|
+
self.format.display_status(count_msg)
|
96
|
+
end
|
97
|
+
data = item_list
|
98
|
+
end
|
99
|
+
return {type: :object_list, data: data, fields: display_fields}
|
76
100
|
when :modify
|
77
|
-
property=
|
78
|
-
parameters={property => parameters} unless property.nil?
|
101
|
+
property = options.get_option(:property)
|
102
|
+
parameters = {property => parameters} unless property.nil?
|
79
103
|
rest_api.update(one_res_path,parameters)
|
80
104
|
return Main.result_status('modified')
|
81
105
|
when :delete
|
82
106
|
rest_api.delete(one_res_path)
|
83
|
-
return Main.result_status(
|
107
|
+
return Main.result_status('deleted')
|
84
108
|
else
|
85
109
|
raise "unknown action: #{command}"
|
86
110
|
end
|
87
|
-
raise "internal error should not reach here"
|
88
111
|
end
|
89
112
|
|
90
113
|
# implement generic rest operations on given resource path
|
91
|
-
def entity_action(rest_api,res_class_path
|
114
|
+
def entity_action(rest_api,res_class_path,**opts)
|
92
115
|
#res_name=res_class_path.gsub(%r{^.*/},'').gsub(%r{s$},'').gsub('_',' ')
|
93
|
-
command=
|
94
|
-
return entity_command(command,rest_api,res_class_path
|
116
|
+
command = options.get_next_command(ALL_OPS)
|
117
|
+
return entity_command(command,rest_api,res_class_path,**opts)
|
95
118
|
end
|
96
119
|
|
97
120
|
# shortcuts for plugin environment
|
@@ -104,7 +127,6 @@ module Aspera
|
|
104
127
|
def format; return @agents[:formater];end
|
105
128
|
|
106
129
|
def persistency; return @agents[:persistency];end
|
107
|
-
|
108
130
|
end # Plugin
|
109
131
|
end # Cli
|
110
132
|
end # Aspera
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'aspera/rest'
|
2
4
|
require 'aspera/aoc'
|
3
5
|
|
@@ -5,17 +7,16 @@ module Aspera
|
|
5
7
|
module Cli
|
6
8
|
module Plugins
|
7
9
|
class Alee < BasicAuthPlugin
|
8
|
-
|
9
|
-
ACTIONS=[ :entitlement ]
|
10
|
+
ACTIONS = %i[entitlement].freeze
|
10
11
|
|
11
12
|
def execute_action
|
12
|
-
command=
|
13
|
+
command = options.get_next_command(ACTIONS)
|
13
14
|
case command
|
14
15
|
when :entitlement
|
15
|
-
entitlement_id =
|
16
|
-
customer_id =
|
17
|
-
api_metering=AoC.metering_api(entitlement_id,customer_id)
|
18
|
-
return {:
|
16
|
+
entitlement_id = options.get_option(:username,is_type: :mandatory)
|
17
|
+
customer_id = options.get_option(:password,is_type: :mandatory)
|
18
|
+
api_metering = AoC.metering_api(entitlement_id,customer_id)
|
19
|
+
return {type: :single_object, data: api_metering.read('entitlement')[:data]}
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end # Aspera
|