Sha256: 877035e1eb11d5d222e9eeb5f339e65c1a3e9f76a3a4dec62baa275c55a51ede

Contents?: true

Size: 905 Bytes

Versions: 48

Compression:

Stored size: 905 Bytes

Contents

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

module Fog
  module AWS
    module EC2

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

      class Real
        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 Excon::Errors::BadRequest
          nil
        end
      end

    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
fog-0.1.3 lib/fog/aws/models/ec2/images.rb
fog-0.1.2 lib/fog/aws/models/ec2/images.rb
fog-0.1.1 lib/fog/aws/models/ec2/images.rb
fog-0.1.0 lib/fog/aws/models/ec2/images.rb
fog-0.0.100 lib/fog/aws/models/ec2/images.rb
fog-0.0.99 lib/fog/aws/models/ec2/images.rb
fog-0.0.98 lib/fog/aws/models/ec2/images.rb
fog-0.0.97 lib/fog/aws/models/ec2/images.rb
fog-0.0.96 lib/fog/aws/models/ec2/images.rb
fog-0.0.95 lib/fog/aws/models/ec2/images.rb
fog-0.0.94 lib/fog/aws/models/ec2/images.rb
fog-0.0.93 lib/fog/aws/models/ec2/images.rb
fog-0.0.92 lib/fog/aws/models/ec2/images.rb
fog-0.0.91 lib/fog/aws/models/ec2/images.rb
fog-0.0.90 lib/fog/aws/models/ec2/images.rb
fog-0.0.89 lib/fog/aws/models/ec2/images.rb
fog-0.0.88 lib/fog/aws/models/ec2/images.rb
fog-0.0.87 lib/fog/aws/models/ec2/images.rb
fog-0.0.86 lib/fog/aws/models/ec2/images.rb
fog-0.0.85 lib/fog/aws/models/ec2/images.rb