Sha256: 687dcb93e6af9849ec1b5489ff1fcc3e5f4d0e38d7fc0c2acf1e1f952a7dc872

Contents?: true

Size: 914 Bytes

Versions: 13

Compression:

Stored size: 914 Bytes

Contents

# frozen_string_literal: true

module Awspec::Helper
  module Finder
    module Ami
      def find_ami(image_id)
        res = ec2_client.describe_images({
                                           filters: [{ name: 'image-id', values: [image_id] }]
                                         })
        resource = res.images.single_resource(image_id)
        return resource if resource

        res = ec2_client.describe_images({
                                           filters: [{ name: 'name', values: [image_id] }]
                                         })
        resource = res.images.single_resource(image_id)
        return resource if resource

        res = ec2_client.describe_images({
                                           filters: [{ name: 'tag:Name', values: [image_id] }]
                                         })
        res.images.single_resource(image_id)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
awspec-1.31.0 lib/awspec/helper/finder/ami.rb
awspec-1.30.0 lib/awspec/helper/finder/ami.rb
awspec-1.29.3 lib/awspec/helper/finder/ami.rb
awspec-1.29.2 lib/awspec/helper/finder/ami.rb
awspec-1.29.1 lib/awspec/helper/finder/ami.rb
awspec-1.29.0 lib/awspec/helper/finder/ami.rb
awspec-1.28.2 lib/awspec/helper/finder/ami.rb
awspec-1.28.1 lib/awspec/helper/finder/ami.rb
awspec-1.28.0 lib/awspec/helper/finder/ami.rb
awspec-1.27.1 lib/awspec/helper/finder/ami.rb
awspec-1.27.0 lib/awspec/helper/finder/ami.rb
awspec-1.26.0 lib/awspec/helper/finder/ami.rb
awspec-1.25.2 lib/awspec/helper/finder/ami.rb