def event_handler()

in cloudformation/mediapackage_speke_endpoint.py [0:0]


def event_handler(event, context):
    """
    Lambda entry point. Print the event first.
    """
    print("Event Input: %s" % json.dumps(event))
    try:
        mediapackage = boto3.client('mediapackage')
        if event["RequestType"] == "Create":
            result = create_endpoint(mediapackage, event, context)
        elif event["RequestType"] == "Update":
            result = common.update_endpoint(mediapackage, create_endpoint, event, context)
        elif event["RequestType"] == "Delete":
            result = common.delete_endpoint(mediapackage, event, context)
    except Exception as exp:
        print("Exception: %s" % exp)
        result = {'Status': 'FAILED', 'Data': {"Exception": str(exp)}, 'ResourceId': None}
    resource_tools.send(event, context, result['Status'], result['Data'], result['ResourceId'])
    return