2010-03-19 21:29:42 -04:00
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class Rackspace
|
2010-03-19 21:29:42 -04:00
|
|
|
class Real
|
2009-10-15 01:02:24 -04:00
|
|
|
|
2009-10-18 21:11:19 -04:00
|
|
|
# Get details about a server
|
2009-10-15 01:02:24 -04:00
|
|
|
#
|
2009-11-02 02:34:21 -05:00
|
|
|
# ==== Parameters
|
|
|
|
# * server_id<~Integer> - Id of server to get details for
|
|
|
|
#
|
2009-10-15 01:02:24 -04:00
|
|
|
# ==== Returns
|
2009-11-02 21:48:49 -05:00
|
|
|
# * response<~Excon::Response>:
|
2009-10-15 01:02:24 -04:00
|
|
|
# * body<~Hash>:
|
2009-10-18 21:11:19 -04:00
|
|
|
# * 'server'<~Hash>:
|
2009-10-15 01:02:24 -04:00
|
|
|
# * 'addresses'<~Hash>:
|
|
|
|
# * 'public'<~Array> - public address strings
|
|
|
|
# * 'private'<~Array> - private address strings
|
2009-10-18 21:11:19 -04:00
|
|
|
# * 'flavorId'<~Integer> - Id of servers current flavor
|
|
|
|
# * 'hostId'<~String>
|
|
|
|
# * 'id'<~Integer> - Id of server
|
|
|
|
# * 'imageId'<~Integer> - Id of image used to boot server
|
2009-10-15 01:02:24 -04:00
|
|
|
# * 'metadata'<~Hash> - metadata
|
2009-10-18 21:11:19 -04:00
|
|
|
# * 'name<~String> - Name of server
|
|
|
|
# * 'progress'<~Integer> - Progress through current status
|
|
|
|
# * 'status'<~String> - Current server status
|
2009-11-02 02:34:21 -05:00
|
|
|
def get_server_details(server_id)
|
2009-10-15 01:02:24 -04:00
|
|
|
request(
|
2009-11-10 12:37:47 -05:00
|
|
|
:expects => [200, 203],
|
2009-10-15 01:02:24 -04:00
|
|
|
:method => 'GET',
|
2009-11-02 02:34:21 -05:00
|
|
|
:path => "servers/#{server_id}.json"
|
2009-10-15 01:02:24 -04:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2010-03-19 21:29:42 -04:00
|
|
|
class Mock
|
2009-10-15 01:02:24 -04:00
|
|
|
|
2009-11-10 12:37:47 -05:00
|
|
|
def get_server_details(server_id)
|
2009-11-20 14:08:08 -05:00
|
|
|
response = Excon::Response.new
|
2010-10-13 16:20:18 -04:00
|
|
|
if server = list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
|
2009-11-10 12:37:47 -05:00
|
|
|
response.status = [200, 203][rand(1)]
|
|
|
|
response.body = { 'server' => server }
|
2010-05-31 11:37:26 -04:00
|
|
|
response
|
2009-11-10 12:37:47 -05:00
|
|
|
else
|
2011-06-16 19:28:54 -04:00
|
|
|
raise Fog::Compute::Rackspace::NotFound
|
2009-11-10 12:37:47 -05:00
|
|
|
end
|
2009-10-15 01:02:24 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|