Class: BBGAPI::LB_Backends
- Inherits:
-
Object
- Object
- BBGAPI::LB_Backends
- Defined in:
- lib/bbgapi/lb_backends.rb
Class Method Summary collapse
- .add_from_bootstrap(serverid, lbid) ⇒ Object
- .list ⇒ Object
- .menulist ⇒ Object
- .raw ⇒ Object
- .recurse ⇒ Object
- .tbi ⇒ Object
Class Method Details
.add_from_bootstrap(serverid, lbid) ⇒ Object
66 67 68 69 |
# File 'lib/bbgapi/lb_backends.rb', line 66 def self.add_from_bootstrap(serverid,lbid) puts "Server ID:#{serverid}" puts "LB ID:#{lbid}" end |
.list ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/bbgapi/lb_backends.rb', line 39 def self.list begin cur_app = BBGAPI::LB_Applications.get_app cur_service = BBGAPI::LB_Services.get_service rescue self.recurse cur_app = BBGAPI::LB_Applications.get_app cur_service = BBGAPI::LB_Services.get_service end partial = "/api/lb_services/#{cur_service}/lb_backends" api_response = BBGAPI::Client.geturl(partial,"") api_response.each {|x| puts "\n" puts "Name: #{x["backend_name"]}" puts "ID: #{x["id"]}" puts "Alive Check: #{x["monitoring_url"]}" puts "Check Interval: #{x["check_interval"]}" nodes = x["lb_machines"].sort_by {|var| var["hostname"]} nodes.each {|y| puts "App: #{y["hostname"]}" } } puts "\n" end |
.menulist ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/bbgapi/lb_backends.rb', line 4 def self. choose do || puts "Load Balancer Backends" puts "----------------------------------------" .prompt = "Which Action?" .choices(:list) {self.list} .choices(:update) {self.tbi} .choices(:delete) {self.tbi} end end |
.raw ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/bbgapi/lb_backends.rb', line 71 def self.raw begin cur_app = BBGAPI::LB_Applications.get_app cur_service = BBGAPI::LB_Services.get_service rescue self.recurse cur_app = BBGAPI::LB_Applications.get_app cur_service = BBGAPI::LB_Services.get_service end partial = "/api/lb_services/#{cur_service}/lb_backends" api_response = BBGAPI::Client.geturl(partial,"") return api_response end |
.recurse ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/bbgapi/lb_backends.rb', line 15 def self.recurse apps = BBGAPI::LB_Applications.only_name_id choose do || .prompt = "Which Application?" apps.each {|k| .choices(k["name"]) { BBGAPI::LB_Applications.set_app(k["id"]) cur_app = k["id"] } } end services = BBGAPI::LB_Services.only_name_id choose do || .prompt = "Which Service?" services.each {|k| .choices(k["name"]) { BBGAPI::LB_Services.set_service(k["id"]) cur_service = k["id"] } } end end |
.tbi ⇒ Object
86 87 88 |
# File 'lib/bbgapi/lb_backends.rb', line 86 def self.tbi puts "This is not yet implemented" end |