diff --git a/core/cli.py b/core/cli.py index 114c081..b441b31 100644 --- a/core/cli.py +++ b/core/cli.py @@ -1,3 +1,4 @@ +import json import logging import boto3 @@ -121,11 +122,13 @@ def import_template( help="The namespace you wish to target (e.g. tpp-prod, tpp-dev, tpp-staging).", ) @click.option("--group-name", required=True, help="Name of the Quicksight User Group") +@click.option("--output-json", required=True, help="The file path to which operation output should be written as json") def publish_dashboard( aws_account_id: str, template_id: str, target_namespace: str, group_name: str, + output_json: str, ): """ Create/Update a dashboard from a template @@ -144,5 +147,9 @@ def publish_dashboard( ).execute() log.info(result) + with open(output_json, "w") as output: + output.write(json.dumps(result)) + logging.info(f"Output written to {output_json}") + cli.add_command(publish_dashboard)