Class: Aspera::Cli::Plugins::Httpgw
- Defined in:
- lib/aspera/cli/plugins/httpgw.rb
Constant Summary collapse
- ACTIONS =
i[health info].freeze
Constants inherited from Base
Base::ALL_OPS, Base::GLOBAL_OPS, Base::INSTANCE_OPS, Base::MAX_ITEMS, Base::MAX_PAGES, Base::REGEX_LOOKUP_ID_BY_FIELD
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #execute_action ⇒ Object
-
#initialize(**_) ⇒ Httpgw
constructor
A new instance of Httpgw.
-
#wizard(wizard, app_url) ⇒ Hash
:preset_value, :test_args.
Methods inherited from Base
#add_manual_header, #config, declare_options, #do_bulk_operation, #entity_execute, #formatter, #instance_identifier, #list_entities_limit_offset_total_count, #lookup_entity_by_field, #options, #persistency, #query_read_delete, #transfer, #value_create_modify
Constructor Details
#initialize(**_) ⇒ Httpgw
Returns a new instance of Httpgw.
41 42 43 44 45 |
# File 'lib/aspera/cli/plugins/httpgw.rb', line 41 def initialize(**_) super .declare(:url, 'URL of application, e.g. https://app.example.com/aspera/app') . end |
Class Method Details
.application_name ⇒ Object
13 14 15 |
# File 'lib/aspera/cli/plugins/httpgw.rb', line 13 def application_name 'HTTP Gateway' end |
.detect(base_url) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/aspera/cli/plugins/httpgw.rb', line 17 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
#execute_action ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/aspera/cli/plugins/httpgw.rb', line 47 def execute_action base_url = .get_option(:url, mandatory: true) command = .get_next_command(ACTIONS) case command when :health nagios = Nagios.new begin Api::Httpgw.new(url: base_url) nagios.add_ok('api', 'answered ok') rescue StandardError => e nagios.add_critical('api', e.to_s) end return nagios.result when :info api_v1 = Api::Httpgw.new(url: base_url) return Main.result_single_object(api_v1.info) end end |
#wizard(wizard, app_url) ⇒ Hash
Returns :preset_value, :test_args.
31 32 33 34 35 36 37 38 |
# File 'lib/aspera/cli/plugins/httpgw.rb', line 31 def wizard(wizard, app_url) return { preset_value: { url: app_url }, test_args: 'info' } end |