Module: Awspec::Helper::Finder::Eip

Included in:
Awspec::Helper::Finder
Defined in:
lib/awspec/helper/finder/eip.rb

Instance Method Summary collapse

Instance Method Details

#select_eip(id) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/awspec/helper/finder/eip.rb', line 13

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

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

#select_eip_by_instance_id(id) ⇒ Object



6
7
8
9
10
11
# File 'lib/awspec/helper/finder/eip.rb', line 6

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