Module: Awspec::Helper::Finder::Alb

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

Instance Method Summary collapse

Instance Method Details

#find_alb(id) ⇒ Object



4
5
6
7
8
9
# File 'lib/awspec/helper/finder/alb.rb', line 4

def find_alb(id)
  res = elbv2_client.describe_load_balancers({ names: [id] })
  res.load_balancers.single_resource(id)
rescue
  return nil
end

#select_alb_by_vpc_id(vpc_id) ⇒ Object



11
12
13
14
15
16
# File 'lib/awspec/helper/finder/alb.rb', line 11

def select_alb_by_vpc_id(vpc_id)
  res = elbv2_client.describe_load_balancers
  res.load_balancer_descriptions.select do |lb|
    lb.vpc_id == vpc_id
  end
end