Sha256: 5f84b8be356a5e3e29342cc2f2ea0fdc47a1e45088b51a3ef0e125b223b21be3

Contents?: true

Size: 1.36 KB

Versions: 7

Compression:

Stored size: 1.36 KB

Contents

require 'fog/core/collection'
require 'fog/compute/models/aws/image'

module Fog
  module Compute
    class AWS

      class Images < Fog::Collection

        attribute :filters

        model Fog::Compute::AWS::Image
        
        # Creates a new Amazon machine image
        #
        # AWS.images.new
        #
        # ==== Returns
        #
        # Returns the details of the new image
        #
        #>> AWS.images.new
        #  <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 = filters)
          self.filters = filters
          data = connection.describe_images(filters).body
          load(data['imagesSet'])
        end
        
        def get(image_id)
          if image_id
            self.class.new(:connection => connection).all('image-id' => image_id).first
          end
        end
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
brightbox-cli-0.13.1 lib/brightbox-cli/vendor/fog/lib/fog/compute/models/aws/images.rb
brightbox-cli-0.13.0 lib/brightbox-cli/vendor/fog/lib/fog/compute/models/aws/images.rb
fog-0.11.0 lib/fog/compute/models/aws/images.rb
fog-0.10.0 lib/fog/compute/models/aws/images.rb
fog4encbs-0.9.0.1 lib/fog/compute/models/aws/images.rb
fog4encbs-0.9.0 lib/fog/compute/models/aws/images.rb
fog-0.9.0 lib/fog/compute/models/aws/images.rb