2009-10-15 01:03:16 -04:00
|
|
|
module Fog
|
|
|
|
module Rackspace
|
|
|
|
class Servers
|
|
|
|
|
|
|
|
def servers
|
|
|
|
Fog::Rackspace::Servers::Servers.new(:connection => self)
|
|
|
|
end
|
|
|
|
|
|
|
|
class Servers < Fog::Collection
|
|
|
|
|
2009-10-30 03:11:50 -04:00
|
|
|
model Fog::Rackspace::Servers::Server
|
2009-10-30 02:35:28 -04:00
|
|
|
|
2009-10-15 01:03:16 -04:00
|
|
|
def all
|
2010-03-06 23:02:10 -05:00
|
|
|
data = connection.list_servers_detail.body['servers']
|
|
|
|
load(data)
|
2009-10-15 01:03:16 -04:00
|
|
|
end
|
|
|
|
|
2009-11-15 23:05:59 -05:00
|
|
|
def get(server_id)
|
2010-01-13 01:00:49 -05:00
|
|
|
if server = connection.get_server_details(server_id).body['server']
|
|
|
|
new(server)
|
|
|
|
end
|
2009-11-08 15:16:52 -05:00
|
|
|
rescue Excon::Errors::NotFound
|
2009-10-15 01:03:16 -04:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|