def account_handler()

in functions/source/new_account_handler.py [0:0]


def account_handler(event, context):
    '''Lambda Handler'''

    result = False

    if event['RequestType'] == 'Create':
        fcontent = read_file(BUCKET_NAME, KEY_NAME)

        if fcontent:
            update_response = validate_update_dyno(fcontent, TABLE_NAME)

            if update_response:
                result = True

            if len(get_items('INVALID')) > 0:
                LOGGER.warning('INVALID Entries: %s', get_items('INVALID'))
    else:
        result = True

    if result is True:
        response = {}
        cfnresource.send(event, context, cfnresource.SUCCESS,
                         response, "CustomResourcePhysicalID")
    else:
        response = {"error": "Failed to load the data"}
        LOGGER.error(response)
        cfnresource.send(event, context, cfnresource.FAILED,
                         response, "CustomResourcePhysicalID")