Sha256: 20dc459928fc785892c701b0b02eba9e418fad15e1c148a678447fbede90de75

Contents?: true

Size: 680 Bytes

Versions: 8

Compression:

Stored size: 680 Bytes

Contents

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

module Fog
  module AWS
    class Compute

      class Images < Fog::Collection

        attribute :image_id

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

8 entries across 8 versions & 1 rubygems

Version Path
fog-0.3.7 lib/fog/aws/models/compute/images.rb
fog-0.3.6 lib/fog/aws/models/compute/images.rb
fog-0.3.5 lib/fog/aws/models/compute/images.rb
fog-0.3.4 lib/fog/aws/models/compute/images.rb
fog-0.3.3 lib/fog/aws/models/compute/images.rb
fog-0.3.2 lib/fog/aws/models/compute/images.rb
fog-0.3.1 lib/fog/aws/models/compute/images.rb
fog-0.3.0 lib/fog/aws/models/compute/images.rb