Sha256: 4b9f3c7ea3379f05a9970cea4d233648c03cb055ac53522c0efadf361c01b90e

Contents?: true

Size: 793 Bytes

Versions: 33

Compression:

Stored size: 793 Bytes

Contents

require 'fog/collection'
require 'fog/aws/models/ec2/image'

module Fog
  module AWS
    module EC2

      module Collections
        def images
          Fog::AWS::EC2::Images.new(:connection => self)
        end
      end

      class Images < Fog::Collection

        attribute :image_id

        model Fog::AWS::EC2::Image

        def initialize(attributes)
          @image_id ||= []
          super
        end

        def all(image_id = @image_id)
          @image_id = image_id
          data = connection.describe_images('ImageId' => image_id).body
          load(data['imagesSet'])
        end

        def get(image_id)
          if image_id
            all(image_id).first
          end
        rescue Fog::Errors::NotFound
          nil
        end
      end

    end
  end
end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
fog-0.2.30 lib/fog/aws/models/ec2/images.rb
fog-0.2.28 lib/fog/aws/models/ec2/images.rb
fog-0.2.27 lib/fog/aws/models/ec2/images.rb
fog-0.2.26 lib/fog/aws/models/ec2/images.rb
fog-0.2.25 lib/fog/aws/models/ec2/images.rb
fog-0.2.24 lib/fog/aws/models/ec2/images.rb
tecnh-fog-0.2.23.vpc lib/fog/aws/models/ec2/images.rb
fog-0.2.23 lib/fog/aws/models/ec2/images.rb
fog-0.2.22 lib/fog/aws/models/ec2/images.rb
fog-0.2.21 lib/fog/aws/models/ec2/images.rb
fog-0.2.20 lib/fog/aws/models/ec2/images.rb
fog-0.2.19 lib/fog/aws/models/ec2/images.rb
fog-0.2.18 lib/fog/aws/models/ec2/images.rb
fog-0.2.17 lib/fog/aws/models/ec2/images.rb
fog-0.2.16 lib/fog/aws/models/ec2/images.rb
fog-0.2.15 lib/fog/aws/models/ec2/images.rb
fog-0.2.14 lib/fog/aws/models/ec2/images.rb
fog-0.2.13 lib/fog/aws/models/ec2/images.rb
fog-0.2.12 lib/fog/aws/models/ec2/images.rb
fog-0.2.11 lib/fog/aws/models/ec2/images.rb