aspera-cli 4.19.0 → 4.20.0

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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +20 -0
  4. data/CONTRIBUTING.md +16 -4
  5. data/README.md +344 -164
  6. data/bin/asession +26 -19
  7. data/examples/build_exec +65 -76
  8. data/examples/build_exec_rubyc +40 -0
  9. data/examples/get_proto_file.rb +7 -0
  10. data/lib/aspera/agent/alpha.rb +8 -8
  11. data/lib/aspera/agent/base.rb +2 -18
  12. data/lib/aspera/agent/connect.rb +14 -13
  13. data/lib/aspera/agent/direct.rb +23 -24
  14. data/lib/aspera/agent/httpgw.rb +2 -3
  15. data/lib/aspera/agent/node.rb +10 -10
  16. data/lib/aspera/agent/trsdk.rb +17 -20
  17. data/lib/aspera/api/alee.rb +15 -0
  18. data/lib/aspera/api/aoc.rb +126 -97
  19. data/lib/aspera/api/ats.rb +1 -1
  20. data/lib/aspera/api/cos_node.rb +1 -1
  21. data/lib/aspera/api/httpgw.rb +15 -10
  22. data/lib/aspera/api/node.rb +33 -12
  23. data/lib/aspera/ascmd.rb +56 -48
  24. data/lib/aspera/ascp/installation.rb +99 -42
  25. data/lib/aspera/ascp/management.rb +3 -2
  26. data/lib/aspera/ascp/products.rb +12 -0
  27. data/lib/aspera/assert.rb +10 -5
  28. data/lib/aspera/cli/formatter.rb +27 -17
  29. data/lib/aspera/cli/hints.rb +2 -1
  30. data/lib/aspera/cli/info.rb +12 -10
  31. data/lib/aspera/cli/main.rb +16 -13
  32. data/lib/aspera/cli/manager.rb +5 -0
  33. data/lib/aspera/cli/plugin.rb +15 -29
  34. data/lib/aspera/cli/plugins/alee.rb +3 -3
  35. data/lib/aspera/cli/plugins/aoc.rb +222 -194
  36. data/lib/aspera/cli/plugins/ats.rb +16 -14
  37. data/lib/aspera/cli/plugins/config.rb +53 -45
  38. data/lib/aspera/cli/plugins/console.rb +3 -3
  39. data/lib/aspera/cli/plugins/faspex.rb +11 -21
  40. data/lib/aspera/cli/plugins/faspex5.rb +44 -42
  41. data/lib/aspera/cli/plugins/faspio.rb +2 -2
  42. data/lib/aspera/cli/plugins/httpgw.rb +1 -1
  43. data/lib/aspera/cli/plugins/node.rb +153 -95
  44. data/lib/aspera/cli/plugins/orchestrator.rb +14 -13
  45. data/lib/aspera/cli/plugins/preview.rb +8 -9
  46. data/lib/aspera/cli/plugins/server.rb +5 -9
  47. data/lib/aspera/cli/plugins/shares.rb +2 -2
  48. data/lib/aspera/cli/sync_actions.rb +2 -2
  49. data/lib/aspera/cli/transfer_agent.rb +12 -14
  50. data/lib/aspera/cli/transfer_progress.rb +35 -17
  51. data/lib/aspera/cli/version.rb +1 -1
  52. data/lib/aspera/command_line_builder.rb +3 -4
  53. data/lib/aspera/coverage.rb +13 -1
  54. data/lib/aspera/environment.rb +34 -18
  55. data/lib/aspera/faspex_gw.rb +2 -2
  56. data/lib/aspera/json_rpc.rb +1 -1
  57. data/lib/aspera/keychain/macos_security.rb +7 -12
  58. data/lib/aspera/log.rb +3 -4
  59. data/lib/aspera/oauth/base.rb +39 -45
  60. data/lib/aspera/oauth/factory.rb +11 -4
  61. data/lib/aspera/oauth/generic.rb +4 -8
  62. data/lib/aspera/oauth/jwt.rb +3 -3
  63. data/lib/aspera/oauth/url_json.rb +1 -2
  64. data/lib/aspera/oauth/web.rb +5 -2
  65. data/lib/aspera/persistency_action_once.rb +16 -8
  66. data/lib/aspera/preview/utils.rb +5 -16
  67. data/lib/aspera/rest.rb +100 -76
  68. data/lib/aspera/transfer/faux_file.rb +4 -4
  69. data/lib/aspera/transfer/parameters.rb +14 -16
  70. data/lib/aspera/transfer/spec.rb +12 -12
  71. data/lib/aspera/transfer/sync.rb +1 -5
  72. data/lib/aspera/transfer/uri.rb +1 -1
  73. data/lib/aspera/uri_reader.rb +1 -1
  74. data/lib/aspera/web_auth.rb +166 -17
  75. data/lib/aspera/web_server_simple.rb +4 -3
  76. data/lib/transfer_pb.rb +84 -0
  77. data/lib/transfer_services_pb.rb +82 -0
  78. data.tar.gz.sig +0 -0
  79. metadata +24 -5
  80. metadata.gz.sig +0 -0
@@ -98,7 +98,7 @@ module Aspera
98
98
  CSV_RECORD_SEPARATOR = "\n"
99
99
  CSV_FIELD_SEPARATOR = ','
100
100
  # supported output formats
101
- DISPLAY_FORMATS = %i[text nagios ruby json jsonpp yaml table multi csv image].freeze
101
+ DISPLAY_FORMATS = %i[text nagios ruby json jsonpp yaml table csv image].freeze
102
102
  # user output levels
103
103
  DISPLAY_LEVELS = %i[info data error].freeze
104
104
  FIELD_VALUE_HEADINGS = %i[key value].freeze
@@ -167,6 +167,11 @@ module Aspera
167
167
  @spinner.spin
168
168
  end
169
169
 
170
+ def long_operation_terminated
171
+ @spinner&.stop
172
+ @spinner = nil
173
+ end
174
+
170
175
  # options are: format, output, display, fields, select, table_style, flat_hash, transpose_single
171
176
  def option_handler(option_symbol, operation, value=nil)
172
177
  Aspera.assert_values(operation, %i[set get])
@@ -197,7 +202,6 @@ module Aspera
197
202
  else
198
203
  {}
199
204
  end
200
-
201
205
  options.declare(:format, 'Output format', values: DISPLAY_FORMATS, handler: {o: self, m: :option_handler}, default: :table)
202
206
  options.declare(:output, 'Destination for results', types: String, handler: {o: self, m: :option_handler})
203
207
  options.declare(:display, 'Output only some information', values: DISPLAY_LEVELS, handler: {o: self, m: :option_handler}, default: :info)
@@ -207,8 +211,9 @@ module Aspera
207
211
  default: SpecialValues::DEF)
208
212
  options.declare(:select, 'Select only some items in lists: column, value', types: [Hash, Proc], handler: {o: self, m: :option_handler})
209
213
  options.declare(:table_style, 'Table display style', types: [Hash], handler: {o: self, m: :option_handler}, default: default_table_style)
210
- options.declare(:flat_hash, 'Display deep values as additional keys', values: :bool, handler: {o: self, m: :option_handler}, default: true)
211
- options.declare(:transpose_single, 'Single object fields output vertically', values: :bool, handler: {o: self, m: :option_handler}, default: true)
214
+ options.declare(:flat_hash, '(Table) Display deep values as additional keys', values: :bool, handler: {o: self, m: :option_handler}, default: true)
215
+ options.declare(:transpose_single, '(Table) Single object fields output vertically', values: :bool, handler: {o: self, m: :option_handler}, default: true)
216
+ options.declare(:multi_table, '(Table) Each element of a table are displayed as a table', values: :bool, handler: {o: self, m: :option_handler}, default: false)
212
217
  options.declare(:show_secrets, 'Show secrets on command output', values: :bool, handler: {o: self, m: :option_handler}, default: false)
213
218
  options.declare(:image, 'Options for image display', types: Hash, handler: {o: self, m: :option_handler}, default: {})
214
219
  end
@@ -325,8 +330,9 @@ module Aspera
325
330
  display_message(:data, object_array.first[fields.first])
326
331
  return
327
332
  end
333
+ single_transposed = @options[:transpose_single] && object_array.length == 1
328
334
  # Special case if only one row (it could be object_list or single_object)
329
- if @options[:transpose_single] && object_array.length == 1
335
+ if single_transposed
330
336
  single = object_array.first
331
337
  object_array = fields.map { |i| FIELD_VALUE_HEADINGS.zip([i, single[i]]).to_h }
332
338
  fields = FIELD_VALUE_HEADINGS
@@ -334,20 +340,24 @@ module Aspera
334
340
  Log.log.debug{Log.dump(:object_array, object_array)}
335
341
  # convert data to string, and keep only display fields
336
342
  final_table_rows = object_array.map { |r| fields.map { |c| r[c].to_s } }
343
+ # remove empty rows
344
+ final_table_rows.select!{|i| !(i.is_a?(Hash) && i.empty?)}
337
345
  # here : fields : list of column names
338
346
  case @options[:format]
339
347
  when :table
340
- # display the table !
341
- display_message(:data, Terminal::Table.new(
342
- headings: fields,
343
- rows: final_table_rows,
344
- style: @options[:table_style]&.symbolize_keys))
345
- when :multi
346
- final_table_rows.each do |row|
347
- Log.log.debug{Log.dump(:row, row)}
348
+ if @options[:multi_table] && !single_transposed
349
+ final_table_rows.each do |row|
350
+ Log.log.debug{Log.dump(:row, row)}
351
+ display_message(:data, Terminal::Table.new(
352
+ headings: FIELD_VALUE_HEADINGS,
353
+ rows: fields.zip(row),
354
+ style: @options[:table_style]&.symbolize_keys))
355
+ end
356
+ else
357
+ # display the table !
348
358
  display_message(:data, Terminal::Table.new(
349
- headings: FIELD_VALUE_HEADINGS,
350
- rows: fields.zip(row),
359
+ headings: fields,
360
+ rows: final_table_rows,
351
361
  style: @options[:table_style]&.symbolize_keys))
352
362
  end
353
363
  when :csv
@@ -360,7 +370,7 @@ module Aspera
360
370
  # @return text suitable to display an image from url
361
371
  def status_image(blob)
362
372
  begin
363
- raise URI::InvalidURIError, 'not uri' if !(blob =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/)
373
+ raise URI::InvalidURIError, 'not uri' if !(blob =~ /\A#{URI::RFC2396_PARSER.make_regexp}\z/)
364
374
  # it's a url
365
375
  url = blob
366
376
  unless Environment.instance.url_method.eql?(:text)
@@ -424,7 +434,7 @@ module Aspera
424
434
  end
425
435
  raise "not url: #{url.class} #{url}" unless url.is_a?(String)
426
436
  display_message(:data, status_image(url))
427
- when :table, :csv, :multi
437
+ when :table, :csv
428
438
  case type
429
439
  when :config_over
430
440
  display_table(Flattener.new(self).config_over(data), CONF_OVERVIEW_KEYS)
@@ -4,6 +4,7 @@ require 'aspera/transfer/error'
4
4
  require 'aspera/rest'
5
5
  require 'aspera/log'
6
6
  require 'aspera/assert'
7
+ require 'aspera/cli/info'
7
8
  require 'net/ssh'
8
9
  require 'openssl'
9
10
 
@@ -18,7 +19,7 @@ module Aspera
18
19
  match: 'Remote host is not who we expected',
19
20
  remediation: [
20
21
  'For this specific error, refer to:',
21
- "#{SRC_URL}#error-remote-host-is-not-who-we-expected",
22
+ "#{Info::SRC_URL}#error-remote-host-is-not-who-we-expected",
22
23
  'Add this to arguments:',
23
24
  %q{--ts=@json:'{"sshfp":null}'"}
24
25
  ]
@@ -2,15 +2,17 @@
2
2
 
3
3
  module Aspera
4
4
  module Cli
5
- # name of command line tool, also used as foldername where config is stored
6
- PROGRAM_NAME = 'ascli'
7
- # name of the containing gem, same as in <gem name>.gemspec
8
- GEM_NAME = 'aspera-cli'
9
- DOC_URL = "https://www.rubydoc.info/gems/#{GEM_NAME}"
10
- GEM_URL = "https://rubygems.org/gems/#{GEM_NAME}"
11
- SRC_URL = 'https://github.com/IBM/aspera-cli'
12
- # set this to warn in advance when minimum required ruby version will increase
13
- # see also required_ruby_version in gemspec file
14
- RUBY_FUTURE_MINIMUM_VERSION = '3.0'
5
+ module Info
6
+ # name of command line tool, also used as foldername where config is stored
7
+ CMD_NAME = 'ascli'
8
+ # name of the containing gem, same as in <gem name>.gemspec
9
+ GEM_NAME = 'aspera-cli'
10
+ DOC_URL = "https://www.rubydoc.info/gems/#{GEM_NAME}"
11
+ GEM_URL = "https://rubygems.org/gems/#{GEM_NAME}"
12
+ SRC_URL = 'https://github.com/IBM/aspera-cli'
13
+ # set this to warn in advance when minimum required ruby version will increase
14
+ # see also required_ruby_version in gemspec file
15
+ RUBY_FUTURE_MINIMUM_VERSION = '3.0'
16
+ end
15
17
  end
16
18
  end
@@ -94,7 +94,7 @@ module Aspera
94
94
  # create formatter, in case there is an exception, it is used to display.
95
95
  @plug_init[:formatter] = Formatter.new
96
96
  # create command line manager with arguments
97
- @plug_init[:options] = Manager.new(PROGRAM_NAME, @argv)
97
+ @plug_init[:options] = Manager.new(Info::CMD_NAME, @argv)
98
98
  # formatter adds options
99
99
  @plug_init[:formatter].declare_options(options)
100
100
  ExtendedValue.instance.default_decoder = options.get_option(:struct_parser)
@@ -102,16 +102,18 @@ module Aspera
102
102
  current_prog_name = File.basename($PROGRAM_NAME)
103
103
  formatter.display_message(
104
104
  :error,
105
- "#{Formatter::WARNING_FLASH} Please use '#{PROGRAM_NAME}' instead of '#{current_prog_name}'") unless current_prog_name.eql?(PROGRAM_NAME)
105
+ "#{Formatter::WARNING_FLASH} Please use '#{Info::CMD_NAME}' instead of '#{current_prog_name}'") unless current_prog_name.eql?(Info::CMD_NAME)
106
106
  # declare and parse global options
107
107
  declare_global_options
108
108
  # the Config plugin adds the @preset parser, so declare before TransferAgent which may use it
109
- @plug_init[:config] = Plugins::Config.new(**@plug_init, gem: GEM_NAME, name: PROGRAM_NAME, help: DOC_URL, version: Cli::VERSION)
109
+ @plug_init[:config] = Plugins::Config.new(**@plug_init, man_header: false)
110
110
  @plug_init[:persistency] = @plug_init[:config].persistency
111
111
  # data persistency
112
112
  Aspera.assert(@plug_init[:persistency]){'missing persistency object'}
113
113
  # the TransferAgent plugin may use the @preset parser
114
114
  @plug_init[:config].transfer = @plug_init[:transfer] = TransferAgent.new(options, config)
115
+ # add commands for config plugin after all options have been added
116
+ @plug_init[:config].add_manual_header(false)
115
117
  nil_keys = @plug_init.select{|_, value|value.nil?}.keys
116
118
  Aspera.assert(nil_keys.empty?){"nil : #{nil_keys}"}
117
119
  Log.log.debug('plugin env created'.red)
@@ -123,23 +125,23 @@ module Aspera
123
125
  t = ' ' * 8
124
126
  return <<~END_OF_BANNER
125
127
  NAME
126
- #{t}#{PROGRAM_NAME} -- a command line tool for Aspera Applications (v#{Cli::VERSION})
128
+ #{t}#{Info::CMD_NAME} -- a command line tool for Aspera Applications (v#{Cli::VERSION})
127
129
 
128
130
  SYNOPSIS
129
- #{t}#{PROGRAM_NAME} COMMANDS [OPTIONS] [ARGS]
131
+ #{t}#{Info::CMD_NAME} COMMANDS [OPTIONS] [ARGS]
130
132
 
131
133
  DESCRIPTION
132
134
  #{t}Use Aspera application to perform operations on command line.
133
- #{t}Documentation and examples: #{GEM_URL}
134
- #{t}execute: #{PROGRAM_NAME} conf doc
135
- #{t}or visit: #{DOC_URL}
136
- #{t}source repo: #{SRC_URL}
135
+ #{t}Documentation and examples: #{Info::GEM_URL}
136
+ #{t}execute: #{Info::CMD_NAME} conf doc
137
+ #{t}or visit: #{Info::DOC_URL}
138
+ #{t}source repo: #{Info::SRC_URL}
137
139
 
138
140
  ENVIRONMENT VARIABLES
139
141
  #{t}Any option can be set as an environment variable, refer to the manual
140
142
 
141
143
  COMMANDS
142
- #{t}To list first level commands, execute: #{PROGRAM_NAME}
144
+ #{t}To list first level commands, execute: #{Info::CMD_NAME}
143
145
  #{t}Note that commands can be written shortened (provided it is unique).
144
146
 
145
147
  OPTIONS
@@ -199,16 +201,17 @@ module Aspera
199
201
 
200
202
  def exit_with_usage(include_all_plugins)
201
203
  Log.log.debug{"exit_with_usage(#{include_all_plugins})".bg_red}
202
- # display main plugin options
204
+ # display main plugin options (+config)
203
205
  formatter.display_message(:error, options.parser)
204
206
  if include_all_plugins
205
207
  # list plugins that have a "require" field, i.e. all but main plugin
206
208
  PluginFactory.instance.plugin_list.each do |plugin_name_sym|
209
+ # config was already included in the global options
207
210
  next if plugin_name_sym.eql?(COMMAND_CONFIG)
208
211
  # override main option parser with a brand new, to avoid having global options
209
212
  plugin_env = @plug_init.clone
210
213
  plugin_env[:only_manual] = true # force declaration of all options
211
- plugin_env[:options] = Manager.new(PROGRAM_NAME)
214
+ plugin_env[:options] = Manager.new(Info::CMD_NAME)
212
215
  plugin_env[:options].parser.banner = '' # remove default banner
213
216
  get_plugin_instance_with_options(plugin_name_sym, plugin_env)
214
217
  # display generated help for plugin options
@@ -223,7 +226,7 @@ module Aspera
223
226
  # early debug for parser
224
227
  # Note: does not accept shortcuts
225
228
  def early_debug_setup
226
- Log.instance.program_name = PROGRAM_NAME
229
+ Log.instance.program_name = Info::CMD_NAME
227
230
  @argv.each do |arg|
228
231
  case arg
229
232
  when '--' then break
@@ -386,6 +386,11 @@ module Aspera
386
386
  end
387
387
  end
388
388
 
389
+ # allows a plugin to add an argument as next argument to process
390
+ def unshift_next_argument(argument)
391
+ @unprocessed_cmd_line_arguments.unshift(argument)
392
+ end
393
+
389
394
  # check if there were unprocessed values to generate error
390
395
  def command_or_arg_empty?
391
396
  return @unprocessed_cmd_line_arguments.empty?
@@ -24,10 +24,7 @@ module Aspera
24
24
 
25
25
  class << self
26
26
  def declare_generic_options(options)
27
- options.declare(:query, 'Additional filter for for some commands (list/delete)', types: Hash)
28
- options.declare(
29
- :value, 'Value for create, update, list filter', types: Hash,
30
- deprecation: '(4.14) Use positional value for create/modify or option: query for list/delete')
27
+ options.declare(:query, 'Additional filter for for some commands (list/delete)', types: [Hash, Array])
31
28
  options.declare(:property, 'Name of property to set (modify operation)')
32
29
  options.declare(:bulk, 'Bulk operation (only some)', values: :bool, default: :no)
33
30
  options.declare(:bfail, 'Bulk operation error handling', values: :bool, default: :yes)
@@ -36,21 +33,25 @@ module Aspera
36
33
 
37
34
  attr_accessor(*INIT_PARAMS)
38
35
 
39
- def initialize(options:, transfer:, config:, formatter:, persistency:, only_manual:)
36
+ def initialize(options:, transfer:, config:, formatter:, persistency:, only_manual:, man_header: true)
37
+ # check presence in descendant of mandatory method and constant
38
+ Aspera.assert(respond_to?(:execute_action)){"Missing method 'execute_action' in #{self.class}"}
39
+ Aspera.assert(self.class.constants.include?(:ACTIONS)){"Missing constant 'ACTIONS' in #{self.class}"}
40
40
  @options = options
41
41
  @transfer = transfer
42
42
  @config = config
43
43
  @formatter = formatter
44
44
  @persistency = persistency
45
45
  @only_manual = only_manual
46
- # check presence in descendant of mandatory method and constant
47
- Aspera.assert(respond_to?(:execute_action)){"Missing method 'execute_action' in #{self.class}"}
48
- Aspera.assert(self.class.constants.include?(:ACTIONS)){'ACTIONS shall be redefined by subclass'}
46
+ add_manual_header if man_header
47
+ end
48
+
49
+ def add_manual_header(has_options = true)
49
50
  # manual header for all plugins
50
51
  options.parser.separator('')
51
52
  options.parser.separator("COMMAND: #{self.class.name.split('::').last.downcase}")
52
53
  options.parser.separator("SUBCOMMANDS: #{self.class.const_get(:ACTIONS).map(&:to_s).sort.join(' ')}")
53
- options.parser.separator('OPTIONS:')
54
+ options.parser.separator('OPTIONS:') if has_options
54
55
  end
55
56
 
56
57
  # @return a hash of instance variables
@@ -156,7 +157,7 @@ module Aspera
156
157
  when :create
157
158
  raise 'cannot create singleton' if is_singleton
158
159
  return do_bulk_operation(command: command, descr: 'data', fields: display_fields) do |params|
159
- rest_api.create(res_class_path, params)[:data]
160
+ rest_api.create(res_class_path, params)
160
161
  end
161
162
  when :delete
162
163
  raise 'cannot delete singleton' if is_singleton
@@ -171,9 +172,9 @@ module Aspera
171
172
  {'id' => one_id}
172
173
  end
173
174
  when :show
174
- return {type: :single_object, data: rest_api.read(one_res_path)[:data], fields: display_fields}
175
+ return {type: :single_object, data: rest_api.read(one_res_path), fields: display_fields}
175
176
  when :list
176
- resp = rest_api.read(res_class_path, query_read_delete)
177
+ resp = rest_api.call(operation: 'GET', subpath: res_class_path, headers: {'Accept' => 'application/json'}, query: query_read_delete)
177
178
  return Main.result_empty if resp[:http].code == '204'
178
179
  data = resp[:data]
179
180
  # TODO: not generic : which application is this for ?
@@ -214,7 +215,7 @@ module Aspera
214
215
  return entity_command(command, rest_api, res_class_path, **opts, &block)
215
216
  end
216
217
 
217
- # query parameters in URL suitable for REST list/GET and delete/DELETE
218
+ # query parameters in URL suitable for REST: list/GET and delete/DELETE
218
219
  def query_read_delete(default: nil)
219
220
  query = options.get_option(:query)
220
221
  # dup default, as it could be frozen
@@ -229,30 +230,15 @@ module Aspera
229
230
  return query
230
231
  end
231
232
 
232
- # TODO: when deprecation of `value` is completed: remove this method, replace with options.get_option(:query)
233
- # deprecation: 4.14
234
- def query_option(mandatory: false, default: nil)
235
- option = :value
236
- value = options.get_option(option, mandatory: false)
237
- if value.nil?
238
- option = :query
239
- value = options.get_option(option, mandatory: mandatory, default: default)
240
- end
241
- return value
242
- end
243
-
244
233
  # Retrieves an extended value from command line, used for creation or modification of entities
245
234
  # @param command [Symbol] command name for error message
246
235
  # @param type [Class] expected type of value, either a Class, an Array of Class
247
236
  # @param bulk [Boolean] if true, value must be an Array of <type>
248
237
  # @param default [Object] default value if not provided
249
- # TODO: when deprecation of `value` is completed: remove line with :value
250
238
  def value_create_modify(command:, description: nil, type: Hash, bulk: false, default: nil)
251
- value = options.get_option(:value)
252
- Log.log.warn("option `value` is deprecated. Use positional parameter for #{command}") unless value.nil?
253
239
  value = options.get_next_argument(
254
240
  "parameters for #{command}#{description.nil? ? '' : " (#{description})"}", mandatory: default.nil?,
255
- validation: bulk ? Array : type) if value.nil?
241
+ validation: bulk ? Array : type)
256
242
  value = default if value.nil?
257
243
  unless type.nil?
258
244
  type = [type] unless type.is_a?(Array)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'aspera/api/aoc'
3
+ require 'aspera/api/alee'
4
4
  require 'aspera/nagios'
5
5
 
6
6
  module Aspera
@@ -16,7 +16,7 @@ module Aspera
16
16
  nagios = Nagios.new
17
17
  begin
18
18
  api = Api::Alee.new(nil, nil, version: 'ping')
19
- result = api.call(operation: 'GET', subpath: '')
19
+ result = api.call(operation: 'GET')
20
20
  raise "unexpected response: #{result[:http].body}" unless result[:http].body.eql?('pong')
21
21
  nagios.add_ok('api', 'answered ok')
22
22
  rescue StandardError => e
@@ -27,7 +27,7 @@ module Aspera
27
27
  entitlement_id = options.get_option(:username, mandatory: true)
28
28
  customer_id = options.get_option(:password, mandatory: true)
29
29
  api_metering = Api::Alee.new(entitlement_id, customer_id)
30
- return {type: :single_object, data: api_metering.read('entitlement')[:data]}
30
+ return {type: :single_object, data: api_metering.read('entitlement')}
31
31
  end
32
32
  end
33
33
  end