2012-07-30 18:22:16 -04:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class RackspaceV2
|
|
|
|
class Real
|
2013-01-30 09:05:10 -06:00
|
|
|
|
|
|
|
# Reboots server
|
|
|
|
# @param [String] server_id
|
|
|
|
# @param [String<SOFT,HARD>] type type of reboot
|
2013-03-27 09:50:30 -05:00
|
|
|
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
|
|
|
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
|
|
|
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
|
|
|
# @raise [Fog::Rackspace::Errors::ServiceError]
|
2013-01-30 09:05:10 -06:00
|
|
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Reboot_Server-d1e3371.html
|
2012-07-30 18:22:16 -04:00
|
|
|
def reboot_server(server_id, type)
|
|
|
|
data = {
|
|
|
|
'reboot' => {
|
|
|
|
'type' => type
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
request(
|
|
|
|
:body => Fog::JSON.encode(data),
|
|
|
|
:expects => [202],
|
|
|
|
:method => 'POST',
|
|
|
|
:path => "servers/#{server_id}/action"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
2013-01-11 16:06:58 -05:00
|
|
|
|
|
|
|
class Mock
|
|
|
|
def reboot_server(server_id, type)
|
|
|
|
body = {
|
|
|
|
"reboot" => {
|
|
|
|
"type" => type.upcase
|
|
|
|
}
|
|
|
|
}
|
|
|
|
response(
|
|
|
|
:body => body,
|
|
|
|
:status => 202
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
2012-07-30 18:22:16 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|