aspera-cli 4.22.0 → 4.23.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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +374 -364
  4. data/README.md +255 -155
  5. data/lib/aspera/agent/direct.rb +1 -1
  6. data/lib/aspera/api/aoc.rb +9 -12
  7. data/lib/aspera/api/httpgw.rb +8 -4
  8. data/lib/aspera/ascmd.rb +14 -6
  9. data/lib/aspera/ascp/installation.rb +6 -3
  10. data/lib/aspera/assert.rb +3 -3
  11. data/lib/aspera/cli/hints.rb +9 -1
  12. data/lib/aspera/cli/main.rb +1 -1
  13. data/lib/aspera/cli/manager.rb +1 -1
  14. data/lib/aspera/cli/plugin.rb +1 -1
  15. data/lib/aspera/cli/plugins/aoc.rb +33 -23
  16. data/lib/aspera/cli/plugins/config.rb +20 -15
  17. data/lib/aspera/cli/plugins/node.rb +96 -92
  18. data/lib/aspera/cli/plugins/server.rb +1 -0
  19. data/lib/aspera/cli/transfer_agent.rb +7 -11
  20. data/lib/aspera/cli/version.rb +1 -1
  21. data/lib/aspera/data_repository.rb +1 -0
  22. data/lib/aspera/environment.rb +1 -0
  23. data/lib/aspera/log.rb +1 -0
  24. data/lib/aspera/oauth/base.rb +2 -0
  25. data/lib/aspera/oauth/factory.rb +1 -0
  26. data/lib/aspera/preview/file_types.rb +40 -33
  27. data/lib/aspera/preview/generator.rb +1 -1
  28. data/lib/aspera/products/connect.rb +1 -0
  29. data/lib/aspera/rest.rb +18 -7
  30. data/lib/aspera/rest_error_analyzer.rb +1 -0
  31. data/lib/aspera/ssh.rb +1 -1
  32. data/lib/aspera/temp_file_manager.rb +1 -0
  33. data/lib/aspera/timer_limiter.rb +7 -5
  34. data/lib/aspera/transfer/async_conf.schema.yaml +716 -0
  35. data/lib/aspera/transfer/sync.rb +14 -4
  36. data/lib/aspera/transfer/sync_instance.schema.yaml +7 -0
  37. data/lib/aspera/transfer/sync_session.schema.yaml +7 -0
  38. data.tar.gz.sig +0 -0
  39. metadata +3 -5
  40. metadata.gz.sig +0 -0
  41. data/examples/dascli +0 -30
  42. data/examples/get_proto_file.rb +0 -8
  43. data/examples/proxy.pac +0 -60
@@ -17,8 +17,10 @@ module Aspera
17
17
  module Transfer
18
18
  # builds command line arg for async and execute it
19
19
  module Sync
20
- # sync direction, default is push
20
+ # sync direction
21
21
  DIRECTIONS = %i[push pull bidi].freeze
22
+ # default direction for sync
23
+ DEFAULT_DIRECTION = :push
22
24
  # JSON for async instance command line options
23
25
  INSTANCE_SCHEMA = CommandLineBuilder.read_schema(__FILE__, 'instance')
24
26
  SESSION_SCHEMA = CommandLineBuilder.read_schema(__FILE__, 'session')
@@ -26,6 +28,7 @@ module Aspera
26
28
  CMDLINE_PARAMS_KEYS = %w[instance sessions].freeze
27
29
 
28
30
  # Translation of transfer spec parameters to async v2 API (asyncs)
31
+ # TODO: complete this list with all transfer spec parameters or include in async json schema with x- parameters
29
32
  TSPEC_TO_ASYNC_CONF = {
30
33
  'remote_host' => 'remote.host',
31
34
  'remote_user' => 'remote.user',
@@ -87,6 +90,13 @@ module Aspera
87
90
  return certificates_to_use
88
91
  end
89
92
 
93
+ # Get symbol of sync direction, defaulting to :push
94
+ # @param params [Hash] sync parameters, old or new format
95
+ # @return [Symbol] direction symbol, one of :push, :pull, :bidi
96
+ def direction_sym(params)
97
+ (params['direction'] || DEFAULT_DIRECTION).to_sym
98
+ end
99
+
90
100
  # @param sync_params [Hash] sync parameters, old or new format
91
101
  # @param &block [nil, Proc] block to generate transfer spec, takes: direction (one of DIRECTIONS), local_dir, remote_dir
92
102
  def start(sync_params)
@@ -105,7 +115,7 @@ module Aspera
105
115
  Aspera.assert_type(remote['path'], String){'remote path'}
106
116
  # get transfer spec if possible, and feed back to new structure
107
117
  if block_given?
108
- transfer_spec = yield((sync_params['direction'] || 'push').to_sym, sync_params['local']['path'], remote['path'])
118
+ transfer_spec = yield(direction_sym(sync_params), sync_params['local']['path'], remote['path'])
109
119
  # translate transfer spec to async parameters
110
120
  TSPEC_TO_ASYNC_CONF.each do |ts_param, sy_path|
111
121
  next unless transfer_spec.key?(ts_param)
@@ -139,7 +149,7 @@ module Aspera
139
149
  sync_params['sessions'].each do |session|
140
150
  Aspera.assert_type(session['local_dir'], String){'local_dir'}
141
151
  Aspera.assert_type(session['remote_dir'], String){'remote_dir'}
142
- transfer_spec = yield((session['direction'] || 'push').to_sym, session['local_dir'], session['remote_dir'])
152
+ transfer_spec = yield(direction_sym(session), session['local_dir'], session['remote_dir'])
143
153
  SESSION_SCHEMA['properties'].each do |name, properties|
144
154
  if properties.key?('x-tspec')
145
155
  tspec_param = properties['x-tspec'].is_a?(TrueClass) ? name : properties['x-tspec'].to_s
@@ -158,7 +168,7 @@ module Aspera
158
168
  end
159
169
  sync_params['sessions'].each do |session_params|
160
170
  Aspera.assert_type(session_params, Hash)
161
- Aspera.assert(session_params.key?('name')){'session must contain at least name'}
171
+ Aspera.assert(session_params.key?('name')){'session must contain at least: name'}
162
172
  session_builder = CommandLineBuilder.new(session_params, SESSION_SCHEMA, Convert)
163
173
  session_builder.process_params
164
174
  session_builder.add_env_args(env_args)
@@ -1,4 +1,11 @@
1
+ $schema: https://json-schema.org/draft/2020-12/schema
2
+ $id: https://github.com/IBM/aspera-cli/tree/main/lib/aspera/transfer/sync_instance.schema.yaml
3
+ $comment: >-
4
+ `x-` fields documented in command_line_builder.rb
5
+ This spec is specific to ascli.
6
+ The native async conf format is now preferred.
1
7
  title: SyncInstanceSpec
8
+ description: Global parameters for async.
2
9
  type: object
3
10
  properties:
4
11
  alt_logdir:
@@ -1,4 +1,11 @@
1
+ $schema: https://json-schema.org/draft/2020-12/schema
2
+ $id: https://github.com/IBM/aspera-cli/tree/main/lib/aspera/transfer/sync_instance.schema.yaml
3
+ $comment: >-
4
+ `x-` fields documented in command_line_builder.rb
5
+ This spec is specific to ascli.
6
+ The native async conf format is now preferred.
1
7
  title: SyncSessionSpec
8
+ description: Sync session parameters for async.
2
9
  type: object
3
10
  properties:
4
11
  name:
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.22.0
4
+ version: 4.23.0
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: 2025-06-23 00:00:00.000000000 Z
40
+ date: 2025-08-12 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: blankslate
@@ -278,9 +278,6 @@ files:
278
278
  - README.md
279
279
  - bin/ascli
280
280
  - bin/asession
281
- - examples/dascli
282
- - examples/get_proto_file.rb
283
- - examples/proxy.pac
284
281
  - lib/aspera/agent/base.rb
285
282
  - lib/aspera/agent/connect.rb
286
283
  - lib/aspera/agent/desktop.rb
@@ -383,6 +380,7 @@ files:
383
380
  - lib/aspera/ssh.rb
384
381
  - lib/aspera/temp_file_manager.rb
385
382
  - lib/aspera/timer_limiter.rb
383
+ - lib/aspera/transfer/async_conf.schema.yaml
386
384
  - lib/aspera/transfer/convert.rb
387
385
  - lib/aspera/transfer/error.rb
388
386
  - lib/aspera/transfer/error_info.rb
metadata.gz.sig CHANGED
Binary file
data/examples/dascli DELETED
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env bash
2
- # set env var image to specify another docker image
3
- : "${image:=docker.io/martinlaurent/ascli}"
4
- # set env var version to specify another image version (default: latest version)
5
- : "${version:=latest}"
6
- # set env var imgtag to specify a specific image/version
7
- : "${imgtag=$image:$version}"
8
- # set env var `docker` to podman, to use podman
9
- : "${docker:=docker}"
10
- # set env var `docker_args` to add options to docker run (then, transform this var into array) # spellcheck disable=SC2086
11
- read -a add_dock_args <<< $docker_args
12
- # set env var ASCLI_HOME to set the config folder on host
13
- : "${ASCLI_HOME:=$HOME/.aspera/ascli}"
14
- # main config folder for ascli in container (same value as in `Dockerfile`)
15
- ascli_home_container=/home/cliuser/.aspera/ascli
16
- if test ! -d "$ASCLI_HOME";then
17
- echo "creating folder: $ASCLI_HOME"
18
- # create it if necessary to allow mounting the volume in container
19
- mkdir -p "$ASCLI_HOME"
20
- fi
21
- exec $docker run \
22
- --rm \
23
- --tty \
24
- --interactive \
25
- --user root \
26
- --env ASCLI_HOME="$ascli_home_container" \
27
- --volume "$ASCLI_HOME:$ascli_home_container:z" \
28
- "${add_dock_args[@]}" \
29
- "$imgtag" \
30
- "$@"
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'aspera/ascp/installation'
5
- require 'aspera/cli/transfer_progress'
6
- Aspera::RestParameters.instance.progress_bar = Aspera::Cli::TransferProgress.new
7
- # Retrieve `transfer.proto` from the web
8
- Aspera::Ascp::Installation.instance.install_sdk(folder: ARGV.first, backup: false, with_exe: false){ |name| name.end_with?('.proto') ? '/' : nil}
data/examples/proxy.pac DELETED
@@ -1,60 +0,0 @@
1
- /* demo proxy pac for `ascli` */
2
- function FindProxyForURL(url, host) {
3
- /* Normalize the URL for pattern matching */
4
- url = url.toLowerCase();
5
- host = host.toLowerCase();
6
-
7
- /* Don't proxy local host names */
8
- if (isPlainHostName(host)) {
9
- return 'DIRECT';
10
- }
11
-
12
- /* Don't proxy local domains */
13
- if (dnsDomainIs(host, ".example1.com") || (host == "example1.com")
14
- || dnsDomainIs(host, ".example2.com") || (host == "example2.com")
15
- || dnsDomainIs(host, ".example3.com") || (host == "example3.com")) {
16
- return 'DIRECT';
17
- }
18
-
19
- /* Don't proxy Windows Update */
20
- if ((host == "download.microsoft.com")
21
- || (host == "ntservicepack.microsoft.com")
22
- || (host == "cdm.microsoft.com") || (host == "wustat.windows.com")
23
- || (host == "windowsupdate.microsoft.com")
24
- || (dnsDomainIs(host, ".windowsupdate.microsoft.com"))
25
- || (host == "update.microsoft.com")
26
- || (dnsDomainIs(host, ".update.microsoft.com"))
27
- || (dnsDomainIs(host, ".windowsupdate.com"))) {
28
- return 'DIRECT';
29
- }
30
-
31
- if (isResolvable(host)) {
32
- var hostIP = dnsResolve(host);
33
-
34
- /* Don't proxy private addresses (RFC 3330) */
35
- if (isInNet(hostIP, '0.0.0.0', '255.0.0.0')
36
- || isInNet(hostIP, '10.0.0.0', '255.0.0.0')
37
- || isInNet(hostIP, '127.0.0.0', '255.0.0.0')
38
- || isInNet(hostIP, '169.254.0.0', '255.255.0.0')
39
- || isInNet(hostIP, '172.16.0.0', '255.240.0.0')
40
- || isInNet(hostIP, '192.0.2.0', '255.255.255.0')
41
- || isInNet(hostIP, '192.88.99.0', '255.255.255.0')
42
- || isInNet(hostIP, '192.168.0.0', '255.255.0.0')
43
- || isInNet(hostIP, '198.18.0.0', '255.254.0.0')
44
- || isInNet(hostIP, '224.0.0.0', '240.0.0.0')
45
- || isInNet(hostIP, '240.0.0.0', '240.0.0.0')) {
46
- return 'DIRECT';
47
- }
48
- }
49
-
50
- if (url.substring(0, 5) == 'http:' || url.substring(0, 6) == 'https:'
51
- || url.substring(0, 4) == 'ftp:') {
52
- return 'PROXY proxy.example.com:8080';
53
- }
54
-
55
- if (url.substring(0, 4) == 'ssh:') {
56
- return 'PROXY proxy.aspera.com:9092';
57
- }
58
-
59
- return 'DIRECT';
60
- }