From 627b36d2a53bff8189d616863352177b8001ab80 Mon Sep 17 00:00:00 2001 From: Jeremy Heffner Date: Thu, 27 Aug 2015 15:45:00 -0700 Subject: [PATCH] Adding method to get existing listeners --- lemur/plugins/lemur_aws/elb.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lemur/plugins/lemur_aws/elb.py b/lemur/plugins/lemur_aws/elb.py index b263d473..1b9226fb 100644 --- a/lemur/plugins/lemur_aws/elb.py +++ b/lemur/plugins/lemur_aws/elb.py @@ -138,3 +138,19 @@ def delete_listeners(account_number, region, name, ports): :return: """ return assume_service(account_number, 'elb', region).delete_load_balancer_listeners(name, ports) + + +def get_listeners(account_number, region, name): + """ + Gets the listeners configured on an elb and returns a array of tuples + + :param account_number: + :param region: + :param name: + :return: list of tuples + """ + + conn = assume_service(account_number, 'elb', region) + elbs = conn.get_all_load_balancers(load_balancer_names=[name]) + if elbs: + return elbs[0].listeners