aspera-cli 4.0.0.pre1 → 4.0.0.pre2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ config:
3
3
  version: 4.0.0.pre1
4
4
  default:
5
5
  config: cli_default
6
- oncloud: tst_oncloud
6
+ aoc: tst_aoc
7
7
  faspex: tst_faspex
8
8
  faspex5: tst_faspex5
9
9
  shares: tst_shares
@@ -20,18 +20,6 @@ cli_default:
20
20
  interactive: your value here
21
21
  smtp: your value here
22
22
  ascp_path: your value here
23
- misc:
24
- upload_folder: your value here
25
- syncuser: your value here
26
- faspex_publink_recv_from_fxuser: your value here
27
- faspex_publink_send_to_fxuser: your value here
28
- faspex_publink_send_to_dropbox: your value here
29
- shares_upload: your value here
30
- orch_workflow_id: your value here
31
- file_dcm: your value here
32
- file_pdf: your value here
33
- file_docx: your value here
34
- file_mxf: your value here
35
23
  local_user:
36
24
  ssh_keys: your value here
37
25
  smtp_config:
@@ -43,7 +31,7 @@ smtp_config:
43
31
  from_name: your value here
44
32
  username: your value here
45
33
  password: your value here
46
- tst_oncloud:
34
+ tst_aoc:
47
35
  url: your value here
48
36
  username: your value here
49
37
  auth: your value here
@@ -115,3 +103,38 @@ tst_cos:
115
103
  crn: your value here
116
104
  bucket: your value here
117
105
  endpoint: your value here
106
+ misc:
107
+ upload_folder: your value here
108
+ syncuser: your value here
109
+ faspex_publink_recv_from_fxuser: your value here
110
+ faspex_publink_send_to_fxuser: your value here
111
+ faspex_publink_send_to_dropbox: your value here
112
+ shares_upload: your value here
113
+ orch_workflow_id: your value here
114
+ file_dcm: your value here
115
+ file_pdf: your value here
116
+ file_docx: your value here
117
+ file_mxf: your value here
118
+ aws_bucket_key: your value here
119
+ aws_bucket_secret: your value here
120
+ aws_bucket_name: your value here
121
+ aws_bucket_region: your value here
122
+ aoc_publink_recv_from_aocuser: your value here
123
+ aoc_publink_send_shd_inbox: your value here
124
+ aoc_publink_send_aoc_user: your value here
125
+ aoc_publink_folder: your value here
126
+ aoc_shbx_ws: your value here
127
+ aoc_shbx_name: your value here
128
+ aoc_node1_name: your value here
129
+ aoc_node1_secret: your value here
130
+ icos_bucket_key: your value here
131
+ icos_bucket_secret: your value here
132
+ icos_bucket_name: your value here
133
+ icos_bucket_region: your value here
134
+ icos_bucket_endpoint: your value here
135
+ icos_bucket_apikey: your value here
136
+ icos_resource_instance_id: your value here
137
+ email_internal: your value here
138
+ email_external: your value here
139
+ aoc_org: your value here
140
+ aoc_user: your value here
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
- require 'aspera/on_cloud'
2
+ require 'aspera/aoc'
3
3
  require 'aspera/log'
4
4
 
5
5
  Aspera::Log.instance.level=:debug
6
6
 
7
- aocapi=Aspera::OnCloud.new(
7
+ aocapi=Aspera::AoC.new(
8
8
  url: 'https://myorg.ibmaspera.com',
9
9
  auth: :jwt,
10
10
  private_key: File.read('path/to_your_private_key.pem'),
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # Example: transfer a file using one of the provided transfer agents
3
-
3
+ # location of ascp can be specified with env var "ascp"
4
+ # temp folder can be specified with env var "tmp"
4
5
  require 'aspera/fasp/local'
5
6
  require 'aspera/fasp/listener'
6
7
  require 'aspera/fasp/installation'
@@ -8,8 +9,15 @@ require 'aspera/log'
8
9
  require 'aspera/rest'
9
10
  require 'aspera/rest_errors_aspera'
10
11
  require 'json'
12
+ require 'tmpdir'
13
+
14
+ tmpdir=ENV['tmp']||Dir.tmpdir || '.'
11
15
 
12
- tmpdir=ENV['tmp'] || '.'
16
+ DEMO_CONFIG=[
17
+ 'ssh://asperaweb@eudemo.asperademo.com:33001',
18
+ 'https://node_asperaweb@eudemo.asperademo.com:9092',
19
+ 'demoaspera',
20
+ ]
13
21
 
14
22
  ##############################################################
15
23
  # generic initialisation : configuration of FaspManager
@@ -17,17 +25,18 @@ tmpdir=ENV['tmp'] || '.'
17
25
  # set trace level for sample, set to :debug to see complete list of debug information
18
26
  Aspera::Log.instance.level=:debug
19
27
 
20
- # set path to your copy of ascp binary
21
- Aspera::Fasp::Installation.instance.ascp_path=ENV['ascp'] || '/Library/aspera/bin/ascp'
22
- # some required files are generated here (keys, certs)
23
- Aspera::Fasp::Installation.instance.config_folder = tmpdir
24
-
25
28
  # register aspera REST call error handlers
26
29
  Aspera::RestErrorsAspera.registerHandlers
27
30
 
31
+ # some required files are generated here (keys, certs)
32
+ Aspera::Fasp::Installation.instance.folder = tmpdir
33
+ # set path to your copy of ascp binary (else, let the system find)
34
+ Aspera::Fasp::Installation.instance.ascp_path=ENV['ascp'] if ENV.has_key?('ascp')
28
35
  # another way is to detect installed products and use one of them
29
36
  #Aspera::Fasp::Installation.instance.installed_products.each{|p|puts("found: #{p[:name]}")}
30
37
  #Aspera::Fasp::Installation.instance.use_ascp_from_product('Aspera Connect')
38
+ # or install:
39
+ #
31
40
 
32
41
  # get FASP Manager singleton based on above ascp location
33
42
  fasp_manager=Aspera::Fasp::Local.new
@@ -57,11 +66,11 @@ fasp_manager.add_listener(MyListener.new)
57
66
  # manually build teansfer spec
58
67
  transfer_spec={
59
68
  #'remote_host' =>'demo.asperasoft.com',
60
- 'remote_host' =>'eudemo.asperademo.com',
61
- 'remote_user' =>'asperaweb',
62
- 'remote_password' =>'demoaspera',
69
+ 'remote_host' =>URI.parse(DEMO_CONFIG[0]).host,
70
+ 'ssh_port' =>URI.parse(DEMO_CONFIG[0]).port,
71
+ 'remote_user' =>URI.parse(DEMO_CONFIG[0]).user,
72
+ 'remote_password' =>DEMO_CONFIG[2],
63
73
  'direction' =>'receive',
64
- 'ssh_port' =>33001,
65
74
  'destination_root'=>tmpdir,
66
75
  'paths' =>[{'source'=>'aspera-test-dir-tiny/200KB.1'}]
67
76
  }
@@ -86,11 +95,11 @@ raise "Error(s) occured: #{errors.join(',')}" if !errors.empty?
86
95
 
87
96
  # create rest client for Node API on a public demo system, using public demo credentials
88
97
  node_api=Aspera::Rest.new({
89
- :base_url => 'https://eudemo.asperademo.com:9092',
98
+ :base_url => DEMO_CONFIG[1],
90
99
  :auth => {
91
100
  :type => :basic,
92
- :username => 'node_asperaweb',
93
- :password => 'demoaspera'
101
+ :username => URI.parse(DEMO_CONFIG[1]).user,
102
+ :password => DEMO_CONFIG[2]
94
103
  }})
95
104
  # define sample file(s) and destination folder
96
105
  sources=["#{tmpdir}/sample_file.txt"]
@@ -1,10 +1,11 @@
1
1
  require 'aspera/log'
2
2
  require 'aspera/rest'
3
3
  require 'aspera/hash_ext'
4
+ require 'aspera/data_repository'
4
5
  require 'base64'
5
6
 
6
7
  module Aspera
7
- class OnCloud < Rest
8
+ class AoC < Rest
8
9
  private
9
10
  @@use_standard_ports = true
10
11
 
@@ -13,13 +14,9 @@ module Aspera
13
14
  PROD_DOMAIN='ibmaspera.com'
14
15
  # to avoid infinite loop in pub link redirection
15
16
  MAX_REDIRECT=10
16
- DEFAULT_CLIENT='aspera.global-cli-client'
17
- # Random generator seed
18
- # strings /Applications/Aspera\ Drive.app/Contents/MacOS/AsperaDrive|grep -E '.{100}==$'|base64 --decode
19
- CLIENT_RANDOM={
20
- 'aspera.drive' => '1FwelGbL9xsv3M8H-VXPs5k69OdbaMgfB66qfBqlELFPk6r9ANztmGMOSLqaXEWXEPwk-6JnMZ7-RaXAYLd5thLbcL3QzgeU',
21
- 'aspera.global-cli-client' => 'bK_qpqFpP-OPEuRJ9mnmdw_ebLtpSqCnqhuAKfKdoLXC6OF2yLMgsfAMBmXg7XI_zplV4gBqNOvlJdgCxlP0Zjm4GsRsmprf'
22
- }
17
+ CLIENT_APPS=['aspera.global-cli-client','aspera.drive']
18
+ DATA_REPO_INDEX_START = 4
19
+
23
20
  # path in URL of public links
24
21
  PATHS_PUBLIC_LINK=['/packages/public/receive','/packages/public/send','/files/public']
25
22
  JWT_AUDIENCE='https://api.asperafiles.com/api/v1/oauth2/token'
@@ -30,7 +27,7 @@ module Aspera
30
27
  'fasp_port' => 33001
31
28
  }
32
29
 
33
- private_constant :PRODUCT_NAME,:PROD_DOMAIN,:MAX_REDIRECT,:DEFAULT_CLIENT,:CLIENT_RANDOM,:PATHS_PUBLIC_LINK,:JWT_AUDIENCE,:OAUTH_API_SUBPATH,:DEFAULT_TSPEC_INFO
30
+ private_constant :PRODUCT_NAME,:PROD_DOMAIN,:MAX_REDIRECT,:CLIENT_APPS,:PATHS_PUBLIC_LINK,:JWT_AUDIENCE,:OAUTH_API_SUBPATH,:DEFAULT_TSPEC_INFO
34
31
 
35
32
  public
36
33
  # various API scopes supported
@@ -45,9 +42,16 @@ module Aspera
45
42
  FILES_APP='files'
46
43
  PACKAGES_APP='packages'
47
44
 
48
- def self.get_client_ids(id,secret,client_name=DEFAULT_CLIENT)
49
- return id,secret unless id.nil? and secret.nil?
50
- return client_name,CLIENT_RANDOM[client_name].reverse
45
+ CLIENT_RANDOM={
46
+ 'aspera.global-cli-client' => 'frpmsRsG4mjZ0PlxCgdJlvONqBg4Vlpz_IX7gXmBMAfsgMLy2FO6CXLodKfKAuhqnCqSptLbe_wdmnm9JRuEPO-PpFqpq_Kb',
47
+ 'aspera.drive' => 'UegzQ3LcbLht5dLYAXaR-7ZMnJ6-kwPEXWEXaqLSOMGmtzNA9r6kPFLElqBfq66BfgMabdO96k5sPXV-H8M3vsx9LbGlewF1'
48
+ }
49
+
50
+ def self.get_client_info(client_name=CLIENT_APPS.first)
51
+ client_index=CLIENT_APPS.index(client_name)
52
+ raise "no such pre-defined client: #{client_name}" if client_index.nil?
53
+ # strings /Applications/Aspera\ Drive.app/Contents/MacOS/AsperaDrive|grep -E '.{100}==$'|base64 --decode
54
+ return client_name,Base64.urlsafe_encode64(DataRepository.instance.get_bin(DATA_REPO_INDEX_START+client_index))
51
55
  end
52
56
 
53
57
  # @param url of AoC instance
@@ -149,13 +153,18 @@ module Aspera
149
153
  aoc_rest_p[:base_url]="#{api_base_url}/#{opt[:subpath]}"
150
154
  # base auth URL
151
155
  aoc_auth_p[:base_url] = "#{api_base_url}/#{OAUTH_API_SUBPATH}/#{organization}"
156
+ aoc_auth_p[:client_id]=opt[:client_id]
157
+ aoc_auth_p[:client_secret] = opt[:client_secret]
152
158
 
153
159
  if !aoc_auth_p.has_key?(:grant)
154
160
  raise ArgumentError,"Missing mandatory option: auth" if opt[:auth].nil?
155
161
  aoc_auth_p[:grant] = opt[:auth]
156
162
  end
157
163
 
158
- aoc_auth_p[:client_id],aoc_auth_p[:client_secret] = self.class.get_client_ids(opt[:client_id],opt[:client_secret])
164
+ if aoc_auth_p[:client_id].nil?
165
+ aoc_auth_p[:client_id],aoc_auth_p[:client_secret] = self.class.get_client_info()
166
+ end
167
+
159
168
  raise ArgumentError,"Missing mandatory option: scope" if opt[:scope].nil?
160
169
  aoc_auth_p[:scope] = opt[:scope]
161
170
 
@@ -166,7 +175,7 @@ module Aspera
166
175
  aoc_auth_p[:redirect_uri] = opt[:redirect_uri]
167
176
  when :jwt
168
177
  # add jwt payload for global ids
169
- if CLIENT_RANDOM.keys.include?(aoc_auth_p[:client_id])
178
+ if CLIENT_APPS.include?(aoc_auth_p[:client_id])
170
179
  aoc_auth_p.merge!({:jwt_add=>{org: organization}})
171
180
  end
172
181
  raise ArgumentError,"Missing mandatory option: private_key" if opt[:private_key].nil?
@@ -417,5 +426,5 @@ module Aspera
417
426
  return {node_info: current_node_info, file_id: current_file_id}
418
427
  end
419
428
 
420
- end # OnCloud
429
+ end # AoC
421
430
  end # Aspera
@@ -76,6 +76,7 @@ module Aspera
76
76
  @plugin_env[:persistency]=PersistencyFolder.new(File.join(@plugin_env[:config].main_folder,'persist_store'))
77
77
  Oauth.persist_mgr=@plugin_env[:persistency]
78
78
  Fasp::Parameters.file_list_folder=File.join(@plugin_env[:config].main_folder,'filelists')
79
+ Aspera::RestErrorAnalyzer.instance.log_file=File.join(@plugin_env[:config].main_folder,'rest_exceptions.log')
79
80
  # register aspera REST call error handlers
80
81
  Aspera::RestErrorsAspera.registerHandlers
81
82
  end
@@ -1,5 +1,5 @@
1
1
  require 'aspera/rest'
2
- require 'aspera/on_cloud'
2
+ require 'aspera/aoc'
3
3
 
4
4
  module Aspera
5
5
  module Cli
@@ -14,7 +14,7 @@ module Aspera
14
14
  when :entitlement
15
15
  entitlement_id = self.options.get_option(:username,:mandatory),
16
16
  customer_id = self.options.get_option(:password,:mandatory)
17
- api_metering=OnCloud.metering_api(entitlement_id,customer_id)
17
+ api_metering=AoC.metering_api(entitlement_id,customer_id)
18
18
  return {:type=>:single_object, :data=>api_metering.read('entitlement')[:data]}
19
19
  end
20
20
  end
@@ -2,7 +2,7 @@ require 'aspera/cli/plugins/node'
2
2
  require 'aspera/cli/plugins/ats'
3
3
  require 'aspera/cli/basic_auth_plugin'
4
4
  require 'aspera/cli/transfer_agent'
5
- require 'aspera/on_cloud'
5
+ require 'aspera/aoc'
6
6
  require 'aspera/persistency_action_once'
7
7
  require 'securerandom'
8
8
  require 'resolv'
@@ -47,10 +47,10 @@ module Aspera
47
47
  self.options.set_option(:new_user_option,{'package_contact'=>true})
48
48
  self.options.set_option(:operation,:push)
49
49
  self.options.set_option(:auth,:jwt)
50
- self.options.set_option(:scope,OnCloud::SCOPE_FILES_USER)
50
+ self.options.set_option(:scope,AoC::SCOPE_FILES_USER)
51
51
  self.options.set_option(:private_key,'@file:'+env[:private_key_path]) if env[:private_key_path].is_a?(String)
52
52
  self.options.parse_options!
53
- OnCloud.set_use_default_ports(self.options.get_option(:default_ports))
53
+ AoC.set_use_default_ports(self.options.get_option(:default_ports))
54
54
  return if env[:man_only]
55
55
  update_aoc_api
56
56
  end
@@ -79,8 +79,8 @@ module Aspera
79
79
 
80
80
  # starts transfer using transfer agent
81
81
  def transfer_start(app,direction,node_file,ts_add)
82
- ts_add.deep_merge!(OnCloud.analytics_ts(app,direction,@workspace_id,@workspace_name))
83
- ts_add.deep_merge!(OnCloud.console_ts(app,user_info['name'],user_info['email']))
82
+ ts_add.deep_merge!(AoC.analytics_ts(app,direction,@workspace_id,@workspace_name))
83
+ ts_add.deep_merge!(AoC.console_ts(app,user_info['name'],user_info['email']))
84
84
  return self.transfer.start(*@api_aoc.tr_spec(app,direction,node_file,ts_add))
85
85
  end
86
86
 
@@ -96,12 +96,12 @@ module Aspera
96
96
  when :bearer_token_node
97
97
  thepath=self.options.get_next_argument('path')
98
98
  node_file = @api_aoc.resolve_node_file(top_node_file,thepath)
99
- node_api=@api_aoc.get_node_api(node_file[:node_info],OnCloud::SCOPE_NODE_USER)
99
+ node_api=@api_aoc.get_node_api(node_file[:node_info],AoC::SCOPE_NODE_USER)
100
100
  return Main.result_status(node_api.oauth_token)
101
101
  when :browse
102
102
  thepath=self.options.get_next_argument('path')
103
103
  node_file = @api_aoc.resolve_node_file(top_node_file,thepath)
104
- node_api=@api_aoc.get_node_api(node_file[:node_info],OnCloud::SCOPE_NODE_USER)
104
+ node_api=@api_aoc.get_node_api(node_file[:node_info],AoC::SCOPE_NODE_USER)
105
105
  file_info = node_api.read("files/#{node_file[:file_id]}")[:data]
106
106
  if file_info['type'].eql?('folder')
107
107
  result=node_api.read("files/#{node_file[:file_id]}/files",self.options.get_option(:value,:optional))
@@ -124,17 +124,17 @@ module Aspera
124
124
  return {:type=>:object_list,:data=>@api_aoc.find_files(node_file,test_block),:fields=>['path']}
125
125
  when :mkdir
126
126
  thepath=self.options.get_next_argument('path')
127
- containing_folder_path = thepath.split(OnCloud::PATH_SEPARATOR)
127
+ containing_folder_path = thepath.split(AoC::PATH_SEPARATOR)
128
128
  new_folder=containing_folder_path.pop
129
- node_file = @api_aoc.resolve_node_file(top_node_file,containing_folder_path.join(OnCloud::PATH_SEPARATOR))
130
- node_api=@api_aoc.get_node_api(node_file[:node_info],OnCloud::SCOPE_NODE_USER)
129
+ node_file = @api_aoc.resolve_node_file(top_node_file,containing_folder_path.join(AoC::PATH_SEPARATOR))
130
+ node_api=@api_aoc.get_node_api(node_file[:node_info],AoC::SCOPE_NODE_USER)
131
131
  result=node_api.create("files/#{node_file[:file_id]}/files",{:name=>new_folder,:type=>:folder})[:data]
132
132
  return Main.result_status("created: #{result['name']} (id=#{result['id']})")
133
133
  when :rename
134
134
  thepath=self.options.get_next_argument('source path')
135
135
  newname=self.options.get_next_argument('new name')
136
136
  node_file = @api_aoc.resolve_node_file(top_node_file,thepath)
137
- node_api=@api_aoc.get_node_api(node_file[:node_info],OnCloud::SCOPE_NODE_USER)
137
+ node_api=@api_aoc.get_node_api(node_file[:node_info],AoC::SCOPE_NODE_USER)
138
138
  result=node_api.update("files/#{node_file[:file_id]}",{:name=>newname})[:data]
139
139
  return Main.result_status("renamed #{thepath} to #{newname}")
140
140
  when :delete
@@ -142,7 +142,7 @@ module Aspera
142
142
  return do_bulk_operation(thepath,'deleted','path') do |thepath|
143
143
  raise "expecting String (path), got #{thepath.class.name} (#{thepath})" unless thepath.is_a?(String)
144
144
  node_file = @api_aoc.resolve_node_file(top_node_file,thepath)
145
- node_api=@api_aoc.get_node_api(node_file[:node_info],OnCloud::SCOPE_NODE_USER)
145
+ node_api=@api_aoc.get_node_api(node_file[:node_info],AoC::SCOPE_NODE_USER)
146
146
  result=node_api.delete("files/#{node_file[:file_id]}")[:data]
147
147
  {'path'=>thepath}
148
148
  end
@@ -165,63 +165,63 @@ module Aspera
165
165
  client_node_file = @api_aoc.resolve_node_file(client_home_node_file,client_folder)
166
166
  server_node_file = @api_aoc.resolve_node_file(server_home_node_file,server_folder)
167
167
  # force node as transfer agent
168
- @agents[:transfer].set_agent_instance(Fasp::Node.new(@api_aoc.get_node_api(client_node_file[:node_info],OnCloud::SCOPE_NODE_USER)))
168
+ @agents[:transfer].set_agent_instance(Fasp::Node.new(@api_aoc.get_node_api(client_node_file[:node_info],AoC::SCOPE_NODE_USER)))
169
169
  # additional node to node TS info
170
170
  add_ts={
171
171
  'remote_access_key' => server_node_file[:node_info]['access_key'],
172
172
  'destination_root_id' => server_node_file[:file_id],
173
173
  'source_root_id' => client_node_file[:file_id]
174
174
  }
175
- return Main.result_transfer(transfer_start(OnCloud::FILES_APP,client_tr_oper,server_node_file,add_ts))
175
+ return Main.result_transfer(transfer_start(AoC::FILES_APP,client_tr_oper,server_node_file,add_ts))
176
176
  when :upload
177
177
  node_file = @api_aoc.resolve_node_file(top_node_file,self.transfer.destination_folder('send'))
178
178
  add_ts={'tags'=>{'aspera'=>{'files'=>{'parentCwd'=>"#{node_file[:node_info]['id']}:#{node_file[:file_id]}"}}}}
179
- return Main.result_transfer(transfer_start(OnCloud::FILES_APP,'send',node_file,add_ts))
179
+ return Main.result_transfer(transfer_start(AoC::FILES_APP,'send',node_file,add_ts))
180
180
  when :download
181
181
  source_paths=self.transfer.ts_source_paths
182
182
  # special case for AoC : all files must be in same folder
183
183
  source_folder=source_paths.shift['source']
184
184
  # if a single file: split into folder and path
185
185
  if source_paths.empty?
186
- source_folder=source_folder.split(OnCloud::PATH_SEPARATOR)
186
+ source_folder=source_folder.split(AoC::PATH_SEPARATOR)
187
187
  source_paths=[{'source'=>source_folder.pop}]
188
- source_folder=source_folder.join(OnCloud::PATH_SEPARATOR)
188
+ source_folder=source_folder.join(AoC::PATH_SEPARATOR)
189
189
  end
190
190
  node_file = @api_aoc.resolve_node_file(top_node_file,source_folder)
191
191
  # override paths with just filename
192
192
  add_ts={'tags'=>{'aspera'=>{'files'=>{'parentCwd'=>"#{node_file[:node_info]['id']}:#{node_file[:file_id]}"}}}}
193
193
  add_ts.merge!({'paths'=>source_paths})
194
- return Main.result_transfer(transfer_start(OnCloud::FILES_APP,'receive',node_file,add_ts))
194
+ return Main.result_transfer(transfer_start(AoC::FILES_APP,'receive',node_file,add_ts))
195
195
  when :http_node_download
196
196
  source_paths=self.transfer.ts_source_paths
197
197
  source_folder=source_paths.shift['source']
198
198
  if source_paths.empty?
199
- source_folder=source_folder.split(OnCloud::PATH_SEPARATOR)
199
+ source_folder=source_folder.split(AoC::PATH_SEPARATOR)
200
200
  source_paths=[{'source'=>source_folder.pop}]
201
- source_folder=source_folder.join(OnCloud::PATH_SEPARATOR)
201
+ source_folder=source_folder.join(AoC::PATH_SEPARATOR)
202
202
  end
203
203
  raise CliBadArgument,'one file at a time only in HTTP mode' if source_paths.length > 1
204
204
  file_name = source_paths.first['source']
205
205
  node_file = @api_aoc.resolve_node_file(top_node_file,File.join(source_folder,file_name))
206
- node_api=@api_aoc.get_node_api(node_file[:node_info],OnCloud::SCOPE_NODE_USER)
206
+ node_api=@api_aoc.get_node_api(node_file[:node_info],AoC::SCOPE_NODE_USER)
207
207
  node_api.call({:operation=>'GET',:subpath=>"files/#{node_file[:file_id]}/content",:save_to_file=>File.join(self.transfer.destination_folder('receive'),file_name)})
208
208
  return Main.result_status("downloaded: #{file_name}")
209
209
  when :v3
210
210
  # Note: other "common" actions are unauthorized with user scope
211
211
  command_legacy=self.options.get_next_command(Node::SIMPLE_ACTIONS)
212
212
  # TODO: shall we support all methods here ? what if there is a link ?
213
- node_api=@api_aoc.get_node_api(top_node_file[:node_info],OnCloud::SCOPE_NODE_USER)
213
+ node_api=@api_aoc.get_node_api(top_node_file[:node_info],AoC::SCOPE_NODE_USER)
214
214
  return Node.new(@agents.merge(skip_basic_auth_options: true, node_api: node_api)).execute_action(command_legacy)
215
215
  when :file
216
216
  fileid=self.options.get_next_argument('file id')
217
217
  node_file = @api_aoc.resolve_node_file(top_node_file)
218
- node_api=@api_aoc.get_node_api(node_file[:node_info],OnCloud::SCOPE_NODE_USER)
218
+ node_api=@api_aoc.get_node_api(node_file[:node_info],AoC::SCOPE_NODE_USER)
219
219
  items=node_api.read("files/#{fileid}")[:data]
220
220
  return {:type=>:single_object,:data=>items}
221
221
  when :permissions
222
222
  fileid=self.options.get_next_argument('file id')
223
223
  node_file = @api_aoc.resolve_node_file(top_node_file)
224
- node_api=@api_aoc.get_node_api(node_file[:node_info],OnCloud::SCOPE_NODE_USER)
224
+ node_api=@api_aoc.get_node_api(node_file[:node_info],AoC::SCOPE_NODE_USER)
225
225
  command_perms=self.options.get_next_command([:show,:create])
226
226
  case command_perms
227
227
  when :show
@@ -258,8 +258,8 @@ module Aspera
258
258
  throw "ERR"
259
259
  end # execute_node_gen4_command
260
260
 
261
- # build constructor option list for OnCloud based on options of CLI
262
- def oncloud_params(subpath)
261
+ # build constructor option list for AoC based on options of CLI
262
+ def aoc_params(subpath)
263
263
  # copy command line options to args
264
264
  opt=[:link,:url,:auth,:client_id,:client_secret,:scope,:redirect_uri,:private_key,:username].inject({}){|m,i|m[i]=self.options.get_option(i,:optional);m}
265
265
  opt[:subpath]=subpath
@@ -270,7 +270,7 @@ module Aspera
270
270
  # Parameters based on command line options
271
271
  # @return nil
272
272
  def update_aoc_api
273
- @api_aoc=OnCloud.new(oncloud_params('api/v1'))
273
+ @api_aoc=AoC.new(aoc_params('api/v1'))
274
274
  # add access key secrets
275
275
  @api_aoc.add_secrets(self.config.get_secrets)
276
276
  return nil
@@ -420,7 +420,7 @@ module Aspera
420
420
  end
421
421
 
422
422
  def execute_admin_action
423
- self.options.set_option(:scope,OnCloud::SCOPE_FILES_ADMIN)
423
+ self.options.set_option(:scope,AoC::SCOPE_FILES_ADMIN)
424
424
  update_aoc_api
425
425
  command_admin=self.options.get_next_command([ :ats, :resource, :usage_reports, :analytics, :subscription, :auth_providers ])
426
426
  case command_admin
@@ -434,7 +434,7 @@ module Aspera
434
434
  end
435
435
  when :subscription
436
436
  org=@api_aoc.read('organization')[:data]
437
- bss_api=OnCloud.new(oncloud_params('bss/platform'))
437
+ bss_api=AoC.new(aoc_params('bss/platform'))
438
438
  graphql_query="
439
439
  query ($organization_id: ID!) {
440
440
  aoc (organization_id: $organization_id) {
@@ -488,7 +488,7 @@ module Aspera
488
488
  when :ats
489
489
  ats_api = Rest.new(@api_aoc.params.deep_merge({
490
490
  :base_url => @api_aoc.params[:base_url]+'/admin/ats/pub/v1',
491
- :auth => {:scope => OnCloud::SCOPE_FILES_ADMIN_USER}
491
+ :auth => {:scope => AoC::SCOPE_FILES_ADMIN_USER}
492
492
  }))
493
493
  return @ats.execute_action_gen(ats_api)
494
494
  # when :search_nodes
@@ -507,7 +507,7 @@ module Aspera
507
507
  when :analytics
508
508
  analytics_api = Rest.new(@api_aoc.params.deep_merge({
509
509
  :base_url => @api_aoc.params[:base_url].gsub('/api/v1','')+'/analytics/v2',
510
- :auth => {:scope => OnCloud::SCOPE_FILES_ADMIN_USER}
510
+ :auth => {:scope => AoC::SCOPE_FILES_ADMIN_USER}
511
511
  }))
512
512
  command_analytics=self.options.get_next_command([ :application_events, :transfers ])
513
513
  case command_analytics
@@ -750,7 +750,7 @@ module Aspera
750
750
  # execute transfer
751
751
  node_file = {node_info: node_info, file_id: package_info['contents_file_id']}
752
752
  # raise esception if at least one error
753
- Main.result_transfer(transfer_start(OnCloud::PACKAGES_APP,'send',node_file,OnCloud.package_tags(package_info,'upload')))
753
+ Main.result_transfer(transfer_start(AoC::PACKAGES_APP,'send',node_file,AoC.package_tags(package_info,'upload')))
754
754
  # return all info on package
755
755
  return { :type=>:single_object, :data =>package_info}
756
756
  when :recv
@@ -786,7 +786,7 @@ module Aspera
786
786
  self.format.display_status("downloading package: #{package_info['name']}")
787
787
  add_ts={'paths'=>[{'source'=>'.'}]}
788
788
  node_file = {node_info: node_info, file_id: package_info['contents_file_id']}
789
- statuses=transfer_start(OnCloud::PACKAGES_APP,'receive',node_file,OnCloud.package_tags(package_info,'download').merge(add_ts))
789
+ statuses=transfer_start(AoC::PACKAGES_APP,'receive',node_file,AoC.package_tags(package_info,'download').merge(add_ts))
790
790
  result_transfer.push({'package'=>package_id,'status'=>statuses.map{|i|i.to_s}.join(',')})
791
791
  # update skip list only if all transfer sessions completed
792
792
  if TransferAgent.session_status(statuses).eql?(:success)
@@ -861,7 +861,7 @@ module Aspera
861
861
  end
862
862
  result=self.entity_action(@api_aoc,'short_links',nil,:id,'self')
863
863
  if result[:data].is_a?(Hash) and result[:data].has_key?('created_at') and result[:data]['resource_type'].eql?('UrlToken')
864
- node_api=@api_aoc.get_node_api(node_file[:node_info],OnCloud::SCOPE_NODE_USER)
864
+ node_api=@api_aoc.get_node_api(node_file[:node_info],AoC::SCOPE_NODE_USER)
865
865
  perm_data={
866
866
  "file_id" =>node_file[:file_id],
867
867
  "access_type" =>"user",