2013-03-01 14:26:52 -06:00
|
|
|
require 'fog/core/collection'
|
2013-03-06 11:01:54 -06:00
|
|
|
require 'fog/hp/models/lb/node'
|
2013-03-01 14:26:52 -06:00
|
|
|
|
|
|
|
module Fog
|
|
|
|
module HP
|
|
|
|
class LB
|
|
|
|
class Nodes < Fog::Collection
|
|
|
|
model Fog::HP::LB::Node
|
|
|
|
|
|
|
|
def all
|
2013-05-21 15:09:13 -06:00
|
|
|
data = service.list_load_balancer_nodes(@attributes[:load_balancer_id]).body['nodes']
|
2013-03-01 14:26:52 -06:00
|
|
|
load(data)
|
2013-05-21 15:09:13 -06:00
|
|
|
self.each{ |x| x.load_balancer_id = @attributes[:load_balancer_id] }
|
2013-03-01 14:26:52 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
def get(record_id)
|
2013-05-21 15:09:13 -06:00
|
|
|
record = service.get_load_balancer_node(@attributes[:load_balancer_id], record_id).body['node']
|
2013-03-01 14:26:52 -06:00
|
|
|
new(record)
|
|
|
|
rescue Fog::HP::LB::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2013-05-21 15:09:13 -06:00
|
|
|
end
|