lib/gaptool-api.rb in gaptool-api-0.6.4 vs lib/gaptool-api.rb in gaptool-api-0.6.5

- old
+ new

@@ -25,12 +25,12 @@ def getonenode(id) options = {:headers => @auth} JSON::parse self.class.get("/instance/#{id}", options) end - def getenvroles(role, environment) - options = {:headers => @auth} + def getenvroles(role, environment, params={}) + options = {:headers => @auth, :query => params} JSON::parse self.class.get("/hosts/#{role}/#{environment}", options) end def addnode(zone, itype, role, environment, mirror=nil, security_group=nil, ami=nil, chef_repo=nil, chef_branch=nil, chef_runlist=nil, @@ -62,32 +62,38 @@ @body = {'id' => id, 'zone' => zone || @default_aws_region}.to_json options = {:body => @body, :headers => @auth} JSON::parse self.class.post("/terminate", options) end - def getappnodes(app, environment) - options = {:headers => @auth} + def setparameters(instance, params) + @body = params.to_json + options = {:body => @body, :headers => @auth} + JSON::parse self.class.patch("/instance/#{instance}", options) + end + + def getappnodes(app, environment, params={}) + options = {:headers => @auth, :query => params} role = JSON::parse(self.class.get("/apps", options))["app:#{app}"]['role'] JSON::parse self.class.get("/hosts/#{role}/#{environment}", options) end def ssh(role, environment, id) options = { :headers => @auth} JSON::parse self.class.get("/ssh/#{role}/#{environment}/#{id}", options) end - def getrolenodes(role) - options = { :headers => @auth} + def getrolenodes(role, params={}) + options = {:headers => @auth, :query => params} JSON::parse self.class.get("/hosts/#{role}", options) end - def getenvnodes(environment) - options = { :headers => @auth} + def getenvnodes(environment, params={}) + options = {:headers => @auth, :query => params} JSON::parse self.class.get("/hosts/ALL/#{environment}", options) end - def getallnodes() - options = { :headers => @auth} + def getallnodes(params) + options = {:headers => @auth, :query => params} JSON::parse self.class.get("/hosts", options) end def api_version() options = { :headers => @auth }