aspera-cli 4.10.0 → 4.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/BUGS.md +19 -0
  4. data/CHANGELOG.md +528 -0
  5. data/CONTRIBUTING.md +143 -0
  6. data/README.md +977 -589
  7. data/bin/ascli +4 -4
  8. data/bin/asession +12 -12
  9. data/docs/test_env.conf +29 -19
  10. data/examples/aoc.rb +6 -6
  11. data/examples/dascli +18 -16
  12. data/examples/faspex4.rb +15 -15
  13. data/examples/node.rb +12 -12
  14. data/examples/proxy.pac +2 -2
  15. data/examples/server.rb +12 -12
  16. data/lib/aspera/aoc.rb +344 -272
  17. data/lib/aspera/ascmd.rb +56 -54
  18. data/lib/aspera/ats_api.rb +4 -4
  19. data/lib/aspera/cli/basic_auth_plugin.rb +15 -12
  20. data/lib/aspera/cli/extended_value.rb +9 -9
  21. data/lib/aspera/cli/{formater.rb → formatter.rb} +69 -69
  22. data/lib/aspera/cli/listener/line_dump.rb +1 -1
  23. data/lib/aspera/cli/listener/logger.rb +1 -1
  24. data/lib/aspera/cli/listener/progress.rb +5 -6
  25. data/lib/aspera/cli/listener/progress_multi.rb +16 -21
  26. data/lib/aspera/cli/main.rb +72 -73
  27. data/lib/aspera/cli/manager.rb +112 -112
  28. data/lib/aspera/cli/plugin.rb +68 -48
  29. data/lib/aspera/cli/plugins/alee.rb +4 -4
  30. data/lib/aspera/cli/plugins/aoc.rb +322 -720
  31. data/lib/aspera/cli/plugins/ats.rb +50 -52
  32. data/lib/aspera/cli/plugins/bss.rb +10 -10
  33. data/lib/aspera/cli/plugins/config.rb +514 -410
  34. data/lib/aspera/cli/plugins/console.rb +12 -12
  35. data/lib/aspera/cli/plugins/cos.rb +18 -20
  36. data/lib/aspera/cli/plugins/faspex.rb +134 -136
  37. data/lib/aspera/cli/plugins/faspex5.rb +235 -70
  38. data/lib/aspera/cli/plugins/node.rb +378 -309
  39. data/lib/aspera/cli/plugins/orchestrator.rb +52 -49
  40. data/lib/aspera/cli/plugins/preview.rb +129 -120
  41. data/lib/aspera/cli/plugins/server.rb +137 -83
  42. data/lib/aspera/cli/plugins/shares.rb +77 -52
  43. data/lib/aspera/cli/plugins/sync.rb +13 -33
  44. data/lib/aspera/cli/transfer_agent.rb +61 -61
  45. data/lib/aspera/cli/version.rb +2 -1
  46. data/lib/aspera/colors.rb +3 -3
  47. data/lib/aspera/command_line_builder.rb +78 -74
  48. data/lib/aspera/cos_node.rb +31 -29
  49. data/lib/aspera/data_repository.rb +1 -1
  50. data/lib/aspera/environment.rb +30 -28
  51. data/lib/aspera/fasp/agent_base.rb +17 -15
  52. data/lib/aspera/fasp/agent_connect.rb +34 -32
  53. data/lib/aspera/fasp/agent_direct.rb +70 -73
  54. data/lib/aspera/fasp/agent_httpgw.rb +79 -74
  55. data/lib/aspera/fasp/agent_node.rb +26 -26
  56. data/lib/aspera/fasp/agent_trsdk.rb +20 -20
  57. data/lib/aspera/fasp/error.rb +3 -2
  58. data/lib/aspera/fasp/error_info.rb +11 -8
  59. data/lib/aspera/fasp/installation.rb +80 -80
  60. data/lib/aspera/fasp/listener.rb +2 -2
  61. data/lib/aspera/fasp/parameters.rb +103 -92
  62. data/lib/aspera/fasp/parameters.yaml +313 -214
  63. data/lib/aspera/fasp/resume_policy.rb +10 -10
  64. data/lib/aspera/fasp/transfer_spec.rb +22 -2
  65. data/lib/aspera/fasp/uri.rb +7 -7
  66. data/lib/aspera/faspex_gw.rb +80 -159
  67. data/lib/aspera/faspex_postproc.rb +77 -0
  68. data/lib/aspera/hash_ext.rb +3 -3
  69. data/lib/aspera/id_generator.rb +5 -5
  70. data/lib/aspera/keychain/encrypted_hash.rb +23 -28
  71. data/lib/aspera/keychain/macos_security.rb +21 -20
  72. data/lib/aspera/log.rb +13 -13
  73. data/lib/aspera/nagios.rb +24 -23
  74. data/lib/aspera/node.rb +217 -38
  75. data/lib/aspera/oauth.rb +78 -74
  76. data/lib/aspera/open_application.rb +19 -11
  77. data/lib/aspera/persistency_action_once.rb +4 -4
  78. data/lib/aspera/persistency_folder.rb +13 -13
  79. data/lib/aspera/preview/file_types.rb +8 -8
  80. data/lib/aspera/preview/generator.rb +67 -67
  81. data/lib/aspera/preview/utils.rb +27 -27
  82. data/lib/aspera/proxy_auto_config.js +63 -63
  83. data/lib/aspera/proxy_auto_config.rb +19 -19
  84. data/lib/aspera/rest.rb +65 -67
  85. data/lib/aspera/rest_call_error.rb +2 -1
  86. data/lib/aspera/rest_error_analyzer.rb +22 -21
  87. data/lib/aspera/rest_errors_aspera.rb +16 -16
  88. data/lib/aspera/secret_hider.rb +17 -14
  89. data/lib/aspera/ssh.rb +15 -14
  90. data/lib/aspera/sync.rb +177 -62
  91. data/lib/aspera/temp_file_manager.rb +2 -2
  92. data/lib/aspera/uri_reader.rb +4 -4
  93. data/lib/aspera/web_auth.rb +13 -64
  94. data/lib/aspera/web_server_simple.rb +76 -0
  95. data.tar.gz.sig +0 -0
  96. metadata +11 -6
  97. metadata.gz.sig +0 -0
@@ -6,16 +6,16 @@ require 'aspera/nagios'
6
6
  module Aspera
7
7
  module Cli
8
8
  module Plugins
9
- class Console < BasicAuthPlugin
9
+ class Console < Aspera::Cli::BasicAuthPlugin
10
10
  DEFAULT_FILTER_AGE_SECONDS = 3 * 3600
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')
14
+ options.add_opt_date(:filter_from, 'only after date')
15
+ options.add_opt_date(:filter_to, 'only before date')
16
16
  time_now = Time.now
17
- options.set_option(:filter_from,Manager.time_to_string(time_now - DEFAULT_FILTER_AGE_SECONDS))
18
- options.set_option(:filter_to,Manager.time_to_string(time_now))
17
+ options.set_option(:filter_from, Manager.time_to_string(time_now - DEFAULT_FILTER_AGE_SECONDS))
18
+ options.set_option(:filter_to, Manager.time_to_string(time_now))
19
19
  options.parse_options!
20
20
  end
21
21
 
@@ -29,9 +29,9 @@ module Aspera
29
29
  nagios = Nagios.new
30
30
  begin
31
31
  api_console.read('ssh_keys')
32
- nagios.add_ok('console api','accessible')
32
+ nagios.add_ok('console api', 'accessible')
33
33
  rescue StandardError => e
34
- nagios.add_critical('console api',e.to_s)
34
+ nagios.add_critical('console api', e.to_s)
35
35
  end
36
36
  return nagios.result
37
37
  when :transfer
@@ -41,11 +41,11 @@ module Aspera
41
41
  command = options.get_next_command(%i[list submit])
42
42
  case command
43
43
  when :list
44
- return {type: :object_list,data: api_console.read('smart_transfers')[:data]}
44
+ return {type: :object_list, data: api_console.read('smart_transfers')[:data]}
45
45
  when :submit
46
46
  smart_id = options.get_next_argument('smart_id')
47
47
  params = options.get_next_argument('transfer parameters')
48
- return {type: :object_list,data: api_console.create('smart_transfers/' + smart_id,params)[:data]}
48
+ return {type: :object_list, data: api_console.create('smart_transfers/' + smart_id, params)[:data]}
49
49
  end
50
50
  when :current
51
51
  command = options.get_next_command([:list])
@@ -53,9 +53,9 @@ module Aspera
53
53
  when :list
54
54
  return {
55
55
  type: :object_list,
56
- data: api_console.read('transfers',{
57
- 'from' => options.get_option(:filter_from,is_type: :mandatory),
58
- 'to' => options.get_option(:filter_to,is_type: :mandatory)
56
+ data: api_console.read('transfers', {
57
+ 'from' => options.get_option(:filter_from, is_type: :mandatory),
58
+ 'to' => options.get_option(:filter_to, is_type: :mandatory)
59
59
  })[:data],
60
60
  fields: %w[id contact name status]}
61
61
  end
@@ -7,18 +7,18 @@ require 'aspera/cos_node'
7
7
  module Aspera
8
8
  module Cli
9
9
  module Plugins
10
- class Cos < Plugin
10
+ class Cos < Aspera::Cli::Plugin
11
11
  def initialize(env)
12
12
  super(env)
13
13
  @service_creds = nil
14
- options.add_opt_simple(:bucket,'Bucket name')
15
- options.add_opt_simple(:endpoint,'Storage endpoint url')
16
- options.add_opt_simple(:apikey,'Storage API key')
17
- options.add_opt_simple(:crn,'Ressource instance id')
18
- options.add_opt_simple(:service_credentials,'IBM Cloud service credentials (Hash)')
19
- options.add_opt_simple(:region,'Storage region')
20
- options.add_opt_simple(:identity,"Authentication url (#{CosNode::IBM_CLOUD_TOKEN_URL})")
21
- options.set_option(:identity,CosNode::IBM_CLOUD_TOKEN_URL)
14
+ options.add_opt_simple(:bucket, 'Bucket name')
15
+ options.add_opt_simple(:endpoint, 'Storage endpoint url')
16
+ options.add_opt_simple(:apikey, 'Storage API key')
17
+ options.add_opt_simple(:crn, 'Resource instance id')
18
+ options.add_opt_simple(:service_credentials, 'IBM Cloud service credentials (Hash)')
19
+ options.add_opt_simple(:region, 'Storage region')
20
+ options.add_opt_simple(:identity, "Authentication url (#{CosNode::IBM_CLOUD_TOKEN_URL})")
21
+ options.set_option(:identity, CosNode::IBM_CLOUD_TOKEN_URL)
22
22
  options.parse_options!
23
23
  end
24
24
 
@@ -28,26 +28,24 @@ module Aspera
28
28
  command = options.get_next_command(ACTIONS)
29
29
  case command
30
30
  when :node
31
- bucket_name = options.get_option(:bucket,is_type: :mandatory)
31
+ bucket_name = options.get_option(:bucket, is_type: :mandatory)
32
32
  # get service credentials, Hash, e.g. @json:@file:...
33
33
  service_credentials = options.get_option(:service_credentials)
34
34
  storage_endpoint = options.get_option(:endpoint)
35
- raise CliBadArgument,'one of: endpoint or service_credentials is required' if service_credentials.nil? && storage_endpoint.nil?
36
- raise CliBadArgument,'endpoint and service_credentials are mutually exclusive' unless service_credentials.nil? || storage_endpoint.nil?
35
+ raise CliBadArgument, 'one of: endpoint or service_credentials is required' if service_credentials.nil? && storage_endpoint.nil?
36
+ raise CliBadArgument, 'endpoint and service_credentials are mutually exclusive' unless service_credentials.nil? || storage_endpoint.nil?
37
37
  if service_credentials.nil?
38
- service_api_key = options.get_option(:apikey,is_type: :mandatory)
39
- instance_id = options.get_option(:crn,is_type: :mandatory)
38
+ service_api_key = options.get_option(:apikey, is_type: :mandatory)
39
+ instance_id = options.get_option(:crn, is_type: :mandatory)
40
40
  else
41
- params=CosNode.parameters_from_svc_creds(service_credentials,options.get_option(:region,is_type: :mandatory))
41
+ params = CosNode.parameters_from_svc_creds(service_credentials, options.get_option(:region, is_type: :mandatory))
42
42
  storage_endpoint = params[:storage_endpoint]
43
43
  service_api_key = params[:service_api_key]
44
44
  instance_id = params[:instance_id]
45
45
  end
46
- api_node = CosNode.new(bucket_name,storage_endpoint,instance_id,service_api_key,options.get_option(:identity,is_type: :mandatory))
47
- #command=self.options.get_next_command(Node::ACTIONS)
48
- #command=self.options.get_next_command(Node::COMMON_ACTIONS)
49
- command = options.get_next_command(%i[upload download info access_key api_details transfer])
50
- node_plugin = Node.new(@agents.merge(skip_basic_auth_options: true, node_api: api_node, add_request_param: api_node.add_ts))
46
+ api_node = CosNode.new(bucket_name, storage_endpoint, instance_id, service_api_key, options.get_option(:identity, is_type: :mandatory))
47
+ node_plugin = Node.new(@agents.merge(skip_basic_auth_options: true, node_api: api_node))
48
+ command = options.get_next_command(Node::COMMANDS_COS)
51
49
  return node_plugin.execute_action(command)
52
50
  end
53
51
  end