Sha256: 8b9751e0645f2e25415c04171d832fbdabbb9077c2c3578341ac725c39e827f9

Contents?: true

Size: 849 Bytes

Versions: 3

Compression:

Stored size: 849 Bytes

Contents

# frozen_string_literal: true

module Awspec::Helper
  module Finder
    module Eip
      def select_eip_by_instance_id(id)
        res = ec2_client.describe_addresses({
                                              filters: [{ name: 'instance-id', values: [id] }]
                                            })
        res.addresses
      end

      def select_eip(id)
        res = ec2_client.describe_addresses({
                                              filters: [{ name: 'public-ip', values: [id] }]
                                            })
        return res.addresses unless res.addresses.empty?

        res = ec2_client.describe_addresses({
                                              filters: [{ name: 'tag:Name', values: [id] }]
                                            })
        res.addresses
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
awspec-1.28.1 lib/awspec/helper/finder/eip.rb
awspec-1.28.0 lib/awspec/helper/finder/eip.rb
awspec-1.27.1 lib/awspec/helper/finder/eip.rb