Sha256: 9605fe93dab93a3dc74d75b5ad1d043a1aa1637a2b45851147fe62d7b44f46ae

Contents?: true

Size: 1.36 KB

Versions: 16

Compression:

Stored size: 1.36 KB

Contents

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

module Fog
  module AWS
    class Compute

      class Images < Fog::Collection

        attribute :filters

        model Fog::AWS::Compute::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

16 entries across 16 versions & 2 rubygems

Version Path
fog-0.8.2 lib/fog/compute/models/aws/images.rb
fog-0.8.1 lib/fog/compute/models/aws/images.rb
fog-0.8.0 lib/fog/compute/models/aws/images.rb
fog-0.7.2 lib/fog/compute/models/aws/images.rb
fog-0.7.1 lib/fog/compute/models/aws/images.rb
fog-0.7.0 lib/fog/compute/models/aws/images.rb
fog-0.6.0 lib/fog/compute/models/aws/images.rb
fog-0.5.3 lib/fog/compute/models/aws/images.rb
fog-0.5.2 lib/fog/compute/models/aws/images.rb
fog-0.5.1 lib/fog/compute/models/aws/images.rb
fog-0.5.0 lib/fog/compute/models/aws/images.rb
phpfog-fog-0.4.1.3 lib/fog/compute/models/aws/images.rb
phpfog-fog-0.4.1.2 lib/fog/compute/models/aws/images.rb
phpfog-fog-0.4.1.1 lib/fog/compute/models/aws/images.rb
phpfog-fog-0.4.1 lib/fog/compute/models/aws/images.rb
fog-0.4.1 lib/fog/compute/models/aws/images.rb