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/aws/models/compute/images.rb

35 lines
671 B
Ruby
Raw Normal View History

2010-10-04 17:02:08 -04:00
require 'fog/core/collection'
2010-09-08 17:40:02 -04:00
require 'fog/aws/models/compute/image'
2010-03-16 18:46:21 -04:00
2010-01-10 16:35:20 -05:00
module Fog
module AWS
2010-09-08 17:40:02 -04:00
class Compute
2010-01-10 16:35:20 -05:00
class Images < Fog::Collection
attribute :filters
2010-01-10 16:35:20 -05:00
2010-09-08 17:40:02 -04:00
model Fog::AWS::Compute::Image
2010-01-10 16:35:20 -05:00
def initialize(attributes)
@filters ||= []
2010-01-10 16:35:20 -05:00
super
end
def all(filters = @filters)
@filters = filters
data = connection.describe_images(@filters).body
load(data['imagesSet'])
2010-01-10 16:35:20 -05:00
end
def get(image_id)
if image_id
self.class.new(:connection => connection).all('image-id' => image_id).first
2010-01-10 16:35:20 -05:00
end
end
end
end
end
end