class Stingray::Pool

Attributes

monitors[RW]
name[RW]
nodes[RW]
note[RW]
pool[RW]
pool_hash[RW]
pools[RW]

Public Instance Methods

add_nodes_to_pool(node_arr) click to toggle source

add an array of nodes to the pool

# File lib/stingray/pools.rb, line 62
def add_nodes_to_pool(node_arr)
  current_nodes=nodes
  node_arr.map {|node| current_nodes << node unless current_nodes.include?(node)}
  nodes=current_nodes.uniq
end
create(name) click to toggle source

Create a new pool

# File lib/stingray/pools.rb, line 27
def create(name)
  @name=name
  @pool_hash=Map.new.set(:properties, :basic, :nodes,[])
end
delete_nodes_from_pool(node_arr) click to toggle source

delete an array of nodes from the pool

# File lib/stingray/pools.rb, line 69
def delete_nodes_from_pool(node_arr)
  current_nodes=nodes
  node_arr.map {|node| current_nodes.delete(node)if current_nodes.include?(node)}
  nodes=current_nodes.uniq
end
destroy() click to toggle source

Delete a pool.

# File lib/stingray/pools.rb, line 76
def destroy
  return false if @name.nil?
  delete_rest "pools/#{@name}"
  true
end
monitors=(monitor_arr) click to toggle source

monitors

# File lib/stingray/pools.rb, line 48
def monitors=(monitor_arr)
  @monitors=@pool_hash.properties.basic.monitors=monitor_arr
end
nodes=(node_arr) click to toggle source

set nodes

# File lib/stingray/pools.rb, line 38
def nodes=(node_arr)
  @pool_hash.properties.basic.nodes=node_arr
end
note=(note) click to toggle source
# File lib/stingray/pools.rb, line 57
def note=(note)
  @pool_hash.properties.basic.note=note
end
save() click to toggle source

Save the current pool.

# File lib/stingray/pools.rb, line 83
def save
  return false if @pool_hash.nil?
  put_rest "pools/#{@name}", @pool_hash.to_json, :content_type => "application/json"
  true
end