Class: BBGAPI::Servers
- Inherits:
-
Object
- Object
- BBGAPI::Servers
- Defined in:
- lib/bbgapi/servers.rb
Class Method Summary collapse
Class Method Details
.fulllist ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/bbgapi/servers.rb', line 43 def self.fulllist partial = '/api/servers' api_response = BBGAPI::Client.geturl(partial,"") nodes = api_response.sort_by {|var| var["hostname"]} nodes.each {|x| puts "\n" puts "Name: #{x["hostname"]}" puts "ID: #{x["id"]}" puts "Description: #{x["description"]}" puts "IP: #{x["ips"].first["address"]}" puts "Status: #{x["status"]}" puts "CPU: #{x["cpu"]}" puts "Memory: #{x["memory"]}" puts "Storage: #{x["storage"]}" puts "Load Balancers:" x["lb_applications"].each {|y| puts y["lb_application_name"] } } puts "\n" end |
.list ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bbgapi/servers.rb', line 14 def self.list partial = '/api/servers' api_response = BBGAPI::Client.geturl(partial,"") nodes = api_response.sort_by {|var| var["hostname"]} nodes.each {|x| puts "\n" puts "Name: #{x["hostname"]}" puts "ID: #{x["id"]}" if not x["description"].to_s.empty? puts "Description: #{x["description"]}" end } puts "\n" choose do || .prompt = "Would you like to list extended information?" .choices(:yes) {self.fulllist} .choices(:no) end end |
.menulist ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/bbgapi/servers.rb', line 4 def self. choose do || puts "Servers" puts "----------------------------------------" .prompt = "Which Action?" .choices(:list) {self.list} end end |