1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/rackspace/models/servers/servers.rb
2009-10-29 23:35:28 -07:00

37 lines
821 B
Ruby

module Fog
module Rackspace
class Servers
def servers
Fog::Rackspace::Servers::Servers.new(:connection => self)
end
class Servers < Fog::Collection
klass Fog::Rackspace::Servers::Server
def all
data = connection.list_servers_details.body
servers = Fog::Rackspace::Servers::Servers.new({
:connection => connection
})
for server in data['servers']
servers << Fog::Rackspace::Servers::Server.new({
:collection => servers,
:connection => connection
}.merge!(server))
end
servers
end
def get(id)
connection.get_server_details(id)
rescue Fog::Errors::NotFound
nil
end
end
end
end
end