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

38 lines
729 B
Ruby
Raw Normal View History

module Fog
module Rackspace
class Servers
def servers
Fog::Rackspace::Servers::Servers.new(:connection => self)
end
class Servers < Fog::Collection
model Fog::Rackspace::Servers::Server
def all
2010-01-05 01:03:24 -05:00
if @loaded
clear
end
@loaded = true
2009-11-04 00:46:27 -05:00
data = connection.list_servers_detail.body
for server in data['servers']
2010-01-05 01:03:24 -05:00
self << new(server)
end
2010-01-05 01:03:24 -05:00
self
end
def get(server_id)
if server = connection.get_server_details(server_id).body['server']
new(server)
end
rescue Excon::Errors::NotFound
nil
end
end
end
end
end