asperalm 0.10.15 → 0.10.16

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
  SHA256:
3
- metadata.gz: 2ac2a0d3d0af2ff661338e68d7d1497b3a3f5626ad0fd1937b356576e3e6af02
4
- data.tar.gz: 0df3bb6447b3877fc1cb84c65d8a6d5b3d1e4db4c99e063e2200274889e54d38
3
+ metadata.gz: 38cc2d6ac468b2d71d8ade8f702d974f0eb13caf84e1a3cf90580f1995da6b11
4
+ data.tar.gz: 744456c8f6712432884261eb361a9abbc9a78d681adeec017a73ce11d138ffcc
5
5
  SHA512:
6
- metadata.gz: 0665bc76d054fcf346a991606eb5ec73359ff3b153520bbc8db2c33cdc215e5e4bc72aad5a1325005456dd63064145d5eca31365cd592e191b55af9d9b3a54c4
7
- data.tar.gz: 19acd9437da7cf66fb4b34980c971c0219a90388c9ed094353a76d2c16e2e57392d94b972193d072241a7c14ea3c5f52e84cc62f2293e9660cbac354cd58eddc
6
+ metadata.gz: 38cbd2c018ad62c258c9928b3b3bce52dd5a992d3303c2103f407c752a2ba42033d1460f34601cbca56670c42823879c3d648d1ce61b5b323cc82f39560b2464
7
+ data.tar.gz: 823b173e815c3112f8bee2fc0c4be0a2aadc47dbed644c5fe6390d9aec1fa63407221f5b279e137ef3d4226fe4a64e7e65f5ff7d458e626fa4a5796c14b7da65
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Asperalm - A Ruby library for Aspera transfers and "Amelia", the _Multi Layer IBM Aspera_ Command Line Tool
2
2
 
3
- Version : 0.10.15
3
+ Version : 0.10.16
4
4
 
5
5
 
6
6
  _Laurent/2016-2018_
@@ -39,7 +39,7 @@ Once the gem is installed, `mlia` shall be accessible:
39
39
 
40
40
  ```bash
41
41
  $ mlia --version
42
- 0.10.15
42
+ 0.10.16
43
43
  ```
44
44
 
45
45
  ## First use
@@ -1362,7 +1362,7 @@ mlia sync start --parameters=@json:'{"sessions":[{"name":"test","reset":true,"re
1362
1362
  ```bash
1363
1363
  $ mlia -h
1364
1364
  NAME
1365
- mlia -- a command line tool for Aspera Applications (v0.10.15)
1365
+ mlia -- a command line tool for Aspera Applications (v0.10.16)
1366
1366
 
1367
1367
  SYNOPSIS
1368
1368
  mlia COMMANDS [OPTIONS] [ARGS]
@@ -1621,7 +1621,7 @@ OPTIONS:
1621
1621
  --parameters=VALUE extended value for session set definition
1622
1622
  --session-name=VALUE name of session to use for admin commands, by default first one
1623
1623
  /Users/laurent/workspace/Rubytools/asperalm/lib/asperalm/ssh.rb:5: warning: method redefined; discarding old default_keys
1624
- /usr/local/lib/ruby/gems/2.7.0/gems/net-ssh-5.2.0/lib/net/ssh/authentication/session.rb:138: warning: previous definition of default_keys was here
1624
+ /usr/local/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/session.rb:139: warning: previous definition of default_keys was here
1625
1625
 
1626
1626
 
1627
1627
  COMMAND: server
@@ -3075,6 +3075,10 @@ So, it evolved into `mlia`:
3075
3075
 
3076
3076
  # Release Notes
3077
3077
 
3078
+ * 0.10.16
3079
+
3080
+ * added list of shared inboxes in workspace (or global), use `--query=@json:'{}'`
3081
+
3078
3082
  * 0.10.15
3079
3083
 
3080
3084
  * in case of command line error, display the error cause first, and non-parsed argument second
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ require 'asperalm/on_cloud'
3
+ require 'asperalm/log'
4
+
5
+ Asperalm::Log.instance.level=:debug
6
+
7
+ aocapi=Asperalm::OnCloud.new(
8
+ url: 'https://myorg.ibmaspera.com',
9
+ auth: :jwt,
10
+ private_key: File.read('path/to_your_private_key.pem'),
11
+ username: 'my.email@example.com',
12
+ scope: 'user:all',
13
+ subpath: 'api/v1')
14
+
15
+ self_user_data=aocapi.read('self')
16
+
17
+ Asperalm::Log.dump('self',self_user_data)
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env ruby
1
2
  # Example: transfer a file using one of the provided transfer agents
2
3
 
3
4
  require 'asperalm/fasp/local'
@@ -1 +1 @@
1
- 0.10.15
1
+ 0.10.16
@@ -664,12 +664,19 @@ module Asperalm
664
664
  when :tier_restrictions
665
665
  return { :type=>:single_object, :data =>@api_aoc.read('tier_restrictions')[:data] }
666
666
  when :user
667
- command=self.options.get_next_command([ :workspaces,:info ])
667
+ command=self.options.get_next_command([ :workspaces,:info,:shared_inboxes ])
668
668
  case command
669
669
  when :workspaces
670
670
  return {:type=>:object_list,:data=>@api_aoc.read("workspaces")[:data],:fields=>['id','name']}
671
671
  # when :settings
672
672
  # return {:type=>:object_list,:data=>@api_aoc.read("client_settings/")[:data]}
673
+ when :shared_inboxes
674
+ query=url_query(nil)
675
+ if query.nil?
676
+ set_workspace_info
677
+ query={'embed[]'=>'dropbox','workspace_id'=>@workspace_id,'aggregate_permissions_by_dropbox'=>true,'sort'=>'dropbox_name'}
678
+ end
679
+ return {:type=>:object_list,:data=>@api_aoc.read("dropbox_memberships",query)[:data],:fields=>['dropbox.name']}
673
680
  when :info
674
681
  command=self.options.get_next_command([ :show,:modify ])
675
682
  case command
@@ -21,9 +21,7 @@ module Asperalm
21
21
  raise "Using connect requires a graphical environment" if !OpenApplication.default_gui_mode.eql?(:graphical)
22
22
  trynumber=0
23
23
  begin
24
- uri_file=Installation.instance.connect_uri_file
25
- Log.log.debug("reading connect port file: #{uri_file}")
26
- connect_url=File.open(uri_file){|f|f.gets}.strip
24
+ connect_url=Installation.instance.connect_uri
27
25
  Log.log.debug("found: #{connect_url}")
28
26
  @connect_api=Rest.new({:base_url => "#{connect_url}/v5/connect"}) # could use v6 also now
29
27
  cinfo=@connect_api.read('info/version')[:data]
@@ -107,9 +107,17 @@ module Asperalm
107
107
  end
108
108
 
109
109
  # @returns the file path of local connect where API's URI can be read
110
- def connect_uri_file
110
+ def connect_uri
111
111
  connect=get_product_folders('Aspera Connect')
112
- return File.join(connect[:run_root],VARRUN_SUBFOLDER,'https.uri')
112
+ folder=File.join(connect[:run_root],VARRUN_SUBFOLDER)
113
+ ['','s'].each do |ext|
114
+ uri_file=File.join(folder,"http#{ext}.uri")
115
+ Log.log.debug("checking connect port file: #{uri_file}")
116
+ if File.exist?(uri_file)
117
+ return File.open(uri_file){|f|f.gets}.strip
118
+ end
119
+ end
120
+ raise "no connect uri file found in #{folder}"
113
121
  end
114
122
 
115
123
  # @ return path to configuration file of aspera CLI
@@ -121,7 +129,7 @@ module Asperalm
121
129
  # add Aspera private keys for web access, token based authorization
122
130
  def bypass_keys
123
131
  return [ "%08x-%04x-%04x-%04x-%04x%08x" % "t1(\xBF;\xF3E\xB5\xAB\x14F\x02\xC6\x7F)P".unpack("NnnnnN"),
124
- Installation.instance.path(:ssh_bypass_key_dsa),
132
+ Installation.instance.path(:ssh_bypass_key_dsa),
125
133
  Installation.instance.path(:ssh_bypass_key_rsa) ]
126
134
  end
127
135
 
@@ -1,4 +1,5 @@
1
1
  require 'asperalm/open_application'
2
+ require 'asperalm/oauth_cache'
2
3
  require 'base64'
3
4
  require 'date'
4
5
  require 'socket'
@@ -163,6 +164,7 @@ module Asperalm
163
164
  resp=nil
164
165
  case @params[:grant]
165
166
  when :web
167
+ # AoC Web based Auth
166
168
  check_code=SecureRandom.uuid
167
169
  login_page_url=Rest.build_uri(
168
170
  "#{@params[:base_url]}/#{@params[:path_authorize]}",
@@ -172,10 +174,8 @@ module Asperalm
172
174
  :client_secret => @params[:client_secret],
173
175
  :state => check_code
174
176
  }))
175
-
176
177
  # here, we need a human to authorize on a web page
177
178
  code=goto_page_and_get_code(login_page_url,check_code)
178
-
179
179
  # exchange code for token
180
180
  resp=create_token_www_body(p_client_id_and_scope.merge({
181
181
  :grant_type => 'authorization_code',
@@ -214,19 +214,21 @@ module Asperalm
214
214
  :assertion => assertion
215
215
  }))
216
216
  when :url_token
217
- # exchange url_token for bearer token
217
+ # AoC Public Link
218
218
  resp=create_token_advanced({
219
219
  :json_params => {:url_token=>@params[:url_token]},
220
220
  :url_params => p_scope.merge({
221
221
  :grant_type => 'url_token'
222
222
  })})
223
223
  when :ibm_apikey
224
+ # ATS
224
225
  resp=create_token_www_body({
225
226
  'grant_type' => 'urn:ibm:params:oauth:grant-type:apikey',
226
227
  'response_type' => 'cloud_iam',
227
228
  'apikey' => @params[:api_key]
228
229
  })
229
230
  when :delegated_refresh
231
+ # COS
230
232
  resp=create_token_www_body({
231
233
  'grant_type' => 'urn:ibm:params:oauth:grant-type:apikey',
232
234
  'response_type' => 'delegated_refresh_token',
@@ -249,7 +251,7 @@ module Asperalm
249
251
  :username => @params[:user_name],
250
252
  :password => @params[:user_pass]
251
253
  }))
252
- when :body_data
254
+ when :body_data
253
255
  # used in Faspex apiv5
254
256
  resp=create_token_advanced({
255
257
  :auth => {:type => :none},
@@ -121,11 +121,12 @@ module Asperalm
121
121
  # sets [:org_url], [:auth][:grant], [:auth][:url_token]
122
122
  self.class.resolve_pub_link(aoc_rest_p,opt[:link])
123
123
 
124
- # get org url from pub link or options
125
124
  if aoc_rest_p.has_key?(:org_url)
125
+ # Pub Link only: get org url from pub link
126
126
  opt[:url] = aoc_rest_p[:org_url]
127
127
  aoc_rest_p.delete(:org_url)
128
128
  else
129
+ # else url is mandatory
129
130
  raise ArgumentError,"Missing mandatory option: url" if opt[:url].nil?
130
131
  end
131
132
 
@@ -144,6 +145,7 @@ module Asperalm
144
145
  end
145
146
 
146
147
  aoc_auth_p[:client_id],aoc_auth_p[:client_secret] = self.class.get_client_ids(opt[:client_id],opt[:client_secret])
148
+ raise ArgumentError,"Missing mandatory option: scope" if opt[:scope].nil?
147
149
  aoc_auth_p[:scope] = opt[:scope]
148
150
 
149
151
  # fill other auth parameters based on Oauth method
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.10.15
4
+ version: 0.10.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-23 00:00:00.000000000 Z
11
+ date: 2020-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xml-simple
@@ -182,6 +182,7 @@ files:
182
182
  - bin/mlia
183
183
  - docs/diagrams.txt
184
184
  - docs/transfer_spec.html
185
+ - examples/aoc.rb
185
186
  - examples/proxy.pac
186
187
  - examples/transfer.rb
187
188
  - lib/asperalm/VERSION