Class: Aspera::Cli::Plugins::Httpgw

Inherits:
Base
  • Object
show all
Defined in:
lib/aspera/cli/plugins/httpgw.rb

Constant Summary

Constants inherited from Base

Base::FILTER_ARGS

Instance Attribute Summary

Attributes inherited from Base

#context, #help_path

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#action_for, #add_manual_header, application_name, #bulk_result, command, command_registry, commands_under, #config, crud_commands, declare_options, define_action_method, #dispatch_child, #dispatch_from_registry, #dispatch_leaf, #dispatch_mount, #entity_create, #entity_delete, #entity_list, #entity_modify, entity_noun, #entity_res_path, #entity_show, #execute_action, #execute_leaf, file_matcher, #formatter, #generate_help, #http_config, #initialize, #invoke_action, operation_description, option_sources, option_specs, #options, #persistency, #presets, #progress_bar, #query_read_delete, register_option_spec, #resolve_argument, #resolve_arguments, #transfer, use_options, used_option_sources, #validate_registry

Methods included from OptionDeclarator

#declare_options, #option, #option_specs, #register_option_spec

Constructor Details

This class inherits a constructor from Aspera::Cli::Plugins::Base

Class Method Details

.detect(base_url) ⇒ Hash, NilClass

Returns:



16
17
18
19
20
21
22
23
24
# File 'lib/aspera/cli/plugins/httpgw.rb', line 16

def detect(base_url)
  api = Api::Httpgw.new(url: base_url)
  api_info = api.info
  return {
    url:     api.base_url,
    version: api_info['version']
  } if api_info.is_a?(Hash) && api_info.key?('download_endpoint')
  return
end

Instance Method Details

#action_health ⇒ Object



46
47
48
49
50
51
52
53
54
55
# File 'lib/aspera/cli/plugins/httpgw.rb', line 46

def action_health(**)
  nagios = Nagios.new
  begin
    Api::Httpgw.new(url: options.get_option(:url, mandatory: true))
    nagios.add_ok('api', 'answered ok')
  rescue StandardError => e
    nagios.add_critical('api', e.to_s)
  end
  Result::ObjectList.new(nagios.status_list)
end

#wizard(wizard, app_url) ⇒ Hash

Returns :preset_value, :test_args.

Parameters:

  • wizard (Wizard) —

    The wizard object

  • app_url (String) —

    Tested URL

Returns:

  • (Hash) —

    :preset_value, :test_args



30
31
32
33
34
35
36
37
# File 'lib/aspera/cli/plugins/httpgw.rb', line 30

def wizard(wizard, app_url)
  return {
    preset_value: {
      url: app_url
    },
    test_args:    'info'
  }
end