Class: F5::Cli::VirtualServer
- Inherits:
-
Subcommand
- Object
- Thor
- Subcommand
- F5::Cli::VirtualServer
- Defined in:
- lib/f5/cli/application.rb
Instance Method Summary collapse
Instance Method Details
#list ⇒ Object
436 437 438 439 440 441 442 443 444 445 446 447 |
# File 'lib/f5/cli/application.rb', line 436 def list response = client.LocalLB.VirtualServer.get_list virtualservers = Array(response[:item]) if virtualservers.empty? puts "No virtual servers found" else virtualservers.each do |p| puts p end end end |
#show(vserver) ⇒ Object
450 451 452 453 454 455 456 457 |
# File 'lib/f5/cli/application.rb', line 450 def show(vserver) destination = extract_items client.LocalLB.VirtualServer.get_destination(virtual_servers: { item: [vserver] } ) protocol = extract_items client.LocalLB.VirtualServer.get_protocol(virtual_servers: { item: [vserver] } ) default_pool = extract_items client.LocalLB.VirtualServer.get_default_pool_name(virtual_servers: { item: [vserver] } ) puts "%-25s %-20s %-20s %-20s" % ["Destination Address", "Destination Port", "Protocol", "Default Pool"] puts "%-25s %-20s %-20s %-20s" % [destination[:address], destination[:port], protocol.split('_').last, default_pool] end |
#status(vserver) ⇒ Object
460 461 462 463 464 465 466 467 468 469 |
# File 'lib/f5/cli/application.rb', line 460 def status(vserver) response = client.LocalLB.VirtualServer.get_object_status(virtual_servers: { item: [vserver] } ) availability = response[:item][:availability_status].split('_').last enabled = response[:item][:enabled_status].split('_').last status_description = response[:item][:status_description] puts "%-40s %-20s %-20s %-20s" % ["Name", "Availability", "Enabled", "Status Description"] puts "%-40s %-20s %-20s %-20s" % [vserver, availability, enabled, status_description] end |