Class: Warthog::CLI::Action::Show
- Inherits:
-
Object
- Object
- Warthog::CLI::Action::Show
- Defined in:
- lib/warthog/cli/action/show.rb
Constant Summary collapse
- COMPONENTS =
%w(service-group)
Instance Method Summary collapse
- #exec ⇒ Object
-
#initialize(arguments, options) ⇒ Show
constructor
A new instance of Show.
- #show_service_group(name = nil) ⇒ Object
Constructor Details
#initialize(arguments, options) ⇒ Show
Returns a new instance of Show.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/warthog/cli/action/show.rb', line 7 def initialize(arguments,) @options = @arguments = arguments @component = nil @subcomponent = nil opts = OptionParser.new opts. = "Usage: #{ID} [options] show <component> [arguments]" opts.separator "" opts.separator " <component> is service-group" opts.order!(@arguments) arguments_valid? process_arguments @show = { :service_group => self.method(:show_service_group) } end |
Instance Method Details
#exec ⇒ Object
29 30 31 32 |
# File 'lib/warthog/cli/action/show.rb', line 29 def exec @a10slb = Warthog::A10::AXDevice.new(@options[:hostname],@options[:username],get_password) @show[@component].call(@subcomponent) end |
#show_service_group(name = nil) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/warthog/cli/action/show.rb', line 34 def show_service_group(name=nil) if name.nil? printf "%s" % [@a10slb.slb_service_group_all] else printf "%s" % [@a10slb.slb_service_group_search(name)] end end |