in src/modules/get_azure_lb.py [0:0]
def get_load_balancers(self) -> list:
"""
Get the list of load balancers in a specific resource group.
:return: List of load balancers
:rtype: list
"""
try:
load_balancers = self.network_client.load_balancers.list_all()
return [
lb.as_dict()
for lb in load_balancers
if lb.location.lower() == self.module_params["region"].lower()
]
except Exception as ex:
self.handle_error(ex)
self.result["message"] += f" Failed to get load balancers. {ex} \n"