Method: CloudLB::Node#populate

Defined in:
lib/cloudlb/node.rb

#populateObject Also known as: refresh

Updates the information about this CloudLB::Node object by making an API call.



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cloudlb/node.rb', line 25

def populate
  response = @connection.lbreq("GET",@lbmgmthost,"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@load_balancer.id.to_s)}/nodes/#{CloudLB.escape(@id.to_s)}",@lbmgmtport,@lbmgmtscheme)
  CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)
  data = JSON.parse(response.body)['node']
  @id                    = data["id"]
  @address                  = data["address"]
  @condition              = data["condition"]
  @port                  = data["port"]
  @weight             = data["weight"]
  @status                = data["status"]
  true
end