asperalm 0.6.13 → 0.6.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd2e4031743e8e7a14860a12f604943471273f4a
4
- data.tar.gz: 61c8762b6bbb2ff104fd3e0dbb03a5c7b716c807
3
+ metadata.gz: 7af5dcb17f9e3bba312ed2be99aab8d8020ae67f
4
+ data.tar.gz: 1ac67a635874011e13f95c7db1211c95a290bbd3
5
5
  SHA512:
6
- metadata.gz: 894f2643744d9d5abdcf91805b029906fec8021d48f2f958e7fb3b9abde010f6add00f922e7dcec55635d561804e26a9abe6ec33401f6ae8b6ed756b1e579c72
7
- data.tar.gz: 6731fb3b43c668c598ad31275df4aa5fae799df4f1f5736a3a1766adffc81cb21be3946bc242b5ef7d3026d62c5594e30e905075a5bab389cba8fc3e95cf0302
6
+ metadata.gz: 1c55f90a5de72c9e76fd205dca305579f008f6ebdba66733c2c9dfdb31368c7ca6a2271c5ce7ef73ee4e7ab8adb25c4ed8b1b35f1c9f567b1d27255438ac7b21
7
+ data.tar.gz: a4de0871e89228f730a159baf342490aa7941098a34ef6ff3b7548b7db4e8b9d29106361371c60340e37ce06fca3c88ac2d542ca6ae56b8e877f32dadf7aa40f
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Asperalm - Laurent's Aspera Command Line Interface and Ruby Library
2
2
 
3
- Version : 0.6.13
3
+ Version : 0.6.14
4
4
 
5
5
 
6
6
  _Laurent/2016-2018_
@@ -760,7 +760,7 @@ aslmcli shares2 userinfo
760
760
  ```bash
761
761
  $ aslmcli -h
762
762
  NAME
763
- aslmcli -- a command line tool for Aspera Applications (v0.6.13)
763
+ aslmcli -- a command line tool for Aspera Applications (v0.6.14)
764
764
 
765
765
  SYNOPSIS
766
766
  aslmcli COMMANDS [OPTIONS] [ARGS]
@@ -1186,7 +1186,7 @@ It allows actions (create, update, delete) on "resources": users, group, nodes,
1186
1186
 
1187
1187
  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).
1188
1188
 
1189
- #### Example
1189
+ #### Examples
1190
1190
 
1191
1191
  * Bulk creation
1192
1192
 
@@ -1222,6 +1222,19 @@ $ aslmcli files admin res user --bulk=yes --id=@json:[$thelist] delete
1222
1222
  :.......:.........:
1223
1223
  ```
1224
1224
 
1225
+ * Display current users workspaces
1226
+
1227
+ ```
1228
+ $ aslmcli files user workspaces
1229
+ :......:............................:
1230
+ : id : name :
1231
+ :......:............................:
1232
+ : 16 : Engineering :
1233
+ : 17 : Marketing :
1234
+ : 18 : Sales :
1235
+ :......:............................:
1236
+ ```
1237
+
1225
1238
  ## Aspera Node (Transfer Server)
1226
1239
 
1227
1240
  ### Simple Operations
@@ -22,7 +22,7 @@ module Asperalm
22
22
  singleton_class.send(:alias_method, :tool, :instance)
23
23
  def self.version;return @@TOOL_VERSION;end
24
24
  private
25
- @@TOOL_VERSION='0.6.13'
25
+ @@TOOL_VERSION='0.6.14'
26
26
  # first level command for the main tool
27
27
  @@MAIN_PLUGIN_NAME_STR='config'
28
28
  # name of application, also foldername where config is stored
@@ -51,8 +51,9 @@ module Asperalm
51
51
  # input: root node and file id, and array for path
52
52
  # output: file_id and node_info for the given path
53
53
  def find_nodeinfo_and_fileid( top_node_id, top_file_id, element_path_string )
54
- Log.log.debug "find_nodeinfo_and_fileid: nodeid=#{top_node_id}, #{top_file_id}, path=#{element_path_string}"
55
-
54
+ Log.log.debug "find_nodeinfo_and_fileid: nodeid=#{top_node_id}, fileid=#{top_file_id}, path=#{element_path_string}"
55
+ raise "error" if top_node_id.to_s.empty?
56
+ raise "error" if top_file_id.to_s.empty?
56
57
  # initialize loop elements
57
58
  current_path_elements=element_path_string.split(PATH_SEPARATOR).select{|i| !i.empty?}
58
59
  current_node_info=@api_files_user.read("nodes/#{top_node_id}")[:data]
@@ -89,7 +90,7 @@ module Asperalm
89
90
  Log.log.warn "unknown element type: #{current_file_info['type']}"
90
91
  end
91
92
  end
92
- Log.log.info("node_info,file_id=#{current_node_info},#{current_file_id}")
93
+ Log.log.info("file_id=#{current_file_id},node_info=#{current_node_info}")
93
94
  return current_node_info,current_file_id
94
95
  end
95
96
 
@@ -163,7 +164,7 @@ module Asperalm
163
164
 
164
165
  # initialize apis and authentication
165
166
  # returns true if in default workspace
166
- def init_apis_is_default_ws
167
+ def init_apis
167
168
 
168
169
  api_info=FilesApi.info(Main.tool.options.get_option(:url,:mandatory))
169
170
 
@@ -205,12 +206,12 @@ module Asperalm
205
206
  @api_files_admin=Rest.new(api_info[:api_url],{:auth=>{:type=>:oauth2,:obj=>@api_files_oauth,:scope=>FilesApi::SCOPE_FILES_ADMIN}})
206
207
 
207
208
  # get our user's default information
208
- self_data=@api_files_user.read("self")[:data]
209
+ @self_data=@api_files_user.read("self")[:data]
209
210
 
210
211
  ws_name=Main.tool.options.get_option(:workspace,:optional)
211
212
  if ws_name.nil?
212
213
  # get default workspace
213
- @workspace_id=self_data['default_workspace_id']
214
+ @workspace_id=@self_data['default_workspace_id']
214
215
  @workspace_data=@api_files_user.read("workspaces/#{@workspace_id}")[:data]
215
216
  else
216
217
  # lookup another workspace
@@ -227,7 +228,14 @@ module Asperalm
227
228
  end
228
229
  end
229
230
 
230
- return @workspace_id == self_data['default_workspace_id']
231
+ Log.log.debug("workspace_id=#{@workspace_id},workspace_data=#{@workspace_data}".red)
232
+
233
+ @home_node_id=@workspace_data['home_node_id']
234
+ @home_file_id=@workspace_data['home_file_id']
235
+ raise "error" if @home_node_id.to_s.empty?
236
+ raise "error" if @home_file_id.to_s.empty?
237
+
238
+ nil
231
239
  end
232
240
 
233
241
  def do_bulk_operation(params,success,&do_action)
@@ -244,10 +252,11 @@ module Asperalm
244
252
  end
245
253
 
246
254
  def execute_action
247
- use_default_ws=init_apis_is_default_ws
255
+ init_apis
248
256
  command=Main.tool.options.get_next_argument('command',action_list)
249
257
  if Main.tool.options.get_option(:format,:optional).eql?(:table) and !command.eql?(:admin)
250
- puts "Current Workspace: #{@workspace_data['name'].red}#{" (default)" if use_default_ws}"
258
+ default_ws=@workspace_id == @self_data['default_workspace_id'] ? ' (default)' : ''
259
+ puts "Current Workspace: #{@workspace_data['name'].red}#{default_ws}"
251
260
  end
252
261
 
253
262
  # display name of default workspace
@@ -255,12 +264,24 @@ module Asperalm
255
264
 
256
265
  case command
257
266
  when :user
258
- command=Main.tool.options.get_next_argument('command',[ :workspaces ])
267
+ command=Main.tool.options.get_next_argument('command',[ :workspaces,:info ])
259
268
  case command
260
269
  when :workspaces
261
270
  return {:type=>:hash_array,:data=>@api_files_user.read("workspaces")[:data],:fields=>['id','name']}
262
271
  # when :settings
263
272
  # return {:type=>:hash_array,:data=>@api_files_user.read("client_settings/")[:data]}
273
+ when :info
274
+ resource_instance_path="users/#{@self_data['id']}"
275
+ command=Main.tool.options.get_next_argument('command',[ :show,:modify ])
276
+ case command
277
+ when :show
278
+ object=@api_files_admin.read(resource_instance_path)[:data]
279
+ return { :type=>:key_val_list, :data =>object }
280
+ when :modify
281
+ changes=Main.tool.options.get_next_argument('modified parameters (hash)')
282
+ @api_files_admin.update(resource_instance_path,changes)
283
+ return Main.result_status('modified')
284
+ end
264
285
  end
265
286
  when :package
266
287
  command_pkg=Main.tool.options.get_next_argument('command',[ :send, :recv, :list ])
@@ -305,7 +326,7 @@ module Asperalm
305
326
  return {:type=>:hash_array,:data=>packages,:fields=>['id','name','bytes_transferred']}
306
327
  end
307
328
  when :repository
308
- return execute_node_action(@workspace_data['home_node_id'],@workspace_data['home_file_id'])
329
+ return execute_node_action(@home_node_id,@home_file_id)
309
330
  when :faspexgw
310
331
  require 'asperalm/faspex_gw'
311
332
  FaspexGW.start_server(@api_files_user,@workspace_id)
@@ -320,7 +341,7 @@ module Asperalm
320
341
  # 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
321
342
  #events=@api_files_admin.read('events',{'q'=>'type:(file_upload OR file_download)'})[:data]
322
343
  #Log.log.info "events=#{JSON.generate(events)}"
323
- node_info=@api_files_user.read("nodes/#{@workspace_data['home_node_id']}")[:data]
344
+ node_info=@api_files_user.read("nodes/#{@home_node_id}")[:data]
324
345
  # get access to node API, note the additional header
325
346
  api_node=get_files_node_api(node_info,FilesApi::SCOPE_NODE_USER)
326
347
  # can add filters: tag=aspera.files.package_id%3DLA8OU3p8w
@@ -32,6 +32,7 @@ module Asperalm
32
32
  SCOPE_FILES_SELF='self'
33
33
  SCOPE_FILES_USER='user:all'
34
34
  SCOPE_FILES_ADMIN='admin:all'
35
+ SCOPE_FILES_ADMIN_USER='admin-user:all+user:all'
35
36
  SCOPE_NODE_USER='user:all'
36
37
  SCOPE_NODE_ADMIN='admin:all'
37
38
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asperalm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.13
4
+ version: 0.6.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-08 00:00:00.000000000 Z
11
+ date: 2018-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xml-simple