asperalm 0.10.13 → 0.10.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
  SHA256:
3
- metadata.gz: 49a0c96df4eb9271e83f041e5bd2564ea9fe26422b62d7197a5787e706e99f6c
4
- data.tar.gz: ef810c69d3f929b9c26a45af99479a85ae7bcd11542a9a9e5456db579d4f8e13
3
+ metadata.gz: 7c47ef56f70fd2ecb385b62750dd2c3585908bd4a84b5550dfe1a169ee21f170
4
+ data.tar.gz: a4c5a5beca9b6fe4ddaba704b53ab4ef9c4c3a7bb1cc45fcb3b2a1b940b012b0
5
5
  SHA512:
6
- metadata.gz: 7e73762a6cf8cda5acffede0a86c71c7be6a1e59d8b6528535703af61640406ff0f29112bb4d601ad35c5c843d6f6f17153a8d9b4a7d74a2f90fc8c9793174a5
7
- data.tar.gz: 61e4a4903d39d59249129db0d60d20caa50593db123bee372d9feaabc0f0c64bccc55d36d8c1ae825cbbac1022bb7fdd9b5d86e2e77ba5071b74095ca2c01803
6
+ metadata.gz: 261bd25c91c49d67d74a31407fbd87e5991737973cafc72a6d7fa99ae5a8e498629e8b68d4effac5fe86963b28df1c0beffeba35c8259274aabcf434e9795f57
7
+ data.tar.gz: 223fd8555e7f825c62785e710c1eccee5e1cd84a8310829379d38ad7213285025659fa95949520abc039e78585f1f46ecf90ea73e5c2b4ff265595346fed242b
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.13
3
+ Version : 0.10.14
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.13
42
+ 0.10.14
43
43
  ```
44
44
 
45
45
  ## First use
@@ -1288,7 +1288,7 @@ mlia faspex source name "Server Files" node br /
1288
1288
  mlia faspex5 node list --value=@json:'{"type":"received","subtype":"mypackages"}'
1289
1289
  mlia faspex5 package list --value=@json:'{"state":["released"]}'
1290
1290
  mlia faspex5 package receive --id=$$LAST_PACK
1291
- mlia faspex5 package send --value=@json:'{"title":"test title","recipients":["laurent"]}'
1291
+ mlia faspex5 package send --value=@json:'{"title":"test title","recipients":["laurent"]}' CLIENT_DEMOFILE_PATH
1292
1292
  mlia node async --id=1 bandwidth
1293
1293
  mlia node async --id=1 counters
1294
1294
  mlia node async --id=1 files
@@ -1305,7 +1305,7 @@ mlia node search / --value=@json:'{"sort":"mtime"}'
1305
1305
  mlia node service --id=service1 delete
1306
1306
  mlia node service create @json:'{"id":"service1","type":"WATCHD","run_as":{"user":"user1"}}'
1307
1307
  mlia node service list
1308
- mlia node transfer list
1308
+ mlia node transfer list --value=@json:'{"active_only":true}'
1309
1309
  mlia node upload --to-folder=SERVER_FOLDER_UPLOAD --ts=@json:'{"target_rate_cap_kbps":10000}' CLIENT_DEMOFILE_PATH
1310
1310
  mlia orchestrator info
1311
1311
  mlia orchestrator plugins
@@ -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.13)
1365
+ mlia -- a command line tool for Aspera Applications (v0.10.14)
1366
1366
 
1367
1367
  SYNOPSIS
1368
1368
  mlia COMMANDS [OPTIONS] [ARGS]
@@ -1454,6 +1454,7 @@ OPTIONS:
1454
1454
  --validator=VALUE identifier of validator (optional for central)
1455
1455
  --asperabrowserurl=VALUE URL for simple aspera web ui
1456
1456
  --name=VALUE sync name
1457
+ --token=ENUM package box: aspera, basic, auto
1457
1458
 
1458
1459
 
1459
1460
  COMMAND: orchestrator
@@ -1473,7 +1474,6 @@ OPTIONS:
1473
1474
  --url=VALUE URL of application, e.g. https://org.asperafiles.com
1474
1475
  --username=VALUE username to log in
1475
1476
  --password=VALUE user's password
1476
- /Users/laurent/workspace/Rubytools/asperalm/lib/asperalm/cli/plugins/aspera.rb:413: warning: assigned but unused variable - bss_node
1477
1477
 
1478
1478
 
1479
1479
  COMMAND: aspera
@@ -3051,6 +3051,9 @@ So, it evolved into `mlia`:
3051
3051
 
3052
3052
 
3053
3053
  # Release Notes
3054
+ * 0.10.14
3055
+
3056
+ * added missing bss plugin
3054
3057
 
3055
3058
  * 0.10.13
3056
3059
 
@@ -1 +1 @@
1
- 0.10.13
1
+ 0.10.14
@@ -1,6 +1,5 @@
1
1
  require 'asperalm/cli/plugins/node'
2
2
  require 'asperalm/cli/plugins/ats'
3
- require 'asperalm/cli/plugins/bss'
4
3
  require 'asperalm/cli/basic_auth_plugin'
5
4
  require 'asperalm/cli/transfer_agent'
6
5
  require 'asperalm/on_cloud'
@@ -145,6 +144,7 @@ module Asperalm
145
144
  # server side is protocol server
146
145
  # in same workspace
147
146
  server_home_node_file=client_home_node_file=top_node_file
147
+ # default is push
148
148
  case self.options.get_option(:operation,:mandatory)
149
149
  when :push
150
150
  client_tr_oper='send'
@@ -398,7 +398,7 @@ module Asperalm
398
398
  def execute_admin_action
399
399
  self.options.set_option(:scope,OnCloud::SCOPE_FILES_ADMIN)
400
400
  update_aoc_api
401
- command_admin=self.options.get_next_command([ :ats, :resource, :usage_reports, :events, :subscription, :auth_providers, :bss ])
401
+ command_admin=self.options.get_next_command([ :ats, :resource, :usage_reports, :events, :subscription, :auth_providers ])
402
402
  case command_admin
403
403
  when :auth_providers
404
404
  command_auth_prov=self.options.get_next_command([ :list, :update ])
@@ -408,9 +408,6 @@ module Asperalm
408
408
  return {:type=>:object_list,:data=>providers}
409
409
  when :update
410
410
  end
411
- when :bss
412
- bss_api=OnCloud.new(oncloud_params('bss/platform'))
413
- bss_node=Bss.new(@agents.merge(skip_basic_auth_options: true, bss_api: bss_api)).execute_action
414
411
  when :subscription
415
412
  org=@api_aoc.read('organization')[:data]
416
413
  bss_api=OnCloud.new(oncloud_params('bss/platform'))
@@ -0,0 +1,71 @@
1
+ require 'asperalm/rest'
2
+
3
+ module Asperalm
4
+ module Cli
5
+ module Plugins
6
+ class Bss < BasicAuthPlugin
7
+
8
+ ACTIONS=[ :subscription ]
9
+
10
+ FIELDS={
11
+ 'bssSubscriptions' => %w{id name termVolumeGb termMonths trial startDate endDate plan renewalType chargeAgreementNumber customerName}
12
+ }
13
+
14
+ def initialize(env)
15
+ super(env)
16
+ if env.has_key?(:bss_api)
17
+ @api_bss=env[:bss_api]
18
+ end
19
+ end
20
+
21
+ def all_fields(name)
22
+ return FIELDS[name].join(' ')
23
+ end
24
+
25
+ def execute_action
26
+ if @api_bss.nil?
27
+ key = self.options.get_option(:password,:mandatory)
28
+ @api_bss=Rest.new(
29
+ base_url: 'https://dashboard.bss.asperasoft.com/platform',
30
+ headers: {cookie: "_dashboard_key=#{key}"})
31
+ end
32
+ command=self.options.get_next_command(ACTIONS)
33
+ case command
34
+ when :subscription
35
+ command=self.options.get_next_command([:find,:show, :instances])
36
+ object='bssSubscriptions'
37
+ case command
38
+ when :find
39
+ query = self.options.get_option(:query,:mandatory) # AOC_ORGANIZATION_QUERY AOC_USER_EMAIL
40
+ value = self.options.get_option(:value,:mandatory)
41
+ request={
42
+ 'variables'=>{'filter'=>{'key'=>query,'value'=>value}},
43
+ 'query'=>"query($filter: BssSubscriptionFilter!) {#{object}(filter: $filter) { #{all_fields('bssSubscriptions')} } }"
44
+ }
45
+ result=@api_bss.create('graphql',request)[:data]
46
+ # give fields to keep order
47
+ return {:type=>:object_list, :data=>result['data'][object],:fields=> FIELDS['bssSubscriptions']}
48
+ when :show
49
+ id = self.options.get_option(:id,:mandatory)
50
+ request={
51
+ 'variables'=>{'id'=>id},
52
+ 'query'=>"query($id: ID!) {#{object}(id: $id) { #{all_fields('bssSubscriptions')} roleAssignments(uniqueSubjectId: true) { id subjectId } instances { id state planId serviceId ssmSubscriptionId entitlement { id } aocOrganization { id subdomainName name status tier urlId trialExpiresAt users(organizationAdmin: true) { id name email atsAdmin subscriptionAdmin } } } } }"
53
+ }
54
+ result=@api_bss.create('graphql',request)[:data]['data'][object].first
55
+ result.delete('instances')
56
+ return {:type=>:single_object, :data=>result}
57
+ when :instances
58
+ id = self.options.get_option(:id,:mandatory)
59
+ request={
60
+ 'variables'=>{'id'=>id},
61
+ 'query'=>"query($id: ID!) {#{object}(id: $id) { aocOrganization { id subdomainName name status tier urlId trialExpiresAt } } } }"
62
+ }
63
+ result=@api_bss.create('graphql',request)[:data]['data'][object].first
64
+ return {:type=>:object_list, :data=>result['instances']}
65
+ end
66
+ end
67
+ end
68
+ end # Bss
69
+ end # Plugins
70
+ end # Cli
71
+ end # Asperalm
@@ -18,7 +18,9 @@ module Asperalm
18
18
  self.options.add_opt_simple(:validator,"identifier of validator (optional for central)")
19
19
  self.options.add_opt_simple(:asperabrowserurl,"URL for simple aspera web ui")
20
20
  self.options.add_opt_simple(:name,"sync name")
21
+ self.options.add_opt_list(:token,[:aspera,:basic,:auto],'package box')
21
22
  self.options.set_option(:asperabrowserurl,'https://asperabrowser.mybluemix.net')
23
+ self.options.set_option(:token,:aspera)
22
24
  self.options.parse_options!
23
25
  end
24
26
  return if env[:man_only]
@@ -176,7 +178,7 @@ module Asperalm
176
178
  self.format.display_status("Items: #{send_result[:data]['item_count']}/#{send_result[:data]['total_count']}")
177
179
  return c_result_remove_prefix_path(result,'path',prefix_path)
178
180
  when :upload
179
- # only one transfer request
181
+ # we send only a list of one transfer request
180
182
  transfer_request = { :paths => [ { :destination => self.transfer.destination_folder('send') } ] }
181
183
  transfer_request.deep_merge!(@add_request_param)
182
184
  send_result=@api_node.create('files/upload_setup',{:transfer_requests => [ { :transfer_request => transfer_request } ] } )[:data]
@@ -205,7 +205,7 @@ module Asperalm
205
205
  # but to_folder was used in initial API call
206
206
  @transfer_spec_cmdline.delete('destination_root')
207
207
  when :node_gen4
208
- @transfer_spec_cmdline['destination_root']='/'
208
+ @transfer_spec_cmdline.delete('destination_root') if @transfer_spec_cmdline.has_key?('destination_root_id')
209
209
  else
210
210
  raise StandardError,"InternalError: unsupported value: #{options[:src]}"
211
211
  end
@@ -153,7 +153,7 @@ module Asperalm
153
153
  # optional args, at the end to override previous ones (to allow override)
154
154
  @builder.add_command_line_options(@builder.process_param('EX_ascp_args',:get_value,:accepted_types=>Array))
155
155
  # process destination folder
156
- destination_folder = @builder.process_param('destination_root',:get_value,:accepted_types=>String,:mandatory=>true)
156
+ destination_folder = @builder.process_param('destination_root',:get_value,:accepted_types=>String,:mandatory=>false) || '/'
157
157
  # ascp4 does not support base64 encoding of destination
158
158
  destination_folder = Base64.strict_encode64(destination_folder) unless env_args[:ascp_version].eql?(:ascp4)
159
159
  # destination MUST be last command line argument to ascp
@@ -83,7 +83,7 @@ module Asperalm
83
83
  end
84
84
 
85
85
  # shortcut for create_token_advanced
86
- def create_token_simple(creation_params)
86
+ def create_token_www_body(creation_params)
87
87
  return create_token_advanced({:www_body_params=>creation_params})
88
88
  end
89
89
 
@@ -145,7 +145,7 @@ module Asperalm
145
145
  # try to refresh
146
146
  # note: admin token has no refresh, and lives by default 1800secs
147
147
  # Note: scope is mandatory in Files, and we can either provide basic auth, or client_Secret in data
148
- resp=create_token_simple(p_client_id_and_scope.merge({
148
+ resp=create_token_www_body(p_client_id_and_scope.merge({
149
149
  :grant_type =>'refresh_token',
150
150
  :refresh_token=>refresh_token}))
151
151
  if resp[:http].code.start_with?('2') then
@@ -177,7 +177,7 @@ module Asperalm
177
177
  code=goto_page_and_get_code(login_page_url,check_code)
178
178
 
179
179
  # exchange code for token
180
- resp=create_token_simple(p_client_id_and_scope.merge({
180
+ resp=create_token_www_body(p_client_id_and_scope.merge({
181
181
  :grant_type => 'authorization_code',
182
182
  :code => code,
183
183
  :redirect_uri => @params[:redirect_uri]
@@ -209,7 +209,7 @@ module Asperalm
209
209
 
210
210
  Log.log.debug("assertion=[#{assertion}]")
211
211
 
212
- resp=create_token_simple(p_scope.merge({
212
+ resp=create_token_www_body(p_scope.merge({
213
213
  :grant_type => 'urn:ietf:params:oauth:grant-type:jwt-bearer',
214
214
  :assertion => assertion
215
215
  }))
@@ -221,13 +221,13 @@ module Asperalm
221
221
  :grant_type => 'url_token'
222
222
  })})
223
223
  when :ibm_apikey
224
- resp=create_token_simple({
224
+ resp=create_token_www_body({
225
225
  'grant_type' => 'urn:ibm:params:oauth:grant-type:apikey',
226
226
  'response_type' => 'cloud_iam',
227
227
  'apikey' => @params[:api_key]
228
228
  })
229
229
  when :delegated_refresh
230
- resp=create_token_simple({
230
+ resp=create_token_www_body({
231
231
  'grant_type' => 'urn:ibm:params:oauth:grant-type:apikey',
232
232
  'response_type' => 'delegated_refresh_token',
233
233
  'apikey' => @params[:api_key],
@@ -244,7 +244,7 @@ module Asperalm
244
244
  })
245
245
  when :body_userpass
246
246
  # legacy, not used
247
- resp=create_token_simple(p_client_id_and_scope.merge({
247
+ resp=create_token_www_body(p_client_id_and_scope.merge({
248
248
  :grant_type => 'password',
249
249
  :username => @params[:user_name],
250
250
  :password => @params[:user_pass]
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.13
4
+ version: 0.10.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: 2020-06-12 00:00:00.000000000 Z
11
+ date: 2020-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xml-simple
@@ -201,6 +201,7 @@ files:
201
201
  - lib/asperalm/cli/plugins/alee.rb
202
202
  - lib/asperalm/cli/plugins/aspera.rb
203
203
  - lib/asperalm/cli/plugins/ats.rb
204
+ - lib/asperalm/cli/plugins/bss.rb
204
205
  - lib/asperalm/cli/plugins/config.rb
205
206
  - lib/asperalm/cli/plugins/console.rb
206
207
  - lib/asperalm/cli/plugins/cos.rb