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/load_balancers/nodes.rb
geemus d2e06e96ca [rackspace|loadbalancers] cleanup
pluralize service name
use multi_json
fix directory structure for consistency
2011-08-04 16:21:22 -05:00

29 lines
700 B
Ruby

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