Class: Aspera::Plugins::Alee::Commands

Inherits:
Cli::Plugins::Base show all
Includes:
Cli::Plugins::BasicAuth
Defined in:
lib/aspera/plugins/alee/commands.rb

Constant Summary

Constants inherited from Cli::Plugins::Base

Cli::Plugins::Base::FILTER_ARGS

Instance Attribute Summary

Attributes inherited from Cli::Plugins::Base

#context, #help_path

Instance Method Summary collapse

Methods included from Cli::Plugins::BasicAuth

#basic_auth_api, #basic_auth_params, included

Methods included from Cli::Option::Declarator

#declare_options, #option, #option_specs, #register_option_spec

Methods inherited from Cli::Plugins::Base

#action_for, application_name, #bulk_result, #check_argument_access, command, command_registry, commands_under, #config, #crud_api, 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, include_mounts, #initialize, #invoke_action, operation_description, option_sources, option_specs, #options, #persistency, #poll_result, #presets, #progress_bar, #query_read_delete, register_option_spec, #resolve_argument, #resolve_arguments, #transfer, use_options, used_option_sources, #validate_registry

Constructor Details

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

Instance Method Details

#action_entitlement ⇒ Object



34
35
36
37
38
39
# File 'lib/aspera/plugins/alee/commands.rb', line 34

def action_entitlement(**)
  Cli::Result::SingleObject.new(Api.new(
    options.get_option(:username, mandatory: true),
    options.get_option(:password, mandatory: true)
  ).read('entitlement'))
end

#action_health ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/aspera/plugins/alee/commands.rb', line 21

def action_health(**)
  nagios = Nagios.new
  begin
    api = Api.new(nil, nil, version: 'ping')
    http = api.read(nil, ret: :resp)
    Aspera.assert(http.body.eql?('pong')) { "unexpected response: #{http.body}" }
    nagios.add_ok('api', 'answered ok')
  rescue StandardError => e
    nagios.add_critical('api', e.to_s)
  end
  Cli::Result::ObjectList.new(nagios.status_list)
end