Completed
Pull Request — master (#415)
by Anthony
02:06
created

GetBalancerByNameAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %
Metric Value
dl 0
loc 8
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 6 2
1
from lib import actions
2
3
__all__ = [
4
    'GetBalancerByNameAction',
5
]
6
7
8
class GetBalancerByNameAction(actions.BaseAction):
9
10
    def run(self, region, balancer_name):
11
        driver = self._get_lb_driver(region)
12
        balancers = driver.list_balancers()
13
        balancer = list(filter(lambda x: x.name == balancer_name,
14
                               balancers))[0]
15
        return self.resultsets.formatter(balancer)
16