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
|
|
|
|
|
2013-10-15 17:35:30 -04:00
|
|
|
attr_accessor :load_balancer
|
|
|
|
|
2013-03-01 14:26:52 -06:00
|
|
|
def all
|
2013-10-15 17:35:30 -04:00
|
|
|
requires :load_balancer
|
|
|
|
data = service.list_load_balancer_nodes(load_balancer.id).body['nodes']
|
2013-03-01 14:26:52 -06:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
2013-10-15 17:35:30 -04:00
|
|
|
def get(node_id)
|
|
|
|
requires :load_balancer
|
|
|
|
node = service.get_load_balancer_node(load_balancer.id, node_id).body
|
|
|
|
new(node)
|
2013-03-01 14:26:52 -06:00
|
|
|
rescue Fog::HP::LB::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2013-05-21 15:09:13 -06:00
|
|
|
end
|