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/rackspace/models/nodes.rb
2011-07-18 22:47:55 -04:00

33 lines
718 B
Ruby

require 'fog/core/collection'
require 'fog/rackspace/models/node'
module Fog
module Rackspace
class LoadBalancer
class Nodes < Fog::Collection
model Fog::Rackspace::LoadBalancer::Node
attr_accessor :load_balancer
def all
data = connection.list_nodes(load_balancer.id).body['nodes']
load(data)
end
def get(node_id)
if node = connection.get_node(load_balancer.id, node_id).body['node']
new(node)
end
rescue Fog::Rackspace::LoadBalancer::NotFound
nil
end
def to_object
collect do |node|
node.to_object
end
end
end
end
end
end