module Rackconnect::BulkNodes::InstanceMethods
Public Instance Methods
add_nodes(ids)
click to toggle source
# File lib/rackconnect/lib/bulk_nodes.rb, line 9 def add_nodes(ids) body = ids.inject({}) do |hash, id| h = {} h[key] = {id: id} h["server_group"] = {id: self.id} hash.merge(h) end.to_json path = self.class.instance_variable_get("@_endpoint") + "/nodes" # sorry resp = Rackconnect::Request.post(path, body: body) resp.body.map{ |obj| node_class.new(json: obj) } end
remove_nodes(ids)
click to toggle source
# File lib/rackconnect/lib/bulk_nodes.rb, line 22 def remove_nodes(ids) body = ids.inject({}) do |hash, id| hash.merge({ cloud_server: {id: id}, server_group: {id: self.id} }).to_json end path = self.class.instance_variable_get("@_endpoint") + "/nodes" # sorry Rackconnect::Request.delete(path) end