From 7f70e6a3168f2427b1b0e6212751bc462664174d Mon Sep 17 00:00:00 2001 From: Daniel Bernstein Date: Fri, 20 Oct 2023 12:08:04 -0700 Subject: [PATCH] Add output-json parameter to publish command for use by downstream processes. --- core/cli.py | 7 +++++++ 1 file changed, 7 insertions(+) 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)