aspera-cli 4.12.0 → 4.14.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 (80) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +45 -5
  4. data/CONTRIBUTING.md +113 -22
  5. data/README.md +1289 -754
  6. data/bin/ascli +3 -3
  7. data/examples/dascli +1 -1
  8. data/examples/rubyc +24 -0
  9. data/lib/aspera/aoc.rb +63 -74
  10. data/lib/aspera/ascmd.rb +5 -3
  11. data/lib/aspera/cli/basic_auth_plugin.rb +6 -6
  12. data/lib/aspera/cli/extended_value.rb +24 -37
  13. data/lib/aspera/cli/formatter.rb +23 -25
  14. data/lib/aspera/cli/info.rb +2 -4
  15. data/lib/aspera/cli/main.rb +27 -27
  16. data/lib/aspera/cli/manager.rb +143 -120
  17. data/lib/aspera/cli/plugin.rb +88 -43
  18. data/lib/aspera/cli/plugins/alee.rb +2 -2
  19. data/lib/aspera/cli/plugins/aoc.rb +235 -104
  20. data/lib/aspera/cli/plugins/ats.rb +16 -18
  21. data/lib/aspera/cli/plugins/bss.rb +3 -3
  22. data/lib/aspera/cli/plugins/config.rb +190 -373
  23. data/lib/aspera/cli/plugins/console.rb +4 -6
  24. data/lib/aspera/cli/plugins/cos.rb +12 -13
  25. data/lib/aspera/cli/plugins/faspex.rb +21 -21
  26. data/lib/aspera/cli/plugins/faspex5.rb +399 -150
  27. data/lib/aspera/cli/plugins/node.rb +260 -174
  28. data/lib/aspera/cli/plugins/orchestrator.rb +15 -18
  29. data/lib/aspera/cli/plugins/preview.rb +40 -62
  30. data/lib/aspera/cli/plugins/server.rb +33 -16
  31. data/lib/aspera/cli/plugins/shares.rb +24 -33
  32. data/lib/aspera/cli/plugins/sync.rb +6 -6
  33. data/lib/aspera/cli/transfer_agent.rb +47 -30
  34. data/lib/aspera/cli/version.rb +2 -1
  35. data/lib/aspera/colors.rb +9 -7
  36. data/lib/aspera/command_line_builder.rb +2 -1
  37. data/lib/aspera/cos_node.rb +1 -1
  38. data/lib/aspera/data/6 +0 -0
  39. data/lib/aspera/environment.rb +7 -3
  40. data/lib/aspera/fasp/agent_connect.rb +6 -1
  41. data/lib/aspera/fasp/agent_direct.rb +17 -17
  42. data/lib/aspera/fasp/agent_httpgw.rb +138 -60
  43. data/lib/aspera/fasp/agent_node.rb +14 -4
  44. data/lib/aspera/fasp/agent_trsdk.rb +2 -0
  45. data/lib/aspera/fasp/error_info.rb +2 -0
  46. data/lib/aspera/fasp/installation.rb +19 -19
  47. data/lib/aspera/fasp/parameters.rb +29 -20
  48. data/lib/aspera/fasp/parameters.yaml +5 -2
  49. data/lib/aspera/fasp/resume_policy.rb +3 -3
  50. data/lib/aspera/fasp/transfer_spec.rb +8 -5
  51. data/lib/aspera/fasp/uri.rb +23 -21
  52. data/lib/aspera/faspex_gw.rb +1 -0
  53. data/lib/aspera/faspex_postproc.rb +3 -3
  54. data/lib/aspera/hash_ext.rb +12 -2
  55. data/lib/aspera/keychain/macos_security.rb +13 -13
  56. data/lib/aspera/log.rb +1 -0
  57. data/lib/aspera/node.rb +73 -84
  58. data/lib/aspera/oauth.rb +4 -3
  59. data/lib/aspera/persistency_action_once.rb +1 -1
  60. data/lib/aspera/preview/file_types.rb +8 -6
  61. data/lib/aspera/preview/generator.rb +23 -11
  62. data/lib/aspera/preview/options.rb +3 -2
  63. data/lib/aspera/preview/terminal.rb +80 -0
  64. data/lib/aspera/preview/utils.rb +11 -11
  65. data/lib/aspera/proxy_auto_config.js +2 -2
  66. data/lib/aspera/rest.rb +42 -4
  67. data/lib/aspera/rest_call_error.rb +3 -1
  68. data/lib/aspera/secret_hider.rb +10 -5
  69. data/lib/aspera/ssh.rb +1 -1
  70. data/lib/aspera/sync.rb +41 -33
  71. data/lib/aspera/web_server_simple.rb +22 -18
  72. data.tar.gz.sig +0 -0
  73. metadata +40 -48
  74. metadata.gz.sig +0 -0
  75. data/docs/test_env.conf +0 -179
  76. data/examples/aoc.rb +0 -30
  77. data/examples/faspex4.rb +0 -94
  78. data/examples/node.rb +0 -96
  79. data/examples/server.rb +0 -93
  80. data/lib/aspera/data/7 +0 -0
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.12.0
4
+ version: 4.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Martin
@@ -10,32 +10,34 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADA0MTIwMAYDVQQDDClsYXVy
14
- ZW50Lm1hcnRpbi5hc3BlcmEvREM9ZnIvREM9aWJtL0RDPWNvbTAeFw0yMjA2MTUy
15
- MzQ5NDdaFw0yMzA2MTUyMzQ5NDdaMDQxMjAwBgNVBAMMKWxhdXJlbnQubWFydGlu
16
- LmFzcGVyYS9EQz1mci9EQz1pYm0vREM9Y29tMIIBojANBgkqhkiG9w0BAQEFAAOC
17
- AY8AMIIBigKCAYEAn4dpdgpX97n2d+jsdQFBlvCLpWluceH+0bJ/UfGEm+3m5nwW
18
- Y3TfdcxT45QytqA0cQXu8FeiybkZxSclTK0ozc2r3615y4ssHKI9D37YNTTISeq0
19
- ifSYTgtHzqUXEe4TlHJz/babvi94pYFmA8nngJ2WBvMq7x8QPPPxaSi3Eb+e9yEK
20
- AH4TiMFAZpJMs8Do8nzaOmWOHzftulLjkdWHmKoFD0S6Fo8hXgQU3XpiReCdKGz3
21
- TtIUyMu1rrAewnu4k7ZpFJuNpRqrGQvQZqjCOEvKTyK1YJHiN/A+HbsCaVNcm3Gz
22
- +r1O8KCy9tihjVVQvdBKVuhfNuGLiUJSxdvRT/T7RNTXVEFBk6OwVqE2uTTPYQ7X
23
- wr/w3/W/BWp5MCbMFdg2GUIzsTaGkdEu5Jwr/8Gn8fUg3NAy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oAJOMnyjhhgKfLd/PPJIckCxz/Tscsuq9+ZUDTubz2E3ltycdxrz0OOul
32
+ M8cWfkJ4cvdGAGTtqhmv3GGWZwFN8V8WYmmXrgej4o33vx6o8B6uwBn38hvkkAlB
33
+ ixQDORrk0ck1GVUYYo2UmDOlqArf6paaqd7rziY0dntYl0DfFWe7eJYA467FKjM6
34
+ /V3L2mTuHg4nCqC2febbAG+W+n158UrEkIKoOpAvQsykuuRtMaTpSTnYd0kLtQIF
35
+ qNyjadnjZB8iMIedYmEOKApKUJS/9BN1iXHxVbL03AS4o5xMQO3PPjXcwwaybE8G
36
+ sqAiwQUoawi1m3fZ8u3Xx+GmWE7tE9oxnPA48Y44EkiiWozq263f4S2Xa449ODoh
37
+ eTf9kxhVM40wGQOECVNA8UsEEZHD48eF+csUYZtAJOF5oxTI8UyV9T/o6CgO0c9/
38
+ Gzz+Qm5ULOUcPiJLjSpaiTrkiIVYiDGnqNSr6R1Hb1c=
37
39
  -----END CERTIFICATE-----
38
- date: 2023-03-20 00:00:00.000000000 Z
40
+ date: 2023-09-22 00:00:00.000000000 Z
39
41
  dependencies:
40
42
  - !ruby/object:Gem::Dependency
41
43
  name: execjs
@@ -69,36 +71,30 @@ dependencies:
69
71
  name: net-smtp
70
72
  requirement: !ruby/object:Gem::Requirement
71
73
  requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: '0.1'
75
- - - "<"
74
+ - - "~>"
76
75
  - !ruby/object:Gem::Version
77
- version: '0.4'
76
+ version: '0.3'
78
77
  type: :runtime
79
78
  prerelease: false
80
79
  version_requirements: !ruby/object:Gem::Requirement
81
80
  requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- version: '0.1'
85
- - - "<"
81
+ - - "~>"
86
82
  - !ruby/object:Gem::Version
87
- version: '0.4'
83
+ version: '0.3'
88
84
  - !ruby/object:Gem::Dependency
89
85
  name: net-ssh
90
86
  requirement: !ruby/object:Gem::Requirement
91
87
  requirements:
92
- - - ">="
88
+ - - "~>"
93
89
  - !ruby/object:Gem::Version
94
- version: '6.0'
90
+ version: '7.0'
95
91
  type: :runtime
96
92
  prerelease: false
97
93
  version_requirements: !ruby/object:Gem::Requirement
98
94
  requirements:
99
- - - ">="
95
+ - - "~>"
100
96
  - !ruby/object:Gem::Version
101
- version: '6.0'
97
+ version: '7.0'
102
98
  - !ruby/object:Gem::Dependency
103
99
  name: ruby-progressbar
104
100
  requirement: !ruby/object:Gem::Requirement
@@ -366,13 +362,9 @@ files:
366
362
  - README.md
367
363
  - bin/ascli
368
364
  - bin/asession
369
- - docs/test_env.conf
370
- - examples/aoc.rb
371
365
  - examples/dascli
372
- - examples/faspex4.rb
373
- - examples/node.rb
374
366
  - examples/proxy.pac
375
- - examples/server.rb
367
+ - examples/rubyc
376
368
  - lib/aspera/aoc.rb
377
369
  - lib/aspera/ascmd.rb
378
370
  - lib/aspera/ats_api.rb
@@ -413,7 +405,6 @@ files:
413
405
  - lib/aspera/data/4
414
406
  - lib/aspera/data/5
415
407
  - lib/aspera/data/6
416
- - lib/aspera/data/7
417
408
  - lib/aspera/data_repository.rb
418
409
  - lib/aspera/environment.rb
419
410
  - lib/aspera/fasp/agent_base.rb
@@ -448,6 +439,7 @@ files:
448
439
  - lib/aspera/preview/generator.rb
449
440
  - lib/aspera/preview/image_error.png
450
441
  - lib/aspera/preview/options.rb
442
+ - lib/aspera/preview/terminal.rb
451
443
  - lib/aspera/preview/utils.rb
452
444
  - lib/aspera/preview/video_error.png
453
445
  - lib/aspera/proxy_auto_config.js
@@ -482,7 +474,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
482
474
  requirements:
483
475
  - - ">="
484
476
  - !ruby/object:Gem::Version
485
- version: '2.4'
477
+ version: '2.6'
486
478
  required_rubygems_version: !ruby/object:Gem::Requirement
487
479
  requirements:
488
480
  - - ">="
@@ -490,7 +482,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
490
482
  version: '0'
491
483
  requirements:
492
484
  - Read the manual for any requirement
493
- rubygems_version: 3.4.6
485
+ rubygems_version: 3.4.10
494
486
  signing_key:
495
487
  specification_version: 4
496
488
  summary: 'Execute actions using command line on IBM Aspera Server products: Aspera
metadata.gz.sig CHANGED
Binary file
data/docs/test_env.conf DELETED
@@ -1,179 +0,0 @@
1
- ---
2
- config:
3
- version: 4.0.0
4
- default:
5
- config: cli_default
6
- aoc: tst_aoc_jwt
7
- faspex: tst_faspex
8
- faspex5: tst_faspex5_jwt
9
- shares: tst_shares
10
- node: tst_node_simple
11
- server: tst_server
12
- orchestrator: tst_orch
13
- console: tst_console
14
- preview: tst_ak_preview
15
- ats: tst_ats
16
- bss: tst_bss
17
- cos: tst_cos
18
- cli_default:
19
- interactive: your value here
20
- smtp: your value here
21
- local_user:
22
- ssh_keys: your value here
23
- smtp_config:
24
- server: your value here
25
- port: your value here
26
- domain: your value here
27
- tls: your value here
28
- from_email: your value here
29
- from_name: your value here
30
- username: your value here
31
- password: your value here
32
- tst_aoc_jwt:
33
- url: your value here
34
- username: your value here
35
- auth: your value here
36
- private_key: your value here
37
- tst_aoc_web:
38
- url: your value here
39
- auth: your value here
40
- redirect_uri: your value here
41
- client_id: your value here
42
- client_secret: your value here
43
- tst_faspex:
44
- url: your value here
45
- username: your value here
46
- password: your value here
47
- storage: your value here
48
- tst_hstsfaspex_ssh:
49
- url: your value here
50
- username: your value here
51
- tst_faspex5_boot:
52
- url: your value here
53
- auth: your value here
54
- username: your value here
55
- password: your value here
56
- tst_faspex5_web:
57
- url: your value here
58
- auth: your value here
59
- redirect_uri: your value here
60
- client_id: your value here
61
- tst_faspex5_jwt:
62
- url: your value here
63
- auth: your value here
64
- client_id: your value here
65
- client_secret: your value here
66
- private_key: your value here
67
- username: your value here
68
- tst_shares:
69
- url: your value here
70
- username: your value here
71
- password: your value here
72
- tst_shares_1:
73
- url: your value here
74
- username: your value here
75
- password: your value here
76
- tst_node_simple:
77
- url: your value here
78
- username: your value here
79
- password: your value here
80
- tst_node_ak:
81
- url: your value here
82
- username: your value here
83
- password: your value here
84
- tst_node_faspex:
85
- url: your value here
86
- username: your value here
87
- password: your value here
88
- tst_node_admak:
89
- url: your value here
90
- username: your value here
91
- password: your value here
92
- tst_node_preview:
93
- url: your value here
94
- username: your value here
95
- password: your value here
96
- tst_console:
97
- url: your value here
98
- username: your value here
99
- password: your value here
100
- tst_server:
101
- url: your value here
102
- username: your value here
103
- password: your value here
104
- tst_server_bykey:
105
- url: your value here
106
- username: your value here
107
- tst_orch:
108
- url: your value here
109
- username: your value here
110
- password: your value here
111
- tst_ats:
112
- ibm_api_key: your value here
113
- ats_key: your value here
114
- ats_secret: your value here
115
- instance: your value here
116
- tst_bss:
117
- password: your value here
118
- tst_ak_preview:
119
- url: your value here
120
- username: your value here
121
- password: your value here
122
- mimemagic: your value here
123
- tst_cos:
124
- apikey: your value here
125
- crn: your value here
126
- bucket: your value here
127
- endpoint: your value here
128
- sync:
129
- local_path: your value here
130
- remote_path: your value here
131
- nowss:
132
- ts: your value here
133
- misc:
134
- upload_folder: your value here
135
- syncuser: your value here
136
- faspex_publink_recv_from_fxuser: your value here
137
- faspex_publink_send_to_fxuser: your value here
138
- faspex_publink_send_to_dropbox: your value here
139
- faspex_dbx: your value here
140
- faspex_wkg: your value here
141
- faspex_src: your value here
142
- faspex5_shinbox: your value here
143
- faspex5_meta: your value here
144
- shares_upload: your value here
145
- console_smart_id: your value here
146
- console_smart_file: your value here
147
- orch_workflow_id: your value here
148
- file_dcm: your value here
149
- file_pdf: your value here
150
- file_docx: your value here
151
- file_mxf: your value here
152
- aws_bucket_key: your value here
153
- aws_bucket_secret: your value here
154
- aws_bucket_name: your value here
155
- aws_bucket_region: your value here
156
- aoc_publink_recv_from_aocuser: your value here
157
- aoc_publink_send_shd_inbox: your value here
158
- aoc_publink_send_aoc_user: your value here
159
- aoc_publink_send_use_pass: your value here
160
- aoc_publink_folder: your value here
161
- aoc_shbx_ws: your value here
162
- aoc_shbx_name: your value here
163
- aoc_shbx_meta: your value here
164
- aoc_ak_name: your value here
165
- aoc_ak_secret: your value here
166
- aoc_test_folder: your value here
167
- icos_bucket_key: your value here
168
- icos_bucket_secret: your value here
169
- icos_bucket_name: your value here
170
- icos_bucket_region: your value here
171
- icos_bucket_endpoint: your value here
172
- icos_bucket_apikey: your value here
173
- icos_resource_instance_id: your value here
174
- email_internal: your value here
175
- email_external: your value here
176
- aoc_org: your value here
177
- aoc_user_email: your value here
178
- aoc_workspace2: your value here
179
- http_gw_fqdn_port: your value here
data/examples/aoc.rb DELETED
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'aspera/aoc'
5
- require 'aspera/log'
6
-
7
- Aspera::Log.instance.level = :debug
8
-
9
- if !ARGV.length.eql?(3)
10
- Aspera::Log.log.error{"wrong number of args: #{ARGV.length}"}
11
- Aspera::Log.log.error{"Usage: #{$PROGRAM_NAME} <aoc URL> <aoc username> <aoc private key content>"}
12
- Aspera::Log.log.error{"Example: #{$PROGRAM_NAME} https://myorg.ibmaspera.com john@example.com $(cat /home/john/my_key.pem)"}
13
- Process.exit(1)
14
- end
15
-
16
- aoc_url = ARGV[0]
17
- aoc_user = ARGV[1]
18
- aoc_key_value = ARGV[2]
19
-
20
- aoc_api = Aspera::AoC.new(
21
- url: aoc_url,
22
- auth: :jwt,
23
- private_key: aoc_key_value,
24
- username: aoc_user,
25
- scope: 'user:all',
26
- subpath: 'api/v1')
27
-
28
- self_user_data = aoc_api.read('self')
29
-
30
- Aspera::Log.dump('self', self_user_data)
data/examples/faspex4.rb DELETED
@@ -1,94 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # find Faspex API here: https://developer.ibm.com/apis/catalog/?search=faspex
5
- # this example makes use of class Aspera::Rest for REST calls, alternatively class RestClient of gem rest-client could be used
6
- # this example makes use of class Aspera::Fasp::AgentDirect for transfers, alternatively the official "Transfer SDK" could be used
7
- # Aspera SDK can be downloaded with: `ascli conf ascp install` , it installs in $HOME/.aspera/ascli/sdk
8
- require 'aspera/rest'
9
- require 'aspera/log'
10
- require 'aspera/fasp/agent_direct'
11
-
12
- tmpdir = ENV['tmp'] || Dir.tmpdir || '.'
13
-
14
- # Set high log level for the example, decrease to :warn usually
15
- Aspera::Log.instance.level = :debug
16
-
17
- # Set folder where SDK is installed (mandatory)
18
- # (if ascp is not there, the lib will try to find in usual locations)
19
- # (if data files are not there, they will be created)
20
- Aspera::Fasp::Installation.instance.folder = tmpdir
21
-
22
- if !ARGV.length.eql?(3)
23
- Aspera::Log.log.error{"Wrong number of args: #{ARGV.length}"}
24
- Aspera::Log.log.error{"Usage: #{$PROGRAM_NAME} <faspex URL> <faspex username> <faspex password>"}
25
- Aspera::Log.log.error{"Example: #{$PROGRAM_NAME} https://faspex.com/aspera/faspex john p@sSw0rd"}
26
- Process.exit(1)
27
- end
28
-
29
- faspex_url = ARGV[0] # typically: https://faspex.example.com/aspera/faspex
30
- faspex_user = ARGV[1]
31
- faspex_pass = ARGV[2]
32
-
33
- # uncomment this if certificate is self signed
34
- # Rest.session_cb = lambda{|http|http.verify_mode = OpenSSL::SSL::VERIFY_NONE}
35
-
36
- # 1: Faspex 4 API v3
37
- #---------------
38
-
39
- # create REST API object
40
- api_v3 = Aspera::Rest.new({
41
- base_url: faspex_url,
42
- auth: {
43
- type: :basic,
44
- username: faspex_user,
45
- password: faspex_pass
46
- }})
47
-
48
- # very simple api call
49
- api_v3.read('me')
50
-
51
- # 2: send a package
52
- #---------------
53
-
54
- # create a sample file to send
55
- file_to_send = File.join(tmpdir, 'myfile.bin')
56
- File.write(file_to_send, 'sample data')
57
- # package creation parameters
58
- package_create_params = {'delivery' => {
59
- 'title' => 'test package',
60
- 'recipients' => ['aspera.user1@gmail.com'],
61
- 'sources' => [{'paths' => [file_to_send]}]
62
- }}
63
- pkg_created = api_v3.create('send', package_create_params)[:data]
64
- # get transfer specification (normally: only one)
65
- transfer_spec = pkg_created['xfer_sessions'].first
66
- # set paths of files to send
67
- transfer_spec['paths'] = [{'source' => file_to_send}]
68
- # get local agent (ascp), disable ascp output on stdout to not mix with JSON events
69
- transfer_client = Aspera::Fasp::AgentDirect.new({quiet: true})
70
- # start transfer (asynchronous)
71
- job_id = transfer_client.start_transfer(transfer_spec)
72
- Aspera::Log.dump('job_id', job_id)
73
- # wait for all transfer completion (for the example)
74
- result = transfer_client.wait_for_transfers_completion
75
- # notify of any transfer error
76
- result.reject{|i|i.eql?(:success)}.each do |e|
77
- Aspera::Log.log.error{"A transfer error occurred: #{e.message}"}
78
- end
79
-
80
- # 3: Faspex 4 API v4
81
- #---------------
82
- api_v4 = Aspera::Rest.new({
83
- base_url: faspex_url + '/api',
84
- auth: {
85
- type: :oauth2,
86
- base_url: faspex_url + '/auth/oauth2',
87
- auth: {type: :basic, username: faspex_user, password: faspex_pass},
88
- grant_method: :generic,
89
- generic: {grant_type: 'password'},
90
- scope: 'admin'
91
- }})
92
-
93
- # Use it. Note that Faspex 4 API v4 is totally different from Faspex 4 v3 APIs, see ref in header
94
- Aspera::Log.dump('users', api_v4.read('users')[:data])
data/examples/node.rb DELETED
@@ -1,96 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # Example: transfer a file using one of the provided transfer agents
5
- # location of ascp can be specified with env var "ascp"
6
- # temp folder can be specified with env var "tmp"
7
- require 'aspera/fasp/agent_direct'
8
- require 'aspera/fasp/listener'
9
- require 'aspera/fasp/installation'
10
- require 'aspera/log'
11
- require 'aspera/rest'
12
- require 'aspera/rest_errors_aspera'
13
- require 'json'
14
- require 'tmpdir'
15
-
16
- tmpdir = ENV['tmp'] || Dir.tmpdir || '.'
17
-
18
- raise 'Usage: PASSWORD=<password> $0 https://<address>:<port> <node user>' unless ARGV.length.eql?(2) && ENV.key?('PASSWORD')
19
-
20
- # example : https://node_asperaweb@eudemo.asperademo.com:9092
21
- node_uri = URI.parse(ARGV.shift)
22
- node_user = ARGV.shift
23
- node_pass = ENV['PASSWORD']
24
-
25
- ##############################################################
26
- # generic initialization : configuration of FaspManager
27
-
28
- # set trace level for sample, set to :debug to see complete list of debug information
29
- Aspera::Log.instance.level = :debug
30
-
31
- # register aspera REST call error handlers
32
- Aspera::RestErrorsAspera.register_handlers
33
-
34
- # some required files are generated here (keys, certs)
35
- Aspera::Fasp::Installation.instance.folder = tmpdir
36
- # set path to your copy of ascp binary (else, let the system find)
37
- Aspera::Fasp::Installation.instance.ascp_path = ENV['ascp'] if ENV.key?('ascp')
38
- # another way is to detect installed products and use one of them
39
- # Aspera::Fasp::Installation.instance.installed_products.each{|p|puts("found: #{p[:name]}")}
40
- # Aspera::Fasp::Installation.instance.use_ascp_from_product('Aspera Connect')
41
- # or install:
42
- #
43
-
44
- # get Transfer Agent
45
- transfer_agent = Aspera::Fasp::AgentDirect.new
46
-
47
- # Note that it would also be possible to start transfers using other agents
48
- # require 'aspera/fasp/connect'
49
- # transfer_agent=Aspera::Fasp::Connect.new
50
- # require 'aspera/fasp/node'
51
- # transfer_agent=Aspera::Fasp::Node.new(Aspera::Rest.new(...))
52
-
53
- ##############################################################
54
- # Optional : register an event listener
55
-
56
- # example of event listener that displays events on stdout
57
- class MyListener < Aspera::Fasp::Listener
58
- # this is the callback called during transfers, here we only display the received information
59
- # but it could be used to get detailed error information, check "type" field is "ERROR"
60
- def event_enhanced(data); $stdout.puts(JSON.generate(data)); $stdout.flush; end # rubocop:disable Style/Semicolon
61
- end
62
-
63
- # register the sample listener to display events
64
- transfer_agent.add_listener(MyListener.new)
65
-
66
- ##############################################################
67
- # Upload with node authorization
68
-
69
- # create rest client for Node API on a public demo system, using public demo credentials
70
- node_api = Aspera::Rest.new({
71
- base_url: node_uri.to_s,
72
- auth: {
73
- type: :basic,
74
- username: node_user,
75
- password: node_pass
76
- }})
77
- # define sample file(s) and destination folder
78
- sources = ["#{tmpdir}/sample_file.txt"]
79
- destination = '/Upload'
80
- # create sample file(s)
81
- sources.each{|p|File.write(p, 'Hello World!')}
82
- # request transfer authorization to node for a single transfer (This is a node api v3 call)
83
- send_result = node_api.create('files/upload_setup', { transfer_requests: [{ transfer_request: { paths: [{ destination: destination }] } }] })[:data]
84
- # we normally have only one transfer spec in list, so just get the first transfer_spec
85
- transfer_spec = send_result['transfer_specs'].first['transfer_spec']
86
- # add list of files to upload
87
- transfer_spec['paths'] = sources.map{|p|{'source' => p}}
88
- # set authentication type to "token" (will trigger use of bypass SSH key)
89
- transfer_spec['authentication'] = 'token'
90
- # from here : same as example 1
91
- transfer_agent.start_transfer(transfer_spec)
92
- # optional: wait for transfer completion helper function to get events
93
- transfer_result = transfer_agent.wait_for_transfers_completion
94
- errors = transfer_result.reject{|i|i.eql?(:success)}
95
- # the transfer was not success, as there is at least one error
96
- raise "Error(s) occurred: #{errors.join(',')}" if !errors.empty?
data/examples/server.rb DELETED
@@ -1,93 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # Example: transfer a file using one of the provided transfer agents
5
- # location of ascp can be specified with env var "ascp"
6
- # temp folder can be specified with env var "tmp"
7
- require 'aspera/fasp/agent_direct'
8
- require 'aspera/fasp/listener'
9
- require 'aspera/fasp/installation'
10
- require 'aspera/log'
11
- require 'aspera/rest'
12
- require 'aspera/rest_errors_aspera'
13
- require 'json'
14
- require 'tmpdir'
15
-
16
- tmpdir = ENV['tmp'] || Dir.tmpdir || '.'
17
-
18
- raise 'Usage: PASSWORD=<password> $0 ssh://<address>:<port> <transfer user>' unless ARGV.length.eql?(2) && ENV.key?('PASSWORD')
19
-
20
- # example : ssh://asperaweb@eudemo.asperademo.com:33001
21
- server_uri = URI.parse(ARGV.shift)
22
- server_user = ARGV.shift
23
- server_pass = ENV['PASSWORD']
24
-
25
- ##############################################################
26
- # generic initialization : configuration of FaspManager
27
-
28
- # set trace level for sample, set to :debug to see complete list of debug information
29
- Aspera::Log.instance.level = :debug
30
-
31
- # register aspera REST call error handlers
32
- Aspera::RestErrorsAspera.register_handlers
33
-
34
- # some required files are generated here (keys, certs)
35
- Aspera::Fasp::Installation.instance.folder = tmpdir
36
- # set path to your copy of ascp binary (else, let the system find)
37
- Aspera::Fasp::Installation.instance.ascp_path = ENV['ascp'] if ENV.key?('ascp')
38
- # another way is to detect installed products and use one of them
39
- # Aspera::Fasp::Installation.instance.installed_products.each{|p|puts("found: #{p[:name]}")}
40
- # Aspera::Fasp::Installation.instance.use_ascp_from_product('Aspera Connect')
41
- # or install:
42
- #
43
-
44
- # get Transfer Agent
45
- transfer_agent = Aspera::Fasp::AgentDirect.new
46
-
47
- # Note that it would also be possible to start transfers using other agents
48
- # require 'aspera/fasp/connect'
49
- # transfer_agent=Aspera::Fasp::Connect.new
50
- # require 'aspera/fasp/node'
51
- # transfer_agent=Aspera::Fasp::Node.new(Aspera::Rest.new(...))
52
-
53
- ##############################################################
54
- # Optional : register an event listener
55
-
56
- # example of event listener that displays events on stdout
57
- class MyListener < Aspera::Fasp::Listener
58
- # this is the callback called during transfers, here we only display the received information
59
- # but it could be used to get detailed error information, check "type" field is "ERROR"
60
- def event_enhanced(data); $stdout.puts(JSON.generate(data)); $stdout.flush; end # rubocop:disable Style/Semicolon
61
- end
62
-
63
- # register the sample listener to display events
64
- transfer_agent.add_listener(MyListener.new)
65
-
66
- ##############################################################
67
- # first example: download by SSH credentials
68
-
69
- # manually build transfer spec
70
- transfer_spec = {
71
- 'remote_host' => server_uri.host,
72
- 'ssh_port' => server_uri.port,
73
- 'remote_user' => server_user,
74
- 'remote_password' => server_pass,
75
- 'direction' => 'receive',
76
- 'destination_root' => tmpdir,
77
- 'paths' => [{'source' => 'aspera-test-dir-tiny/200KB.1'}]
78
- }
79
- # start transfer in separate thread
80
- # method returns as soon as transfer thread is created
81
- # it des not wait for completion, or even for session startup
82
- transfer_agent.start_transfer(transfer_spec)
83
-
84
- # optional: helper method: wait for completion of transfers
85
- # here we started a single transfer session (no multi session parameter)
86
- # get array of status, one for each session (so, a single value array)
87
- # each status is either :success or "error message"
88
- transfer_result = transfer_agent.wait_for_transfers_completion
89
- $stdout.puts(JSON.generate(transfer_result))
90
- # get list of errors only
91
- errors = transfer_result.reject{|i|i.eql?(:success)}
92
- # the transfer was not success, as there is at least one error
93
- raise "Error(s) occurred: #{errors.join(',')}" if !errors.empty?
data/lib/aspera/data/7 DELETED
Binary file