Module: Awspec::Helper::Finder::Elb

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

Instance Method Summary collapse

Instance Method Details

#find_elb(id) ⇒ Object



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

def find_elb(id)
  res = @elb_client.describe_load_balancers({
                                              load_balancer_names: [id]
                                            })
  return res[:load_balancer_descriptions].first if res[:load_balancer_descriptions].count == 1
rescue
  return nil
end

#select_elb_by_vpc_id(vpc_id) ⇒ Object



13
14
15
16
17
18
# File 'lib/awspec/helper/finder/elb.rb', line 13

def select_elb_by_vpc_id(vpc_id)
  res = @elb_client.describe_load_balancers
  res[:load_balancer_descriptions].select do |lb|
    lb.vpc_id == vpc_id
  end
end