use consistent quotes, 2 spaces per tab
This commit is contained in:
parent
c192fd2baf
commit
290ddd56ab
|
@ -36,44 +36,37 @@ import googleapiclient.errors
|
|||
|
||||
|
||||
def _configure_logging(verbose=True):
|
||||
"""Basic logging configuration.
|
||||
'''Basic logging configuration.
|
||||
Args:
|
||||
verbose: enable verbose logging
|
||||
"""
|
||||
'''
|
||||
level = logging.DEBUG if verbose else logging.INFO
|
||||
logging.basicConfig(level=level)
|
||||
warnings.filterwarnings('ignore', r'.*end user credentials.*', UserWarning)
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.option('--project', required=True,
|
||||
help='Project ID')
|
||||
@click.option('--bq-project', required=True,
|
||||
help='Bigquery project to use.')
|
||||
@click.option('--bq-dataset', required=True,
|
||||
help='Bigquery dataset to use.')
|
||||
@click.option('--bq-table', required=True,
|
||||
help='Bigquery table name to use.')
|
||||
@click.option('--read-time', required=False,
|
||||
help=('Day to take an asset snapshot in the format \'YYYYMMDD\'.'
|
||||
'If not specified run for the current day. Export will'
|
||||
'run for the midnight of the specified day.'))
|
||||
@click.option('--project', required=True, help='Project ID')
|
||||
@click.option('--bq-project', required=True, help='Bigquery project to use.')
|
||||
@click.option('--bq-dataset', required=True, help='Bigquery dataset to use.')
|
||||
@click.option('--bq-table', required=True, help='Bigquery table name to use.')
|
||||
@click.option('--read-time', required=False, help=(
|
||||
'Day to take an asset snapshot in \'YYYYMMDD\' format, uses current day '
|
||||
' as default. Export will run at midnight of the specified day.'))
|
||||
@click.option('--verbose', is_flag=True, help='Verbose output')
|
||||
def main_cli(project=None, bq_project=None, bq_dataset=None,
|
||||
bq_table=None, read_time=None, verbose=False):
|
||||
"""Trigger Cloud Asset inventory export to Bigquery. Data will
|
||||
be stored in the dataset specified on a dated table with the name
|
||||
specified.
|
||||
"""
|
||||
def main_cli(project=None, bq_project=None, bq_dataset=None, bq_table=None,
|
||||
read_time=None, verbose=False):
|
||||
'''Trigger Cloud Asset inventory export to Bigquery. Data will be stored in
|
||||
the dataset specified on a dated table with the name specified.
|
||||
'''
|
||||
try:
|
||||
_main(project, bq_project, bq_dataset,
|
||||
bq_table, read_time, verbose)
|
||||
_main(project, bq_project, bq_dataset, bq_table, read_time, verbose)
|
||||
except RuntimeError:
|
||||
logging.exception('exception raised')
|
||||
|
||||
|
||||
def main(event, context):
|
||||
"""Cloud Function entry point."""
|
||||
'Cloud Function entry point.'
|
||||
try:
|
||||
data = json.loads(base64.b64decode(event['data']).decode('utf-8'))
|
||||
print(data)
|
||||
|
@ -86,7 +79,7 @@ def main(event, context):
|
|||
|
||||
|
||||
def _main(project=None, bq_project=None, bq_dataset=None, bq_table=None, read_time=None, verbose=False):
|
||||
"""Module entry point used by cli and cloud function wrappers."""
|
||||
'Module entry point used by cli and cloud function wrappers.'
|
||||
|
||||
_configure_logging(verbose)
|
||||
if not read_time:
|
||||
|
|
Loading…
Reference in New Issue