reboot/update servers first pass
This commit is contained in:
parent
1e27e61687
commit
7f09aec594
|
@ -0,0 +1,42 @@
|
|||
unless Fog.mocking?
|
||||
|
||||
module Fog
|
||||
module Rackspace
|
||||
class Servers
|
||||
|
||||
# Reboot an existing server
|
||||
#
|
||||
# ==== Parameters
|
||||
# * server_id<~Integer> - Id of server to reboot
|
||||
# * type<~String> - Type of reboot, must be in ['HARD', 'SOFT']
|
||||
#
|
||||
def reboot_server(server_id, type)
|
||||
data = {
|
||||
'reboot' => { 'type' => type }
|
||||
}
|
||||
request(
|
||||
:body => data.to_json,
|
||||
:expects => 202,
|
||||
:method => 'POST',
|
||||
:path => "servers/#{id}"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
module Fog
|
||||
module Rackspace
|
||||
class Servers
|
||||
|
||||
def update_server
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,40 @@
|
|||
unless Fog.mocking?
|
||||
|
||||
module Fog
|
||||
module Rackspace
|
||||
class Servers
|
||||
|
||||
# Update an existing server
|
||||
#
|
||||
# ==== Parameters
|
||||
# * options<~Hash>:
|
||||
# * name<~String> - New name for server
|
||||
# * adminPass<~String> - New admin password for server
|
||||
#
|
||||
def update_server(options = {})
|
||||
request(
|
||||
:body => options.to_json,
|
||||
:expects => 204,
|
||||
:method => 'PUT',
|
||||
:path => "servers/#{id}"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
module Fog
|
||||
module Rackspace
|
||||
class Servers
|
||||
|
||||
def update_server
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -15,6 +15,8 @@ module Fog
|
|||
load "fog/rackspace/requests/servers/list_images.rb"
|
||||
load "fog/rackspace/requests/servers/list_servers.rb"
|
||||
load "fog/rackspace/requests/servers/list_servers_details.rb"
|
||||
load "fog/rackspace/requests/servers/reboot_server.rb"
|
||||
load "fog/rackspace/requests/servers/update_server.rb"
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
|
|
Loading…
Reference in New Issue