diff --git a/lib/fog/storm_on_demand/compute.rb b/lib/fog/storm_on_demand/compute.rb index 5a4fbefde..edbadd4b7 100644 --- a/lib/fog/storm_on_demand/compute.rb +++ b/lib/fog/storm_on_demand/compute.rb @@ -35,6 +35,11 @@ module Fog request :get_server request :create_server request :resize_server + request :server_history + request :shutdown_server + request :start_server + request :server_status + request :update_server request :remove_balancer_node request :add_balancer_node diff --git a/lib/fog/storm_on_demand/models/compute/server.rb b/lib/fog/storm_on_demand/models/compute/server.rb index 44db3208d..28a58cae5 100644 --- a/lib/fog/storm_on_demand/models/compute/server.rb +++ b/lib/fog/storm_on_demand/models/compute/server.rb @@ -8,6 +8,7 @@ module Fog identity :uniq_id attribute :accnt + attribute :active attribute :backup_enabled attribute :backup_plan attribute :backup_quota @@ -20,11 +21,10 @@ module Fog attribute :ip attribute :ip_count attribute :manage_level - attribute :subaccnt attribute :template attribute :template_description + attribute :type attribute :zone - attribute :active attr_writer :password @@ -32,11 +32,6 @@ module Fog super end - def create(options) - data = service.create_server(options).body['servers'] - load(data) - end - def destroy requires :identity service.delete_server(:uniq_id => identity) @@ -47,9 +42,9 @@ module Fog active == 1 end - def reboot + def reboot(options={}) requires :identity - service.reboot_server(:uniq_id => identity) + service.reboot_server({:uniq_id => identity}.merge!(options)) true end @@ -58,11 +53,40 @@ module Fog service.clone_server({:uniq_id => identity}.merge!(options)) true end + def resize(options) requires :identity service.resize_server({:uniq_id => identity}.merge!(options)) true end + + def history(options={}) + requires :identity + res = service.server_history({:uniq_id => identity}.merge!(options)) + res[:items] + end + + def shutdown(options={}) + requires :identity + service.shutdown_server({:uniq_id => identity}.merge!(options)) + end + + def start + reqwuires :identity + service.start_server({:uniq_id => identity}) + end + + def status + requires :identity + service.server_status({:uniq_id => identity}).body + end + + def update(options) + requires :identity + s = service.update_server({:uniq_id => identity}.merge!(options)) + load(s) + end + end end diff --git a/lib/fog/storm_on_demand/models/compute/servers.rb b/lib/fog/storm_on_demand/models/compute/servers.rb index 3418bec0f..2cca03223 100644 --- a/lib/fog/storm_on_demand/models/compute/servers.rb +++ b/lib/fog/storm_on_demand/models/compute/servers.rb @@ -9,8 +9,8 @@ module Fog model Fog::Compute::StormOnDemand::Server - def all - data = service.list_servers.body['items'] + def all(options={}) + data = service.list_servers(options).body['items'] load(data) end @@ -19,6 +19,11 @@ module Fog new(server) end + def create(options) + server = service.create_server(options).body + new(server) + end + end end diff --git a/lib/fog/storm_on_demand/requests/compute/clone_server.rb b/lib/fog/storm_on_demand/requests/compute/clone_server.rb index 891ce8332..7e0518462 100644 --- a/lib/fog/storm_on_demand/requests/compute/clone_server.rb +++ b/lib/fog/storm_on_demand/requests/compute/clone_server.rb @@ -5,7 +5,7 @@ module Fog def clone_server(options = {}) request( - :path => "/storm/server/clone", + :path => "/Storm/Server/clone", :body => Fog::JSON.encode({:params => options}) ) end diff --git a/lib/fog/storm_on_demand/requests/compute/create_server.rb b/lib/fog/storm_on_demand/requests/compute/create_server.rb index c7ee9c647..492d5a189 100644 --- a/lib/fog/storm_on_demand/requests/compute/create_server.rb +++ b/lib/fog/storm_on_demand/requests/compute/create_server.rb @@ -5,7 +5,7 @@ module Fog def create_server(options = {}) request( - :path => "/storm/server/create", + :path => "/Storm/Server/create", :body => Fog::JSON.encode({:params => options}) ) end diff --git a/lib/fog/storm_on_demand/requests/compute/delete_server.rb b/lib/fog/storm_on_demand/requests/compute/delete_server.rb index 9a4fc137f..1488a462c 100644 --- a/lib/fog/storm_on_demand/requests/compute/delete_server.rb +++ b/lib/fog/storm_on_demand/requests/compute/delete_server.rb @@ -5,7 +5,7 @@ module Fog def delete_server(options = {}) request( - :path => "/storm/server/destroy", + :path => "/Storm/Server/destroy", :body => Fog::JSON.encode({:params => options}) ) end diff --git a/lib/fog/storm_on_demand/requests/compute/get_server.rb b/lib/fog/storm_on_demand/requests/compute/get_server.rb index aab2fa16c..f464bfe64 100644 --- a/lib/fog/storm_on_demand/requests/compute/get_server.rb +++ b/lib/fog/storm_on_demand/requests/compute/get_server.rb @@ -5,7 +5,7 @@ module Fog def get_server(options = {}) request( - :path => "/storm/server/details", + :path => "/Storm/Server/details", :body => Fog::JSON.encode({:params => options}) ) end diff --git a/lib/fog/storm_on_demand/requests/compute/list_servers.rb b/lib/fog/storm_on_demand/requests/compute/list_servers.rb index 84181309b..275b50d02 100644 --- a/lib/fog/storm_on_demand/requests/compute/list_servers.rb +++ b/lib/fog/storm_on_demand/requests/compute/list_servers.rb @@ -5,8 +5,8 @@ module Fog def list_servers(options = {}) request( - :path => "/storm/server/list", - :body => Fog::JSON.encode(options) + :path => "/Storm/Server/list", + :body => Fog::JSON.encode(:params => options) ) end diff --git a/lib/fog/storm_on_demand/requests/compute/reboot_server.rb b/lib/fog/storm_on_demand/requests/compute/reboot_server.rb index a42c66d67..20ac20eda 100644 --- a/lib/fog/storm_on_demand/requests/compute/reboot_server.rb +++ b/lib/fog/storm_on_demand/requests/compute/reboot_server.rb @@ -5,7 +5,7 @@ module Fog def reboot_server(options = {}) request( - :path => "/storm/server/reboot", + :path => "/Storm/Server/reboot", :body => Fog::JSON.encode({:params => options}) ) end diff --git a/lib/fog/storm_on_demand/requests/compute/resize_server.rb b/lib/fog/storm_on_demand/requests/compute/resize_server.rb index 79d4243f8..23af497bf 100644 --- a/lib/fog/storm_on_demand/requests/compute/resize_server.rb +++ b/lib/fog/storm_on_demand/requests/compute/resize_server.rb @@ -5,7 +5,7 @@ module Fog def resize_server(options = {}) request( - :path => "/storm/server/resize", + :path => "/Storm/Server/resize", :body => Fog::JSON.encode({:params => options}) ) end diff --git a/lib/fog/storm_on_demand/requests/compute/server_history.rb b/lib/fog/storm_on_demand/requests/compute/server_history.rb new file mode 100644 index 000000000..79f8f3937 --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/server_history.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def server_history(options={}) + request( + :path => '/Storm/Server/history', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/server_status.rb b/lib/fog/storm_on_demand/requests/compute/server_status.rb new file mode 100644 index 000000000..2c8db69ca --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/server_status.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def server_status(options={}) + request( + :path => '/Storm/Server/status', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/shutdown_server.rb b/lib/fog/storm_on_demand/requests/compute/shutdown_server.rb new file mode 100644 index 000000000..ae2d675fe --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/shutdown_server.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def shutdown_server(options={}) + request( + :path => '/Storm/Server/shutdown', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/start_server.rb b/lib/fog/storm_on_demand/requests/compute/start_server.rb new file mode 100644 index 000000000..2c61475e1 --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/start_server.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def start_server(options={}) + request( + :path => '/Storm/Server/start', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/update_server.rb b/lib/fog/storm_on_demand/requests/compute/update_server.rb new file mode 100644 index 000000000..cc9dc7d6e --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/update_server.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def update_server(options={}) + request( + :path => '/Storm/Server/update', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end