# File lib/fog/storm_on_demand/compute.rb, line 87 def initialize(options={}) uri = URI.parse(options[:storm_on_demand_auth_url] ||= API_URL) @connection_options = options[:connection_options] || {} @host = uri.host @path = uri.path @persistent = options[:persistent] || false @port = uri.port @scheme = uri.scheme @storm_on_demand_username = options[:storm_on_demand_username] @storm_on_demand_password = options[:storm_on_demand_password] @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end
# File lib/fog/storm_on_demand/requests/compute/add_balancer_node.rb, line 6 def add_balancer_node(options = {}) request( :path => "/network/loadbalancer/addnode", :body => Fog::JSON.encode({:params => options}) ) end
# File lib/fog/storm_on_demand/requests/compute/clone_server.rb, line 6 def clone_server(options = {}) request( :path => "/storm/server/clone", :body => Fog::JSON.encode({:params => options}) ) end
# File lib/fog/storm_on_demand/requests/compute/create_server.rb, line 6 def create_server(options = {}) request( :path => "/storm/server/create", :body => Fog::JSON.encode({:params => options}) ) end
# File lib/fog/storm_on_demand/requests/compute/delete_server.rb, line 6 def delete_server(options = {}) request( :path => "/storm/server/destroy", :body => Fog::JSON.encode({:params => options}) ) end
# File lib/fog/storm_on_demand/requests/compute/get_server.rb, line 6 def get_server(options = {}) request( :path => "/storm/server/details", :body => Fog::JSON.encode({:params => options}) ) end
# File lib/fog/storm_on_demand/requests/compute/get_stats.rb, line 6 def get_stats(options = {}) request( :path => "/monitoring/load/stats", :body => Fog::JSON.encode({:params => options}) ) end
# File lib/fog/storm_on_demand/requests/compute/list_balancers.rb, line 6 def list_balancers(options = {}) request( :path => "/network/loadbalancer/list", :body => Fog::JSON.encode(options) ) end
# File lib/fog/storm_on_demand/requests/compute/list_configs.rb, line 6 def list_configs(options = {}) request( :path => "/storm/config/list", :body => Fog::JSON.encode(options) ) end
# File lib/fog/storm_on_demand/requests/compute/list_images.rb, line 6 def list_images(options = {}) request( :path => "/server/image/list", :body => Fog::JSON.encode(options) ) end
# File lib/fog/storm_on_demand/requests/compute/list_private_ips.rb, line 6 def list_private_ips(options = {}) request( :path => "/network/private/get", :body => Fog::JSON.encode(options) ) end
# File lib/fog/storm_on_demand/requests/compute/list_servers.rb, line 6 def list_servers(options = {}) request( :path => "/storm/server/list", :body => Fog::JSON.encode(options) ) end
# File lib/fog/storm_on_demand/requests/compute/list_templates.rb, line 6 def list_templates(options = {}) request( :path => "/server/template/list", :body => Fog::JSON.encode(options) ) end
# File lib/fog/storm_on_demand/requests/compute/reboot_server.rb, line 6 def reboot_server(options = {}) request( :path => "/storm/server/reboot", :body => Fog::JSON.encode({:params => options}) ) end
# File lib/fog/storm_on_demand/compute.rb, line 100 def reload @connection.reset end
# File lib/fog/storm_on_demand/requests/compute/remove_balancer_node.rb, line 6 def remove_balancer_node(options = {}) request( :path => "/network/loadbalancer/removenode", :body => Fog::JSON.encode({:params => options}) ) end
# File lib/fog/storm_on_demand/compute.rb, line 104 def request(params) begin response = @connection.request(params.merge!({ :headers => { 'Content-Type' => 'application/json', 'Authorization' => 'Basic ' << Base64.encode64("#{@storm_on_demand_username}:#{@storm_on_demand_password}").chomp }.merge!(params[:headers] || {}), :host => @host, :path => "#{@path}/#{params[:path]}", :expects => 200, :method => :post })) rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::StormOnDemand::Compute::NotFound.slurp(error) else error end end unless response.body.empty? response.body = Fog::JSON.decode(response.body) end if response.body.has_key?('full_error') raise(Fog::Compute::StormOnDemand::Error, response.body.inspect) end response end
Generated with the Darkfish Rdoc Generator 2.