From d0bf26aaee87c69f437b897f77e3d6b731eb1246 Mon Sep 17 00:00:00 2001 From: Brandon John Lewis Date: Sat, 5 May 2018 01:04:09 -0400 Subject: [PATCH] add s3-endpoint-url argument to cloudformation package and deploy --- awscli/customizations/cloudformation/deploy.py | 13 ++++++++++++- awscli/customizations/cloudformation/package.py | 13 ++++++++++++- awscli/paramfile.py | 4 ++++ .../customizations/cloudformation/test_deploy.py | 1 + .../customizations/cloudformation/test_package.py | 1 + 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/awscli/customizations/cloudformation/deploy.py b/awscli/customizations/cloudformation/deploy.py index 3b944045ff3a..b2c4d98f6ee8 100644 --- a/awscli/customizations/cloudformation/deploy.py +++ b/awscli/customizations/cloudformation/deploy.py @@ -95,6 +95,16 @@ class DeployCommand(BasicCommand): ) }, + { + 'name': 's3-endpoint-url', + 'help_text': ( + 'URL of storage service where packaged templates and artifacts' + ' will be uploaded. Useful for testing and local development' + ' or when uploading to a non-AWS storage service that is' + ' nonetheless S3-compatible.' + ) + }, + { 'name': 'kms-key-id', 'help_text': ( @@ -276,7 +286,8 @@ def _run_main(self, parsed_args, parsed_globals): "s3", config=Config(signature_version='s3v4'), region_name=parsed_globals.region, - verify=parsed_globals.verify_ssl) + verify=parsed_globals.verify_ssl, + endpoint_url=parsed_args.s3_endpoint_url) s3_uploader = S3Uploader(s3_client, bucket, diff --git a/awscli/customizations/cloudformation/package.py b/awscli/customizations/cloudformation/package.py index 9bc7464d442e..d254dc99e4b2 100644 --- a/awscli/customizations/cloudformation/package.py +++ b/awscli/customizations/cloudformation/package.py @@ -74,6 +74,16 @@ class PackageCommand(BasicCommand): ) }, + { + 'name': 's3-endpoint-url', + 'help_text': ( + 'URL of storage service where packaged templates and artifacts' + ' will be uploaded. Useful for testing and local development' + ' or when uploading to a non-AWS storage service that is' + ' nonetheless S3-compatible.' + ) + }, + { 'name': 'kms-key-id', 'help_text': ( @@ -128,7 +138,8 @@ def _run_main(self, parsed_args, parsed_globals): "s3", config=Config(signature_version='s3v4'), region_name=parsed_globals.region, - verify=parsed_globals.verify_ssl) + verify=parsed_globals.verify_ssl, + endpoint_url=parsed_args.s3_endpoint_url) template_path = parsed_args.template_file if not os.path.isfile(template_path): diff --git a/awscli/paramfile.py b/awscli/paramfile.py index 2c91c010af36..684f6ec9f351 100644 --- a/awscli/paramfile.py +++ b/awscli/paramfile.py @@ -53,8 +53,12 @@ 'cloudformation.set-stack-policy.stack-policy-url', # aws cloudformation package --template-file 'custom.package.template-file', + # aws cloudformation package --s3-endpoint-url + 'custom.package.s3-endpoint-url', # aws cloudformation deploy --template-file 'custom.deploy.template-file', + # aws cloudformation deploy --s3-endpoint-url + 'custom.deploy.s3-endpoint-url', 'cloudformation.update-stack.stack-policy-during-update-url', # We will want to change the event name to ``s3`` as opposed to diff --git a/tests/unit/customizations/cloudformation/test_deploy.py b/tests/unit/customizations/cloudformation/test_deploy.py index f000cbe97921..5ef697edf770 100644 --- a/tests/unit/customizations/cloudformation/test_deploy.py +++ b/tests/unit/customizations/cloudformation/test_deploy.py @@ -60,6 +60,7 @@ def setUp(self): fail_on_empty_changeset=True, s3_bucket=None, s3_prefix="some prefix", + s3_endpoint_url="http://localhost", kms_key_id="some kms key id", force_upload=True, tags=["tagkey1=tagvalue1"]) diff --git a/tests/unit/customizations/cloudformation/test_package.py b/tests/unit/customizations/cloudformation/test_package.py index 4e8bfc025b55..d6a5f7bcef93 100644 --- a/tests/unit/customizations/cloudformation/test_package.py +++ b/tests/unit/customizations/cloudformation/test_package.py @@ -50,6 +50,7 @@ def setUp(self): self.parsed_args = FakeArgs(template_file='./foo', s3_bucket="s3bucket", s3_prefix="s3prefix", + s3_endpoint_url="http://localhost", kms_key_id="kmskeyid", output_template_file="./oputput", use_json=False,