2010-11-08 07:21:31 -05:00
|
|
|
require 'fog/core/collection'
|
2011-01-14 13:41:12 -05:00
|
|
|
require 'fog/compute/models/brightbox/server'
|
2010-11-08 07:21:31 -05:00
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Brightbox
|
|
|
|
class Compute
|
|
|
|
|
|
|
|
class Servers < Fog::Collection
|
|
|
|
|
|
|
|
model Fog::Brightbox::Compute::Server
|
|
|
|
|
|
|
|
def all
|
2010-11-09 12:40:04 -05:00
|
|
|
data = connection.list_servers
|
2010-11-08 07:21:31 -05:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(identifier)
|
|
|
|
return nil if identifier.nil? || identifier == ""
|
2010-11-09 12:40:04 -05:00
|
|
|
data = connection.get_server(identifier)
|
2010-11-08 07:21:31 -05:00
|
|
|
new(data)
|
|
|
|
rescue Excon::Errors::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|