in classic-load-balancer-consolelink-utility/consolelink_classic_load_balancer.py [0:0]
def main():
'''
Taking in args in main function
'''
parser = argparse.ArgumentParser(
description='Create a Console Link Spreadsheet for '
'Classic Load Balancers', usage='%(prog)s --region --format ')
parser.add_argument("--region", help="The region of the Classic Load Balancers "
"that you want to describe",required=True)
parser.add_argument("--format", help="The format of the output file that you "
"want to retrieve. Current "
"supported formats are CSV and HTML", required=True)
parser.add_argument("--debug", help="debug mode", action='store_true')
# if no options, print help
if len(sys.argv[1:]) == 0:
parser.print_help()
parser.exit()
args = parser.parse_args()
region = args.region
format = args.format.lower()
if format != 'csv' and format != 'html':
logger.error('Unsupported output format. The supported '
'formats are HTML and CSV')
parser.print_help()
parser.exit()
global debug
debug = args.debug
global client
session = botocore.session.get_session()
session.user_agent_name = 'CLBConsoleLink/' + VERSION
# Obtain Classic Load Balancer data
elb_data = get_elb_data(region)
if format == 'csv':
get_csv(elb_data)
if format == 'html':
get_html(elb_data)