Class: Boxcutter::LoadBalancer::Backend
- Inherits:
-
Object
- Object
- Boxcutter::LoadBalancer::Backend
- Defined in:
- lib/boxcutter/load_balancer/backend.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
Instance Method Summary collapse
- #add_machine(machine_id, options = {}) ⇒ Object
- #id ⇒ Object
-
#initialize(api, attrs) ⇒ Backend
constructor
A new instance of Backend.
- #machines ⇒ Object
- #name ⇒ Object
- #remove_machine(machine_id) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(api, attrs) ⇒ Backend
Returns a new instance of Backend.
5 6 7 8 |
# File 'lib/boxcutter/load_balancer/backend.rb', line 5 def initialize(api, attrs) @api = api @attrs = attrs end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
3 4 5 |
# File 'lib/boxcutter/load_balancer/backend.rb', line 3 def api @api end |
Instance Method Details
#add_machine(machine_id, options = {}) ⇒ Object
30 31 32 |
# File 'lib/boxcutter/load_balancer/backend.rb', line 30 def add_machine(machine_id, = {}) api.create_machine(id, machine_id, ) end |
#id ⇒ Object
18 19 20 |
# File 'lib/boxcutter/load_balancer/backend.rb', line 18 def id @attrs["id"] end |
#machines ⇒ Object
22 23 24 |
# File 'lib/boxcutter/load_balancer/backend.rb', line 22 def machines api.machines(id).map {|attrs| Machine.new(self, api, attrs)} end |
#name ⇒ Object
14 15 16 |
# File 'lib/boxcutter/load_balancer/backend.rb', line 14 def name @attrs["backend_name"] end |
#remove_machine(machine_id) ⇒ Object
26 27 28 |
# File 'lib/boxcutter/load_balancer/backend.rb', line 26 def remove_machine(machine_id) api.delete_machine(id, machine_id) end |
#to_s ⇒ Object
10 11 12 |
# File 'lib/boxcutter/load_balancer/backend.rb', line 10 def to_s "#<Backend id:'#{id}' name:'#{name}'>" end |