Class: Fog::Compute::StormOnDemand::Real
- Inherits:
-
Object
- Object
- Fog::Compute::StormOnDemand::Real
- Defined in:
- lib/fog/compute/storm_on_demand.rb,
lib/fog/compute/requests/storm_on_demand/get_stats.rb,
lib/fog/compute/requests/storm_on_demand/get_server.rb,
lib/fog/compute/requests/storm_on_demand/list_images.rb,
lib/fog/compute/requests/storm_on_demand/clone_server.rb,
lib/fog/compute/requests/storm_on_demand/list_configs.rb,
lib/fog/compute/requests/storm_on_demand/list_servers.rb,
lib/fog/compute/requests/storm_on_demand/create_server.rb,
lib/fog/compute/requests/storm_on_demand/delete_server.rb,
lib/fog/compute/requests/storm_on_demand/reboot_server.rb,
lib/fog/compute/requests/storm_on_demand/resize_server.rb,
lib/fog/compute/requests/storm_on_demand/list_balancers.rb,
lib/fog/compute/requests/storm_on_demand/list_templates.rb,
lib/fog/compute/requests/storm_on_demand/list_private_ips.rb,
lib/fog/compute/requests/storm_on_demand/add_balancer_node.rb,
lib/fog/compute/requests/storm_on_demand/remove_balancer_node.rb
Instance Method Summary collapse
- #add_balancer_node(options = {}) ⇒ Object
- #clone_server(options = {}) ⇒ Object
- #create_server(options = {}) ⇒ Object
- #delete_server(options = {}) ⇒ Object
- #get_server(options = {}) ⇒ Object
- #get_stats(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
- #list_balancers(options = {}) ⇒ Object
- #list_configs(options = {}) ⇒ Object
- #list_images(options = {}) ⇒ Object
- #list_private_ips(options = {}) ⇒ Object
- #list_servers(options = {}) ⇒ Object
- #list_templates(options = {}) ⇒ Object
- #reboot_server(options = {}) ⇒ Object
- #reload ⇒ Object
- #remove_balancer_node(options = {}) ⇒ Object
- #request(params) ⇒ Object
- #resize_server(options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/fog/compute/storm_on_demand.rb', line 84 def initialize(={}) require 'multi_json' uri = URI.parse([:storm_on_demand_auth_url] ||= API_URL) @host = uri.host @path = uri.path @port = uri.port @scheme = uri.scheme @storm_on_demand_username = [:storm_on_demand_username] @storm_on_demand_password = [:storm_on_demand_password] @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}") end |
Instance Method Details
#add_balancer_node(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/add_balancer_node.rb', line 6 def add_balancer_node( = {}) request( :path => "/network/loadbalancer/addnode", :body => MultiJson.encode({:params => }) ) end |
#clone_server(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/clone_server.rb', line 6 def clone_server( = {}) request( :path => "/storm/server/clone", :body => MultiJson.encode({:params => }) ) end |
#create_server(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/create_server.rb', line 6 def create_server( = {}) request( :path => "/storm/server/create", :body => MultiJson.encode({:params => }) ) end |
#delete_server(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/delete_server.rb', line 6 def delete_server( = {}) request( :path => "/storm/server/destroy", :body => MultiJson.encode({:params => }) ) end |
#get_server(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/get_server.rb', line 6 def get_server( = {}) request( :path => "/storm/server/details", :body => MultiJson.encode({:params => }) ) end |
#get_stats(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/get_stats.rb', line 6 def get_stats( = {}) request( :path => "/monitoring/load/stats", :body => MultiJson.encode({:params => }) ) end |
#list_balancers(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/list_balancers.rb', line 6 def list_balancers( = {}) request( :path => "/network/loadbalancer/list", :body => MultiJson.encode() ) end |
#list_configs(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/list_configs.rb', line 6 def list_configs( = {}) request( :path => "/storm/config/list", :body => MultiJson.encode() ) end |
#list_images(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/list_images.rb', line 6 def list_images( = {}) request( :path => "/server/image/list", :body => MultiJson.encode() ) end |
#list_private_ips(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/list_private_ips.rb', line 6 def list_private_ips( = {}) request( :path => "/network/private/get", :body => MultiJson.encode() ) end |
#list_servers(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/list_servers.rb', line 6 def list_servers( = {}) request( :path => "/storm/server/list", :body => MultiJson.encode() ) end |
#list_templates(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/list_templates.rb', line 6 def list_templates( = {}) request( :path => "/server/template/list", :body => MultiJson.encode() ) end |
#reboot_server(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/reboot_server.rb', line 6 def reboot_server( = {}) request( :path => "/storm/server/reboot", :body => MultiJson.encode({:params => }) ) end |
#reload ⇒ Object
96 97 98 |
# File 'lib/fog/compute/storm_on_demand.rb', line 96 def reload @connection.reset end |
#remove_balancer_node(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/remove_balancer_node.rb', line 6 def remove_balancer_node( = {}) request( :path => "/network/loadbalancer/removenode", :body => MultiJson.encode({:params => }) ) end |
#request(params) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/fog/compute/storm_on_demand.rb', line 100 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 = MultiJson.decode(response.body) end if response.body.keys.include?('full_error') raise(Fog::Compute::StormOnDemand::Error, response.body.inspect) end response end |
#resize_server(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/compute/requests/storm_on_demand/resize_server.rb', line 6 def resize_server( = {}) request( :path => "/storm/server/resize", :body => MultiJson.encode({:params => }) ) end |