def handler()

in functions/source/ResourceReader/lambda.py [0:0]


def handler(event, context):
    logger.debug(event)
    status = SUCCESS
    pid = 'None'
    resp = {}
    reason = ''
    try:
        if event['RequestType'] != 'Delete':
            while not Path("/tmp/bin/aws").is_file():
                print("waiting for cli install to complete")
                sleep(10)
            resp = execute_cli(event['ResourceProperties'])
            if 'IdField' in event['ResourceProperties'] and isinstance(resp, dict):
                pid = resp[event['ResourceProperties']['IdField']]
            else:
                pid = str(resp)
    except Exception:
        logging.error('Unhandled exception', exc_info=True)
        reason = (str(e))
        status = FAILED
    finally:
        send(event, context, status, resp, pid, reason=reason)