bigquery-jobs-notifier/gcf/main.py [27:52]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    aboveLimit, message = read_event_data(cloud_event)

    if aboveLimit:
        notify(message)

    return 'OK', 200

# See event_data.json for the format
def read_event_data(cloud_event):

    # Assume custom event by default
    event_data = cloud_event.data

    protoPayload = event_data['protoPayload']
    principalEmail = protoPayload['authenticationInfo']['principalEmail']
    job = protoPayload['serviceData']['jobCompletedEvent']['job']
    jobId = job['jobName']['jobId']
    jobStatistics = job['jobStatistics']
    createTime = jobStatistics['createTime']
    totalBilledBytes = 0
    if 'totalBilledBytes' in jobStatistics:
        totalBilledBytes = float(jobStatistics['totalBilledBytes'])
    query = job['jobConfiguration']['query']['query']
    aboveLimit = totalBilledBytes > 1000000000

    message = f"""
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



bigquery-jobs-notifier/run/app.py [38:63]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    aboveLimit, message = read_event_data(cloud_event)

    if aboveLimit:
        notify(message)

    return 'OK', 200

# See event_data.json for the format
def read_event_data(cloud_event):

    # Assume custom event by default
    event_data = cloud_event.data

    protoPayload = event_data['protoPayload']
    principalEmail = protoPayload['authenticationInfo']['principalEmail']
    job = protoPayload['serviceData']['jobCompletedEvent']['job']
    jobId = job['jobName']['jobId']
    jobStatistics = job['jobStatistics']
    createTime = jobStatistics['createTime']
    totalBilledBytes = 0
    if 'totalBilledBytes' in jobStatistics:
        totalBilledBytes = float(jobStatistics['totalBilledBytes'])
    query = job['jobConfiguration']['query']['query']
    aboveLimit = totalBilledBytes > 1000000000

    message = f"""
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



