Skip to content

Commit af217ab

Browse files
committed
Add CodeCommit::Repository to cfn package command
This commit adds the CodeCommitRepositoryS3Resource. This enables `aws cloudformation package` to work with the CodeCommit repository resource type
1 parent ca77732 commit af217ab

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

awscli/customizations/cloudformation/artifact_exporter.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,18 @@ class GlueJobCommandScriptLocationResource(Resource):
496496
# Note the PROPERTY_NAME includes a '.' implying it's nested.
497497
PROPERTY_NAME = "Command.ScriptLocation"
498498

499+
class CodeCommitRepositoryS3Resource(ResourceWithS3UrlDict):
500+
"""
501+
Represents CodeCommit::Repository resource.
502+
"""
503+
RESOURCE_TYPE = "AWS::CodeCommit::Repository"
504+
PROPERTY_NAME = "Code.S3"
505+
BUCKET_NAME_PROPERTY = "Bucket"
506+
OBJECT_KEY_PROPERTY = "Key"
507+
VERSION_PROPERTY = "ObjectVersion"
508+
# Don't package the directory if S3 is omitted.
509+
PACKAGE_NULL_PROPERTY = False
510+
FORCE_ZIP = True
499511

500512
RESOURCES_EXPORT_LIST = [
501513
ServerlessFunctionResource,
@@ -513,7 +525,8 @@ class GlueJobCommandScriptLocationResource(Resource):
513525
ServerlessLayerVersionResource,
514526
LambdaLayerVersionResource,
515527
GlueJobCommandScriptLocationResource,
516-
StepFunctionsStateMachineDefinitionResource
528+
StepFunctionsStateMachineDefinitionResource,
529+
CodeCommitRepositoryS3Resource
517530
]
518531

519532
METADATA_EXPORT_LIST = [

awscli/examples/cloudformation/_package_description.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ This command can upload local artifacts referenced in the following places:
2323
- ``TemplateURL`` property for the ``AWS::CloudFormation::Stack`` resource
2424
- ``Command.ScriptLocation`` property for the ``AWS::Glue::Job`` resource
2525
- ``DefinitionS3Location`` property for the ``AWS::StepFunctions::StateMachine`` resource
26+
- ``S3`` property for the ``AWS::CodeCommit::Repository`` resource
2627

2728

2829
To specify a local artifact in your template, specify a path to a local file or folder,

tests/unit/customizations/cloudformation/test_artifact_exporter.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
AppSyncFunctionConfigurationRequestTemplateResource, \
2929
AppSyncFunctionConfigurationResponseTemplateResource, \
3030
GlueJobCommandScriptLocationResource, \
31-
StepFunctionsStateMachineDefinitionResource
31+
StepFunctionsStateMachineDefinitionResource, \
32+
CodeCommitRepositoryS3Resource
3233

3334

3435
def test_is_s3_url():
@@ -158,6 +159,16 @@ def test_all_resources_export():
158159
"Bucket": "foo", "Key": "bar", "Version": "baz"
159160
}
160161
},
162+
{
163+
"class": CodeCommitRepositoryS3Resource,
164+
"expected_result": {
165+
"S3": {
166+
"Bucket": "foo",
167+
"Key": "bar",
168+
"ObjectVersion": "baz"
169+
}
170+
}
171+
},
161172
]
162173

163174
with patch("awscli.customizations.cloudformation.artifact_exporter.upload_local_artifacts") as upload_local_artifacts_mock:

0 commit comments

Comments
 (0)