diff --git a/lib/fog/serverlove/requests/compute/reset_server.rb b/lib/fog/serverlove/requests/compute/reset_server.rb new file mode 100644 index 000000000..99b0de64d --- /dev/null +++ b/lib/fog/serverlove/requests/compute/reset_server.rb @@ -0,0 +1,13 @@ +module Fog + module Compute + class Serverlove + class Real + + def reset_server(server_id) + request(:method => "post", :path => "/servers/#{server_id}/reset", :expects => 204) + end + + end + end + end +end \ No newline at end of file diff --git a/lib/fog/serverlove/requests/compute/shutdown_server.rb b/lib/fog/serverlove/requests/compute/shutdown_server.rb new file mode 100644 index 000000000..ebc24893f --- /dev/null +++ b/lib/fog/serverlove/requests/compute/shutdown_server.rb @@ -0,0 +1,13 @@ +module Fog + module Compute + class Serverlove + class Real + + def shutdown_server(server_id) + request(:method => "post", :path => "/servers/#{server_id}/shutdown", :expects => 204) + end + + end + end + end +end \ No newline at end of file diff --git a/lib/fog/serverlove/requests/compute/start_server.rb b/lib/fog/serverlove/requests/compute/start_server.rb new file mode 100644 index 000000000..f0f4801ea --- /dev/null +++ b/lib/fog/serverlove/requests/compute/start_server.rb @@ -0,0 +1,13 @@ +module Fog + module Compute + class Serverlove + class Real + + def start_server(server_id) + request(:method => "post", :path => "/servers/#{server_id}/start", :expects => 204) + end + + end + end + end +end \ No newline at end of file diff --git a/lib/fog/serverlove/requests/compute/stop_server.rb b/lib/fog/serverlove/requests/compute/stop_server.rb new file mode 100644 index 000000000..2cc73b8e7 --- /dev/null +++ b/lib/fog/serverlove/requests/compute/stop_server.rb @@ -0,0 +1,13 @@ +module Fog + module Compute + class Serverlove + class Real + + def stop_server(server_id) + request(:method => "post", :path => "/servers/#{server_id}/stop", :expects => 204) + end + + end + end + end +end \ No newline at end of file diff --git a/tests/serverlove/requests/compute/server_tests.rb b/tests/serverlove/requests/compute/server_tests.rb index 56f963e6a..44ff4a6e8 100644 --- a/tests/serverlove/requests/compute/server_tests.rb +++ b/tests/serverlove/requests/compute/server_tests.rb @@ -13,7 +13,7 @@ Shindo.tests('Fog::Compute[:serverlove] | server requests', ['serverlove']) do tests('success') do - attributes = { 'name' => 'Test', 'cpu' => '1000' } + attributes = { 'name' => 'Test', 'cpu' => '1000', 'persistent' => 'true' } tests("#create_server").formats(@server_format) do @server = Fog::Compute[:serverlove].create_server(attributes).body @@ -28,7 +28,22 @@ Shindo.tests('Fog::Compute[:serverlove] | server requests', ['serverlove']) do Fog::Compute[:serverlove].update_server(@server['server'], { name: @server['name']}) Fog::Compute[:serverlove].servers.get(@server['server']).name == "Diff" end - + + tests("#start_server").succeeds do + Fog::Compute[:serverlove].start_server(@server['server']) + end + + tests("#reset_server").succeeds do + Fog::Compute[:serverlove].reset_server(@server['server']) + end + + tests("#shutdown_server").succeeds do + Fog::Compute[:serverlove].shutdown_server(@server['server']) + end + + tests("#stop_server").succeeds do + Fog::Compute[:serverlove].stop_server(@server['server']) + end tests("#destroy_server").succeeds do Fog::Compute[:serverlove].destroy_server(@server['server'])