2010-10-11 02:16:40 -04:00
|
|
|
require 'fog/core/collection'
|
2011-08-24 21:27:03 -04:00
|
|
|
require 'fog/go_grid/models/compute/server'
|
2010-10-11 02:16:40 -04:00
|
|
|
|
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class GoGrid
|
2010-10-11 02:16:40 -04:00
|
|
|
|
|
|
|
class Servers < Fog::Collection
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
model Fog::Compute::GoGrid::Server
|
2010-10-11 02:16:40 -04:00
|
|
|
|
|
|
|
def all
|
2012-12-22 18:26:52 -05:00
|
|
|
data = service.grid_server_list.body['list']
|
2010-10-11 02:16:40 -04:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def bootstrap(new_attributes = {})
|
|
|
|
server = create(new_attributes)
|
|
|
|
server.wait_for { ready? }
|
2011-06-24 17:27:25 -04:00
|
|
|
server.setup
|
2010-10-11 02:16:40 -04:00
|
|
|
server
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(server_id)
|
2012-12-22 18:26:52 -05:00
|
|
|
if server_id && server = service.grid_server_get(server_id).body['list'].first
|
2010-10-11 02:16:40 -04:00
|
|
|
new(server)
|
|
|
|
end
|
2011-06-16 19:28:54 -04:00
|
|
|
rescue Fog::Compute::GoGrid::NotFound
|
2010-10-11 02:16:40 -04:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|