INNER CODE UNIT · Python

main

HariSekhon/DevOps-Python-tools · gcp_cloud_function_sql_export/main.py:57

def main(event, context):
#    if os.getenv("DEBUG"):
#        # debug level logs don't appear in function details logs tab even with
#        # DEBUG=1 runtime env var set and logs severity filter set to >= DEBUG
#        #logging.debug('event: %s', event)
#        #logging.debug('context: %s', context)
#        logging.info('event: %s', event)
#        logging.info('context: %s', context)
    data = json.loads(base64.b64decode(event['data']).decode('utf-8'))
    credentials = GoogleCredentials.get_application_default()

    service = discovery.build('sqladmin', 'v1beta4', http=credentials.authorize(Http()), cache_discovery=False)

    project = data['project']
    bucket = data['bucket']
    bucket = bucket.lstrip('gs://')
    instance = data['instance']
    database = data['database']

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…