Method: CloudLB::Balancer#populate
- Defined in:
- lib/cloudlb/balancer.rb
#populate ⇒ Object Also known as: refresh
Updates the information about the current Balancer object by making an API call.
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/cloudlb/balancer.rb', line 26 def populate response = @connection.lbreq("GET",@lbmgmthost,"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}",@lbmgmtport,@lbmgmtscheme) CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/) data = JSON.parse(response.body)['loadBalancer'] @id = data["id"] @name = data["name"] @protocol = data["protocol"] @port = data["port"] @algorithm = data["algorithm"] @connection_logging = data["connectionLogging"]["enabled"] @status = data["status"] true end |