1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/hp/models/lb/nodes.rb

27 lines
640 B
Ruby
Raw Normal View History

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
data = service.list_load_balancer_nodes(@attributes[:load_balancer_id]).body['nodes']
2013-03-01 14:26:52 -06:00
load(data)
self.each{ |x| x.load_balancer_id = @attributes[:load_balancer_id] }
2013-03-01 14:26:52 -06:00
end
def get(record_id)
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
end