def lambda_handler()

in retrieve_path_to_test/app.py [0:0]


def lambda_handler(event, context):

    currentRouteIndex = event['globalvars']['routedetails']['currentrouteindex']
    testBatchSize = event['globalvars']['routedetails']['testbatchsize']
    allRoutes = {}

    if(currentRouteIndex == 0):
        cloudFormationStackName = event['stackName']
        routeToTestOutputKey = event['routeToTestOutputKey']
        logging.info("stack name>> " + str(cloudFormationStackName))
        logging.info("route to test output key>> " + str(routeToTestOutputKey))

        if cloudFormationStackName and routeToTestOutputKey:
            try:
                cfnStack = cloudFormationClient.describe_stacks(
                    StackName=cloudFormationStackName
                )
            except botocore.exceptions.ClientError as error:
                logging.error("Call to describe_stacks failed")
                raise error

            stackDetails = cfnStack['Stacks'][0]
            try:
                allRoutes = json.loads(get_network_path_from_cfnoutput(
                    stackDetails,
                    routeToTestOutputKey
                ))
            except botocore.exceptions.ClientError as error:
                logging.error("Call to get_network_path_from_cfoutput failed")
                raise error

        else:
            logging.error(
                "The two parameters stackNames and routeToTestOutputKey are required")
            raise botocore.exceptions.ClientError

    else:
        allRoutes = event['globalvars']['routedetails']['allroutes']

    routeDetails = inflight_routes_to_test(
        allRoutes, currentRouteIndex, testBatchSize)

    return routeDetails