2014-12-30 17:25:09 -05:00
|
|
|
require 'fog/core/collection'
|
|
|
|
require 'fog/aws/models/compute/image'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
2015-01-02 12:34:40 -05:00
|
|
|
class AWS
|
2014-12-30 17:25:09 -05:00
|
|
|
class Images < Fog::Collection
|
|
|
|
attribute :filters
|
|
|
|
|
|
|
|
model Fog::Compute::AWS::Image
|
|
|
|
|
|
|
|
# Creates a new Amazon machine image
|
|
|
|
#
|
2015-01-02 12:34:40 -05:00
|
|
|
# AWS.images.new
|
2014-12-30 17:25:09 -05:00
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
#
|
|
|
|
# Returns the details of the new image
|
|
|
|
#
|
2015-01-02 12:34:40 -05:00
|
|
|
#>> AWS.images.new
|
2014-12-30 17:25:09 -05:00
|
|
|
# <Fog::AWS::Compute::Image
|
|
|
|
# id=nil,
|
|
|
|
# architecture=nil,
|
|
|
|
# block_device_mapping=nil,
|
|
|
|
# location=nil,
|
|
|
|
# owner_id=nil,
|
|
|
|
# state=nil,
|
|
|
|
# type=nil,
|
|
|
|
# is_public=nil,
|
|
|
|
# kernel_id=nil,
|
|
|
|
# platform=nil,
|
|
|
|
# product_codes=nil,
|
|
|
|
# ramdisk_id=nil,
|
|
|
|
# root_device_type=nil,
|
|
|
|
# root_device_name=nil,
|
|
|
|
# tags=nil
|
|
|
|
# >
|
|
|
|
#
|
|
|
|
|
|
|
|
def initialize(attributes)
|
|
|
|
self.filters ||= {}
|
|
|
|
super
|
|
|
|
end
|
|
|
|
|
|
|
|
def all(filters_arg = filters)
|
|
|
|
filters = filters_arg
|
|
|
|
data = service.describe_images(filters).body
|
|
|
|
load(data['imagesSet'])
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(image_id)
|
|
|
|
if image_id
|
|
|
|
self.class.new(:service => service).all('image-id' => image_id).first
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|