aspera-cli 4.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +3592 -0
  3. data/bin/ascli +7 -0
  4. data/bin/asession +89 -0
  5. data/docs/Makefile +59 -0
  6. data/docs/README.erb.md +3012 -0
  7. data/docs/README.md +13 -0
  8. data/docs/diagrams.txt +49 -0
  9. data/docs/secrets.make +38 -0
  10. data/docs/test_env.conf +117 -0
  11. data/docs/transfer_spec.html +99 -0
  12. data/examples/aoc.rb +17 -0
  13. data/examples/proxy.pac +60 -0
  14. data/examples/transfer.rb +115 -0
  15. data/lib/aspera/api_detector.rb +60 -0
  16. data/lib/aspera/ascmd.rb +151 -0
  17. data/lib/aspera/ats_api.rb +43 -0
  18. data/lib/aspera/cli/basic_auth_plugin.rb +38 -0
  19. data/lib/aspera/cli/extended_value.rb +88 -0
  20. data/lib/aspera/cli/formater.rb +238 -0
  21. data/lib/aspera/cli/listener/line_dump.rb +17 -0
  22. data/lib/aspera/cli/listener/logger.rb +20 -0
  23. data/lib/aspera/cli/listener/progress.rb +52 -0
  24. data/lib/aspera/cli/listener/progress_multi.rb +91 -0
  25. data/lib/aspera/cli/main.rb +304 -0
  26. data/lib/aspera/cli/manager.rb +440 -0
  27. data/lib/aspera/cli/plugin.rb +90 -0
  28. data/lib/aspera/cli/plugins/alee.rb +24 -0
  29. data/lib/aspera/cli/plugins/ats.rb +231 -0
  30. data/lib/aspera/cli/plugins/bss.rb +71 -0
  31. data/lib/aspera/cli/plugins/config.rb +806 -0
  32. data/lib/aspera/cli/plugins/console.rb +62 -0
  33. data/lib/aspera/cli/plugins/cos.rb +106 -0
  34. data/lib/aspera/cli/plugins/faspex.rb +377 -0
  35. data/lib/aspera/cli/plugins/faspex5.rb +93 -0
  36. data/lib/aspera/cli/plugins/node.rb +438 -0
  37. data/lib/aspera/cli/plugins/oncloud.rb +937 -0
  38. data/lib/aspera/cli/plugins/orchestrator.rb +169 -0
  39. data/lib/aspera/cli/plugins/preview.rb +464 -0
  40. data/lib/aspera/cli/plugins/server.rb +216 -0
  41. data/lib/aspera/cli/plugins/shares.rb +63 -0
  42. data/lib/aspera/cli/plugins/shares2.rb +114 -0
  43. data/lib/aspera/cli/plugins/sync.rb +65 -0
  44. data/lib/aspera/cli/plugins/xnode.rb +115 -0
  45. data/lib/aspera/cli/transfer_agent.rb +251 -0
  46. data/lib/aspera/cli/version.rb +5 -0
  47. data/lib/aspera/colors.rb +39 -0
  48. data/lib/aspera/command_line_builder.rb +137 -0
  49. data/lib/aspera/fasp/aoc.rb +24 -0
  50. data/lib/aspera/fasp/connect.rb +99 -0
  51. data/lib/aspera/fasp/error.rb +21 -0
  52. data/lib/aspera/fasp/error_info.rb +60 -0
  53. data/lib/aspera/fasp/http_gw.rb +81 -0
  54. data/lib/aspera/fasp/installation.rb +240 -0
  55. data/lib/aspera/fasp/listener.rb +11 -0
  56. data/lib/aspera/fasp/local.rb +377 -0
  57. data/lib/aspera/fasp/manager.rb +69 -0
  58. data/lib/aspera/fasp/node.rb +88 -0
  59. data/lib/aspera/fasp/parameters.rb +235 -0
  60. data/lib/aspera/fasp/resume_policy.rb +76 -0
  61. data/lib/aspera/fasp/uri.rb +51 -0
  62. data/lib/aspera/faspex_gw.rb +196 -0
  63. data/lib/aspera/hash_ext.rb +28 -0
  64. data/lib/aspera/log.rb +80 -0
  65. data/lib/aspera/nagios.rb +71 -0
  66. data/lib/aspera/node.rb +14 -0
  67. data/lib/aspera/oauth.rb +319 -0
  68. data/lib/aspera/on_cloud.rb +421 -0
  69. data/lib/aspera/open_application.rb +72 -0
  70. data/lib/aspera/persistency_action_once.rb +42 -0
  71. data/lib/aspera/persistency_folder.rb +91 -0
  72. data/lib/aspera/preview/file_types.rb +300 -0
  73. data/lib/aspera/preview/generator.rb +258 -0
  74. data/lib/aspera/preview/image_error.png +0 -0
  75. data/lib/aspera/preview/options.rb +35 -0
  76. data/lib/aspera/preview/utils.rb +131 -0
  77. data/lib/aspera/preview/video_error.png +0 -0
  78. data/lib/aspera/proxy_auto_config.erb.js +287 -0
  79. data/lib/aspera/proxy_auto_config.rb +34 -0
  80. data/lib/aspera/rest.rb +296 -0
  81. data/lib/aspera/rest_call_error.rb +13 -0
  82. data/lib/aspera/rest_error_analyzer.rb +98 -0
  83. data/lib/aspera/rest_errors_aspera.rb +58 -0
  84. data/lib/aspera/ssh.rb +53 -0
  85. data/lib/aspera/sync.rb +82 -0
  86. data/lib/aspera/temp_file_manager.rb +37 -0
  87. data/lib/aspera/uri_reader.rb +25 -0
  88. metadata +288 -0
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ $LOAD_PATH.unshift(File.dirname(__FILE__)+"/../lib")
4
+ require 'aspera/cli/main'
5
+ Encoding.default_internal = Encoding::UTF_8
6
+ Encoding.default_external = Encoding::UTF_8
7
+ Aspera::Cli::Main.new(ARGV).process_command_line
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env ruby
2
+ # Laurent Martin/2017
3
+ $LOAD_PATH.unshift(File.dirname(__FILE__)+"/../lib")
4
+ require 'aspera/fasp/local'
5
+ require 'aspera/cli/listener/line_dump'
6
+ require 'aspera/cli/extended_value'
7
+ require 'aspera/log'
8
+ require 'json'
9
+ # extended transfer spec parameter to change log level
10
+ TS_LOGLEVEL='EX_loglevel'
11
+ # by default go to /tmp/username.filelist
12
+ TS_TMP_FILELIST_FOLDER='EX_file_list_folder'
13
+
14
+ def assert_usage(assertion,errmsg)
15
+ return if assertion
16
+ STDERR.puts('ERROR: '.red.blink+errmsg) if errmsg
17
+ STDERR.puts('USAGE')
18
+ STDERR.puts(' asession')
19
+ STDERR.puts(' asession -h|--help')
20
+ STDERR.puts(' asession <transfer spec extended value>')
21
+ STDERR.puts(' ')
22
+ STDERR.puts(' If no argument is provided, default will be used: @json:@stdin')
23
+ STDERR.puts(' -h, --help display this message')
24
+ STDERR.puts(' <transfer spec extended value> a JSON value for transfer_spec, using the prefix: @json:')
25
+ STDERR.puts(' The value can be either:')
26
+ STDERR.puts(" the JSON description itself, e.g. @json:'{\"xx\":\"yy\",...}'")
27
+ STDERR.puts(' @json:@stdin, if the JSON is provided from stdin')
28
+ STDERR.puts(' @json:@file:<path>, if the JSON is provided from a file')
29
+ STDERR.puts(' Asynchronous commands can be provided on STDIN, examples:')
30
+ STDERR.puts(' {"type":"START","source":"/aspera-test-dir-tiny/200KB.2"}')
31
+ STDERR.puts(' {"type":"START","source":"xx","destination":"yy"}')
32
+ STDERR.puts(' {"type":"DONE"}')
33
+ STDERR.puts('Note: debug information can be placed on STDERR, using the "'+TS_LOGLEVEL+'" parameter in transfer spec (debug=0)')
34
+ STDERR.puts('EXAMPLES')
35
+ STDERR.puts(%q( asession @json:'{"remote_host":"demo.asperasoft.com","remote_user":"asperaweb","ssh_port":33001,"remote_password":"demoaspera","direction":"receive","destination_root":"./test.dir","paths":[{"source":"/aspera-test-dir-tiny/200KB.1"}]}'))
36
+ STDERR.puts(%q( echo '{"remote_host":...}'|asession @json:@stdin))
37
+ Process.exit(1)
38
+ end
39
+
40
+ parameter_source_err_msg=' (argument), did you specify: "@json:" ?'
41
+ # by default assume JSON input on stdin if no argument
42
+ if ARGV.empty?
43
+ ARGV.push('@json:@stdin')
44
+ parameter_source_err_msg=' (JSON on stdin)'
45
+ end
46
+ # anyway expect only one argument: session information
47
+ assert_usage(ARGV.length.eql?(1),'exactly one argument is expected')
48
+ assert_usage(!['-h','--help'].include?(ARGV.first),nil)
49
+ # parse transfer spec
50
+ begin
51
+ transfer_spec_arg=ARGV.pop
52
+ transfer_spec=Aspera::Cli::ExtendedValue.instance.evaluate(transfer_spec_arg)
53
+ rescue => e
54
+ assert_usage(false,"Cannot extract transfer spec from: #{transfer_spec_arg}")
55
+ end
56
+ # ensure right type
57
+ assert_usage(transfer_spec.is_a?(Hash),"the value must be a hash table#{parameter_source_err_msg}")
58
+ # additional debug capability
59
+ if transfer_spec.has_key?(TS_LOGLEVEL)
60
+ Aspera::Log.instance.level=transfer_spec[TS_LOGLEVEL]
61
+ transfer_spec.delete(TS_LOGLEVEL)
62
+ end
63
+ # possibly override temp folder
64
+ if transfer_spec.has_key?(TS_TMP_FILELIST_FOLDER)
65
+ Aspera::Fasp::Parameters.file_list_folder=transfer_spec[TS_TMP_FILELIST_FOLDER]
66
+ transfer_spec.delete(TS_TMP_FILELIST_FOLDER)
67
+ end
68
+ # get local agent (ascp)
69
+ client=Aspera::Fasp::Local.new
70
+ # disable ascp output on stdout to not mix with JSON events
71
+ client.quiet=true
72
+ # display JSON instead of legacy Lines
73
+ client.add_listener(Aspera::Cli::Listener::LineDump.new)
74
+ # start transfer (asynchronous)
75
+ job_id=client.start_transfer(transfer_spec)
76
+ # async commands
77
+ Thread.new do
78
+ begin
79
+ loop do
80
+ data=JSON.parse(STDIN.gets)
81
+ client.send_command(job_id,0,data)
82
+ end
83
+ rescue
84
+ Process.exit(1)
85
+ end
86
+ end
87
+ # no exit code: status is success (0)
88
+ client.wait_for_transfers_completion
89
+ client.shutdown
@@ -0,0 +1,59 @@
1
+ ##################################
2
+ # Documentation
3
+
4
+ DIR_TOP=../
5
+ include $(DIR_TOP)common.make
6
+ DIR_DOC=
7
+
8
+ # files generated to be included in README.md
9
+ INCL_USAGE=$(DIR_TMP)$(EXENAME)_usage.txt
10
+ INCL_COMMANDS=$(DIR_TMP)$(EXENAME)_commands.txt
11
+ INCL_ASESSION=$(DIR_TMP)asession_usage.txt
12
+ TMPL_TEST_CONF=$(DIR_DOC)$(TEST_CONF_FILE_BASE)
13
+ TMPL_SECRETS=$(DIR_DOC)$(SECRETS_FILE_NAME)
14
+
15
+ MANUAL_BASE=$(DIR_DOC)Manual_$(EXENAME)_$(GEMVERSION)
16
+ MANUAL_PDF=$(MANUAL_BASE).pdf
17
+ MANUAL_HTML=$(MANUAL_BASE).html
18
+
19
+ # main target to build doc
20
+ all:: $(MANUAL_PDF) $(TMPL_SECRETS) $(TMPL_TEST_CONF)
21
+
22
+ doc: all
23
+
24
+ # generate template configuration files, remove own secrets
25
+ $(TMPL_SECRETS): $(SECRETS_FILE_PATH)
26
+ sed 's/=.*/=_value_here_/' < $(SECRETS_FILE_PATH) > $(TMPL_SECRETS)
27
+ $(TMPL_TEST_CONF): $(TEST_CONF_FILE_PATH)
28
+ ruby -e 'require "yaml";n={};c=YAML.load_file("$(TEST_CONF_FILE_PATH)").each{|k,v| n[k]=["config","default"].include?(k)?v:v.keys.inject({}){|m,i|m[i]="your value here";m}};File.write("$(TMPL_TEST_CONF)",n.to_yaml)'
29
+
30
+ $(MANUAL_PDF): $(DIR_TOP)README.md
31
+ pandoc --number-sections --resource-path=. --toc -o $(MANUAL_HTML) $(DIR_TOP)README.md
32
+ wkhtmltopdf toc $(MANUAL_HTML) $(MANUAL_PDF)
33
+
34
+ $(DIR_TOP)README.md: $(DIR_DOC)README.erb.md $(INCL_COMMANDS) $(INCL_USAGE) $(INCL_ASESSION)
35
+ DIR_DOC=$(DIR_DOC) COMMANDS=$(INCL_COMMANDS) USAGE=$(INCL_USAGE) ASESSION=$(INCL_ASESSION) VERSION=`$(EXETESTB) -Cnone --version` TOOLNAME=$(EXENAME) erb $(DIR_DOC)README.erb.md > $(DIR_TOP)README.md
36
+
37
+ $(INCL_COMMANDS): $(DIR_TMP).exists $(TEST_MAKEFILE)
38
+ sed -nEe 's/.*\$$\(EXE_MAN.?\)/$(EXENAME)/p' $(TEST_MAKEFILE) > $(DIR_TMP)usg1.txt
39
+ sed -i.bak -Ee 's/\$$\((DIR_[^)]+)\)/\1\//g' $(DIR_TMP)usg1.txt
40
+ sed -i.bak -Ee 's/\$$\(([^)]+)\)/\1/g' $(DIR_TMP)usg1.txt
41
+ sed -i.bak -Ee 's/CF_([0-9A-Z_]*)/MY_\1/g' $(DIR_TMP)usg1.txt
42
+ sed -i.bak -Ee 's/\$$(\$$)/\1/g' $(DIR_TMP)usg1.txt
43
+ sed -i.bak -Ee 's/"'"'"'"\$${([a-z_]+)}"'"'"'"/"my_\1"/g' $(DIR_TMP)usg1.txt
44
+ sed -i.bak -Ee 's/="\$${([a-z_]+)}"/="my_\1"/g' $(DIR_TMP)usg1.txt
45
+ sed -i.bak -Ee 's/\$$@/xyz/g' $(DIR_TMP)usg1.txt
46
+ sed -i.bak -Ee 's/"'"'"'"/"/g' $(DIR_TMP)usg1.txt
47
+ sed -i.bak -Ee 's/"'"'"'/"/g' $(DIR_TMP)usg1.txt
48
+ sed -i.bak -Ee 's/'"'"'"/"/g' $(DIR_TMP)usg1.txt
49
+ sort -u < $(DIR_TMP)usg1.txt > $(INCL_COMMANDS)
50
+ # generated help of tools depends on all sources, so regenerate always
51
+ .PHONY: $(INCL_USAGE)
52
+ $(INCL_USAGE): $(DIR_TMP).exists
53
+ $(EXETESTB) -Cnone -h 2> $(INCL_USAGE) || true
54
+ .PHONY: $(INCL_ASESSION)
55
+ $(INCL_ASESSION): $(DIR_TMP).exists
56
+ $(DIR_BIN)/asession -h 2> $(INCL_ASESSION) || true
57
+ clean::
58
+ rm -f $(MANUAL_PDF) $(MANUAL_HTML) $(INCL_COMMANDS) $(INCL_USAGE) $(INCL_ASESSION)
59
+
@@ -0,0 +1,3012 @@
1
+ [comment1]: # (Do not edit this README.md, edit docs/README.erb.md, for details, read docs/README.md)
2
+ <%cmd=ENV["TOOLNAME"];tool='`'+cmd+'`';evp=cmd.upcase+'_';opprst='option preset';prst='['+opprst+'](#lprt)';prsts='['+opprst+'s](#lprt)';prstt=opprst.capitalize%>
3
+
4
+ # <%=tool%> : a Command Line for IBM Aspera products
5
+
6
+ Version : <%= ENV["VERSION"] %>
7
+
8
+ _Laurent/2016-<%=Time.new.year%>_
9
+
10
+ This gem provides a command line interface to Aspera Applications.
11
+
12
+ Location (once released):
13
+ [https://rubygems.org/gems/aspera-cli](https://rubygems.org/gems/aspera-cli)
14
+
15
+ Disclaimers:
16
+
17
+ * This has not yet been officially released so things may change
18
+
19
+ That being said, <%=tool%> is very powerful and gets things done, it&apos;s also a great tool to learn Aspera APIs.
20
+
21
+ This manual addresses three parts:
22
+
23
+ * <%=tool%> : The command line tool
24
+ * `asession` : starting a FASP Session with JSON parameters
25
+ * `Aspera` : includes a Ruby "FASPManager"
26
+
27
+ In examples, command line operations (starting with `$`) are shown using a standard shell: `bash` or `zsh`.
28
+
29
+ Command line parameters in example beginning with `my_`, like `my_param_value` are user-provided value and not fixed value commands.
30
+
31
+ # Quick Start
32
+
33
+ This section guides you from installation, first use and advanced use.
34
+
35
+ First, follow the section: [Installation](#installation) (Ruby, Gem, FASP) to start using <%=tool%>.
36
+
37
+ Once the gem is installed, <%=tool%> shall be accessible:
38
+
39
+ ```
40
+ $ <%=cmd%> --version
41
+ <%= ENV["VERSION"] %>
42
+ ```
43
+
44
+ ## First use
45
+
46
+ Once installation is completed, you can proceed to the first use with a demo server:
47
+
48
+ If you want to test with Aspera on Cloud, jump to section: [Wizard](#aocwizard)
49
+
50
+ If you want to test with Aspera demo transfer server, a default configuration is created on first use:
51
+
52
+ ```
53
+ $ <%=cmd%> server browse /
54
+ :............:...........:......:........:...........................:.......................:
55
+ : zmode : zuid : zgid : size : mtime : name :
56
+ :............:...........:......:........:...........................:.......................:
57
+ : dr-xr-xr-x : asperaweb : fasp : 4096 : 2014-04-10 19:44:05 +0200 : aspera-test-dir-tiny :
58
+ : drwxr-xr-x : asperaweb : fasp : 176128 : 2018-03-15 12:20:10 +0100 : Upload :
59
+ : dr-xr-xr-x : asperaweb : fasp : 4096 : 2015-04-01 00:37:22 +0200 : aspera-test-dir-small :
60
+ : dr-xr-xr-x : asperaweb : fasp : 4096 : 2018-05-04 14:26:55 +0200 : aspera-test-dir-large :
61
+ :............:...........:......:........:...........................:.......................:
62
+ ```
63
+
64
+ If you want to use <%=tool%> with another server, and in order to make further calls more convenient, it is advised to define a <%=prst%> for the server's authentication options. The following example will:
65
+
66
+ * create a <%=prst%>
67
+ * define it as default for "server" plugin
68
+ * list files in a folder
69
+ * download a file
70
+
71
+ ```
72
+ $ <%=cmd%> config id myserver update --url=ssh://demo.asperasoft.com:33001 --username=asperaweb --password=demoaspera
73
+ updated: myserver
74
+ $ <%=cmd%> config id default set server myserver
75
+ updated: default&rarr;server to myserver
76
+ $ <%=cmd%> server browse /aspera-test-dir-large
77
+ :............:...........:......:..............:...........................:............................:
78
+ : zmode : zuid : zgid : size : mtime : name :
79
+ :............:...........:......:..............:...........................:............................:
80
+ : -rw-rw-rw- : asperaweb : fasp : 10133504 : 2018-05-04 14:16:24 +0200 : ctl_female_2.fastq.partial :
81
+ : -rw-r--r-- : asperaweb : fasp : 209715200 : 2014-04-10 19:49:27 +0200 : 200MB :
82
+ : -rw-r--r-- : asperaweb : fasp : 524288000 : 2014-04-10 19:44:15 +0200 : 500MB :
83
+ : -rw-r--r-- : asperaweb : fasp : 5368709120 : 2014-04-10 19:45:52 +0200 : 5GB :
84
+ : -rw-r--r-- : asperaweb : fasp : 500000000000 : 2017-06-14 20:09:57 +0200 : 500GB :
85
+ : -rw-rw-rw- : asperaweb : fasp : 13606912 : 2018-05-04 14:20:21 +0200 : ctl_male_2.fastq.partial :
86
+ : -rw-rw-rw- : asperaweb : fasp : 76 : 2018-05-04 14:13:18 +0200 : ctl_female_2.fastq.haspx :
87
+ : -rw-rw-rw- : asperaweb : fasp : 647348 : 2018-05-04 14:26:39 +0200 : ctl_female_2.gz :
88
+ : -rw-rw-rw- : asperaweb : fasp : 74 : 2018-05-04 14:16:00 +0200 : ctl_male_2.fastq.haspx :
89
+ : -rw-r--r-- : asperaweb : fasp : 1048576000 : 2014-04-10 19:49:23 +0200 : 1GB :
90
+ : -rw-r--r-- : asperaweb : fasp : 104857600 : 2014-04-10 19:49:29 +0200 : 100MB :
91
+ : -rw-r--r-- : asperaweb : fasp : 10737418240 : 2014-04-10 19:49:04 +0200 : 10GB :
92
+ :............:...........:......:..............:...........................:............................:
93
+ $ <%=cmd%> server download /aspera-test-dir-large/200MB
94
+ Time: 00:00:02 ========================================================================================================== 100% 100 Mbps Time: 00:00:00
95
+ complete
96
+ ```
97
+
98
+ ## Going further
99
+
100
+ Get familiar with configuration, options, commands : [Command Line Interface](#cli).
101
+
102
+ Then, follow the section relative to the product you want to interact with ( Aspera on Cloud, Faspex, ...) : [Application Plugins](plugins)
103
+
104
+ # <a name="installation"></a>Installation
105
+
106
+ In order to use the tool or the gem, it is necessary to install those components:
107
+
108
+ * [Ruby](#ruby)
109
+ * [aspera-cli](#the_gem)
110
+ * [FASP](#fasp_prot)
111
+
112
+ The following sections provide information on the installation.
113
+
114
+ ## <a name="ruby"></a>Ruby
115
+
116
+ A ruby interpreter is required to run the tool or to use the gem and tool.
117
+ It is required to have privilege to install gems.
118
+ Ruby 2.5+ is prefered, but it should also work with 2.1+.
119
+ Any type of Ruby installation can be used.
120
+
121
+ Refer to the following sections for a proposed method for specific operating systems.
122
+
123
+ ### macOS
124
+
125
+
126
+ MacOS 10.13+ (High Sierra) comes with a recent Ruby, so you can use it directly, you will need to install aspera-cli using `sudo` :
127
+
128
+ ```
129
+ $ sudo gem install aspera-cli
130
+ ```
131
+
132
+ Alternatively, if you use [Homebrew](https://brew.sh/) already you can install Ruby with it:
133
+
134
+ ```
135
+ $ brew install ruby
136
+ ```
137
+
138
+ ### Windows
139
+
140
+ Install Latest stable Ruby using [https://rubyinstaller.org/](https://rubyinstaller.org/).
141
+
142
+ Go to "Downloads".
143
+
144
+ Select the version "without devkit", x64 corresponding to the one recommended "with devkit".
145
+
146
+ During installation, skip the installation of "MSys2".
147
+
148
+ ### Linux
149
+
150
+ Install Latest Ruby using "rvm" [https://rvm.io/](https://rvm.io/) .
151
+ It installs by default in /usr/local/rvm , but you can install in another location:
152
+
153
+ ```
154
+ curl -sSL https://get.rvm.io | bash -s -- --path /usr/local
155
+ ```
156
+
157
+ Once installed, you can install latest ruby:
158
+
159
+ ```
160
+ # rvm install ruby
161
+ ```
162
+
163
+ If you dont want all users to have ruby by default,
164
+ rename the file: `/etc/profile.d/rvm.sh` with another extension, and source it to get rvm.
165
+
166
+ Alternatively, only if you know what you do, on RPM based systems (CentOs, Redhat), install the ruby provided by yum which may be 2.0.
167
+
168
+ ```
169
+ # yum install -y ruby rubygems ruby-json
170
+ ```
171
+
172
+ If necessary, pre-install jwt for older Ruby < 2.1.
173
+
174
+ ```
175
+ # gem install jwt -v 1.5.6
176
+ ```
177
+
178
+ You can cleanup your whole yum-installed ruby environment like this to uninstall:
179
+
180
+ ```
181
+ gem uninstall $(ls $(gem env gemdir)/gems/|sed -e 's/-[^-]*$//'|sort -u)
182
+ yum remove -y ruby ruby-libs
183
+ ```
184
+
185
+ ### Other Unixes: Aix, etc...
186
+
187
+ If your unix do not provide a pre-built ruby, you can get using one of those
188
+ [methods](https://www.ruby-lang.org/en/documentation/installation/)
189
+
190
+ For instance to build from source, and install in `/opt/ruby` :
191
+
192
+ ```
193
+ # wget https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.gz
194
+ # gzip -d ruby-2.7.2.tar.gz
195
+ # tar xvf ruby-2.7.2.tar
196
+ # cd ruby-2.7.2
197
+ # ./configure --prefix=/opt/ruby
198
+ # make ruby.imp
199
+ # make
200
+ # make install
201
+ ```
202
+
203
+ ## <a name="the_gem"></a>`aspera-cli` gem
204
+
205
+ Once you have Ruby and rights to install gems: Install the gem and its dependencies:
206
+
207
+ ```
208
+ # gem install aspera-cli
209
+ ```
210
+
211
+ To upgrade to the latest version:
212
+
213
+ ```
214
+ # gem update aspera-cli
215
+ ```
216
+
217
+ ## <a name="fasp_prot"></a>FASP Protocol
218
+
219
+ Most file transfers will be done using the FASP protocol. Only two additional files are required to perform
220
+ an Aspera Transfer:
221
+
222
+ * ascp
223
+ * aspera-license (in same folder, or ../etc)
224
+
225
+ Those can be found in one of IBM Asprea transfer server or client with its license file (some are free):
226
+
227
+ * IBM Aspera Connect Client (Free)
228
+ * IBM Aspera Desktop Client (Free)
229
+ * IBM Aspera CLI (Free)
230
+ * IBM Aspera High Speed Transfer Server (Licensed)
231
+ * IBM Aspera High Speed Transfer EndPoint (Licensed)
232
+
233
+ For instance, Aspera Connect Client can be installed
234
+ by visiting the page: [http://downloads.asperasoft.com/connect2/](http://downloads.asperasoft.com/connect2/).
235
+
236
+ <%=tool%> will detect most of Aspera transfer products in standard locations and use the first one found.
237
+ Refer to section [FASP](#client) for details on how to select a client or set path to the FASP protocol.
238
+
239
+ Several methods are provided on how to start a transfer. Use of a local client is one of them, but
240
+ other methods are available. Refer to section: [Transfer Agents](#agents)
241
+
242
+ # <a name="cli"></a>Command Line Interface: <%=tool%>
243
+
244
+ The `aspera-cli` Gem provides a command line interface (CLI) which interacts with Aspera Products (mostly using REST APIs):
245
+
246
+ * IBM Aspera High Speed Transfer Server (FASP and Node)
247
+ * IBM Aspera on Cloud (including ATS)
248
+ * IBM Aspera Faspex
249
+ * IBM Aspera Shares
250
+ * IBM Aspera Console
251
+ * IBM Aspera Orchestrator
252
+ * and more...
253
+
254
+ <%=tool%> provides the following features:
255
+
256
+ * Supports most Aspera server products (on-premise and SaaS)
257
+ * Any command line options (products URL, credentials or any option) can be provided on command line, in configuration file, in env var, in files
258
+ * Supports Commands, Option values and Parameters shortcuts
259
+ * FASP [Transfer Agents](#agents) can be: FaspManager (local ascp), or Connect Client, or any transfer node
260
+ * Transfer parameters can be altered by modification of _transfer-spec_, this includes requiring multi-session
261
+ * Allows transfers from products to products, essentially at node level (using the node transfer agent)
262
+ * Supports FaspStream creation (using Node API)
263
+ * Supports Watchfolder creation (using Node API)
264
+ * Additional command plugins can be written by the user
265
+ * Supports download of faspex and Aspera on Cloud "external" links
266
+ * Supports "legacy" ssh based FASP transfers and remote commands (ascmd)
267
+
268
+ Basic usage is displayed by executing:
269
+
270
+ ```
271
+ $ <%=cmd%> -h
272
+ ```
273
+
274
+ Refer to sections: [Usage](#usage) and [Sample Commands](#commands).
275
+
276
+ Not all <%=tool%> features are fully documented here, the user may explore commands on the command line.
277
+
278
+ ## Arguments : Commands and options
279
+
280
+ Arguments are the units of command line, as parsed by the shell, typically separated by spaces (and called "argv").
281
+
282
+ There are two types of arguments: Commands and Options. Example :
283
+
284
+ ```
285
+ $ <%=cmd%> command --option-name=VAL1 VAL2
286
+ ```
287
+
288
+ * executes _command_: `command`
289
+ * with one _option_: `option_name`
290
+ * this option has a _value_ of: `VAL1`
291
+ * the command has one additional _argument_: `VAL2`
292
+
293
+ When the value of a command, option or argument is constrained by a fixed list of values, it is possible to use the first letters of the value only, provided that it uniquely identifies a value. For example `<%=cmd%> conf ov` is the same as `<%=cmd%> config overview`.
294
+
295
+ The value of options and arguments is evaluated with the [Extended Value Syntax](#extended).
296
+
297
+ ### Options
298
+
299
+ All options, e.g. `--log-level=debug`, are command line arguments that:
300
+
301
+ * start with `--`
302
+ * have a name, in lowercase, using `-` as word separator in name (e.g. `--log-level=debug`)
303
+ * have a value, separated from name with a `=`
304
+ * can be used by prefix, provided that it is unique. E.g. `--log-l=debug` is the same as `--log-level=debug`
305
+
306
+ Exceptions:
307
+
308
+ * some options accept a short form, e.g. `-Ptoto` is equivalent to `--preset=toto`, refer to the manual or `-h`.
309
+ * some options (flags) don't take a value, e.g. `-r`
310
+ * the special option `--` stops option processing and is ignored, following command line arguments are taken as arguments, including the ones starting with a `-`. Example:
311
+
312
+ ```
313
+ $ <%=cmd%> config echo -- --sample
314
+ "--sample"
315
+ ```
316
+
317
+ Note that `--sample` is taken as an argument, and not option.
318
+
319
+ Options can be optional or mandatory, with or without (hardcoded) default value. Options can be placed anywhere on comand line and evaluated in order.
320
+
321
+ The value for _any_ options can come from the following locations (in this order, last value evaluated overrides previous value):
322
+
323
+ * [Configuration file](#configfile).
324
+ * Environment variable
325
+ * Command line
326
+
327
+ Environment variable starting with prefix: <%=evp%> are taken as option values,
328
+ e.g. `<%=evp%>OPTION_NAME` is for `--option-name`.
329
+
330
+ Options values can be displayed for a given command by providing the `--show-config` option: `<%=cmd%> node --show-config`
331
+
332
+ ### Commands and Arguments
333
+
334
+ Command line arguments that are not options are either commands or arguments. If an argument must begin with `-`, then either use the `@val:` syntax (see [Extended Values](#extended)), or use the `--` separator (see above).
335
+
336
+ ## Interactive Input
337
+
338
+ Some options and parameters are mandatory and other optional. By default, the tool will ask for missing mandatory options or parameters for interactive execution.
339
+
340
+ The behaviour can be controlled with:
341
+
342
+ * --interactive=&lt;yes|no&gt; (default=yes if STDIN is a terminal, else no)
343
+ * yes : missing mandatory parameters/options are asked to the user
344
+ * no : missing mandatory parameters/options raise an error message
345
+ * --ask-options=&lt;yes|no&gt; (default=no)
346
+ * optional parameters/options are asked to user
347
+
348
+ ## Output
349
+
350
+ Command execution will result in output (terminal, stdout/stderr).
351
+ The information displayed depends on the action.
352
+
353
+ ### Types of output data
354
+
355
+ Depending on action, the output will contain:
356
+
357
+ * `single_object` : displayed as a 2 dimensional table: one line per attribute, first column is attribute name, and second is atteribute value. Nested hashes are collapsed.
358
+ * `object_list` : displayed as a 2 dimensional table: one line per item, one colum per attribute.
359
+ * `value_list` : a table with one column.
360
+ * `empty` : nothing
361
+ * `status` : a message
362
+ * `other_struct` : a complex structure that cannot be displayed as an array
363
+
364
+ ### Format of output
365
+
366
+ By default, result of type single_object and object_list are displayed using format `table`.
367
+ The table style can be customized with parameter: `table_style` (horizontal, vertical and intersection characters) and is `:.:` by default.
368
+
369
+ In a table format, when displaying "objects" (single, or list), by default, sub object are
370
+ flatten (option flat_hash). So, object {"user":{"id":1,"name":"toto"}} will have attributes: user.id and user.name. Setting `flat_hash` to `false` will only display one
371
+ field: "user" and value is the sub hash table. When in flatten mode, it is possible to
372
+ filter fields by "dotted" field name.
373
+
374
+ The style of output can be set using the `format` parameter, supporting:
375
+
376
+ * `table` : Text table
377
+ * `ruby` : Ruby code
378
+ * `json` : JSON code
379
+ * `jsonpp` : JSON pretty printed
380
+ * `yaml` : YAML
381
+ * `csv` : Comma Separated Values
382
+
383
+ ### Filtering columns for `object_list`
384
+
385
+ Table output can be filtered using the `select` parameter. Example:
386
+
387
+ ```
388
+ $ <%=cmd%> aspera admin res user list --fields=name,email,ats_admin --query=@json:'{"per_page":1000,"page":1,"sort":"name"}' --select=@json:'{"ats_admin":true}'
389
+ :...............................:..................................:...........:
390
+ : name : email : ats_admin :
391
+ :...............................:..................................:...........:
392
+ : John Custis : john@example.com : true :
393
+ : Laurent Martin : laurent@example.com : true :
394
+ :...............................:..................................:...........:
395
+ ```
396
+
397
+ Note that `select` filters selected elements from the result of API calls, while the `query` parameters gives filtering parameters to the API when listing elements.
398
+
399
+ ### Verbosity of output
400
+
401
+ Outpout messages are categorized in 3 types:
402
+
403
+ * `info` output contain additional information, such as number of elements in a table
404
+ * `data` output contain the actual output of the command (object, or list of objects)
405
+ * `error`output contain error messages
406
+
407
+ The option `display` controls the level of output:
408
+
409
+ * `info` displays all messages
410
+ * `data` display `data` and `error` messages
411
+ * `error` display only error messages.
412
+
413
+ ### Selection of output object properties
414
+
415
+ By default, a table output will display one line per entry, and columns for each entries. Depending on the command, columns may include by default all properties, or only some selected properties. It is possible to define specific colums to be displayed, by setting the `fields` option to one of the following value:
416
+
417
+ * DEF : default display of columns (that's the default, when not set)
418
+ * ALL : all columns available
419
+ * a,b,c : the list of attributes specified by the comma separated list
420
+ * Array extended value: for instance, @json:'["a","b","c"]' same as above
421
+ * +a,b,c : add selected properties to the default selection.
422
+
423
+ ## <a name="extended"></a>Extended Value Syntax
424
+
425
+ Usually, values of options and arguments are specified by a simple string. But sometime it is convenient to read a value from a file, or decode it, or have a value more complex than a string (e.g. Hash table).
426
+
427
+ The extended value syntax is:
428
+
429
+ ```
430
+ <0 or more decoders><0 or 1 reader><nothing or some text value>
431
+ ```
432
+
433
+ The difference between reader and decoder is order and ordinality. Both act like a function of value on right hand side. Decoders are at the beginning of the value, followed by a single optional reader, followed by the optional value.
434
+
435
+ The following "readers" are supported:
436
+
437
+ * @val:VALUE , prevent further special prefix processing, e.g. `--username=@val:laurent` sets the option `username` to value `laurent`.
438
+ * @file:PATH , read value from a file (prefix "~/" is replaced with the users home folder), e.g. --key=@file:~/.ssh/mykey
439
+ * @path:PATH , performs path expansion (prefix "~/" is replaced with the users home folder), e.g. --config-file=@path:~/sample_config.yml
440
+ * @env:ENVVAR , read from a named env var, e.g.--password=@env:MYPASSVAR
441
+ * @stdin: , read from stdin (no value on right)
442
+ * @preset:NAME , get whole <%=opprst%> value by name
443
+
444
+ In addition it is possible to decode a value, using one or multiple decoders :
445
+
446
+ * @base64: decode a base64 encoded string
447
+ * @json: decode JSON values (convenient to provide complex structures)
448
+ * @zlib: uncompress data
449
+ * @ruby: execute ruby code
450
+ * @csvt: decode a titled CSV value
451
+ * @lines: split a string in multiple lines and return an array
452
+ * @list: split a string in multiple items taking first character as separator and return an array
453
+ * @incps: include values of presets specified by key include_presets in hash
454
+
455
+ To display the result of an extended value, use the `config echo` command.
456
+
457
+ Example: read the content of the specified file, then, base64 decode, then unzip:
458
+
459
+ ```
460
+ $ <%=cmd%> config echo @zlib:@base64:@file:myfile.dat
461
+ ```
462
+
463
+ Example: create a value as a hash, with one key and the value is read from a file:
464
+
465
+ ```
466
+ $ <%=cmd%> config echo @ruby:'{"token_verification_key"=>File.read("pubkey.txt")}'
467
+ ```
468
+
469
+ Example: read a csv file and create a list of hash for bulk provisioning:
470
+
471
+ ```
472
+ $ cat test.csv
473
+ name,email
474
+ lolo,laurent@example.com
475
+ toto,titi@tutu.tata
476
+ $ <%=cmd%> config echo @csvt:@file:test.csv
477
+ :......:.....................:
478
+ : name : email :
479
+ :......:.....................:
480
+ : lolo : laurent@example.com :
481
+ : toto : titi@tutu.tata :
482
+ :......:.....................:
483
+ ```
484
+
485
+ Example: create a hash and include values from preset named "config" of config file
486
+
487
+ ```
488
+ $ <%=cmd%> config echo @incps:@json:'{"hello":true,"incps":["config"]}'
489
+ {"version"=>"0.9", "hello"=>true}
490
+ ```
491
+
492
+ Note that `@incps:@json:'{"incps":["config"]}'` or `@incps:@ruby:'{"incps"=>["config"]}'` is equivalent to: `@preset:config`
493
+
494
+ ## <a name="native"></a>Structured Value
495
+
496
+ Some options and parameters expect a _Structured Value_, i.e. a value more complex than a simple string. This is usually a Hash table or an Array, which could also contain sub structures.
497
+
498
+ For instance, a [_transfer-spec_](#transferspec) is expected to be a _Structured Value_.
499
+
500
+ Structured values shall be described using the [Extended Value Syntax](#extended).
501
+ A convenient way to specify a _Structured Value_ is to use the `@json:` decoder, and describe the value in JSON format. The `@ruby:` decoder can also be used. For an array of hash tables, the `@csvt:` decoder can be used.
502
+
503
+ It is also possible to provide a _Structured Value_ in a file using `@json:@file:<path>`
504
+
505
+ ## <a name="conffolder"></a>Configuration and Persistency Folder
506
+
507
+ <%=tool%> configuration and other runtime files (token cache, file lists, persistency files)
508
+ are stored in folder `$HOME/.aspera/<%=cmd%>`. The folder can be displayed using :
509
+
510
+ ```
511
+ $ <%=cmd%> config folder
512
+ /Users/kenji/.aspera/<%=cmd%>
513
+ ```
514
+
515
+ ## <a name="configfile"></a>Configuration file
516
+
517
+ On the first execution of <%=tool%>, an empty configuration file is created in the configuration folder.
518
+ Nevertheless, there is no mandatory information required in this file, the use of it is optional as any option can be provided on the command line.
519
+
520
+ Although the file is a standard YAML file, <%=tool%> provides commands to read and modify it
521
+ using the `config` command.
522
+
523
+ All options for <%=tool%> commands can be set on command line, or by env vars, or using <%=prsts%> in the configuratin file.
524
+
525
+ A configuration file provides a way to define default values, especially
526
+ for authentication parameters, thus avoiding to always having to specify those parameters on the command line.
527
+
528
+ The default configuration file is: `$HOME/.aspera/<%=cmd%>/config.yaml`
529
+ (this can be overriden with option `--config-file=path` or equivalent env var).
530
+
531
+ So, finally, the configuration file is simply a catalog of pre-defined lists of options,
532
+ called: <%=prsts%>. Then, instead of specifying some common options on the command line (e.g. address, credentials), it is possible to invoke the ones of a <%=prst%> (e.g. `mypreset`) using the option: `-Pmypreset` or `--preset=mypreset`.
533
+
534
+ ### <a name="lprt"></a><%=prstt%>
535
+
536
+ A <%=prst%> is simply a collection of parameters and their associated values in a named section in the configuration file.
537
+
538
+ A named <%=prst%> can be modified directly using <%=tool%>, which will update the configuration file :
539
+
540
+ ```
541
+ $ <%=cmd%> config id <<%=opprst%>> set|delete|show|initialize|update
542
+ ```
543
+
544
+ The command `update` allows the easy creation of <%=prst%> by simply providing the options in their command line format, e.g. :
545
+
546
+ ```
547
+ $ <%=cmd%> config id demo_server update --url=ssh://demo.asperasoft.com:33001 --username=asperaweb --password=demoaspera --ts=@json:'{"precalculate_job_size":true}'
548
+ ```
549
+
550
+ * This creates a <%=prst%> `demo_server` with all provided options.
551
+
552
+ The command `set` allows setting individual options in a <%=prst%>.
553
+
554
+ ```
555
+ $ <%=cmd%> config id demo_server set password demoaspera
556
+ ```
557
+
558
+ The command `initialize`, like `update` allows to set several parameters at once, but it deletes an existing configuration instead of updating it, and expects a _[Structured Value](#native)_.
559
+
560
+ ```
561
+ $ <%=cmd%> config id demo_server initialize @json:'{"url":"ssh://demo.asperasoft.com:33001","username":"asperaweb","password":"demoaspera","ts":{"precalculate_job_size":true}}'
562
+ ```
563
+
564
+ A good practice is to not manually edit the configuration file and use modification commands instead.
565
+ If necessary, the configuration file can be edited (or simply consulted) with:
566
+
567
+ ```
568
+ $ <%=cmd%> config open
569
+ ```
570
+
571
+ A full terminal based overview of the configuration can be displayed using:
572
+
573
+ ```
574
+ $ <%=cmd%> config over
575
+ ```
576
+
577
+ A list of <%=prst%> can be displayed using:
578
+
579
+ ```
580
+ $ <%=cmd%> config list
581
+ ```
582
+
583
+ ### <a name="lprtconf"></a>Special <%=prstt%>: config
584
+
585
+ This preset name is reserved and contains a single key: `version`. This is the version of <%=tool%> which created the file.
586
+
587
+ ### <a name="lprtdef"></a>Special <%=prstt%>: default
588
+
589
+ This preset name is reserved and contains an array of key-value , where the key is the name of a plugin, and the value is the name of another preset.
590
+
591
+ When a plugin is invoked, the preset associated with the name of the plugin is loaded, unless the option --no-default (or -N) is used.
592
+
593
+ Note that special plugin name: `config` can be associated with a preset that is loaded initially, typically used for default values.
594
+
595
+ Operations on this preset are done using regular `config` operations:
596
+
597
+ ```
598
+ $ <%=cmd%> config id default set _plugin_name_ _defauklt_preset_for_plugin_
599
+ $ <%=cmd%> config id default get _plugin_name_
600
+ "_defauklt_preset_for_plugin_"
601
+ ```
602
+
603
+ ### Format of file
604
+
605
+ The configuration file is a hash in a YAML file. Example:
606
+
607
+ ```yaml
608
+ config:
609
+ version: 0.3.7
610
+ default:
611
+ config: cli_default
612
+ server: demo_server
613
+ cli_default:
614
+ interactive: no
615
+ demo_server:
616
+ url: ssh://demo.asperasoft.com:33001
617
+ username: asperaweb
618
+ password: demoaspera
619
+ ```
620
+
621
+ We can see here:
622
+
623
+ * The configuration was created with CLI version 0.3.7
624
+ * the default <%=prst%> to load for plugin "server" is : `demo_server`
625
+ * the <%=prst%> `demo_server` defines some parameters: the URL and credentials
626
+ * the default <%=prst%> to load in any case is : `cli_default`
627
+
628
+ Two <%=prsts%> are reserved:
629
+
630
+ * `config` contains a single value: `version` showing the CLI
631
+ version used to create the configuration file. It is used to check compatibility.
632
+ * `default` is reserved to define the default <%=prst%> name used for known plugins.
633
+
634
+ The user may create as many <%=prsts%> as needed. For instance, a particular <%=prst%> can be created for a particular application instance and contain URL and credentials.
635
+
636
+ Values in the configuration also follow the [Extended Value Syntax](#extended).
637
+
638
+ Note: if the user wants to use the [Extended Value Syntax](#extended) inside the configuration file, using the `config id update` command, the user shall use the `@val:` prefix. Example:
639
+
640
+ ```
641
+ $ <%=cmd%> config id my_aoc_org set private_key @val:@file:"$HOME/.aspera/<%=cmd%>/aocapikey"
642
+ ```
643
+
644
+ This creates the <%=prst%>:
645
+
646
+ ```
647
+ ...
648
+ my_aoc_org:
649
+ private_key: @file:"/Users/laurent/.aspera/<%=cmd%>/aocapikey"
650
+ ...
651
+ ```
652
+
653
+ So, the key file will be read only at execution time, but not be embedded in the configuration file.
654
+
655
+ Options are loaded using this algorithm:
656
+
657
+ * if option '--preset=xxxx' is specified (or -Pxxxx), this reads the <%=prst%> specified from the configuration file.
658
+ * else if option --no-default (or -N) is specified, then dont load default
659
+ * else it looks for the name of the default <%=prst%> in section "default" and loads it
660
+ * environment variables are evaluated
661
+ * command line options are evaluated
662
+
663
+ Parameters are evaluated in the order of command line.
664
+
665
+ To avoid loading the default <%=prst%> for a plugin, just specify a non existing configuration: `-Pnone`
666
+
667
+ On command line, words in parameter names are separated by a dash, in configuration file, separator
668
+ is an underscore. E.g. --xxx-yyy on command line gives xxx_yyy in configuration file.
669
+
670
+ Note: before version 0.4.5, some keys could be ruby symbols, from 0.4.5 all keys are strings. To
671
+ convert olver versions, remove the leading ":" in front of keys.
672
+
673
+ The main plugin name is *config*, so it is possible to define a default <%=prst%> for
674
+ the main plugin with:
675
+
676
+ ```
677
+ $ <%=cmd%> config id cli_default set interactive no
678
+ $ <%=cmd%> config id default set config cli_default
679
+ ```
680
+
681
+ A <%=prst%> value can be removed with `unset`:
682
+
683
+ ```
684
+ $ <%=cmd%> config id cli_default unset interactive
685
+ ```
686
+
687
+
688
+ ### Examples
689
+
690
+ For Faspex, Shares, Node (including ATS, Aspera Transfer Service), Console,
691
+ only username/password and url are required (either on command line, or from config file).
692
+ Those can usually be provided on the command line:
693
+
694
+ ```
695
+ $ <%=cmd%> shares repo browse / --url=https://10.25.0.6 --username=john --password=4sp3ra
696
+ ```
697
+
698
+ This can also be provisioned in a config file:
699
+
700
+ ```
701
+ 1$ <%=cmd%> config id shares06 set url https://10.25.0.6
702
+ 2$ <%=cmd%> config id shares06 set username john
703
+ 3$ <%=cmd%> config id shares06 set password 4sp3ra
704
+ 4$ <%=cmd%> config id default set shares shares06
705
+ 5$ <%=cmd%> config overview
706
+ 6$ <%=cmd%> shares repo browse /
707
+ ```
708
+
709
+ The three first commands build a <%=prst%>.
710
+ Note that this can also be done with one single command:
711
+
712
+ ```
713
+ $ <%=cmd%> config id shares06 init @json:'{"url":"https://10.25.0.6","username":"john","password":"4sp3ra"}'
714
+ ```
715
+
716
+ The fourth command defines this <%=prst%> as the default <%=prst%> for the
717
+ specified application ("shares"). The 5th command displays the content of configuration file in table format.
718
+ Alternative <%=prsts%> can be used with option "-P&lt;<%=prst%>&gt;"
719
+ (or --preset=&lt;<%=prst%>&gt;)
720
+
721
+ Eventually, the last command shows a call to the shares application using default parameters.
722
+
723
+
724
+ ## Plugins
725
+
726
+ The CLI tool uses a plugin mechanism. The first level command (just after <%=tool%> on the command line) is the name of the concerned plugin which will execute the command. Each plugin usually represent commands sent to a specific application.
727
+ For instance, the plugin "faspex" allows operations on the application "Aspera Faspex".
728
+
729
+ ### Create your own plugin
730
+ ```
731
+ $ mkdir -p ~/.aspera/<%=cmd%>/plugins
732
+ $ cat<<EOF>~/.aspera/<%=cmd%>/plugins/test.rb
733
+ require 'aspera/cli/plugin'
734
+ module Aspera
735
+ module Cli
736
+ module Plugins
737
+ class Test < Plugin
738
+ ACTIONS=[]
739
+ def execute_action; puts "Hello World!"; end
740
+ end # Test
741
+ end # Plugins
742
+ end # Cli
743
+ end # Aspera
744
+ EOF
745
+ ```
746
+
747
+ ## Debugging
748
+
749
+ The gem is equipped with traces. By default logging level is "warn". To increase debug level, use parameter `log_level`, so either command line `--log-level=xx` or env var `<%=evp%>LOG_LEVEL`.
750
+
751
+ ## Learning Aspera Product APIs (REST)
752
+
753
+ This CLI uses REST APIs.
754
+ To display HTTP calls, use argument `-r` or `--rest-debug`, this is useful to display
755
+ exact content or HTTP requests and responses.
756
+
757
+ In order to get traces of execution, use argument : `--log-level=debug`
758
+
759
+ ## <a name="graphical"></a>Graphical Interactions: Browser and Text Editor
760
+
761
+ Some actions may require the use of a graphical tool:
762
+
763
+ * a browser for Aspera on Cloud authentication (web auth method)
764
+ * a text editor for configuration file edition
765
+
766
+ By default the CLI will assume that a graphical environment is available on windows,
767
+ and on other systems, rely on the presence of the "DISPLAY" environment variable.
768
+ It is also possible to force the graphical mode with option --ui :
769
+
770
+ * `--ui=graphical` forces a graphical environment, a browser will be opened for URLs or
771
+ a text editor for file edition.
772
+ * `--ui=text` forces a text environment, the URL or file path to open is displayed on
773
+ terminal.
774
+
775
+ ## HTTP proxy for REST
776
+
777
+ To specify a HTTP proxy, set the HTTP_PROXY environment variable (or HTTPS_PROXY), those are honoured by Ruby when calling REST APIs.
778
+
779
+ ## Proxy auto config
780
+
781
+ The `fpac` option allows specification of a Proxy Auto Configuration (PAC) file, by its URL for local FASP agent. Supported schemes are : http:, https: and file:.
782
+
783
+ The PAC file can be tested with command: `config proxy_check` , example:
784
+
785
+ ```
786
+ $ <%=cmd%> config proxy_check --fpac=file:///./proxy.pac http://www.example.com
787
+ PROXY proxy.example.com:8080
788
+ ```
789
+
790
+ This is not yet implemented to specify http proxy, so use `http_proxy` env vars.
791
+
792
+ ## <a name="client"></a>FASP configuration
793
+
794
+ The `config` plugin also allows specification for the use of a local FASP client. It provides the following commands for `ascp` subcommand:
795
+
796
+ * `show` : shows the path of ascp used
797
+ * `use` : list,download connect client versions available on internet
798
+ * `products` : list Aspera transfer products available locally
799
+ * `connect` : list,download connect client versions available on internet
800
+
801
+ ### Show path of currently used `ascp`
802
+
803
+ ```
804
+ $ <%=cmd%> config ascp show
805
+ /Users/laurent/Applications/Aspera Connect.app/Contents/Resources/ascp
806
+ ```
807
+
808
+ ### Selection of local `ascp`
809
+
810
+ To temporarily use an alternate ascp path use option `ascp_path` (`--ascp-path=`)
811
+
812
+ To permanently use another ascp:
813
+
814
+ ```
815
+ $ <%=cmd%> config ascp use '/Users/laurent/Applications/Aspera CLI/bin/ascp'
816
+ saved to default global preset /Users/laurent/Applications/Aspera CLI/bin/ascp
817
+ ```
818
+
819
+ This sets up a global default.
820
+
821
+ ### List locally installed Aspera Transfer products
822
+
823
+ Locally installed Aspera products can be listed with:
824
+
825
+ ```
826
+ $ <%=cmd%> config ascp products list
827
+ :.........................................:................................................:
828
+ : name : app_root :
829
+ :.........................................:................................................:
830
+ : Aspera Connect : /Users/laurent/Applications/Aspera Connect.app :
831
+ : IBM Aspera CLI : /Users/laurent/Applications/Aspera CLI :
832
+ : IBM Aspera High-Speed Transfer Endpoint : /Library/Aspera :
833
+ : Aspera Drive : /Applications/Aspera Drive.app :
834
+ :.........................................:................................................:
835
+ ```
836
+
837
+ ### Selection of local client
838
+
839
+ If no ascp is selected, this is equivalent to using option: `--use-product=FIRST`.
840
+
841
+ Using the option use_product finds the ascp binary of the selected product.
842
+
843
+ To permanently use the ascp of a product:
844
+
845
+ ```
846
+ $ <%=cmd%> config ascp products use 'Aspera Connect'
847
+ saved to default global preset /Users/laurent/Applications/Aspera Connect.app/Contents/Resources/ascp
848
+ ```
849
+
850
+ ### Installation of Connect Client on command line
851
+
852
+ ```
853
+ $ <%=cmd%> config ascp connect list
854
+ :...............................................:......................................:..............:
855
+ : id : title : version :
856
+ :...............................................:......................................:..............:
857
+ : urn:uuid:589F9EE5-0489-4F73-9982-A612FAC70C4E : Aspera Connect for Windows : 3.7.0.138427 :
858
+ : urn:uuid:A3820D20-083E-11E2-892E-0800200C9A66 : Aspera Connect for Windows 64-bit : 3.7.0.138427 :
859
+ : urn:uuid:589F9EE5-0489-4F73-9982-A612FAC70C4E : Aspera Connect for Windows XP : 3.7.0.138427 :
860
+ : urn:uuid:55425020-083E-11E2-892E-0800200C9A66 : Aspera Connect for Windows XP 64-bit : 3.7.0.138427 :
861
+ : urn:uuid:D8629AD2-6898-4811-A46F-2AF386531BFF : Aspera Connect for Mac Intel 10.6 : 3.6.1.111259 :
862
+ : urn:uuid:D8629AD2-6898-4811-A46F-2AF386531BFF : Aspera Connect for Mac Intel : 3.7.0.138427 :
863
+ : urn:uuid:213C9370-22B1-11E2-81C1-0800200C9A66 : Aspera Connect for Linux 32 : 3.6.2.117442 :
864
+ : urn:uuid:97F94DF0-22B1-11E2-81C1-0800200C9A66 : Aspera Connect for Linux 64 : 3.7.2.141527 :
865
+ :...............................................:......................................:..............:
866
+ $ <%=cmd%> config ascp connect id 'Aspera Connect for Mac Intel 10.6' links list
867
+ :.............................................:..........................:.......................................................................:..........:...............:
868
+ : title : type : href : hreflang : rel :
869
+ :.............................................:..........................:.......................................................................:..........:...............:
870
+ : Mac Intel Installer : application/octet-stream : bin/AsperaConnect-3.6.1.111259-mac-intel-10.6.dmg : en : enclosure :
871
+ : Aspera Connect for Mac HTML Documentation : text/html : : en : documentation :
872
+ : Aspera Connect PDF Documentation for Mac OS : application/pdf : docs/user/osx/ja-jp/pdf/Connect_User_3.7.0_OSX_ja-jp.pdf : ja-jp : documentation :
873
+ : Aspera Connect PDF Documentation for Mac OS : application/pdf : docs/user/osx/en/pdf/Connect_User_3.7.0_OSX.pdf : en : documentation :
874
+ : Aspera Connect PDF Documentation for Mac OS : application/pdf : docs/user/osx/es-es/pdf/Connect_User_3.7.0_OSX_es-es.pdf : es-es : documentation :
875
+ : Aspera Connect PDF Documentation for Mac OS : application/pdf : docs/user/osx/fr-fr/pdf/Connect_User_3.7.0_OSX_fr-fr.pdf : fr-fr : documentation :
876
+ : Aspera Connect PDF Documentation for Mac OS : application/pdf : docs/user/osx/zh-cn/pdf/Connect_User_3.7.0_OSX_zh-cn.pdf : zh-cn : documentation :
877
+ : Aspera Connect for Mac Release Notes : text/html : http://www.asperasoft.com/en/release_notes/default_1/release_notes_54 : en : release-notes :
878
+ :.............................................:..........................:.......................................................................:..........:...............:
879
+ $ <%=cmd%> config ascp connect id 'Aspera Connect for Mac Intel 10.6' links id 'Mac Intel Installer' download --to-folder=.
880
+ downloaded: AsperaConnect-3.6.1.111259-mac-intel-10.6.dmg
881
+ ```
882
+
883
+ ## <a name="agents"></a>Transfer Agents
884
+
885
+ Some of the actions on Aspera Applications lead to file transfers (upload and download) using the FASP protocol (`ascp`).
886
+
887
+ When a transfer needs to be started, a [_transfer-spec_](#transferspec) has been internally prepared.
888
+ This [_transfer-spec_](#transferspec) will be executed by a transfer client, here called "Transfer Agent".
889
+
890
+ There are currently 3 agents:
891
+
892
+ * `direct` : a local execution of `ascp`
893
+ * `connect` : use of a local Connect Client
894
+ * `node` : use of an Aspera Transfer Node (potentially _remote_).
895
+ * `httpgw` : use of an Aspera HTTP Gateway
896
+
897
+ Note that all transfer operation are seen from the point of view of the agent.
898
+ For instance, a node agent making an "upload", or "package send" operation,
899
+ will effectively push files to the related server from the agent node.
900
+
901
+ <%=tool%> standadizes on the use of a [_transfer-spec_](#transferspec) instead of _raw_ ascp options to provide parameters for a transfer session, as a common method for those three Transfer Agents.
902
+
903
+
904
+ ### <a name="direct"></a>Direct (local ascp using FASPManager API)
905
+
906
+ By default the CLI will use a local FASP protocol, equivalent to specifying `--transfer=direct`.
907
+ <%=tool%> will detect locally installed Aspera products.
908
+ Refer to section [FASP](#client).
909
+
910
+ To specify a FASP proxy (only supported with the `direct` agent), set the appropriate [_transfer-spec_](#transferspec) parameter:
911
+
912
+ * `EX_fasp_proxy_url`
913
+ * `EX_http_proxy_url` (proxy for legacy http fallback)
914
+ * `EX_ascp_args`
915
+
916
+ The `transfer-info` optionally provides the following auto resume parameters:
917
+
918
+ <table>
919
+ <tr><th>Name</th><th>Default</th><th>Feature</th><th>Description</th></tr>
920
+ <tr><td>iter_max</td>. <td>7</td><td>Resume</td><td>Max number of retry on error</td></tr>
921
+ <tr><td>sleep_initial</td><td>2</td><td>Resume</td><td>First Sleep before retry</td></tr>
922
+ <tr><td>sleep_factor</td> <td>2</td><td>Resume</td><td>Multiplier of Sleep</td></tr>
923
+ <tr><td>sleep_max</td>. <td>60</td><td>Resume</td><td>Maximum sleep</td></tr>
924
+ <tr><td>wss</td> <td>false</td><td>Web Socket Session</td><td>Enable use of web socket session in case it is available</td></tr>
925
+ </table>
926
+
927
+ ### IBM Aspera Connect Client GUI
928
+
929
+ By specifying option: `--transfer=connect`, <%=tool%> will start transfers
930
+ using the locally installed Aspera Connect Client.
931
+
932
+ ### Aspera Node API : Node to node transfers
933
+
934
+ By specifying option: `--transfer=node`, the CLI will start transfers in an Aspera
935
+ Transfer Server using the Node API, either on a local or remote node.
936
+
937
+ If a default node has been configured
938
+ in the configuration file, then this node is used by default else the parameter
939
+ `--transfer-info` is required. The node specification shall be a hash table with
940
+ three keys: url, username and password, corresponding to the URL of the node API
941
+ and associated credentials (node user or access key).
942
+
943
+ The `--transfer-info` parameter can directly specify a pre-configured <%=prst%> :
944
+ `--transfer-info=@preset:<psetname>` or specified using the option syntax :
945
+ `--transfer-info=@json:'{"url":"https://...","username":"theuser","password":"thepass"}'`
946
+
947
+ ### <a name="trinfoaoc"></a>Aspera on cloud
948
+
949
+ By specifying option: `--transfer=aoc`, WORK IN PROGRESS
950
+
951
+ ### <a name="httpgw"></a>HTTP Gateway
952
+
953
+ If it possible to send using a HTTP gateway, in case FASP is not allowed.
954
+
955
+ Example:
956
+
957
+ ```
958
+ $ <%=cmd%> faspex package recv --id=323 --transfer=httpgw --transfer-info=@json:'{"url":"https://eudemo.asperademo.com:9443/aspera/http-gwy/v1"}'
959
+ ```
960
+
961
+ ## <a name="transferspec"></a>Transfer Specification
962
+
963
+ Some commands lead to file transfer (upload/download), all parameters necessary for this transfer
964
+ is described in a _transfer-spec_ (Transfer Specification), such as:
965
+
966
+ * server address
967
+ * transfer user name
968
+ * credentials
969
+ * file list
970
+ * etc...
971
+
972
+ <%=tool%> builds a default _transfer-spec_ internally, so it is not necessary to provide additional parameters on the command line for this transfer.
973
+
974
+ If needed, it is possible to modify or add any of the supported _transfer-spec_ parameter using the `ts` option. The `ts` option accepts a [Structured Value](#native) containing one or several _transfer-spec_ parameters.
975
+
976
+ It is possible to specify ascp options when the `transfer` option is set to `direct` using the special [_transfer-spec_](#transferspec) parameter: `EX_ascp_args`. Example: `--ts=@json:'{"EX_ascp_args":["-l","100m"]}'`. This is espacially useful for ascp command line parameters not supported yet in the transfer spec.
977
+
978
+ The use of a _transfer-spec_ instead of `ascp` parameters has the advantage of:
979
+
980
+ * common to all [Transfer Agent](#agents)
981
+ * not dependent on command line limitations (special characters...)
982
+
983
+ A [_transfer-spec_](#transferspec) is a Hash table, so it is described on the command line with the [Extended Value Syntax](#extended).
984
+
985
+ ## <a name="transferparams"></a>Transfer Parameters
986
+
987
+ All standard _transfer-spec_ parameters can be overloaded. To display parameters,
988
+ run in debug mode (--log-level=debug). [_transfer-spec_](#transferspec) can
989
+ also be saved/overridden in the config file.
990
+
991
+ <%= File.read("#{ENV['DIR_DOC']}transfer_spec.html").gsub(/.*<body>(.*)<\/body>.*/m,'\1') %>
992
+
993
+ ### Destination folder for transfers
994
+
995
+ The destination folder is set by <%=tool%> by default to:
996
+
997
+ * `.` for downloads
998
+ * `/` for uploads
999
+
1000
+ It is specified by the [_transfer-spec_](#transferspec) parameter `destination_root`.
1001
+ As such, it can be modified with option: `--ts=@json:'{"destination_root":"<path>"}'`.
1002
+ The option `to_folder` provides an equivalent and convenient way to change this parameter:
1003
+ `--to-folder=<path>` .
1004
+
1005
+ ### List of files for transfers
1006
+
1007
+ When uploading, downloading or sending files, the user must specify
1008
+ the list of files to transfer. Most of the time, the list of files to transfer will be simply specified on the command line:
1009
+
1010
+ ```
1011
+ $ <%=cmd%> server upload ~/mysample.file secondfile
1012
+ ```
1013
+
1014
+ This is equivalent to:
1015
+
1016
+ ```
1017
+ $ <%=cmd%> server upload --sources=@args ~/mysample.file secondfile
1018
+ ```
1019
+
1020
+ More advanced options are provided to adapt to various cases. In fact, list of files to transfer are conveyed using the [_transfer-spec_](#transferspec) using the field: "paths" which is a list (array) of pairs of "source" (mandatory) and "destination" (optional).
1021
+
1022
+ Note that this is different from the "ascp" command line. The paradigm used by <%=tool%> is: all transfer parameters are kept in [_transfer-spec_](#transferspec) so that execution of a transfer is independent of the transfer agent. Note that other IBM Aspera interfaces use this: connect, node, transfer sdk.
1023
+
1024
+ For ease of use and flexibility, the list of files to transfer is specified by the option `sources`. Accepted values are:
1025
+
1026
+ * `@args` : (default value) the list of files is directly provided at the end of the command line (see at the beginning of this section).
1027
+
1028
+ * an [Extended Value](#extended) holding an *Array of String*. Examples:
1029
+
1030
+ ```
1031
+ --sources=@json:'["file1","file2"]'
1032
+ --sources=@lines:@stdin:
1033
+ --sources=@ruby:'File.read("myfilelist").split("\n")'
1034
+ ```
1035
+
1036
+ * `@ts` : the user provides the list of files directly in the `ts` option, in its `paths` field. Example:
1037
+
1038
+ ```
1039
+ --sources=@ts --ts=@json:'{"paths":[{"source":"file1"},{"source":"file2"}]}'
1040
+ ```
1041
+
1042
+ * Although not recommended, because it applies *only* to the `local` transfer agent (i.e. bare ascp), it is possible to specify bare ascp arguments using the pseudo [_transfer-spec_](#transferspec) parameter `EX_ascp_args`. In that case, one must specify a dummy list in the [_transfer-spec_](#transferspec), which will be overriden by the bare ascp command line provided.
1043
+
1044
+ ```
1045
+ --sources=@ts --ts=@json:'{"paths":[{"source":"dummy"}],"EX_ascp_args":["--file-list","myfilelist"]}'
1046
+ ```
1047
+
1048
+ In case the file list is provided on the command line (i.e. using `--sources=@args` or `--sources=<Array>`, but not `--sources=@ts`), the list of files will be used either as a simple file list or a file pair list depending on the value of the option: `src_type`:
1049
+
1050
+ * `list` : (default) the path of destination is the same as source
1051
+ * `pair` : in that case, the first element is the first source, the second element is the first destination, and so on.
1052
+
1053
+ Example:
1054
+
1055
+ ```
1056
+ $ <%=cmd%> server upload --src-type=pair ~/Documents/Samples/200KB.1 /Upload/sample1
1057
+ ```
1058
+
1059
+ Note the special case when the source files are located on "Aspera on Cloud", i.e. using access keys and the `file id` API:
1060
+
1061
+ * All files must be in the same source folder.
1062
+ * If there is a single file : specify the full path
1063
+ * For multiple files, specify the source folder as first item in the list followed by the list of file names.
1064
+
1065
+ Source files are located on "Aspera on cloud", when :
1066
+
1067
+ * the server is Aspera on Cloud, and making a download / recv
1068
+ * the agent is Aspera on Cloud, and making an upload / send
1069
+
1070
+ ### <a name="multisession"></a>Support of multi-session
1071
+
1072
+ Multi session, i.e. starting a transfer of a file set using multiple sessions is supported on "direct" and "node" agents, not yet on connect.
1073
+
1074
+ * when agent=node :
1075
+
1076
+ ```
1077
+ --ts=@json:'{"multi_session":10,"multi_session_threshold":1}'
1078
+ ```
1079
+
1080
+ Multi-session is directly supported by the node daemon.
1081
+
1082
+ * when agent=direct :
1083
+
1084
+ ```
1085
+ --ts=@json:'{"multi_session":5,"multi_session_threshold":1,"resume_policy":"none"}'
1086
+ ```
1087
+
1088
+ Note: resume policy of "attr" may cause problems. "none" or "sparse_csum"
1089
+ shall be preferred.
1090
+
1091
+ Multi-session spawn is done by <%=tool%>.
1092
+
1093
+
1094
+ ### Examples
1095
+
1096
+ * Change target rate
1097
+
1098
+ ```
1099
+ --ts=@json:'{"target_rate_kbps":500000}'
1100
+ ```
1101
+
1102
+ * Override the FASP SSH port to a specific TCP port:
1103
+
1104
+ ```
1105
+ --ts=@json:'{"ssh_port":33002}'
1106
+ ```
1107
+
1108
+ * Force http fallback mode:
1109
+
1110
+ ```
1111
+ --ts=@json:'{"http_fallback":"force"}'
1112
+ ```
1113
+
1114
+ * Activate progress when not activated by default on server
1115
+
1116
+ ```
1117
+ --ts=@json:'{"precalculate_job_size":true}'
1118
+ ```
1119
+
1120
+
1121
+
1122
+ ## <a name="scheduling"></a>Scheduling an exclusive execution
1123
+
1124
+ It is possible to ensure that a given command is only run once at a time with parameter: `--lock-port=nnnn`. This is especially usefull when scheduling a command on a regular basis, for instance involving transfers, and a transfer may last longer than the execution period.
1125
+
1126
+ This opens a local TCP server port, and fails if this port is already used, providing a local lock.
1127
+
1128
+ This option is used when the tools is executed automatically, for instance with "preview" generation.
1129
+
1130
+ Usually the OS native scheduler shall already provide some sort of such protection (windows scheduler has it natively, linux cron can leverage `flock`).
1131
+
1132
+ ## <a name="commands"></a>Sample Commands
1133
+
1134
+ A non complete list of commands used in unit tests:
1135
+
1136
+ ```
1137
+ <%= File.read(ENV["COMMANDS"]) %>
1138
+ ...and more
1139
+ ```
1140
+
1141
+ ## <a name="usage"></a>Usage
1142
+
1143
+ ```
1144
+ $ <%=cmd%> -h
1145
+ <%= File.read(ENV["USAGE"]) %>
1146
+
1147
+ ```
1148
+
1149
+ Note that actions and parameter values can be written in short form.
1150
+
1151
+ # <a name="plugins"></a>Plugins: Application URL and Authentication
1152
+
1153
+ <%=tool%> comes with several Aspera application plugins.
1154
+
1155
+ REST APIs of Aspera legacy applications (Aspera Node, Faspex, Shares, Console, Orchestrator, Server) use simple username/password authentication: HTTP Basic Authentication.
1156
+
1157
+ Those are using options:
1158
+
1159
+ * url
1160
+ * username
1161
+ * password
1162
+
1163
+ Those can be provided using command line, parameter set, env var, see section above.
1164
+
1165
+ Aspera on Cloud relies on Oauth, refer to the [Aspera on Cloud](#aoc) section.
1166
+
1167
+ # <a name="aoc"></a>Plugin: Aspera on Cloud
1168
+
1169
+ Aspera on Cloud uses the more advanced Oauth v2 mechanism for authentication (HTTP Basic authentication is not supported).
1170
+
1171
+ It is recommended to use the wizard to set it up, but manual configuration is also possible.
1172
+
1173
+ ## <a name="aocwizard"></a>Configuration: using Wizard
1174
+
1175
+ <%=tool%> provides a configuration wizard. Here is a sample invocation :
1176
+
1177
+ ```
1178
+ $ <%=cmd%> config wizard
1179
+ option: url> https://myorg.ibmaspera.com
1180
+ Detected: Aspera on Cloud
1181
+ Preparing preset: aoc_myorg
1182
+ Please provide path to your private RSA key, or empty to generate one:
1183
+ option: pkeypath>
1184
+ using existing key:
1185
+ /Users/myself/.aspera/<%=cmd%>/aspera_on_cloud_key
1186
+ Using global client_id.
1187
+ option: username> john@example.com
1188
+ Updating profile with new key
1189
+ creating new config preset: aoc_myorg
1190
+ Setting config preset as default for aspera
1191
+ saving config file
1192
+ Done.
1193
+ You can test with:
1194
+ $ <%=cmd%> aspera user info show
1195
+ ```
1196
+
1197
+ Optionally, it is possible to create a new organization-specific "integration".
1198
+ For this, specify the option: `--use-generic-client=no`.
1199
+
1200
+ This will guide you through the steps to create.
1201
+
1202
+ ## <a name="aocwizard"></a>Configuration: using manual setup
1203
+
1204
+ If you used the wizard (recommended): skip this section.
1205
+
1206
+ ### Configuration details
1207
+
1208
+ Several types of OAuth authentication are supported:
1209
+
1210
+ * JSON Web Token (JWT) : authentication is secured by a private key (recommended for CLI)
1211
+ * Web based authentication : authentication is made by user using a browser
1212
+ * URL Token : external users authentication with url tokens (public links)
1213
+
1214
+ The authentication method is controled by option `auth`.
1215
+
1216
+ For a _quick start_, follow the mandatory and sufficient section: [API Client Registration](#clientreg) (auth=web) as well as [<%=prst%> for Aspera on Cloud](#aocpreset).
1217
+
1218
+ For a more convenient, browser-less, experience follow the [JWT](#jwt) section (auth=jwt) in addition to Client Registration.
1219
+
1220
+ In Oauth, a "Bearer" token are generated to authenticate REST calls. Bearer tokens are valid for a period of time.<%=tool%> saves generated tokens in its configuration folder, tries to re-use them or regenerates them when they have expired.
1221
+
1222
+ ### <a name="clientreg"></a>Optional: API Client Registration
1223
+
1224
+ If you use the built-in client_id and client_secret, skip this and do not set them in next section.
1225
+
1226
+ Else you can use a specific OAuth API client_id, the first step is to declare <%=tool%> in Aspera on Cloud using the admin interface.
1227
+
1228
+ (official documentation: <https://ibmaspera.com/help/admin/organization/registering_an_api_client> ).
1229
+
1230
+ Let's start by a registration with web based authentication (auth=web):
1231
+
1232
+ * Open a web browser, log to your instance: e.g. `https://myorg.ibmaspera.com/`
1233
+ * Go to Apps&rarr;Admin&rarr;Organization&rarr;Integrations
1234
+ * Click "Create New"
1235
+ * Client Name: <%=tool%>
1236
+ * Redirect URIs: `http://localhost:12345`
1237
+ * Origins: `localhost`
1238
+ * uncheck "Prompt users to allow client to access"
1239
+ * leave the JWT part for now
1240
+ * Save
1241
+
1242
+ Note: for web based authentication, <%=tool%> listens on a local port (e.g. specified by the redirect_uri, in this example: 12345), and the browser will provide the OAuth code there. For `<%=tool%>, HTTP is required, and 12345 is the default port.
1243
+
1244
+ Once the client is registered, a "Client ID" and "Secret" are created, these values will be used in the next step.
1245
+
1246
+ ### <a name="aocpreset"></a><%=prst%> for Aspera on Cloud
1247
+
1248
+ If you did not use the wizard, you can also manually create a <%=prst%> for <%=tool%> in its configuration file.
1249
+
1250
+ Lets create an <%=prst%> called: `my_aoc_org` using `ask` interactive input (client info from previous step):
1251
+
1252
+ ```
1253
+ $ <%=cmd%> config id my_aoc_org ask url client_id client_secret
1254
+ option: url> https://myorg.ibmaspera.com/
1255
+ option: client_id> BJLPObQiFw
1256
+ option: client_secret> yFS1mu-crbKuQhGFtfhYuoRW...
1257
+ updated: my_aoc_org
1258
+ ```
1259
+
1260
+ (This can also be done in one line using the command `config id my_aoc_org update --url=...`)
1261
+
1262
+ Define this <%=prst%> as default configuration for the `aspera` plugin:
1263
+
1264
+ ```
1265
+ $ <%=cmd%> config id default set aspera my_aoc_org
1266
+ ```
1267
+
1268
+ Note: Default `auth` method is `web` and default `redirect_uri` is `http://localhost:12345`. Leave those default values.
1269
+
1270
+ ### <a name="jwt"></a>Activation of JSON Web Token (JWT) for direct authentication
1271
+
1272
+ For a Browser-less, Private Key-based authentication, use the following steps.
1273
+
1274
+ #### Key Pair Generation
1275
+
1276
+ In order to use JWT for Aspera on Cloud API client authentication,
1277
+ a private/public key pair must be generated (without passphrase)
1278
+ This can be done using any of the following method:
1279
+
1280
+ (TODO: add passphrase protection as option).
1281
+
1282
+ * using the CLI:
1283
+
1284
+ ```
1285
+ $ <%=cmd%> config genkey ~/.aspera/<%=cmd%>/aocapikey
1286
+ ```
1287
+
1288
+ * `ssh-keygen`:
1289
+
1290
+ ```
1291
+ $ ssh-keygen -t rsa -f ~/.aspera/<%=cmd%>/aocapikey -N ''
1292
+ ```
1293
+
1294
+ * `openssl`
1295
+
1296
+ (on some openssl implementation (mac) there is option: -nodes (no DES))
1297
+
1298
+ ```
1299
+ $ APIKEY=~/.aspera/<%=cmd%>/aocapikey
1300
+ $ openssl genrsa -passout pass:dummypassword -out ${APIKEY}.protected 2048
1301
+ $ openssl rsa -passin pass:dummypassword -in ${APIKEY}.protected -out ${APIKEY}
1302
+ $ openssl rsa -pubout -in ${APIKEY} -out ${APIKEY}.pub
1303
+ $ rm -f ${APIKEY}.protected
1304
+ ```
1305
+
1306
+ #### API Client JWT activation
1307
+
1308
+ If you are not using the built-in client_id and secret, JWT needs to be authorized in Aspera on Cloud. This can be done in two manners:
1309
+
1310
+ * Graphically
1311
+
1312
+ * Open a web browser, log to your instance: https://myorg.ibmaspera.com/
1313
+ * Go to Apps&rarr;Admin&rarr;Organization&rarr;Integrations
1314
+ * Click on the previously created application
1315
+ * select tab : "JSON Web Token Auth"
1316
+ * Modify options if necessary, for instance: activate both options in section "Settings"
1317
+ * Click "Save"
1318
+
1319
+ * Using command line
1320
+
1321
+ ```
1322
+ $ <%=cmd%> aspera admin res client list
1323
+ :............:.........:
1324
+ : id : name :
1325
+ :............:.........:
1326
+ : BJLPObQiFw : <%=cmd%> :
1327
+ :............:.........:
1328
+ $ <%=cmd%> aspera admin res client --id=BJLPObQiFw modify @json:'{"jwt_grant_enabled":true,"explicit_authorization_required":false}'
1329
+ modified
1330
+ ```
1331
+
1332
+ ### User key registration
1333
+
1334
+ The public key must be assigned to your user. This can be done in two manners:
1335
+
1336
+ * Graphically
1337
+
1338
+ open the previously generated public key located here: `$HOME/.aspera/<%=cmd%>/aocapikey.pub`
1339
+
1340
+ * Open a web browser, log to your instance: https://myorg.ibmaspera.com/
1341
+ * Click on the user's icon (top right)
1342
+ * Select "Account Settings"
1343
+ * Paste the _Public Key_ in the "Public Key" section
1344
+ * Click on "Submit"
1345
+
1346
+ * Using command line
1347
+
1348
+ ```
1349
+ $ <%=cmd%> aspera admin res user list
1350
+ :........:................:
1351
+ : id : name :
1352
+ :........:................:
1353
+ : 109952 : Tech Support :
1354
+ : 109951 : LAURENT MARTIN :
1355
+ :........:................:
1356
+ $ <%=cmd%> aspera user info modify @ruby:'{"public_key"=>File.read(File.expand_path("~/.aspera/<%=cmd%>/aocapikey.pub"))}'
1357
+ modified
1358
+ ```
1359
+
1360
+ Note: the `aspera user info show` command can be used to verify modifications.
1361
+
1362
+ ### <%=prst%> modification for JWT
1363
+
1364
+ To activate default use of JWT authentication for <%=tool%> using the <%=prst%>, do the folowing:
1365
+
1366
+ * change auth method to JWT
1367
+ * provide location of private key
1368
+ * provide username to login as (OAuthg "subject")
1369
+
1370
+ Execute:
1371
+
1372
+ ```
1373
+ $ <%=cmd%> config id my_aoc_org update --auth=jwt --private-key=@val:@file:~/.aspera/<%=cmd%>/aocapikey --username=laurent.martin.aspera@fr.ibm.com
1374
+ ```
1375
+
1376
+ Note: the private key argument represents the actual PEM string. In order to read the content from a file, use the @file: prefix. But if the @file: argument is used as is, it will read the file and set in the config file. So to keep the "@file" tag in the configuration file, the @val: prefix is added.
1377
+
1378
+ After this last step, commands do not require web login anymore.
1379
+
1380
+
1381
+ ### <a name="aocfirst"></a>First Use
1382
+
1383
+ Once client has been registered and <%=prst%> created: <%=tool%> can be used:
1384
+
1385
+ ```
1386
+ $ <%=cmd%> aspera files br /
1387
+ Current Workspace: Default Workspace (default)
1388
+ empty
1389
+ ```
1390
+
1391
+
1392
+ ### Administration
1393
+
1394
+ The `admin` command allows several administrative tasks (and require admin privilege).
1395
+
1396
+ It allows actions (create, update, delete) on "resources": users, group, nodes, workspace, etc... with the `admin resource` command.
1397
+
1398
+ Bulk operations are possible using option `bulk` (yes,no(default)): currently: create only. In that case, the operation expects an Array of Hash instead of a simple Hash using the [Extended Value Syntax](#extended).
1399
+
1400
+ To get more resources when doing request add:
1401
+
1402
+ ```
1403
+ --query=@json:'{"per_page":10000}'
1404
+ ```
1405
+
1406
+ other query parameters can be used:
1407
+ ```
1408
+ --query=@json:'{"member_of_any_workspace":true}'
1409
+ --query=@json:'{"q":"laurent"}'
1410
+ ```
1411
+
1412
+ Refer to the AoC API for full list of query parameters.
1413
+
1414
+ #### Access Key secrets
1415
+
1416
+ In order to access some administrative actions on "nodes" (in fact, access keys), the associated
1417
+ secret is required, it is usually provided using the `secret` option. For example in a command like:
1418
+
1419
+ ```
1420
+ $ <%=cmd%> aspera admin res node --id="access_key1" --secret="secret1" v3 info
1421
+ ```
1422
+
1423
+ It is also possible to provide a set of secrets used on a regular basis. This can be done using the `secrets` option. The value provided shall be a Hash, where keys are access key ids, and values are the associated secrets.
1424
+
1425
+ First choose a repository name, for example `my_secrets`, and populate it like this:
1426
+
1427
+ ```
1428
+ $ <%=cmd%> conf id my_secrets set 'access_key1' 'secret1'
1429
+ $ <%=cmd%> conf id my_secrets set 'access_key2' 'secret2'
1430
+ $ <%=cmd%> conf id default get config
1431
+ "cli_default"
1432
+ ```
1433
+
1434
+ Here above, one already has set a `config` global preset to preset `cli_default` (refer to earlier in documentation), then the repository can be read by default like this (note the prefix `@val:` to avoid the evaluation of prefix `@preset:`):
1435
+
1436
+ ```
1437
+ $ <%=cmd%> conf id cli_default set secrets @val:@preset:my_secrets
1438
+ ```
1439
+
1440
+ A secret repository can always be selected at runtime using `--secrets=@preset:xxxx`, or `--secrets=@json:'{"accesskey1":"secret1"}'`
1441
+
1442
+ #### Examples
1443
+
1444
+ * Bulk creation
1445
+
1446
+ ```
1447
+ $ <%=cmd%> aspera admin res user create --bulk=yes @json:'[{"email":"dummyuser1@example.com"},{"email":"dummyuser2@example.com"}]'
1448
+ :.......:.........:
1449
+ : id : status :
1450
+ :.......:.........:
1451
+ : 98398 : created :
1452
+ : 98399 : created :
1453
+ :.......:.........:
1454
+ ```
1455
+
1456
+ * Find with filter and delete
1457
+
1458
+ ```
1459
+ $ <%=cmd%> aspera admin res user list --query='@json:{"q":"dummyuser"}' --fields=id,email
1460
+ :.......:........................:
1461
+ : id : email :
1462
+ :.......:........................:
1463
+ : 98398 : dummyuser1@example.com :
1464
+ : 98399 : dummyuser2@example.com :
1465
+ :.......:........................:
1466
+ $ thelist=$(echo $(<%=cmd%> aspera admin res user list --query='@json:{"q":"dummyuser"}' --fields=id,email --field=id --format=csv)|tr ' ' ,)
1467
+ $ echo $thelist
1468
+ 98398,98399
1469
+ $ <%=cmd%> aspera admin res user --bulk=yes --id=@json:[$thelist] delete
1470
+ :.......:.........:
1471
+ : id : status :
1472
+ :.......:.........:
1473
+ : 98398 : deleted :
1474
+ : 98399 : deleted :
1475
+ :.......:.........:
1476
+ ```
1477
+
1478
+ * Display current user's workspaces
1479
+
1480
+ ```
1481
+ $ <%=cmd%> aspera user workspaces
1482
+ :......:............................:
1483
+ : id : name :
1484
+ :......:............................:
1485
+ : 16 : Engineering :
1486
+ : 17 : Marketing :
1487
+ : 18 : Sales :
1488
+ :......:............................:
1489
+ ```
1490
+
1491
+ * Create a sub access key in a "node"
1492
+
1493
+ Creation of a sub-access key is like creation of access key with the following difference: authentication to node API is made with accesskey (master access key) and only the path parameter is provided: it is relative to the storage root of the master key. (id and secret are optional)
1494
+
1495
+ ```
1496
+ $ <%=cmd%> aspera admin resource node --name=_node_name_ --secret=_secret_ v4 access_key create --value=@json:'{"storage":{"path":"/folder1"}}'
1497
+ ```
1498
+
1499
+ * Display transfer events (ops/transfer)
1500
+
1501
+ ```
1502
+ $ <%=cmd%> aspera admin res node --secret=_secret_ v3 transfer list --value=@json:'[["q","*"],["count",5]]'
1503
+ ```
1504
+
1505
+ # page=1&per_page=10&q=type:(file_upload+OR+file_delete+OR+file_download+OR+file_rename+OR+folder_create+OR+folder_delete+OR+folder_share+OR+folder_share_via_public_link)&sort=-date
1506
+ #events=@api_files.read('events',{'q'=>'type:(file_upload OR file_download)'})[:data]
1507
+ # can add filters: tag=aspera.files.package_id%3DLA8OU3p8w
1508
+ #'tag'=>'aspera.files.package_id%3DJvbl0w-5A'
1509
+ # filter= 'id', 'short_summary', or 'summary'
1510
+ # count=nnn
1511
+ # tag=x.y.z%3Dvalue
1512
+ # iteration_token=nnn
1513
+ # after_time=2016-05-01T23:53:09Z
1514
+ # active_only=true|false
1515
+
1516
+
1517
+ * Display node events (events)
1518
+
1519
+ ```
1520
+ $ <%=cmd%> aspera admin res node --secret=_secret_ v3 events
1521
+ ```
1522
+
1523
+ * display members of a workspace
1524
+
1525
+ ```
1526
+ $ <%=cmd%> aspera admin res workspace_membership list --fields=member_type,manager,member.email --query=@json:'{"page":1,"per_page":50,"embed":"member","inherited":false,"workspace_id":11363,"sort":"name"}'
1527
+ :.............:.........:..................................:
1528
+ : member_type : manager : member.email :
1529
+ :.............:.........:..................................:
1530
+ : user : true : john.curtis@email.com :
1531
+ : user : false : laurent.martin.aspera@fr.ibm.com :
1532
+ : user : false : jean.dupont@me.com :
1533
+ : user : false : another.user@example.com :
1534
+ : group : false : :
1535
+ : user : false : aspera.user@gmail.com :
1536
+ :.............:.........:..................................:
1537
+ ```
1538
+
1539
+ other query parameters:
1540
+
1541
+ ```
1542
+ {"workspace_membership_through":true,"include_indirect":true}
1543
+ ```
1544
+
1545
+ * <a name="aoc_sample_member"></a>add all members of a workspace to another workspace
1546
+
1547
+ a- get id of first workspace
1548
+
1549
+ ```
1550
+ WS1='First Workspace'
1551
+ WS1ID=$(<%=cmd%> aspera admin res workspace list --query=@json:'{"q":"'"$WS1"'"}' --select=@json:'{"name":"'"$WS1"'"}' --fields=id --format=csv)
1552
+ ```
1553
+
1554
+ b- get id of second workspace
1555
+
1556
+ ```
1557
+ WS2='Second Workspace'
1558
+ WS2ID=$(<%=cmd%> aspera admin res workspace list --query=@json:'{"q":"'"$WS2"'"}' --select=@json:'{"name":"'"$WS2"'"}' --fields=id --format=csv)
1559
+ ```
1560
+
1561
+ c- extract membership information and change workspace id
1562
+
1563
+ ```
1564
+ $ <%=cmd%> aspera admin res workspace_membership list --fields=manager,member_id,member_type,workspace_id --query=@json:'{"per_page":10000,"workspace_id":'"$WS1ID"'}' --format=jsonpp > ws1_members.json
1565
+ ```
1566
+
1567
+ d- convert to creation data for second workspace:
1568
+
1569
+ ```
1570
+ grep -Eve '(direct|effective_manager|_count|storage|"id")' ws1_members.json|sed '/workspace_id/ s/"'"$WS1ID"'"/"'"$WS2ID"'"/g' > ws2_members.json
1571
+ ```
1572
+
1573
+ or, using jq:
1574
+
1575
+ ```
1576
+ jq '[.[] | {member_type,member_id,workspace_id,manager,workspace_id:"'"$WS2ID"'"}]' ws1_members.json > ws2_members.json
1577
+ ```
1578
+
1579
+ e- add members to second workspace
1580
+
1581
+ ```
1582
+ $ <%=cmd%> aspera admin res workspace_membership create --bulk=yes @json:@file:ws2_members.json
1583
+ ```
1584
+
1585
+ * get users who did not log since a date
1586
+
1587
+ ```
1588
+ $ <%=cmd%> aspera admin res user list --fields=email --query=@json:'{"per_page":10000,"q":"last_login_at:<2018-05-28"}'
1589
+ :...............................:
1590
+ : email :
1591
+ :...............................:
1592
+ : John.curtis@acme.com :
1593
+ : Jean.Dupont@tropfort.com :
1594
+ :...............................:
1595
+ ```
1596
+
1597
+ * list "Limited" users
1598
+
1599
+ ```
1600
+ $ <%=cmd%> aspera admin res user list --fields=email --query=@json:'{"per_page":10000}' --select=@json:'{"member_of_any_workspace":false}'
1601
+ ```
1602
+
1603
+ * Perform a multi Gbps transfer between two remote shared folders
1604
+
1605
+ In this example, a user has access to a workspace where two shared folders are located on differente sites, e.g. different cloud regions.
1606
+
1607
+ First, setup the environment (skip if already done)
1608
+
1609
+ ```
1610
+ $ <%=cmd%> conf wizard --url=https://sedemo.ibmaspera.com --username=laurent.martin.aspera@fr.ibm.com
1611
+ Detected: Aspera on Cloud
1612
+ Preparing preset: aoc_sedemo
1613
+ Using existing key:
1614
+ /Users/laurent/.aspera/<%=cmd%>/aspera_on_cloud_key
1615
+ Using global client_id.
1616
+ Please Login to your Aspera on Cloud instance.
1617
+ Navigate to your "Account Settings"
1618
+ Check or update the value of "Public Key" to be:
1619
+ -----BEGIN PUBLIC KEY-----
1620
+ SOME PUBLIC KEY PEM DATA HERE
1621
+ -----END PUBLIC KEY-----
1622
+ Once updated or validated, press enter.
1623
+
1624
+ creating new config preset: aoc_sedemo
1625
+ Setting config preset as default for aspera
1626
+ saving config file
1627
+ Done.
1628
+ You can test with:
1629
+ $ <%=cmd%> aspera user info show
1630
+ ```
1631
+
1632
+ This creates the option preset "aoc_&lt;org name&gt;" to allow seamless command line access and sets it as default for aspera on cloud.
1633
+
1634
+ Then, create two shared folders located in two regions, in your files home, in a workspace.
1635
+
1636
+ Then, transfer between those:
1637
+
1638
+ ```
1639
+ $ <%=cmd%> -Paoc_show aspera files transfer --from-folder='IBM Cloud SJ' --to-folder='AWS Singapore' 100GB.file --ts=@json:'{"target_rate_kbps":"1000000","multi_session":10,"multi_session_threshold":1}'
1640
+ ```
1641
+
1642
+ * create registration key to register a node
1643
+ ```
1644
+ $ <%=cmd%> aspera admin res admin/client create @json:'{"data":{"name":"laurentnode","client_subject_scopes":["alee","aejd"],"client_subject_enabled":true}}' --fields=token --format=csv
1645
+ jfqslfdjlfdjfhdjklqfhdkl
1646
+ ```
1647
+
1648
+ * delete all registration keys
1649
+
1650
+ ```
1651
+ $ <%=cmd%> aspera admin res admin/client list --fields=id --format=csv|<%=cmd%> aspera admin res admin/client delete --bulk=yes --id=@lines:@stdin:
1652
+ +-----+---------+
1653
+ | id | status |
1654
+ +-----+---------+
1655
+ | 99 | deleted |
1656
+ | 100 | deleted |
1657
+ | 101 | deleted |
1658
+ | 102 | deleted |
1659
+ +-----+---------+
1660
+ ```
1661
+
1662
+ ## Shared folders
1663
+
1664
+ * list shared folders in node
1665
+
1666
+ ```
1667
+ $ <%=cmd%> aspera admin res node --id=8669 shared_folders
1668
+ ```
1669
+
1670
+ * list shared folders in workspace
1671
+
1672
+ ```
1673
+ $ <%=cmd%> aspera admin res workspace --id=10818 shared_folders
1674
+ ```
1675
+
1676
+ * list members of shared folder
1677
+
1678
+ ```
1679
+ $ <%=cmd%> aspera admin res node --id=8669 v4 perm 82 show
1680
+ ```
1681
+
1682
+ ## Send a Package
1683
+
1684
+ Send a package:
1685
+
1686
+ ```
1687
+ $ <%=cmd%> aspera packages send --value=@json:'{"name":"my title","note":"my note","recipients":["laurent.martin.aspera@fr.ibm.com","other@example.com"]}' --sources=@args my_file.dat
1688
+ ```
1689
+
1690
+ Notes:
1691
+
1692
+ * the `value` parameter can contain any supported package creation parameter. Refer to the API, or display an existing package.
1693
+ * to list recipients use fields: "recipients" and/or "bcc_recipients". <%=cmd%> will resolve the list of email addresses to expected user ids. If a recipient is not already registered and the workspace allows external users, then the package is sent to an external user, and
1694
+ * if the option `new_user_option` is `@json:{"package_contact":true}` (default), then a public link is sent and the external user does not need to create an account.
1695
+ * if the option `new_user_option` is `@json:{}`, then external users are invited to join the workspace
1696
+
1697
+ ## <a name="aoccargo"></a>Receive only new packages
1698
+
1699
+ It is possible to automatically download new packages, like using Aspera Cargo:
1700
+
1701
+ ```
1702
+ $ <%=cmd%> aspera packages recv --id=ALL --once-only=yes --lock-port=12345
1703
+ ```
1704
+
1705
+ * `--id=ALL` (case sensitive) will download all packages
1706
+ * `--once-only=yes` keeps memory of any downloaded package in persistency files located in the configuration folder.
1707
+ * `--lock-port=12345` ensures that only one instance is started at the same time, to avoid collisions
1708
+
1709
+ Typically, one would regularly execute this command on a regular basis, using the method oif your choice:
1710
+
1711
+ * Windows scheduler
1712
+ * cron
1713
+ * etc...
1714
+
1715
+ ## Download Files
1716
+
1717
+ Download of files is straightforward with a specific syntax for the `aspera files download` action: Like other commands the source file list is provided as a list with the `sources` option. Nevertheless, consider this:
1718
+
1719
+ * if only one source is provided, it is downloaded
1720
+ * if multiple sources must be downloaded, then the first in list is the path of the source folder, and the remaining items are the file names in this folder (without path).
1721
+
1722
+ ## Find Files
1723
+
1724
+ The command `aspera files find [--value=expression]` will recursively scan storage to find files matching the expression criteria. It works also on node resource using the v4 command. (see examples)
1725
+
1726
+ The expression can be of 3 formats:
1727
+
1728
+ * empty (default) : all files, equivalent to: `exec:true`
1729
+ * not starting with `exec:` : the expression is a regular expression, using ruby regex syntax. equivalent to: `exec:f['name'].match(/expression/)`
1730
+
1731
+ For instance, to find files with a special extension, use `--value='\.myext$'`
1732
+
1733
+ * starting with `exec:` : the ruby code after the prefix is executed for each entry found. the entry variable name is `f`. the file is displayed if the result is true;
1734
+
1735
+ Examples of expressions: (think to prefix with `exec:` and put in single quotes using bash)
1736
+
1737
+ * find files more recent than 100 days
1738
+
1739
+ ```
1740
+ f["type"].eql?("file") and (DateTime.now-DateTime.parse(f["modified_time"]))<100
1741
+ ```
1742
+
1743
+ * expression to find files older than 1 year on a given node and store in file list
1744
+
1745
+ ```
1746
+ $ <%=cmd%> aspera admin res node --name='my node name' --secret='my secret' v4 find / --fields=path --value='exec:f["type"].eql?("file") and (DateTime.now-DateTime.parse(f["modified_time"]))<100' --format=csv > my_file_list.txt
1747
+ ```
1748
+
1749
+ * delete the files, one by one
1750
+
1751
+ ```
1752
+ $ cat my_file_list.txt|while read path;do echo <%=cmd%> aspera admin res node --name='my node name' --secret='my secret' v4 delete "$path" ;done
1753
+ ```
1754
+
1755
+ * delete the files in bulk
1756
+
1757
+ ```
1758
+ cat my_file_list.txt | <%=cmd%> aspera admin res node --name='my node name' --secret='my secret' v3 delete @lines:@stdin:
1759
+ ```
1760
+
1761
+ ## Activity
1762
+
1763
+ The activity app can be queried with:
1764
+
1765
+ ```
1766
+ $ <%=cmd%> aspera admin analytics transfers
1767
+ ```
1768
+
1769
+ It can also support filters and send notification email with a template:
1770
+
1771
+ ```
1772
+ $ <%=cmd%> aspera admin analytics transfers --once-only=yes --lock-port=123455 \
1773
+ --query=@json:'{"status":"completed","direction":"receive"}' \
1774
+ --notify=@json:'{"to":"<''%=transfer[:user_email.to_s]%>","subject":"<''%=transfer[:files_completed.to_s]%> files received","body":"Dear <''%=transfer[:user_email.to_s]%>\nWe received <''%=transfer[:files_completed.to_s]%> files for a total of <''%=transfer[:transferred_bytes.to_s]%> bytes, starting with file:\n<''%=transfer[:content.to_s]%>\n\nThank you."}'
1775
+ ```
1776
+
1777
+ * `once_only` keep track of last date it was called, so next call will get only new events
1778
+ * `query` filter (on API call)
1779
+ * `notify` send an email as specified by template, this could be places in a file with the `@file` modifier.
1780
+
1781
+ Note this must not be executed in less than 5 minutes because the analytics interface accepts only a period of time between 5 minutes and 6 months. here the period is [date of previous execution]..[now].
1782
+
1783
+ ## Using specific transfer ports
1784
+
1785
+ By default transfer nodes are expected to use ports TCP/UDP 33001. The web UI enforces that. The option `default_ports` ([yes]/no) allows <%=cmd%> to retrieve the server ports from an API call (download_setup) which reads the information from `aspera.conf` on the server.
1786
+
1787
+
1788
+ # Plugin: Aspera Transfer Service
1789
+
1790
+ ATS is usable either :
1791
+
1792
+ * from an AoC subscription : <%=cmd%> aspera admin ats
1793
+
1794
+ * or from an IBM Cloud subscription : <%=cmd%> ats
1795
+
1796
+ ## IBM Cloud ATS : creation of api key
1797
+
1798
+ First get your IBM Cloud APIkey. For instance, it can be created using the IBM Cloud web interface, or using command line:
1799
+
1800
+ ```
1801
+ $ ibmcloud iam api-key-create mykeyname -d 'my sample key'
1802
+ OK
1803
+ API key mykeyname was created
1804
+
1805
+ Please preserve the API key! It cannot be retrieved after it's created.
1806
+
1807
+ Name mykeyname
1808
+ Description my sample key
1809
+ Created At 2019-09-30T12:17+0000
1810
+ API Key my_secret_api_key_here_8f8d9fdakjhfsashjk678
1811
+ Locked false
1812
+ UUID ApiKey-05b8fadf-e7fe-4bc4-93a9-6fd348c5ab1f
1813
+ ```
1814
+
1815
+ References:
1816
+
1817
+ * [https://console.bluemix.net/docs/iam/userid_keys.html#userapikey](https://console.bluemix.net/docs/iam/userid_keys.html#userapikey)
1818
+ * [https://ibm.ibmaspera.com/helpcenter/transfer-service](https://ibm.ibmaspera.com/helpcenter/transfer-service)
1819
+
1820
+
1821
+ Then, to register the key by default for the ats plugin, create a preset. Execute:
1822
+
1823
+ ```
1824
+ $ <%=cmd%> config id my_ibm_ats update --ibm-api-key=my_secret_api_key_here_8f8d9fdakjhfsashjk678
1825
+ $ <%=cmd%> config id default set ats my_ibm_ats
1826
+ $ <%=cmd%> ats api_key instances
1827
+ +--------------------------------------+
1828
+ | instance |
1829
+ +--------------------------------------+
1830
+ | aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee |
1831
+ +--------------------------------------+
1832
+ $ <%=cmd%> config id my_ibm_ats update --instance=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
1833
+ $ <%=cmd%> ats api_key create
1834
+ +--------+----------------------------------------------+
1835
+ | key | value |
1836
+ +--------+----------------------------------------------+
1837
+ | id | ats_XXXXXXXXXXXXXXXXXXXXXXXX |
1838
+ | secret | YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY |
1839
+ +--------+----------------------------------------------+
1840
+ $ <%=cmd%> config id my_ibm_ats update --ats-key=ats_XXXXXXXXXXXXXXXXXXXXXXXX --ats-secret=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
1841
+ ```
1842
+
1843
+ ## Examples
1844
+
1845
+ Example: create access key on softlayer:
1846
+
1847
+ ```
1848
+ $ <%=cmd%> ats access_key create --cloud=softlayer --region=ams --params=@json:'{"storage":{"type":"softlayer_swift","container":"_container_name_","credentials":{"api_key":"value","username":"_name_:_usr_name_"},"path":"/"},"id":"_optional_id_","name":"_optional_name_"}'
1849
+ ```
1850
+
1851
+ Example: create access key on AWS:
1852
+
1853
+ ```
1854
+ $ <%=cmd%> ats access_key create --cloud=aws --region=eu-west-1 --params=@json:'{"id":"testkey3","name":"laurent key AWS","storage":{"type":"aws_s3","bucket":"my-bucket","credentials":{"access_key_id":"AKIA_MY_API_KEY","secret_access_key":"my/secret/here"},"path":"/laurent"}}'
1855
+
1856
+ ```
1857
+
1858
+ Example: create access key on Azure SAS:
1859
+
1860
+ ```
1861
+ $ <%=cmd%> ats access_key create --cloud=azure --region=eastus --params=@json:'{"id":"testkeyazure","name":"laurent key azure","storage":{"type":"azure_sas","credentials":{"shared_access_signature":"https://containername.blob.core.windows.net/blobname?sr=c&..."},"path":"/"}}'
1862
+
1863
+ ```
1864
+
1865
+ (Note that the blob name is mandatory after server address and before parameters. and that parameter sr=c is mandatory.)
1866
+
1867
+ Example: create access key on Azure:
1868
+
1869
+ ```
1870
+ $ <%=cmd%> ats access_key create --cloud=azure --region=eastus --params=@json:'{"id":"testkeyazure","name":"laurent key azure","storage":{"type":"azure","credentials":{"account":"myaccount","key":"myaccesskey","storage_endpoint":"myblob"},"path":"/"}}'
1871
+
1872
+ ```
1873
+
1874
+ delete all my access keys:
1875
+
1876
+ ```
1877
+ for k in $(<%=cmd%> ats access_key list --field=id --format=csv);do <%=cmd%> ats access_key id $k delete;done
1878
+ ```
1879
+
1880
+ # Plugin: IBM Aspera High Speed Transfer Server (transfer)
1881
+
1882
+ This plugin works at FASP level (SSH/ascp/ascmd) and does not use the node API.
1883
+
1884
+ ## Authentication
1885
+
1886
+ Both password and SSH keys auth are supported.
1887
+
1888
+ Multiple SSH key paths can be provided. The value of the parameter `ssh_keys` can be a single value or an array. Each value is a path to a private key and is expanded ("~" is replaced with the user's home folder).
1889
+
1890
+ Examples:
1891
+
1892
+ ```
1893
+ $ <%=cmd%> server --ssh-keys=~/.ssh/id_rsa
1894
+ $ <%=cmd%> server --ssh-keys=@list:,~/.ssh/id_rsa
1895
+ $ <%=cmd%> server --ssh-keys=@json:'["~/.ssh/id_rsa"]'
1896
+ ```
1897
+
1898
+ The underlying ssh library `net::ssh` provides several options that may be used
1899
+ depending on environment. By default the ssh library expect that an ssh-agent is running, but if you get the error message:
1900
+
1901
+ ```
1902
+ ERROR -- net.ssh.authentication.agent: could not connect to ssh-agent: Agent not configured
1903
+ ```
1904
+
1905
+ This means that you dont have such agent, check env var: `SSH_AGENT_SOCK`, check if the key is protected with a passphrase. [check the manual](https://net-ssh.github.io/ssh/v1/chapter-2.html#s2)
1906
+
1907
+ To diable use of `ssh-agent`, use the option `ssh_option` like this (or set in preset):
1908
+
1909
+ ```
1910
+ $ <%=cmd%> server --ssh-options=@ruby:'{use_agent: false}' ...
1911
+ ```
1912
+
1913
+ ## Example
1914
+
1915
+ One can test the "server" application using the well known demo server:
1916
+
1917
+ ```
1918
+ $ <%=cmd%> config id aspera_demo_server update --url=ssh://demo.asperasoft.com:33001 --username=asperaweb --password=demoaspera
1919
+ $ <%=cmd%> config id default set server aspera_demo_server
1920
+ $ <%=cmd%> server browse /aspera-test-dir-large
1921
+ $ <%=cmd%> server download /aspera-test-dir-large/200MB
1922
+ ```
1923
+
1924
+ This creates a <%=prst%> "aspera_demo_server" and set it as default for application "server"
1925
+
1926
+
1927
+ # Plugin: IBM Aspera High Speed Transfer Server (node)
1928
+
1929
+ This plugin gives access to capabilities provided by HSTS node API.
1930
+
1931
+ ## Simple Operations
1932
+
1933
+ It is possible to:
1934
+ * browse
1935
+ * transfer (upload / download)
1936
+ * ...
1937
+
1938
+ ## Central
1939
+
1940
+ The central subcommand uses the "reliable query" API (session and file). It allows listing transfer sessions and transfered files.
1941
+
1942
+ Filtering can be applied:
1943
+ ```
1944
+ $ <%=cmd%> node central file list
1945
+ ```
1946
+
1947
+ by providing the `validator` option, offline transfer validation can be done.
1948
+
1949
+ ## FASP Stream
1950
+
1951
+ It is possible to start a FASPStream session using the node API:
1952
+
1953
+ Use the "node stream create" command, then arguments are provided as a [_transfer-spec_](#transferspec).
1954
+
1955
+ ```
1956
+ $ <%=cmd%> node stream create --ts=@json:'{"direction":"send","source":"udp://233.3.3.4:3000?loopback=1&ttl=2","destination":"udp://233.3.3.3:3001/","remote_host":"localhost","remote_user":"stream","remote_password":"XXXX"}' --preset=stream
1957
+ ```
1958
+
1959
+ ## Watchfolder
1960
+
1961
+ Refer to [Aspera documentation](https://download.asperasoft.com/download/docs/entsrv/3.7.4/es_admin_linux/webhelp/index.html#watchfolder_external/dita/json_conf.html) for watch folder creation.
1962
+
1963
+ <%=tool%> supports remote operations through the node API. Operations are:
1964
+
1965
+ * Start watchd and watchfolderd services running as a system user having access to files
1966
+ * configure a watchfolder to define automated transfers
1967
+
1968
+
1969
+ ```
1970
+ $ <%=cmd%> node service create @json:'{"id":"mywatchd","type":"WATCHD","run_as":{"user":"user1"}}'
1971
+ $ <%=cmd%> node service create @json:'{"id":"mywatchfolderd","type":"WATCHFOLDERD","run_as":{"user":"user1"}}'
1972
+ $ <%=cmd%> node watch_folder create @json:'{"id":"mywfolder","source_dir":"/watch1","target_dir":"/","transport":{"host":"10.25.0.4","user":"user1","pass":"mypassword"}}'
1973
+ ```
1974
+
1975
+ ## Out of Transfer File Validation
1976
+
1977
+ Follow the Aspera Transfer Server configuration to activate this feature.
1978
+
1979
+ ```
1980
+ $ <%=cmd%> node central file list --validator=<%=cmd%> --data=@json:'{"file_transfer_filter":{"max_result":1}}'
1981
+ :..............:..............:............:......................................:
1982
+ : session_uuid : file_id : status : path :
1983
+ :..............:..............:............:......................................:
1984
+ : 1a74444c-... : 084fb181-... : validating : /home/xfer.../PKG - my title/200KB.1 :
1985
+ :..............:..............:............:......................................:
1986
+ $ <%=cmd%> node central file update --validator=<%=cmd%> --data=@json:'{"files":[{"session_uuid": "1a74444c-...","file_id": "084fb181-...","status": "completed"}]}'
1987
+ updated
1988
+ ```
1989
+
1990
+ ## Example: SHOD to ATS
1991
+
1992
+ Access to a "Shares on Demand" (SHOD) server on AWS is provided by a partner. And we need to
1993
+ transfer files from this third party SHOD instance into our Azure BLOB storage.
1994
+ Simply create an "Aspera Transfer Service" instance (https://ts.asperasoft.com), which
1995
+ provides access to the node API.
1996
+ Then create a configuration for the "SHOD" instance in the configuration file: in section
1997
+ "shares", a configuration named: awsshod.
1998
+ Create another configuration for the Azure ATS instance: in section "node", named azureats.
1999
+ Then execute the following command:
2000
+
2001
+ ```
2002
+ $ <%=cmd%> node download /share/sourcefile --to-folder=/destinationfolder --preset=awsshod --transfer=node --transfer-info=@preset:azureats
2003
+ ```
2004
+
2005
+ This will get transfer information from the SHOD instance and tell the Azure ATS instance
2006
+ to download files.
2007
+
2008
+ ## Create access key
2009
+
2010
+ ```
2011
+ $ <%=cmd%> node access_key create --value=@json:'{"id":"eudemo-sedemo","secret":"mystrongsecret","storage":{"type":"local","path":"/data/asperafiles"}}'
2012
+ ```
2013
+
2014
+ # Plugin: IBM Aspera Faspex
2015
+
2016
+ Note that the command "v4" requires the use of APIv4, refer to the Faspex Admin manual on how to activate.
2017
+
2018
+ ## Sending a Package
2019
+
2020
+ Provide delivery info in JSON, example:
2021
+
2022
+ ```
2023
+ --delivery-info=@json:'{"title":"my title","recipients":["laurent.martin.aspera@fr.ibm.com"]}'
2024
+ ```
2025
+
2026
+ a note can be added: `"note":"Please ..."`
2027
+
2028
+ metadata: `"metadata":{"Meta1":"Val1","Meta2":"Val2"}`
2029
+
2030
+
2031
+ Note for full details, refer to:
2032
+ [Reference on Developer Site](https://developer.asperasoft.com/web/faspex/sending)
2033
+
2034
+ ## operation on dropboxes
2035
+
2036
+ Example:
2037
+
2038
+ ```
2039
+ $ <%=cmd%> faspex v4 dropbox create --value=@json:'{"dropbox":{"e_wg_name":"test1","e_wg_desc":"test1"}}'
2040
+ $ <%=cmd%> faspex v4 dropbox list
2041
+ $ <%=cmd%> faspex v4 dropbox delete --id=36
2042
+ ```
2043
+
2044
+ ## remote sources
2045
+
2046
+ Faspex lacks an API to list the contents of a remote source (available in web UI). To workaround this,
2047
+ the node API is used, for this it is required to add a section ":storage" that links
2048
+ a storage name to a node config and sub path.
2049
+
2050
+ Example:
2051
+
2052
+ ```yaml
2053
+ my_faspex_conf:
2054
+ url: https://10.25.0.3/aspera/faspex
2055
+ username: admin
2056
+ password: MyPassword
2057
+ storage:
2058
+ testlaurent:
2059
+ node: "@preset:my_faspex_node"
2060
+ path: /myfiles
2061
+ my_faspex_node:
2062
+ url: https://10.25.0.3:9092
2063
+ username: node_faspex
2064
+ password: MyPassword
2065
+ ```
2066
+
2067
+ In this example, a faspex storage named "testlaurent" exists in Faspex, and is located
2068
+ under the docroot in "/myfiles" (this must be the same as configured in Faspex).
2069
+ The node configuration name is "my_faspex_node" here.
2070
+
2071
+ Note: the v4 API provide an API for nodes and shares.
2072
+
2073
+ ## Automated package download (cargo)
2074
+
2075
+ It is possible to tell <%=tool%> to download newly received packages, much like the official
2076
+ cargo client, or drive. Refer to the [same section](#aoccargo) in the Aspera on Cloud plugin:
2077
+
2078
+ ```
2079
+ $ <%=cmd%> faspex packages recv --id=ALL --once-only=yes --lock-port=12345
2080
+ ```
2081
+
2082
+ # Plugin: IBM Aspera Shares
2083
+
2084
+ Aspera Shares supports the "node API" for the file transfer part. (Shares 1 and 2)
2085
+
2086
+ In Shares2, users, groups listing are paged, to display sequential pages:
2087
+
2088
+ ```
2089
+ $ for p in 1 2 3;do <%=cmd%> shares2 admin users list --value=@json:'{"page":'$p'}';done
2090
+ ```
2091
+
2092
+ # Plugin: IBM Cloud Object Storage
2093
+
2094
+ The IBM Cloud Object Storage provides the possibility to execute transfers using FASP.
2095
+
2096
+ Required options are either:
2097
+
2098
+ * `bucket` bucket name
2099
+ * `endpoint` storage endpoint url, e.g. https://s3.hkg02.cloud-object-storage.appdomain.cloud
2100
+ * `apikey` API Key
2101
+ * `crn` resource instance id
2102
+
2103
+ or:
2104
+
2105
+ * `bucket` bucket name
2106
+ * `region` bucket region, e.g. eu-de
2107
+ * `service_credentials` see below
2108
+
2109
+ Service credentials are directly created using the IBM cloud web ui. Navigate to:
2110
+
2111
+ Navigation Menu &rarr; Resource List &rarr; Storage &rarr; Cloud Object Storage &rarr; Service Credentials &rarr; &lt;select or create credentials&gt; &rarr; view credentials &rarr; copy
2112
+
2113
+ Then save the copied value to a file, e.g. : `$HOME/cos_service_creds.json`
2114
+
2115
+ or using the CLI:
2116
+
2117
+ ```
2118
+ $ ibmcloud resource service-keys
2119
+ $ ibmcloud resource service-key aoclaurent --output JSON|jq '.[0].credentials'>$HOME/service_creds.json
2120
+ ```
2121
+
2122
+ (if you dont have `jq` installed, extract the structure as follows)
2123
+
2124
+ It consists in the following structure:
2125
+
2126
+ ```
2127
+ {
2128
+ "apikey": "xxxxxxx.....",
2129
+ "cos_hmac_keys": {
2130
+ "access_key_id": "xxxxxxx.....",
2131
+ "secret_access_key": "xxxxxxx....."
2132
+ },
2133
+ "endpoints": "https://control.cloud-object-storage.cloud.ibm.com/v2/endpoints",
2134
+ "iam_apikey_description": "my description ...",
2135
+ "iam_apikey_name": "my key name",
2136
+ "iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer",
2137
+ "iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/xxxxxxx.....",
2138
+ "resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/xxxxxxx....."
2139
+ }
2140
+ ```
2141
+
2142
+ The field `resource_instance_id` is for option `crn`
2143
+
2144
+ The field `apikey` is for option `apikey`
2145
+
2146
+ Endpoints for regions can be found by querying the `endpoints` URL.
2147
+
2148
+ For convenience, let us create a default configuration, for example:
2149
+
2150
+ ```
2151
+ $ <%=cmd%> conf id mycos update --service-credentials=@val:@json:@file:$HOME/service_creds.json --region=us-south --bucket=laurent
2152
+ $ <%=cmd%> conf id default set cos mycos
2153
+ ```
2154
+
2155
+ Now, Ready to do operations, a subset of "node" plugin operations are supported, basically node API:
2156
+
2157
+ ```
2158
+ $ <%=cmd%> cos node browse /
2159
+ $ <%=cmd%> cos node upload myfile.txt
2160
+ ```
2161
+
2162
+ # Plugin: IBM Aspera Sync
2163
+
2164
+ A basic plugin to start an "async" using <%=tool%>. The main advantage is the possibility
2165
+ to start from ma configuration file, using <%=tool%> standard options.
2166
+
2167
+ # Plugin: Preview
2168
+
2169
+ The `preview` generates "previews" of graphical files, i.e. thumbnails (office, images, video) and video previews on an Aspera HSTS for use primarily in the Aspera on Cloud application.
2170
+ This is based on the "node API" of Aspera HSTS when using Access Keys only inside it's "storage root".
2171
+ Several parameters can be used to tune several aspects:
2172
+
2173
+ * methods for detection of new files needing generation
2174
+ * methods for generation of video preview
2175
+ * parameters for video handling
2176
+
2177
+ ## Aspera Server configuration
2178
+
2179
+ Specify the previews folder as shown in:
2180
+
2181
+ <https://ibmaspera.com/help/admin/organization/installing_the_preview_maker>
2182
+
2183
+ By default, the `preview` plugin expects previews to be generated in a folder named `previews` located in the storage root. On the transfer server execute:
2184
+
2185
+ ```
2186
+ # /opt/aspera/bin/asconfigurator -x "server;preview_dir,previews"
2187
+ # /opt/aspera/bin/asnodeadmin --reload
2188
+ ```
2189
+
2190
+ Note: the configuration `preview_dir` is *relative* to the storage root, no need leading or trailing `/`. In general just set the value to `previews`
2191
+
2192
+ If another folder is configured on the HSTS, then specify it to <%=tool%> using the option `previews_folder`.
2193
+
2194
+ The HSTS node API limits any preview file to a parameter: `max_request_file_create_size_kb` (1 KB is 1024 bytes).
2195
+ This size is internally capped to `1<<24` Bytes (16777216) , i.e. 16384 KBytes.
2196
+
2197
+ To change this parameter in `aspera.conf`, use `asconfigurator`. To display the value, use `asuserdata`:
2198
+
2199
+ ```
2200
+ # /opt/aspera/bin/asuserdata -a | grep max_request_file_create_size_kb
2201
+ max_request_file_create_size_kb: "1024"
2202
+ # /opt/aspera/bin/asconfigurator -x "server; max_request_file_create_size_kb,16384"
2203
+ ```
2204
+
2205
+ If you use a value different than 16777216, then specify it using option `max_size`.
2206
+
2207
+ Note: the HSTS parameter (max_request_file_create_size_kb) is in kilobytes while the generator parameter is in bytes (factor of 1024).
2208
+
2209
+ ## <a name="prev_ext"></a>External tools: Linux
2210
+
2211
+ The tool requires the following external tools available in the `PATH`:
2212
+
2213
+ * ImageMagick : `convert` `composite`
2214
+ * OptiPNG : `optipng`
2215
+ * FFmpeg : `ffmpeg` `ffprobe`
2216
+ * Libreoffice : `libreoffice`
2217
+
2218
+ Here shown on Redhat/CentOS.
2219
+
2220
+ Other OSes should work as well, but are note tested.
2221
+
2222
+ To check if all tools are found properly, execute:
2223
+
2224
+ ```
2225
+ $ <%=cmd%> preview check
2226
+ ```
2227
+
2228
+ ### Image: Imagemagick and optipng
2229
+
2230
+ ```
2231
+ yum install -y ImageMagick optipng
2232
+ ```
2233
+
2234
+ ### Video: FFmpeg
2235
+
2236
+ ```
2237
+ curl -s https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz|(mkdir -p /opt && cd /opt && tar xJvf - && rm -f /opt/ffmpeg /usr/bin/{ffmpeg,ffprobe} && ln -s ffmpeg-* ffmpeg && ln -s /opt/ffmpeg/{ffmpeg,ffprobe} /usr/bin)
2238
+ ```
2239
+
2240
+ ### Office: Unoconv and Libreoffice
2241
+
2242
+ If you dont want to have preview for office dpcuments or if it is too complex you can skip office document preview generation by using option: `--skip-types=office`
2243
+
2244
+ The generation of preview in based on the use of `unoconv` and `libreoffice`
2245
+
2246
+ * Centos 8
2247
+
2248
+ ```
2249
+ # dnf install unoconv
2250
+ ```
2251
+
2252
+
2253
+ ## Configuration
2254
+
2255
+ Like any <%=tool%> commands, parameters can be passed on command line or using a configuration <%=prst%>. Note that if you use the <%=tool%> run as `xfer` user, like here, the configuration file must be created as the same user. Example using a <%=prst%> named `my_preset_name` (choose any name relevant to you, e.g. the AoC node name, and replace in the following lines):
2256
+
2257
+ ```
2258
+ # su -s /bin/bash - xfer
2259
+ $ <%=cmd%> config id my_preset_name update --url=https://localhost:9092 --username=my_access_key --password=my_secret --skip-types=office --lock-port=12346
2260
+ $ <%=cmd%> config id default set preview my_preset_name
2261
+ ```
2262
+
2263
+ Here we assume that Office file generation is disabled, else remove the option. For the `lock_port` option refer to a previous section in thsi manual.
2264
+
2265
+ Once can check if the access key is well configured using:
2266
+
2267
+ ```
2268
+ $ <%=cmd%> -Pmy_preset_name node browse /
2269
+ ```
2270
+
2271
+ This shall list the contents of the storage root of the access key.
2272
+
2273
+ ## Execution
2274
+
2275
+ The tool intentionally supports only a "one shot" mode in order to avoid having a hanging process or using too many resources (calling REST api too quickly during the scan or event method).
2276
+ It needs to be run regularly to create or update preview files. For that use your best
2277
+ reliable scheduler. For instance use "CRON" on Linux or Task Scheduler on Windows.
2278
+
2279
+ Typically, for "Access key" access, the system/transfer is `xfer`. So, in order to be consiustent have generate the appropriate access rights, the generation process
2280
+ should be run as user `xfer`.
2281
+
2282
+ Lets do a one shot test, using the configuration previously created:
2283
+
2284
+ ```
2285
+ # su -s /bin/bash - xfer
2286
+ $ <%=cmd%> preview scan --overwrite=always
2287
+ ```
2288
+
2289
+ When the preview generator is first executed it will create a file: `.aspera_access_key`
2290
+ which contains the access key used.
2291
+ On subsequent run it reads this file and check that previews are generated for the same access key, else it fails. This is to prevent clash of different access keys using the same root.
2292
+
2293
+ ## Configuration for Execution in scheduler
2294
+
2295
+ Here is an example of configuration for use with cron on Linux. Adapt the scripts to your own preference.
2296
+
2297
+ We assume here that a configuration preset was created as shown previously.
2298
+
2299
+ Here the cronjob is created for `root`, and changes the user to `xfer`, also overriding the shell which should be `aspshell`. (adapt the command below, as it would override existing crontab). It is also up to you to use directly the `xfer` user's crontab. This is an example only.
2300
+
2301
+ ```
2302
+ # crontab<<EOF
2303
+ 2-59 * * * * su -s /bin/bash - xfer -c 'nice +10 timeout 10m <%=cmd%> preview event --log-level=info --logger=syslog --iteration-file=/tmp/preview_restart.txt'
2304
+ 0 * * * * su -s /bin/bash - xfer -c 'nice +10 timeout 30m <%=cmd%> preview scan --log-level=info --logger=syslog'
2305
+ EOF
2306
+ ```
2307
+
2308
+ Nopte that the options here may be located in the config preset, but it was left on the command line to keep stdout for command line execution of preview.
2309
+
2310
+ ## Candidate detection for creation or update (or deletion)
2311
+
2312
+ The tool will find candidates for preview generation using three commands:
2313
+
2314
+ * `trevents` : only recently uploaded files will be tested (transfer events)
2315
+ * `events` : only recently uploaded files will be tested (file events: not working)
2316
+ * `scan` : deeply scan all files under the access key&apos;s "storage root"
2317
+ * `folder` : same as `scan`, but only on the specified folder&apos;s "file identifier"
2318
+ * `file` : for an individual file generation
2319
+
2320
+ Note that for the `event`, the option `iteration_file` should be specified so that
2321
+ successive calls only process new events. This file will hold an identifier
2322
+ telling from where to get new events.
2323
+
2324
+ It is also possible to test a local file, using the `test` command.
2325
+
2326
+ Once candidate are selected, once candidates are selected,
2327
+ a preview is always generated if it does not exist already,
2328
+ else if a preview already exist, it will be generated
2329
+ using one of three overwrite method:
2330
+
2331
+ * `always` : preview is always generated, even if it already exists and is newer than original
2332
+ * `never` : preview is generated only if it does not exist already
2333
+ * `mtime` : preview is generated only if the original file is newer than the existing
2334
+
2335
+ Deletion of preview for deleted source files: not implemented yet.
2336
+
2337
+ If the `scan` or `events` detection method is used, then the option : `skip_folders` can be used
2338
+ to skip some folders. It expects a list of path starting with slash, use the `@json:` notation, example:
2339
+
2340
+ ```
2341
+ $ <%=cmd%> preview scan --skip-folders=@json:'["/not_here"]'
2342
+ ```
2343
+
2344
+ The option `folder_reset_cache` forces the node service to refresh folder contents using various methods.
2345
+
2346
+ ## output preview Files types
2347
+
2348
+ Two types of preview can be generated:
2349
+
2350
+ * png: thumbnail
2351
+ * mp4: video preview (only for video)
2352
+
2353
+ To skip generation of a format use option `skip_format`
2354
+
2355
+ ## Supported input Files types
2356
+
2357
+ The preview generator supports redering of those file categories:
2358
+
2359
+ * image
2360
+ * pdf
2361
+ * plaintext
2362
+ * office
2363
+ * video
2364
+
2365
+ To avoid generation for some categories, specify a list using option `skip_types`.
2366
+
2367
+ Each category has a specific rendering method to produce the png thumbnail.
2368
+
2369
+ The mp4 video preview file is only for category `video`
2370
+
2371
+ File type is primarily based on file extension detected by the node API and translated info a mime type returned by the node API.
2372
+
2373
+ The tool can also locally detect the mime type using gem `mimemagic`.
2374
+
2375
+ ## Access to original files and preview creation
2376
+
2377
+ Standard open source tools are used to create thumnails and video previews.
2378
+ Those tools require that original files are accessible in the local file system and also write generated files on the local file system.
2379
+ The tool provides 2 ways to read and write files with the option: `file_access`
2380
+
2381
+ If the preview generator is run on a system that has direct access to the file system, then the value `local` can be used. In this case, no transfer happen, source files are directly read from the storage, and preview files
2382
+ are directly written to the storage.
2383
+
2384
+ If the preview generator does not have access to files on the file system (it is remote, no mount, or is an object storage), then the original file is first downloaded, then the result is uploaded, use method `remote`.
2385
+
2386
+
2387
+ # SMTP for email notifications
2388
+
2389
+ Aspera CLI can send email, for that setup SMTP configuration. This is done with option `smtp`.
2390
+
2391
+ The `smtp` option is a hash table (extended value) with the following fields:
2392
+ <table>
2393
+ <tr><th>field</th><th>default</th><th>example</th><th>description</th></tr>
2394
+ <tr><td>server</td><td>-</td><td>smtp.gmail.com</td><td>SMTP server address</td></tr>
2395
+ <tr><td>tls</td><td>true</td><td>false</td><td>use of TLS</td></tr>
2396
+ <tr><td>port</td><td>587 for tls<br/>25 else</td><td>587</td><td>port for service</td></tr>
2397
+ <tr><td>domain</td><td>domain of server</td><td>gmail.com</td><td>email domain of user</td></tr>
2398
+ <tr><td>username</td><td>-</td><td>john@example.com</td><td>user to authenticate on SMTP server, leave empty for open auth.</td></tr>
2399
+ <tr><td>password</td><td>-</td><td>MyP@ssword</td><td>password for above username</td></tr>
2400
+ <tr><td>from\_email</td><td>username if defined</td><td>laurent.martin.l@gmail.com</td><td>address used if received replies</td></tr>
2401
+ <tr><td>from\_name</td><td>same as email</td><td>John Wayne</td><td>display name of sender</td></tr>
2402
+ </table>
2403
+
2404
+ ## Example of configuration:
2405
+
2406
+ ```
2407
+ $ <%=cmd%> config id smtp_google set server smtp.google.com
2408
+ $ <%=cmd%> config id smtp_google set username john@gmail.com
2409
+ $ <%=cmd%> config id smtp_google set password P@ssw0rd
2410
+ ```
2411
+
2412
+ or
2413
+
2414
+ ```
2415
+ $ <%=cmd%> config id smtp_google init @json:'{"server":"smtp.google.com","username":"john@gmail.com","password":"P@ssw0rd"}'
2416
+ ```
2417
+
2418
+ or
2419
+
2420
+ ```
2421
+ $ <%=cmd%> config id smtp_google update --server=smtp.google.com --username=john@gmail.com --password=P@ssw0rd
2422
+ ```
2423
+
2424
+ Set this configation as global default, for instance:
2425
+
2426
+ ```
2427
+ $ <%=cmd%> config id cli_default set smtp @val:@preset:smtp_google
2428
+ $ <%=cmd%> config id default set config cli_default
2429
+ ```
2430
+
2431
+ ## Test
2432
+
2433
+ Check settings with `smtp_settings` command. Send test email with `email_test`.
2434
+
2435
+ ```
2436
+ $ <%=cmd%> config --smtp=@preset:smtp_google smtp
2437
+ $ <%=cmd%> config --smtp=@preset:smtp_google email sample.dest@example.com
2438
+ ```
2439
+
2440
+ # Tool: `asession`
2441
+
2442
+ This gem comes with a second executable tool providing a simplified standardized interface
2443
+ to start a FASP session: `asession`.
2444
+
2445
+ It aims at simplifying the startup of a FASP session from a programmatic stand point as formating a [_transfer-spec_](#transferspec) is:
2446
+
2447
+ * common to Aspera Node API (HTTP POST /ops/transfer)
2448
+ * common to Aspera Connect API (browser javascript startTransfer)
2449
+ * easy to generate by using any third party language specific JSON library
2450
+
2451
+ Hopefully, IBM integrates this diectly in `ascp`, and this tool is made redundant.
2452
+
2453
+ This makes it easy to integrate with any language provided that one can spawn a sub process, write to its STDIN, read from STDOUT, generate and parse JSON.
2454
+
2455
+ The tool expect one single argument: a [_transfer-spec_](#transferspec).
2456
+
2457
+ If not argument is provided, it assumes a value of: `@json:@stdin:`, i.e. a JSON formated [_transfer-spec_](#transferspec) on stdin.
2458
+
2459
+ Note that if JSON is the format, one has to specify `@json:` to tell the tool to decode the hash using JSON.
2460
+
2461
+ During execution, it generates all low level events, one per line, in JSON format on stdout.
2462
+
2463
+ Note that there are special "extended" [_transfer-spec_](#transferspec) parameters supported by `asession`:
2464
+
2465
+ * `EX_loglevel` to change log level of the tool
2466
+ * `EX_file_list_folder` to set the folder used to store (exclusively, because of garbage collection) generated file lists. By default it is `[system tmp folder]/[username]_asession_filelists`
2467
+
2468
+ Note that in addition, many "EX_" [_transfer-spec_](#transferspec) parameters are supported for the "local" transfer agent (used by `asession`), refer to section [_transfer-spec_](#transferspec).
2469
+
2470
+ ## Comparison of interfaces
2471
+
2472
+ <table>
2473
+ <tr><th>feature/tool</th><th>asession</th><th>ascp</th><th>FaspManager</th><th>Transfer SDK</th></tr>
2474
+ <tr><td>language integration</td><td>any</td><td>any</td><td>C/C++<br/>C#/.net<br/>Go<br/>Python<br/>java<br/></td><td>any</td></tr>
2475
+ <tr><td>additional components to ascp</td><td>Ruby<br/>Aspera</td><td>-</td><td>library<br/>(headers)</td><td>daemon</td></tr>
2476
+ <tr><td>startup</td><td>JSON on stdin<br/>(standard APIs:<br/>JSON.generate<br/>Process.spawn)</td><td>command line arguments</td><td>API</td><td>daemon</td></tr>
2477
+ <tr><td>events</td><td>JSON on stdout</td><td>none by default<br/>or need to open management port<br/>and proprietary text syntax</td><td>callback</td><td>callback</td></tr>
2478
+ <tr><td>platforms</td><td>any with ruby and ascp</td><td>any with ascp</td><td>any with ascp</td><td>any with ascp and transferdaemon</td></tr></table>
2479
+
2480
+ ## Simple session
2481
+
2482
+ ```
2483
+ MY_TSPEC='{"remote_host":"demo.asperasoft.com","remote_user":"asperaweb","ssh_port":33001,"remote_password":"demoaspera","direction":"receive","destination_root":"./test.dir","paths":[{"source":"/aspera-test-dir-tiny/200KB.1"}],"resume_level":"none"}'
2484
+
2485
+ echo "${MY_TSPEC}"|asession
2486
+ ```
2487
+
2488
+ ## Asynchronous commands and Persistent session
2489
+
2490
+ `asession` also supports asynchronous commands (on the management port). Instead of the traditional text protocol as described in ascp manual, the format for commands is: one single line per command, formatted in JSON, where parameters shall be "snake" style, for example: `LongParameter` -&gt; `long_parameter`
2491
+
2492
+ This is particularly useful for a persistent session ( with the [_transfer-spec_](#transferspec) parameter: `"keepalive":true` )
2493
+
2494
+ ```
2495
+ $ asession
2496
+ {"remote_host":"demo.asperasoft.com","ssh_port":33001,"remote_user":"asperaweb","remote_password":"demoaspera","direction":"receive","destination_root":".","keepalive":true,"resume_level":"none"}
2497
+ {"type":"START","source":"/aspera-test-dir-tiny/200KB.2"}
2498
+ {"type":"DONE"}
2499
+ ```
2500
+
2501
+ (events from FASP are not shown in above example. They would appear after each command)
2502
+
2503
+ ## Example of language wrapper
2504
+
2505
+ Nodejs: [https://www.npmjs.com/package/aspera](https://www.npmjs.com/package/aspera)
2506
+
2507
+ ## Help
2508
+
2509
+ ```
2510
+ $ asession -h
2511
+ <%= File.read(ENV["ASESSION"]) %>
2512
+ ```
2513
+
2514
+ # Hot folder
2515
+
2516
+ ## Requirements
2517
+
2518
+ <%=tool%> maybe used as a simple hot folder engine. A hot folder being defined as a tool that:
2519
+
2520
+ * locally (or remotely) detects new files in a top folder
2521
+ * send detected files to a remote (respectively, local) repository
2522
+ * only sends new files, do not re-send already sent files
2523
+ * optionally: sends only files that are not still "growing"
2524
+ * optionally: after transfer of files, deletes or moves to an archive
2525
+
2526
+ In addition: the detection should be made "continuously" or on specific time/date.
2527
+
2528
+ ## Setup procedure
2529
+
2530
+ The general idea is to rely on :
2531
+
2532
+ * existing `ascp` features for detection and transfer
2533
+ * take advantage of <%=tool%> configuration capabilities and server side knowledge
2534
+ * the OS scheduler for reliability and continuous operation
2535
+
2536
+ ### ascp features
2537
+
2538
+ Interesting ascp features are found in its arguments: (see ascp manual):
2539
+
2540
+ * `ascp` already takes care of sending only "new" files: option `-k 1,2,3`, or transfer_spec: `resume_policy`
2541
+ * `ascp` has some options to remove or move files after transfer: `--remove-after-transfer`, `--move-after-transfer`, `--remove-empty-directories`
2542
+ * `ascp` has an option to send only files not modified since the last X seconds: `--exclude-newer-than` (--exclude-older-than)
2543
+ * `--src-base` if top level folder name shall not be created on destination
2544
+
2545
+ Note that:
2546
+
2547
+ * <%=tool%> takes transfer parameters exclusively as a transfer_spec, with `--ts` parameter.
2548
+ * not all native ascp arguments are available as standard transfer_spec parameters
2549
+ * native ascp arguments can be provided with the [_transfer-spec_](#transferspec) parameter: EX_ascp_args (array), only for the "local" transfer agent (not connect or node)
2550
+
2551
+ ### server side and configuration
2552
+
2553
+ Virtually any transfer on a "repository" on a regular basis might emulate a hot folder. Note that file detection is not based on events (inotify, etc...), but on a stateless scan on source side.
2554
+
2555
+ Note: parameters may be saved in a <%=prst%> and used with `-P`.
2556
+
2557
+ ### Scheduling
2558
+
2559
+ Once <%=tool%> parameters are defined, run the command using the OS native scheduler, e.g. every minutes, or 5 minutes, etc... Refer to section [_Scheduling_](#_scheduling_).
2560
+
2561
+ ## Example
2562
+
2563
+ ```
2564
+ $ <%=cmd%> server upload source_hot --to-folder=/Upload/target_hot --lock-port=12345 --ts=@json:'{"EX_ascp_args":["--remove-after-transfer","--remove-empty-directories","--exclude-newer-than=-8","--src-base","source_hot"]}'
2565
+
2566
+ ```
2567
+
2568
+ The local (here, relative path: source_hot) is sent (upload) to basic fasp server, source files are deleted after transfer. growing files will be sent only once they dont grow anymore (based ona 8 second cooloff period). If a transfer takes more than the execution period, then the subsequent execution is skipped (lock-port).
2569
+
2570
+ # Module: `Aspera`
2571
+
2572
+ Main components:
2573
+
2574
+ * `Aspera` generic classes for REST and OAuth
2575
+ * `Aspera::Fasp`: starting and monitoring transfers. It can be considered as a FASPManager class for Ruby.
2576
+ * `Aspera::Cli`: <%=tool%>.
2577
+
2578
+ A working example can be found in the gem, example:
2579
+
2580
+ ```
2581
+ $ <%=cmd%> config gem_path
2582
+ $ cat $(<%=cmd%> config gem_path)/../examples/transfer.rb
2583
+ ```
2584
+
2585
+ This sample code shows some example of use of the API as well as
2586
+ REST API.
2587
+ Note: although nice, it's probably a good idea to use RestClient for REST.
2588
+
2589
+ # History
2590
+
2591
+ When I joined Aspera, there was only one CLI: `ascp`, which is the implementation of the FASP protocol, but there was no CLI to access the various existing products (Server, Faspex, Shares). Once, Serban (founder) provided a shell script able to create a Faspex Package using Faspex REST API. Since all products relate to file transfers using FASP (ascp), I thought it would be interesting to have a unified CLI for transfers using FASP. Also, because there was already the `ascp` tool, I thought of an extended tool : `eascp.pl` which was accepting all `ascp` options for transfer but was also able to transfer to Faspex and Shares (destination was a kind of URI for the applications).
2592
+
2593
+ There were a few pitfalls:
2594
+
2595
+ * The tool was written in the aging `perl` language while most Aspera application products (but the Transfer Server) are written in `ruby`.
2596
+ * The tool was only for transfers, but not able to call other products APIs
2597
+
2598
+ So, it evolved into <%=tool%>:
2599
+
2600
+ * portable: works on platforms supporting `ruby` (and `ascp`)
2601
+ * easy to install with the `gem` utility
2602
+ * supports transfers with multiple [Transfer Agents](#agents), that&apos;s why transfer parameters moved from ascp command line to [_transfer-spec_](#transferspec) (more reliable , more standard)
2603
+ * `ruby` is consistent with other Aspera products
2604
+
2605
+
2606
+
2607
+ # Release Notes
2608
+
2609
+ * 4.0.0.pre1
2610
+
2611
+ * now available as open source at [https://github.com/IBM/aspera-cli](https://github.com/IBM/aspera-cli) with general cleanup
2612
+ * changed default tool name from `mlia` to `ascli`
2613
+ * changed `aspera` command to `oncloud`
2614
+ * changed gem name from `asperalm` to `aspera-cli`
2615
+ * changed module name from `Asperalm` to `Aspera`
2616
+ * removed command `folder` in `preview`, merged to `scan`
2617
+ * persistency files go to sub folder instead of main folder
2618
+
2619
+ * 0.11.8
2620
+
2621
+ * Simplified to use `unoconv` instead of bare `libreoffice` for office conversion, as `unoconv` does not require a X server (previously using Xvfb
2622
+
2623
+ * 0.11.7
2624
+
2625
+ * rework on rest call error handling
2626
+ * use option `display` with value `data` to remove out of extraneous information
2627
+ * fixed option `lock_port` not working
2628
+ * generate special icon if preview failed
2629
+ * possibility to choose transfer progress bar type with option `progress`
2630
+ * AoC package creation now output package id
2631
+
2632
+ * 0.11.6
2633
+
2634
+ * orchestrator : added more choice in auth type
2635
+ * preview: cleanup in generator (removed and renamed parameters)
2636
+ * preview: better documentation
2637
+ * preview: animated thumbnails for video (option: `video_png_conv=animated`)
2638
+ * preview: new event trigger: `trevents` (`events` seems broken)
2639
+ * preview: unique tmp folder to avoid clash of multiple instances
2640
+ * repo: added template for secrets used for testing
2641
+
2642
+ * 0.11.5
2643
+
2644
+ * added option `default_ports` for AoC (see manual)
2645
+ * allow bulk delete in `aspera files` with option `bulk=yes`
2646
+ * fix getting connect versions
2647
+ * added section for Aix
2648
+ * support all ciphers for `local`ascp (incl. gcm, etc..)
2649
+ * added transfer spec param `apply_local_docroot` for `local`
2650
+
2651
+ * 0.11.4
2652
+
2653
+ * possibility to give shared inbox name when sending a package (else use id and type)
2654
+
2655
+ * 0.11.3
2656
+
2657
+ * minor fixes on multi-session: avoid exception on progress bar
2658
+
2659
+ * 0.11.2
2660
+
2661
+ * fixes on multi-session: progress bat and transfer spec param for "direct"
2662
+
2663
+ * 0.11.1
2664
+
2665
+ * enhanced short_link creation commands (see examples)
2666
+
2667
+ * 0.11
2668
+
2669
+ * add option to provide file list directly to ascp like this (only for direct transfer agent):
2670
+
2671
+ ```
2672
+ ... --sources=@ts --ts=@json:'{"paths":[],"EX_file_list":"filelist"}'
2673
+ ```
2674
+
2675
+ * 0.10.18
2676
+
2677
+ * new option in. `server` : `ssh_options`
2678
+
2679
+ * 0.10.17
2680
+
2681
+ * fixed problem on `server` for option `ssh_keys`, now accepts both single value and list.
2682
+ * new modifier: `@list:<saparator>val1<separator>...`
2683
+
2684
+ * 0.10.16
2685
+
2686
+ * added list of shared inboxes in workspace (or global), use `--query=@json:'{}'`
2687
+
2688
+ * 0.10.15
2689
+
2690
+ * in case of command line error, display the error cause first, and non-parsed argument second
2691
+ * AoC : Activity / Analytics
2692
+
2693
+ * 0.10.14
2694
+
2695
+ * added missing bss plugin
2696
+
2697
+ * 0.10.13
2698
+
2699
+ * added Faspex5 (use option `value` to give API arguments)
2700
+
2701
+ * 0.10.12
2702
+
2703
+ * added support for AoC node registration keys
2704
+ * replaced option : `local_resume` with `transfer_info` for agent `direct`
2705
+ * Transfer agent is no more a Singleton instance, but only one is used in CLI
2706
+ * `@incps` : new extended value modifier
2707
+ * ATS: no more provides access keys secrets: now user must provide it
2708
+ * begin work on "aoc" transfer agent
2709
+
2710
+ * 0.10.11
2711
+
2712
+ * minor refactor and fixes
2713
+
2714
+ * 0.10.10
2715
+
2716
+ * fix on documentation
2717
+
2718
+ * 0.10.9.1
2719
+
2720
+ * add total number of items for AoC resource list
2721
+ * better gem version dependency (and fixes to support Ruby 2.0.0)
2722
+ * removed aoc search_nodes
2723
+
2724
+ * 0.10.8
2725
+
2726
+ * removed option: `fasp_proxy`, use pseudo transfer spec parameter: `EX_fasp_proxy_url`
2727
+ * removed option: `http_proxy`, use pseudo transfer spec parameter: `EX_http_proxy_url`
2728
+ * several other changes..
2729
+
2730
+ * 0.10.7
2731
+
2732
+ * fix: <%=cmd%> fails when username cannot be computed on Linux.
2733
+
2734
+ * 0.10.6
2735
+
2736
+ * FaspManager: transfer spec `authentication` no more needed for local tranfer to use aspera public keys. public keys will be used if there is a token and no key or password is provided.
2737
+ * gem version requirements made more open
2738
+
2739
+ * 0.10.5
2740
+
2741
+ * fix faspex package receive command not working
2742
+
2743
+ * 0.10.4
2744
+
2745
+ * new options for AoC : `secrets`
2746
+ * ACLI-533 temp file list folder to use file lists is set by default, and used by asession
2747
+
2748
+ * 0.10.3
2749
+
2750
+ * included user name in oauth bearer token cache for AoC when JWT is used.
2751
+
2752
+ * 0.10.2
2753
+
2754
+ * updated `search_nodes` to be more generic, so it can search not only on access key, but also other queries.
2755
+ * added doc for "cargo" like actions
2756
+ * added doc for multi-session
2757
+
2758
+ * 0.10.1
2759
+
2760
+ * AoC and node v4 "browse" works now on non-folder items: file, link
2761
+ * initial support for AoC automation (do not use yet)
2762
+
2763
+ * 0.10
2764
+
2765
+ * support for transfer using IBM Cloud Object Storage
2766
+ * improved `find` action using arbitrary expressions
2767
+
2768
+ * 0.9.36
2769
+
2770
+ * added option to specify file pair lists
2771
+
2772
+ * 0.9.35
2773
+
2774
+ * updated plugin `preview` , changed parameter names, added documentation
2775
+ * fix in `ats` plugin : instance id needed in request header
2776
+
2777
+ * 0.9.34
2778
+
2779
+ * parser "@preset" can be used again in option "transfer_info"
2780
+ * some documentation re-organizing
2781
+
2782
+ * 0.9.33
2783
+
2784
+ * new command to display basic token of node
2785
+ * new command to display bearer token of node in AoC
2786
+ * the --fields= option, support +_fieldname_ to add a field to default fields
2787
+ * many small changes
2788
+
2789
+ * 0.9.32
2790
+
2791
+ * all Faspex public links are now supported
2792
+ * removed faspex operation recv_publink
2793
+ * replaced with option `link` (consistent with AoC)
2794
+
2795
+ * 0.9.31
2796
+
2797
+ * added more support for public link: receive and send package, to user or dropbox and files view.
2798
+ * delete expired file lists
2799
+ * changed text table gem from text-table to terminal-table because it supports multiline values
2800
+
2801
+ * 0.9.27
2802
+
2803
+ * basic email support with SMTP
2804
+ * basic proxy auto config support
2805
+
2806
+ * 0.9.26
2807
+
2808
+ * table display with --fields=ALL now includes all column names from all lines, not only first one
2809
+ * unprocessed argument shows error even if there is an error beforehand
2810
+
2811
+ * 0.9.25
2812
+
2813
+ * the option `value` of command `find`, to filter on name, is not optional
2814
+ * `find` now also reports all types (file, folder, link)
2815
+ * `find` now is able to report all fields (type, size, etc...)
2816
+
2817
+ * 0.9.24
2818
+
2819
+ * fix bug where AoC node to node transfer did not work
2820
+ * fix bug on error if ED25519 private key is defined in .ssh
2821
+
2822
+ * 0.9.23
2823
+
2824
+ * defined REST error handlers, more error conditions detected
2825
+ * commands to select specific ascp location
2826
+
2827
+ * 0.9.21
2828
+
2829
+ * supports simplified wizard using global client
2830
+ * only ascp binary is required, other SDK (keys) files are now generated
2831
+
2832
+ * 0.9.20
2833
+
2834
+ * improved wizard (prepare for AoC global client id)
2835
+ * preview generator: addedoption : --skip-format=&lt;png,mp4&gt;
2836
+ * removed outdated pictures from this doc
2837
+
2838
+ * 0.9.19
2839
+
2840
+ * added command aspera bearer --scope=xx
2841
+
2842
+ * 0.9.18
2843
+
2844
+ * enhanced aspera admin events to support query
2845
+
2846
+ * 0.9.16
2847
+
2848
+ * AoC transfers are now reported in activity app
2849
+ * new interface for Rest class authentication (keep backward compatibility)
2850
+
2851
+ * 0.9.15
2852
+
2853
+ * new feature: "find" command in aspera files
2854
+ * sample code for transfer API
2855
+
2856
+ * 0.9.12
2857
+
2858
+ * add nagios commands
2859
+ * support of ATS for IBM Cloud, removed old version based on aspera id
2860
+
2861
+ * 0.9.11
2862
+
2863
+ * Breaking change: @stdin is now @stdin:
2864
+ * support of ATS for IBM Cloud, removed old version based on aspera id
2865
+
2866
+
2867
+ * 0.9.10
2868
+
2869
+ * Breaking change: parameter transfer-node becomes more generic: transfer-info
2870
+ * Display SaaS storage usage with command: aspera admin res node --id=nn info
2871
+ * cleaner way of specifying source file list for transfers
2872
+ * Breaking change: replaced download_mode option with http_download action
2873
+
2874
+ * 0.9.9
2875
+
2876
+ * Breaking change: "aspera package send" parameter deprecated, use the --value option instead with "recipients" value. See example.
2877
+ * Now supports "cargo" for Aspera on Cloud (automatic package download)
2878
+
2879
+ * 0.9.8
2880
+
2881
+ * Faspex: use option once_only set to yes to enable cargo like function. id=NEW deprecated.
2882
+ * AoC: share to share transfer with command "transfer"
2883
+
2884
+ * 0.9.7
2885
+
2886
+ * homogeneous [_transfer-spec_](#transferspec) for node and local
2887
+ * preview persistency goes to unique file by default
2888
+ * catch mxf extension in preview as video
2889
+ * Faspex: possibility to download all paclages by specifying id=ALL
2890
+ * Faspex: to come: cargo-like function to download only new packages with id=NEW
2891
+
2892
+ * 0.9.6
2893
+
2894
+ * Breaking change: `@param:`is now `@preset:` and is generic
2895
+ * AoC: added command to display current workspace information
2896
+
2897
+ * 0.9.5
2898
+
2899
+ * new parameter: new_user_option used to choose between public_link and invite of external users.
2900
+ * fixed bug in wizard, and wizard uses now product detection
2901
+
2902
+ * 0.9.4
2903
+
2904
+ * Breaking change: onCloud file list follow --source convention as well (plus specific case for download when first path is source folder, and other are source file names).
2905
+ * AoC Package send supports external users
2906
+ * new command to export AoC config to Aspera CLI config
2907
+
2908
+ * 0.9.3
2909
+
2910
+ * REST error message show host and code
2911
+ * option for quiet display
2912
+ * modified transfer interface and allow token re-generation on error
2913
+ * async add admin command
2914
+ * async add db parameters
2915
+ * Breaking change: new option "sources" to specify files to transfer
2916
+
2917
+ * 0.9.2
2918
+
2919
+ * Breaking change: changed AoC package creation to match API, see AoC section
2920
+
2921
+ * 0.9.1
2922
+
2923
+ * Breaking change: changed faspex package creation to match API, see Faspex section
2924
+
2925
+ * 0.9
2926
+
2927
+ * Renamed the CLI from aslmcli to <%=tool%>
2928
+ * Automatic rename and conversion of former config folder from aslmcli to <%=tool%>
2929
+
2930
+ * 0.7.6
2931
+
2932
+ * add "sync" plugin
2933
+
2934
+ * 0.7
2935
+
2936
+ * Breaking change: AoC package recv take option if for package instead of argument.
2937
+ * Breaking change: Rest class and Oauth class changed init parameters
2938
+ * AoC: receive package from public link
2939
+ * select by col value on output
2940
+ * added rename (AoC, node)
2941
+
2942
+ * 0.6.19
2943
+
2944
+ Breaking change:
2945
+
2946
+ * ats server list provisioned &rarr; ats cluster list
2947
+ * ats server list clouds &rarr; ats cluster clouds
2948
+ * ats server list instance --cloud=x --region=y &rarr; ats cluster show --cloud=x --region=y
2949
+ * ats server id xxx &rarr; ats cluster show --id=xxx
2950
+ * ats subscriptions &rarr; ats credential subscriptions
2951
+ * ats api_key repository list &rarr; ats credential cache list
2952
+ * ats api_key list &rarr; ats credential list
2953
+ * ats access_key id xxx &rarr; ats access_key --id=xxx
2954
+
2955
+ * 0.6.18
2956
+
2957
+ * some commands take now --id option instead of id command.
2958
+
2959
+ * 0.6.15
2960
+
2961
+ * Breaking change: "files" application renamed to "aspera" (for "Aspera on Cloud"). "repository" renamed to "files". Default is automatically reset, e.g. in config files and change key "files" to "aspera" in <%=prst%> "default".
2962
+
2963
+ # BUGS
2964
+
2965
+ * This is best effort code without official support, dont expect full capabilities. This code is not supported by IBM/Aspera. You can contact the author for bugs or features.
2966
+
2967
+ ## only one value for any option
2968
+
2969
+ Some commands and sub commands may ask for the same option name.
2970
+ Currently, since option definition is position independant (last one wins), it is not possible
2971
+ to give an option to a command and the same option with different value to a sub command.
2972
+
2973
+ For instance, if an entity is identified by the option `id` but later on the command line another `id` option is required, the later will override the earlier one, and both entity will use the same id.
2974
+ As a workaround use another option, if available, to identify the entity.
2975
+
2976
+ This happens typically for the `node` sub command, e.g. identify the node by name instead of id.
2977
+
2978
+
2979
+ ## ED255519 key not supported
2980
+
2981
+ ED255519 keys are deactivated since version 0.9.24 so this type of key will just be ignored.
2982
+ Without this deactivation, if such key was present the following error was generated:
2983
+
2984
+ ```
2985
+ OpenSSH keys only supported if ED25519 is available
2986
+ ```
2987
+
2988
+ Which meant that you do not have ruby support for ED25519 SSH keys.
2989
+ You may either install the suggested Gems, or remove your ed25519 key from your `.ssh` folder to solve the issue.
2990
+
2991
+ # TODO
2992
+
2993
+ * remove rest and oauth classes and use ruby standard gems:
2994
+
2995
+ * oauth
2996
+ * https://github.com/rest-client/rest-client
2997
+
2998
+ * use Thor or any standard Ruby CLI manager
2999
+
3000
+ * provide metadata in packages
3001
+
3002
+ * deliveries to dropboxes
3003
+
3004
+ * Going through proxy: use env var http_proxy and https_proxy, no_proxy
3005
+
3006
+ * easier use with https://github.com/pmq20/ruby-packer
3007
+
3008
+ # Contribution
3009
+
3010
+ Send comments !
3011
+
3012
+ Create your own plugin !