From f8f8f79251144dd51666475d53344eebe82f7fe5 Mon Sep 17 00:00:00 2001 From: Eric Marden Date: Thu, 17 Jan 2019 13:21:46 -0600 Subject: [PATCH 1/2] patches artifact_exporter to support AWS::Type::AppSync::FunctionConfiguration --- .../cloudformation/artifact_exporter.py | 18 ++++++++++++++ .../cloudformation/test_artifact_exporter.py | 24 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/awscli/customizations/cloudformation/artifact_exporter.py b/awscli/customizations/cloudformation/artifact_exporter.py index a1e61bf27ee5..cba80c609aef 100644 --- a/awscli/customizations/cloudformation/artifact_exporter.py +++ b/awscli/customizations/cloudformation/artifact_exporter.py @@ -344,6 +344,22 @@ class AppSyncResolverResponseTemplateResource(Resource): PACKAGE_NULL_PROPERTY = False +class AppSyncFunctionConfigurationRequestTemplateResource(Resource): + RESOURCE_TYPE = "AWS::AppSync::FunctionConfiguration" + PROPERTY_NAME = "RequestMappingTemplateS3Location" + # Don't package the directory if RequestMappingTemplateS3Location is omitted. + # Necessary to support RequestMappingTemplate + PACKAGE_NULL_PROPERTY = False + + +class AppSyncFunctionConfigurationResponseTemplateResource(Resource): + RESOURCE_TYPE = "AWS::AppSync::FunctionConfiguration" + PROPERTY_NAME = "ResponseMappingTemplateS3Location" + # Don't package the directory if ResponseMappingTemplateS3Location is omitted. + # Necessary to support ResponseMappingTemplate + PACKAGE_NULL_PROPERTY = False + + class LambdaFunctionResource(ResourceWithS3UrlDict): RESOURCE_TYPE = "AWS::Lambda::Function" PROPERTY_NAME = "Code" @@ -462,6 +478,8 @@ class ServerlessApplicationResource(CloudFormationStackResource): GraphQLSchemaResource, AppSyncResolverRequestTemplateResource, AppSyncResolverResponseTemplateResource, + AppSyncFunctionConfigurationRequestTemplateResource, + AppSyncFunctionConfigurationResponseTemplateResource, ApiGatewayRestApiResource, LambdaFunctionResource, ElasticBeanstalkApplicationVersion, diff --git a/tests/unit/customizations/cloudformation/test_artifact_exporter.py b/tests/unit/customizations/cloudformation/test_artifact_exporter.py index e93d14575073..6b951c034b67 100644 --- a/tests/unit/customizations/cloudformation/test_artifact_exporter.py +++ b/tests/unit/customizations/cloudformation/test_artifact_exporter.py @@ -78,6 +78,26 @@ def test_all_resources_export(): "expected_result": uploaded_s3_url }, + { + "class": AppSyncResolverRequestTemplateResource, + "expected_result": uploaded_s3_url + }, + + { + "class": AppSyncResolverResponseTemplateResource, + "expected_result": uploaded_s3_url + }, + + { + "class": AppSyncFunctionConfigurationRequestTemplateResource, + "expected_result": uploaded_s3_url + }, + + { + "class": AppSyncFunctionConfigurationResponseTemplateResource, + "expected_result": uploaded_s3_url + }, + { "class": ApiGatewayRestApiResource, "expected_result": { @@ -112,6 +132,10 @@ def test_all_resources_export(): "class": ServerlessRepoApplicationReadme, "expected_result": uploaded_s3_url }, + { + "class": ServerlessRepoApplicationLicense, + "expected_result": uploaded_s3_url + }, { "class": ServerlessRepoApplicationLicense, "expected_result": uploaded_s3_url From 55f3effd3e6cd22d75c520db3ccd548383d36405 Mon Sep 17 00:00:00 2001 From: Eric Marden Date: Wed, 23 Jan 2019 16:43:29 -0600 Subject: [PATCH 2/2] import classes --- .../customizations/cloudformation/test_artifact_exporter.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/unit/customizations/cloudformation/test_artifact_exporter.py b/tests/unit/customizations/cloudformation/test_artifact_exporter.py index 6b951c034b67..8964b6c97056 100644 --- a/tests/unit/customizations/cloudformation/test_artifact_exporter.py +++ b/tests/unit/customizations/cloudformation/test_artifact_exporter.py @@ -22,7 +22,11 @@ ServerlessApplicationResource, LambdaLayerVersionResource, \ copy_to_temp_dir, include_transform_export_handler, GLOBAL_EXPORT_DICT, \ ServerlessLayerVersionResource, ServerlessRepoApplicationLicense, \ - ServerlessRepoApplicationReadme + ServerlessRepoApplicationReadme, \ + AppSyncResolverRequestTemplateResource, \ + AppSyncResolverResponseTemplateResource, \ + AppSyncFunctionConfigurationRequestTemplateResource, \ + AppSyncFunctionConfigurationResponseTemplateResource def test_is_s3_url():