"""Lambda aws_break_glass_home_page function module.""" from jinja2 import Environment from jinja2 import FileSystemLoader from lambdacommon.common_config import logger import sentry_sdk from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration import config sentry_sdk.init( dsn=config.SENTRY_DSN, integrations=[AwsLambdaIntegration()], traces_sample_rate=1.0, ) def handler(event, context): """Lambda entry point.""" logger.info('Break-Glass Home Page started') environment = Environment(loader=FileSystemLoader('src/templates/')) template = environment.get_template('index-template.html.j2') content = template.render(accounts=config.AWS_ACCOUNTS_MAPPING) return { 'statusCode': 200, 'statusDescription': '200 OK', 'isBase64Encoded': False, 'headers': { 'Content-Type': 'text/html' }, 'body': content }