2011-01-19 15:47:35 -05:00
|
|
|
require 'fog/core/collection'
|
|
|
|
require 'fog/compute/models/voxel/image'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Voxel
|
|
|
|
class Compute
|
|
|
|
|
|
|
|
class Images < Fog::Collection
|
|
|
|
|
|
|
|
model Fog::Voxel::Compute::Image
|
|
|
|
|
|
|
|
def all
|
2011-02-23 15:00:56 -08:00
|
|
|
data = connection.images_list.body['images']
|
2011-01-19 15:47:35 -05:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(image_id)
|
2011-02-23 15:00:56 -08:00
|
|
|
data = connection.images_list(image_id).body['images']
|
2011-01-19 15:47:35 -05:00
|
|
|
|
2011-02-23 15:00:56 -08:00
|
|
|
if data.empty?
|
|
|
|
nil
|
|
|
|
else
|
|
|
|
new(data.first)
|
|
|
|
end
|
2011-02-09 11:04:31 -05:00
|
|
|
end
|
2011-01-19 15:47:35 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|