2011-01-19 15:47:35 -05:00
|
|
|
module Fog
|
|
|
|
module Voxel
|
|
|
|
class Compute
|
|
|
|
class Real
|
|
|
|
def images_list( image_id = nil )
|
|
|
|
options = { :verbosity => 'compact' }
|
|
|
|
|
|
|
|
unless image_id.nil?
|
|
|
|
options[:verbosity] = 'extended'
|
|
|
|
options[:image_id] = image_id
|
|
|
|
end
|
|
|
|
|
2011-02-20 22:01:28 -05:00
|
|
|
data = request("voxel.images.list", options, Fog::Parsers::Voxel::Compute::ImagesList.new).body
|
2011-02-09 11:04:31 -05:00
|
|
|
|
2011-02-20 22:01:28 -05:00
|
|
|
if data[:stat] == "ok"
|
|
|
|
data[:images]
|
2011-02-09 11:04:31 -05:00
|
|
|
else
|
2011-02-20 14:39:37 -05:00
|
|
|
raise Fog::Voxel::Compute::NotFound
|
2011-02-09 11:04:31 -05:00
|
|
|
end
|
2011-01-19 15:47:35 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Mock
|
2011-02-09 11:04:31 -05:00
|
|
|
def images_list( image_id = nil )
|
|
|
|
if image_id.nil?
|
2011-02-20 14:39:37 -05:00
|
|
|
@data[:images]
|
2011-02-09 11:04:31 -05:00
|
|
|
else
|
2011-02-20 14:39:37 -05:00
|
|
|
selected = @data[:images].select { |i| i[:id] == image_id }
|
|
|
|
|
|
|
|
if selected.empty?
|
|
|
|
raise Fog::Voxel::Compute::NotFound
|
|
|
|
else
|
|
|
|
selected
|
|
|
|
end
|
2011-02-09 11:04:31 -05:00
|
|
|
end
|
2011-01-19 15:47:35 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|