Class: Emasser::System
- Inherits:
-
SubCommandBase
- Object
- Thor
- SubCommandBase
- Emasser::System
- Defined in:
- lib/emasser/get.rb
Overview
The Systems endpoints provide the ability to view system information.
Endpoint:
/api/systems - Get system information
/api/systems/{systemId} - Get system information for a specific system
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from SubCommandBase
Methods included from OutputConverters
Methods included from InputConverters
Methods included from OptionsParser
#optional_options, #required_options
Class Method Details
.exit_on_failure? ⇒ Boolean
57 58 59 |
# File 'lib/emasser/get.rb', line 57 def self.exit_on_failure? true end |
Instance Method Details
#byId ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/emasser/get.rb', line 103 def byId = (@_initializer).keys = to_input_hash(, ) # optional_options.merge!(Emasser::GET_SYSTEM_RETURN_TYPE) begin # Get system information matching provided parameters result = EmassClient::SystemsApi.new.get_system([:systemId], ) puts to_output_hash(result).green rescue EmassClient::ApiError => e puts 'Exception when calling SystemsApi->get_systems'.red puts to_output_hash(e) end end |
#id ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/emasser/get.rb', line 69 def id if [:system_name].nil? && [:system_owner].nil? raise ArgumentError, 'SYSTEM_NAME or SYSTEM_OWNER is required' end begin results = EmassClient::SystemsApi.new.get_systems.data results = filter_systems(results, [:system_name], [:system_owner]) results.each { |result| puts "#{result[:systemId]} - #{result[:systemOwner]} - #{result[:name]}" } rescue EmassClient::ApiError => e puts 'Exception when calling SystemsApi->get_systems' puts to_output_hash(e) end end |