diff --git a/samtranslator/__init__.py b/samtranslator/__init__.py index 82b6a36f8b..f43a2786d7 100644 --- a/samtranslator/__init__.py +++ b/samtranslator/__init__.py @@ -1 +1 @@ -__version__ = '1.13.1' +__version__ = '1.13.2' diff --git a/samtranslator/model/api/api_generator.py b/samtranslator/model/api/api_generator.py index 3a98ca29f3..9095ae8d09 100644 --- a/samtranslator/model/api/api_generator.py +++ b/samtranslator/model/api/api_generator.py @@ -193,7 +193,7 @@ def _construct_stage(self, deployment, swagger): stage.TracingEnabled = self.tracing_enabled if swagger is not None: - deployment.make_auto_deployable(stage, swagger) + deployment.make_auto_deployable(stage, self.open_api_version, swagger) return stage diff --git a/samtranslator/model/apigateway.py b/samtranslator/model/apigateway.py index 37347ebdc6..ab761811a5 100644 --- a/samtranslator/model/apigateway.py +++ b/samtranslator/model/apigateway.py @@ -61,6 +61,8 @@ class ApiGatewayAccount(Resource): class ApiGatewayDeployment(Resource): + _X_HASH_DELIMITER = "||" + resource_type = 'AWS::ApiGateway::Deployment' property_types = { 'Description': PropertyType(False, is_str()), @@ -73,9 +75,10 @@ class ApiGatewayDeployment(Resource): "deployment_id": lambda self: ref(self.logical_id), } - def make_auto_deployable(self, stage, swagger=None): + def make_auto_deployable(self, stage, openapi_version=None, swagger=None): """ - Sets up the resource such that it will triggers a re-deployment when Swagger changes + Sets up the resource such that it will trigger a re-deployment when Swagger changes + or the openapi version changes. :param swagger: Dictionary containing the Swagger definition of the API """ @@ -88,10 +91,15 @@ def make_auto_deployable(self, stage, swagger=None): # to prevent redeployment when API has not changed # NOTE: `str(swagger)` is for backwards compatibility. Changing it to a JSON or something will break compat - generator = logical_id_generator.LogicalIdGenerator(self.logical_id, str(swagger)) + hash_input = [str(swagger)] + if openapi_version: + hash_input.append(str(openapi_version)) + + data = self._X_HASH_DELIMITER.join(hash_input) + generator = logical_id_generator.LogicalIdGenerator(self.logical_id, data) self.logical_id = generator.gen() - hash = generator.get_hash(length=40) # Get the full hash - self.Description = "RestApi deployment id: {}".format(hash) + digest = generator.get_hash(length=40) # Get the full hash + self.Description = "RestApi deployment id: {}".format(digest) stage.update_deployment_ref(self.logical_id) diff --git a/tests/translator/output/api_request_model_openapi_3.json b/tests/translator/output/api_request_model_openapi_3.json index ce91e1aa79..a65d44b484 100644 --- a/tests/translator/output/api_request_model_openapi_3.json +++ b/tests/translator/output/api_request_model_openapi_3.json @@ -21,6 +21,15 @@ } } }, + "HtmlApiDeploymentefb667b26e": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "HtmlApi" + }, + "Description": "RestApi deployment id: efb667b26e8a0b0f733f5dfc27d039c1a2867db0" + } + }, "HtmlFunctionRole": { "Type": "AWS::IAM::Role", "Properties": { @@ -49,7 +58,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "HtmlApiDeployment47f78fe7d9" + "Ref": "HtmlApiDeploymentefb667b26e" }, "RestApiId": { "Ref": "HtmlApi" @@ -164,15 +173,6 @@ } } }, - "HtmlApiDeployment47f78fe7d9": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "HtmlApi" - }, - "Description": "RestApi deployment id: 47f78fe7d91eb5d2070674ad77943842c49dab89" - } - }, "HtmlFunctionGetHtmlPermissionTest": { "Type": "AWS::Lambda::Permission", "Properties": { diff --git a/tests/translator/output/api_with_auth_all_maximum_openapi_3.json b/tests/translator/output/api_with_auth_all_maximum_openapi_3.json index 1968c4ec00..33b914c849 100644 --- a/tests/translator/output/api_with_auth_all_maximum_openapi_3.json +++ b/tests/translator/output/api_with_auth_all_maximum_openapi_3.json @@ -104,6 +104,15 @@ } } }, + "MyApiDeployment7d5eb3f14f": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "MyApi" + }, + "Description": "RestApi deployment id: 7d5eb3f14f891b4276d48b764348b944dcaf2918" + } + }, "MyFunctionWithCognitoMultipleUserPoolsAuthorizerPermissionProd": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -453,20 +462,11 @@ } } }, - "MyApiDeployment18e0cddfbf": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "MyApi" - }, - "Description": "RestApi deployment id: 18e0cddfbf74ca986461d5a484b9eedd934a6423" - } - }, "MyApiProdStage": { "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "MyApiDeployment18e0cddfbf" + "Ref": "MyApiDeployment7d5eb3f14f" }, "RestApiId": { "Ref": "MyApi" diff --git a/tests/translator/output/api_with_auth_all_minimum_openapi.json b/tests/translator/output/api_with_auth_all_minimum_openapi.json index ba1b635ff5..1b77d6680e 100644 --- a/tests/translator/output/api_with_auth_all_minimum_openapi.json +++ b/tests/translator/output/api_with_auth_all_minimum_openapi.json @@ -58,7 +58,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "MyApiWithLambdaRequestAuthDeployment54a6335ed7" + "Ref": "MyApiWithLambdaRequestAuthDeployment14ab3ddf12" }, "RestApiId": { "Ref": "MyApiWithLambdaRequestAuth" @@ -131,13 +131,25 @@ } } }, - "MyApiWithLambdaTokenAuthDeployment2ac4484273": { - "Type": "AWS::ApiGateway::Deployment", + "MyFnCognitoPermissionTest": { + "Type": "AWS::Lambda::Permission", "Properties": { - "RestApiId": { - "Ref": "MyApiWithLambdaTokenAuth" + "Action": "lambda:invokeFunction", + "Principal": "apigateway.amazonaws.com", + "FunctionName": { + "Ref": "MyFn" }, - "Description": "RestApi deployment id: 2ac4484273f55c601b17c8491ffad73a979b2aeb" + "SourceArn": { + "Fn::Sub": [ + "arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${__ApiId__}/${__Stage__}/GET/cognito", + { + "__Stage__": "*", + "__ApiId__": { + "Ref": "MyApiWithCognitoAuth" + } + } + ] + } } }, "MyAuthFn": { @@ -163,15 +175,6 @@ ] } }, - "MyApiWithCognitoAuthDeployment2eadfec019": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "MyApiWithCognitoAuth" - }, - "Description": "RestApi deployment id: 2eadfec019d342cb7f6d66f595b9ab88e82fa00a" - } - }, "MyFnRole": { "Type": "AWS::IAM::Role", "Properties": { @@ -196,11 +199,20 @@ } } }, + "MyApiWithLambdaRequestAuthDeployment14ab3ddf12": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "MyApiWithLambdaRequestAuth" + }, + "Description": "RestApi deployment id: 14ab3ddf12ee76d46cac076ecffc24b3acd2fb7f" + } + }, "MyApiWithCognitoAuthProdStage": { "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "MyApiWithCognitoAuthDeployment2eadfec019" + "Ref": "MyApiWithCognitoAuthDeployment87cdbda651" }, "RestApiId": { "Ref": "MyApiWithCognitoAuth" @@ -229,36 +241,6 @@ } } }, - "MyApiWithLambdaRequestAuthDeployment54a6335ed7": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "MyApiWithLambdaRequestAuth" - }, - "Description": "RestApi deployment id: 54a6335ed76c2060eaf1fff2ff6522f20ecaef0f" - } - }, - "MyUserPool": { - "Type": "AWS::Cognito::UserPool", - "Properties": { - "UsernameAttributes": [ - "email" - ], - "UserPoolName": "UserPoolName", - "Policies": { - "PasswordPolicy": { - "MinimumLength": 8 - } - }, - "Schema": [ - { - "AttributeDataType": "String", - "Required": false, - "Name": "email" - } - ] - } - }, "MyApiWithLambdaRequestAuthMyLambdaRequestAuthAuthorizerPermission": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -383,25 +365,25 @@ } } }, - "MyFnCognitoPermissionTest": { - "Type": "AWS::Lambda::Permission", + "MyUserPool": { + "Type": "AWS::Cognito::UserPool", "Properties": { - "Action": "lambda:invokeFunction", - "Principal": "apigateway.amazonaws.com", - "FunctionName": { - "Ref": "MyFn" + "UsernameAttributes": [ + "email" + ], + "UserPoolName": "UserPoolName", + "Policies": { + "PasswordPolicy": { + "MinimumLength": 8 + } }, - "SourceArn": { - "Fn::Sub": [ - "arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${__ApiId__}/${__Stage__}/GET/cognito", - { - "__Stage__": "*", - "__ApiId__": { - "Ref": "MyApiWithCognitoAuth" - } - } - ] - } + "Schema": [ + { + "AttributeDataType": "String", + "Required": false, + "Name": "email" + } + ] } }, "MyFn": { @@ -455,7 +437,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "MyApiWithLambdaTokenAuthDeployment2ac4484273" + "Ref": "MyApiWithLambdaTokenAuthDeployment4fdb5f4e3c" }, "RestApiId": { "Ref": "MyApiWithLambdaTokenAuth" @@ -463,6 +445,15 @@ "StageName": "Prod" } }, + "MyApiWithCognitoAuthDeployment87cdbda651": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "MyApiWithCognitoAuth" + }, + "Description": "RestApi deployment id: 87cdbda651523df8d04d15fc50f72ae8ead08c1d" + } + }, "MyApiWithLambdaRequestAuth": { "Type": "AWS::ApiGateway::RestApi", "Properties": { @@ -522,6 +513,15 @@ } } } + }, + "MyApiWithLambdaTokenAuthDeployment4fdb5f4e3c": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "MyApiWithLambdaTokenAuth" + }, + "Description": "RestApi deployment id: 4fdb5f4e3c6e0e2b12af6d7a637ce66bb5bf7d0a" + } } } } \ No newline at end of file diff --git a/tests/translator/output/api_with_cors_openapi_3.json b/tests/translator/output/api_with_cors_openapi_3.json index 02d888397a..9a1658febc 100644 --- a/tests/translator/output/api_with_cors_openapi_3.json +++ b/tests/translator/output/api_with_cors_openapi_3.json @@ -253,7 +253,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ServerlessRestApiDeployment36174ded39" + "Ref": "ServerlessRestApiDeploymentf0997bcd64" }, "RestApiId": { "Ref": "ServerlessRestApi" @@ -265,7 +265,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ExplicitApiDeployment3a5a78688c" + "Ref": "ExplicitApiDeployment8cc53ffaa5" }, "RestApiId": { "Ref": "ExplicitApi" @@ -318,13 +318,22 @@ } } }, - "ExplicitApiDeployment3a5a78688c": { + "ExplicitApiDeployment8cc53ffaa5": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": { "Ref": "ExplicitApi" }, - "Description": "RestApi deployment id: 3a5a78688c9bc377d53aa4153a11f0c4f6e7364c" + "Description": "RestApi deployment id: 8cc53ffaa59a19b69e73d5b422142c7396739b16" + } + }, + "ServerlessRestApiDeploymentf0997bcd64": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ServerlessRestApi" + }, + "Description": "RestApi deployment id: f0997bcd645ceb1529586bc2b9faf855687b46ce" } }, "RestApiFunction": { @@ -350,15 +359,6 @@ ] } }, - "ServerlessRestApiDeployment36174ded39": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ServerlessRestApi" - }, - "Description": "RestApi deployment id: 36174ded3978092f96669107074db6caeaaafddd" - } - }, "ServerlessRestApi": { "Type": "AWS::ApiGateway::RestApi", "Properties": { diff --git a/tests/translator/output/api_with_gateway_responses_all_openapi_3.json b/tests/translator/output/api_with_gateway_responses_all_openapi_3.json index 357ad0e911..da03f6d536 100644 --- a/tests/translator/output/api_with_gateway_responses_all_openapi_3.json +++ b/tests/translator/output/api_with_gateway_responses_all_openapi_3.json @@ -23,15 +23,6 @@ ] } }, - "ExplicitApiDeployment47d77987a3": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ExplicitApi" - }, - "Description": "RestApi deployment id: 47d77987a3152a97c89d794f2682485b9dafde5d" - } - }, "FunctionRole": { "Type": "AWS::IAM::Role", "Properties": { @@ -56,6 +47,15 @@ } } }, + "ExplicitApiDeploymenta8fcf1dd74": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ExplicitApi" + }, + "Description": "RestApi deployment id: a8fcf1dd7480d58309d5673300f397de4f515e47" + } + }, "ExplicitApi": { "Type": "AWS::ApiGateway::RestApi", "Properties": { @@ -108,7 +108,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ExplicitApiDeployment47d77987a3" + "Ref": "ExplicitApiDeploymenta8fcf1dd74" }, "RestApiId": { "Ref": "ExplicitApi" diff --git a/tests/translator/output/api_with_open_api_version.json b/tests/translator/output/api_with_open_api_version.json index 1224c70597..98ad31b0fd 100644 --- a/tests/translator/output/api_with_open_api_version.json +++ b/tests/translator/output/api_with_open_api_version.json @@ -68,13 +68,13 @@ } } }, - "ExplicitApiDeployment01dd43a75f": { + "ServerlessRestApiDeployment83a174fb31": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": { - "Ref": "ExplicitApi" + "Ref": "ServerlessRestApi" }, - "Description": "RestApi deployment id: 01dd43a75fc0e125c678d20749bacde95d723928" + "Description": "RestApi deployment id: 83a174fb31472bc23ccc2f0d96eebff659e59cd2" } }, "ImplicitApiFunctionGetHtmlPermissionProd": { @@ -113,11 +113,20 @@ } } }, + "ExplicitApiDeploymentd9a0f2ae4f": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ExplicitApi" + }, + "Description": "RestApi deployment id: d9a0f2ae4fe2d97b9b91644934a878b6a08cf1c3" + } + }, "ServerlessRestApiProdStage": { "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ServerlessRestApiDeployment82c7b2e316" + "Ref": "ServerlessRestApiDeployment83a174fb31" }, "RestApiId": { "Ref": "ServerlessRestApi" @@ -129,7 +138,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ExplicitApiDeployment01dd43a75f" + "Ref": "ExplicitApiDeploymentd9a0f2ae4f" }, "RestApiId": { "Ref": "ExplicitApi" @@ -204,15 +213,6 @@ "openapi": "3.0.1" } } - }, - "ServerlessRestApiDeployment82c7b2e316": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ServerlessRestApi" - }, - "Description": "RestApi deployment id: 82c7b2e3162ebd01c9b3ccaa1fafa5cc1df94a68" - } } } -} +} \ No newline at end of file diff --git a/tests/translator/output/api_with_open_api_version_2.json b/tests/translator/output/api_with_open_api_version_2.json index ba6e1a5fbe..c3798099dd 100644 --- a/tests/translator/output/api_with_open_api_version_2.json +++ b/tests/translator/output/api_with_open_api_version_2.json @@ -104,20 +104,11 @@ } } }, - "ServerlessRestApiDeploymentb9bf7835be": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ServerlessRestApi" - }, - "Description": "RestApi deployment id: b9bf7835be8ea0cb2c188b846e03ff6f79f4d330" - } - }, "ExplicitApiProdStage": { "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ExplicitApiDeployment5332c373d4" + "Ref": "ExplicitApiDeployment4154e1c30c" }, "RestApiId": { "Ref": "ExplicitApi" @@ -129,7 +120,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ServerlessRestApiDeploymentb9bf7835be" + "Ref": "ServerlessRestApiDeployment32f05a472e" }, "RestApiId": { "Ref": "ServerlessRestApi" @@ -137,6 +128,15 @@ "StageName": "Prod" } }, + "ServerlessRestApiDeployment32f05a472e": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ServerlessRestApi" + }, + "Description": "RestApi deployment id: 32f05a472e885a4cf62d1ae534486511f6152624" + } + }, "ServerlessRestApi": { "Type": "AWS::ApiGateway::RestApi", "Properties": { @@ -205,13 +205,13 @@ } } }, - "ExplicitApiDeployment5332c373d4": { + "ExplicitApiDeployment4154e1c30c": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": { "Ref": "ExplicitApi" }, - "Description": "RestApi deployment id: 5332c373d45c69e6c0f562b4a419aa8eb311adc7" + "Description": "RestApi deployment id: 4154e1c30c97469d4946280461125dbfd4324f15" } } } diff --git a/tests/translator/output/api_with_openapi_definition_body_no_flag.json b/tests/translator/output/api_with_openapi_definition_body_no_flag.json index abc141ca3d..02ab6e4891 100644 --- a/tests/translator/output/api_with_openapi_definition_body_no_flag.json +++ b/tests/translator/output/api_with_openapi_definition_body_no_flag.json @@ -47,15 +47,6 @@ } } }, - "ExplicitApiDeployment9252467a1e": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ExplicitApi" - }, - "Description": "RestApi deployment id: 9252467a1edc49ba35cb258640f5e3734cc9fab1" - } - }, "ImplicitApiFunctionGetHtmlPermissionTest": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -77,6 +68,15 @@ } } }, + "ExplicitApiDeployment63a10e26af": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ExplicitApi" + }, + "Description": "RestApi deployment id: 63a10e26af7194aefd61ead891c470ed75ce20be" + } + }, "ExplicitApi": { "Type": "AWS::ApiGateway::RestApi", "Properties": { @@ -172,7 +172,7 @@ }, "CacheClusterEnabled": true, "DeploymentId": { - "Ref": "ExplicitApiDeployment9252467a1e" + "Ref": "ExplicitApiDeployment63a10e26af" } } }, diff --git a/tests/translator/output/aws-cn/api_request_model_openapi_3.json b/tests/translator/output/aws-cn/api_request_model_openapi_3.json index 63e5818f49..c5f80388f9 100644 --- a/tests/translator/output/aws-cn/api_request_model_openapi_3.json +++ b/tests/translator/output/aws-cn/api_request_model_openapi_3.json @@ -21,6 +21,15 @@ } } }, + "HtmlApiDeploymentbe02cbff83": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "HtmlApi" + }, + "Description": "RestApi deployment id: be02cbff831c2acb5672650bc54b204366bef429" + } + }, "HtmlFunctionRole": { "Type": "AWS::IAM::Role", "Properties": { @@ -49,7 +58,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "HtmlApiDeployment78cd64f7cb" + "Ref": "HtmlApiDeploymentbe02cbff83" }, "RestApiId": { "Ref": "HtmlApi" @@ -172,15 +181,6 @@ } } }, - "HtmlApiDeployment78cd64f7cb": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "HtmlApi" - }, - "Description": "RestApi deployment id: 78cd64f7cb1e91b0fda215267bac0aac70b20b1b" - } - }, "HtmlFunctionGetHtmlPermissionTest": { "Type": "AWS::Lambda::Permission", "Properties": { diff --git a/tests/translator/output/aws-cn/api_with_auth_all_maximum_openapi_3.json b/tests/translator/output/aws-cn/api_with_auth_all_maximum_openapi_3.json index de778924c6..669c8a73ea 100644 --- a/tests/translator/output/aws-cn/api_with_auth_all_maximum_openapi_3.json +++ b/tests/translator/output/aws-cn/api_with_auth_all_maximum_openapi_3.json @@ -422,15 +422,6 @@ } } }, - "MyApiDeploymentbaa112a5f1": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "MyApi" - }, - "Description": "RestApi deployment id: baa112a5f13c2489dbb3bde338d974cf87541b01" - } - }, "MyFunctionWithCognitoMultipleUserPoolsAuthorizerPermissionTest": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -470,11 +461,20 @@ } } }, + "MyApiDeployment046c8986a5": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "MyApi" + }, + "Description": "RestApi deployment id: 046c8986a58a325ce5b92a3fe24ea15bef68aced" + } + }, "MyApiProdStage": { "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "MyApiDeploymentbaa112a5f1" + "Ref": "MyApiDeployment046c8986a5" }, "RestApiId": { "Ref": "MyApi" diff --git a/tests/translator/output/aws-cn/api_with_auth_all_minimum_openapi.json b/tests/translator/output/aws-cn/api_with_auth_all_minimum_openapi.json index a7abb6fded..33e5d53432 100644 --- a/tests/translator/output/aws-cn/api_with_auth_all_minimum_openapi.json +++ b/tests/translator/output/aws-cn/api_with_auth_all_minimum_openapi.json @@ -62,11 +62,20 @@ } } }, + "MyApiWithCognitoAuthDeployment1ecccf8f28": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "MyApiWithCognitoAuth" + }, + "Description": "RestApi deployment id: 1ecccf8f2823a4777fc271569a1688db777f1302" + } + }, "MyApiWithLambdaRequestAuthProdStage": { "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "MyApiWithLambdaRequestAuthDeploymentf8f280f2eb" + "Ref": "MyApiWithLambdaRequestAuthDeployment81b8e9784c" }, "RestApiId": { "Ref": "MyApiWithLambdaRequestAuth" @@ -97,15 +106,6 @@ } } }, - "MyApiWithLambdaRequestAuthDeploymentf8f280f2eb": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "MyApiWithLambdaRequestAuth" - }, - "Description": "RestApi deployment id: f8f280f2eb973eb694b872901c9395c3d3e05252" - } - }, "MyFnLambdaRequestPermissionTest": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -220,7 +220,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "MyApiWithCognitoAuthDeploymente116f8541f" + "Ref": "MyApiWithCognitoAuthDeployment1ecccf8f28" }, "RestApiId": { "Ref": "MyApiWithCognitoAuth" @@ -228,50 +228,68 @@ "StageName": "Prod" } }, - "MyFnCognitoPermissionProd": { + "MyApiWithLambdaRequestAuthMyLambdaRequestAuthAuthorizerPermission": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:invokeFunction", "Principal": "apigateway.amazonaws.com", "FunctionName": { - "Ref": "MyFn" + "Fn::GetAtt": [ + "MyAuthFn", + "Arn" + ] }, "SourceArn": { "Fn::Sub": [ - "arn:aws-cn:execute-api:${AWS::Region}:${AWS::AccountId}:${__ApiId__}/${__Stage__}/GET/cognito", + "arn:aws-cn:execute-api:${AWS::Region}:${AWS::AccountId}:${__ApiId__}/authorizers/*", { - "__Stage__": "Prod", "__ApiId__": { - "Ref": "MyApiWithCognitoAuth" + "Ref": "MyApiWithLambdaRequestAuth" } } ] } } }, - "MyApiWithLambdaRequestAuthMyLambdaRequestAuthAuthorizerPermission": { + "MyFnCognitoPermissionProd": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:invokeFunction", "Principal": "apigateway.amazonaws.com", "FunctionName": { - "Fn::GetAtt": [ - "MyAuthFn", - "Arn" - ] + "Ref": "MyFn" }, "SourceArn": { "Fn::Sub": [ - "arn:aws-cn:execute-api:${AWS::Region}:${AWS::AccountId}:${__ApiId__}/authorizers/*", + "arn:aws-cn:execute-api:${AWS::Region}:${AWS::AccountId}:${__ApiId__}/${__Stage__}/GET/cognito", { + "__Stage__": "Prod", "__ApiId__": { - "Ref": "MyApiWithLambdaRequestAuth" + "Ref": "MyApiWithCognitoAuth" } } ] } } }, + "MyApiWithLambdaRequestAuthDeployment81b8e9784c": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "MyApiWithLambdaRequestAuth" + }, + "Description": "RestApi deployment id: 81b8e9784c9a74f2875713fd92384bb67e756f82" + } + }, + "MyApiWithLambdaTokenAuthDeployment53baac2c0b": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "MyApiWithLambdaTokenAuth" + }, + "Description": "RestApi deployment id: 53baac2c0b5f582d951d933f66c102f8f467770b" + } + }, "MyFnLambdaTokenPermissionProd": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -381,15 +399,6 @@ } } }, - "MyApiWithLambdaTokenAuthDeploymentae2752e462": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "MyApiWithLambdaTokenAuth" - }, - "Description": "RestApi deployment id: ae2752e46261b6dac7c962a6a65154ea5189f594" - } - }, "MyUserPool": { "Type": "AWS::Cognito::UserPool", "Properties": { @@ -462,7 +471,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "MyApiWithLambdaTokenAuthDeploymentae2752e462" + "Ref": "MyApiWithLambdaTokenAuthDeployment53baac2c0b" }, "RestApiId": { "Ref": "MyApiWithLambdaTokenAuth" @@ -537,15 +546,6 @@ "endpointConfigurationTypes": "REGIONAL" } } - }, - "MyApiWithCognitoAuthDeploymente116f8541f": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "MyApiWithCognitoAuth" - }, - "Description": "RestApi deployment id: e116f8541f950bade71c8656c6a8493fd823d35c" - } } } } \ No newline at end of file diff --git a/tests/translator/output/aws-cn/api_with_cors_openapi_3.json b/tests/translator/output/aws-cn/api_with_cors_openapi_3.json index 77acdd9cde..6c2a897e00 100644 --- a/tests/translator/output/aws-cn/api_with_cors_openapi_3.json +++ b/tests/translator/output/aws-cn/api_with_cors_openapi_3.json @@ -47,6 +47,15 @@ } } }, + "ServerlessRestApiDeployment5a1885dc4a": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ServerlessRestApi" + }, + "Description": "RestApi deployment id: 5a1885dc4a36fdbd8b638b37b7bd6fbd1636e07e" + } + }, "ImplicitApiFunctionGetHtmlPermissionTest": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -261,7 +270,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ServerlessRestApiDeployment5f2f2e0731" + "Ref": "ServerlessRestApiDeployment5a1885dc4a" }, "RestApiId": { "Ref": "ServerlessRestApi" @@ -273,7 +282,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ExplicitApiDeployment3a5a78688c" + "Ref": "ExplicitApiDeployment8cc53ffaa5" }, "RestApiId": { "Ref": "ExplicitApi" @@ -281,15 +290,6 @@ "StageName": "Prod" } }, - "ServerlessRestApiDeployment5f2f2e0731": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ServerlessRestApi" - }, - "Description": "RestApi deployment id: 5f2f2e07317e5f71e17f2a1f0cb2c1833f881340" - } - }, "RestApiFunctionRole": { "Type": "AWS::IAM::Role", "Properties": { @@ -335,13 +335,13 @@ } } }, - "ExplicitApiDeployment3a5a78688c": { + "ExplicitApiDeployment8cc53ffaa5": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": { "Ref": "ExplicitApi" }, - "Description": "RestApi deployment id: 3a5a78688c9bc377d53aa4153a11f0c4f6e7364c" + "Description": "RestApi deployment id: 8cc53ffaa59a19b69e73d5b422142c7396739b16" } }, "RestApiFunction": { diff --git a/tests/translator/output/aws-cn/api_with_gateway_responses_all_openapi_3.json b/tests/translator/output/aws-cn/api_with_gateway_responses_all_openapi_3.json index 8da7e78f03..672a1b1603 100644 --- a/tests/translator/output/aws-cn/api_with_gateway_responses_all_openapi_3.json +++ b/tests/translator/output/aws-cn/api_with_gateway_responses_all_openapi_3.json @@ -23,6 +23,15 @@ ] } }, + "ExplicitApiDeploymenta2f31986fe": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ExplicitApi" + }, + "Description": "RestApi deployment id: a2f31986fe718bd69858a109ac2b401fb7d8560f" + } + }, "FunctionRole": { "Type": "AWS::IAM::Role", "Properties": { @@ -107,7 +116,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ExplicitApiDeployment4c4177079d" + "Ref": "ExplicitApiDeploymenta2f31986fe" }, "RestApiId": { "Ref": "ExplicitApi" @@ -136,15 +145,6 @@ } } }, - "ExplicitApiDeployment4c4177079d": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ExplicitApi" - }, - "Description": "RestApi deployment id: 4c4177079dd342a2b71978bd25721b7b774295ad" - } - }, "FunctionGetHtmlPermissionTest": { "Type": "AWS::Lambda::Permission", "Properties": { diff --git a/tests/translator/output/aws-cn/api_with_open_api_version.json b/tests/translator/output/aws-cn/api_with_open_api_version.json index 647d4ae32c..703427ee48 100644 --- a/tests/translator/output/aws-cn/api_with_open_api_version.json +++ b/tests/translator/output/aws-cn/api_with_open_api_version.json @@ -68,15 +68,6 @@ } } }, - "ExplicitApiDeployment01dd43a75f": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ExplicitApi" - }, - "Description": "RestApi deployment id: 01dd43a75fc0e125c678d20749bacde95d723928" - } - }, "ImplicitApiFunctionGetHtmlPermissionProd": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -121,11 +112,20 @@ } } }, + "ExplicitApiDeploymentd9a0f2ae4f": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ExplicitApi" + }, + "Description": "RestApi deployment id: d9a0f2ae4fe2d97b9b91644934a878b6a08cf1c3" + } + }, "ServerlessRestApiProdStage": { "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ServerlessRestApiDeploymentb86b9dad9d" + "Ref": "ServerlessRestApiDeploymentb51bf3171c" }, "RestApiId": { "Ref": "ServerlessRestApi" @@ -137,7 +137,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ExplicitApiDeployment01dd43a75f" + "Ref": "ExplicitApiDeploymentd9a0f2ae4f" }, "RestApiId": { "Ref": "ExplicitApi" @@ -221,14 +221,14 @@ } } }, - "ServerlessRestApiDeploymentb86b9dad9d": { + "ServerlessRestApiDeploymentb51bf3171c": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": { "Ref": "ServerlessRestApi" }, - "Description": "RestApi deployment id: b86b9dad9d2fd5286c7b355dbd5350987cf492c1" + "Description": "RestApi deployment id: b51bf3171cc3cd5bdc024b45dda8a6ec14dcd6ef" } } } -} +} \ No newline at end of file diff --git a/tests/translator/output/aws-cn/api_with_open_api_version_2.json b/tests/translator/output/aws-cn/api_with_open_api_version_2.json index a49aa983b9..64ac6bcc8b 100644 --- a/tests/translator/output/aws-cn/api_with_open_api_version_2.json +++ b/tests/translator/output/aws-cn/api_with_open_api_version_2.json @@ -112,37 +112,34 @@ } } }, - "ServerlessRestApiProdStage": { - "Type": "AWS::ApiGateway::Stage", + "ServerlessRestApiDeployment3146d7e6fb": { + "Type": "AWS::ApiGateway::Deployment", "Properties": { - "DeploymentId": { - "Ref": "ServerlessRestApiDeploymentc444e5d902" - }, "RestApiId": { "Ref": "ServerlessRestApi" }, - "StageName": "Prod" + "Description": "RestApi deployment id: 3146d7e6fbaece0e0eb82d0c91c86c9b74dc217b" } }, - "ExplicitApiProdStage": { + "ServerlessRestApiProdStage": { "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ExplicitApiDeployment5332c373d4" + "Ref": "ServerlessRestApiDeployment3146d7e6fb" }, "RestApiId": { - "Ref": "ExplicitApi" + "Ref": "ServerlessRestApi" }, "StageName": "Prod" } }, - "ServerlessRestApiDeploymentc444e5d902": { + "ExplicitApiDeployment4154e1c30c": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": { - "Ref": "ServerlessRestApi" + "Ref": "ExplicitApi" }, - "Description": "RestApi deployment id: c444e5d902971761ced658a7ce701149743eb376" + "Description": "RestApi deployment id: 4154e1c30c97469d4946280461125dbfd4324f15" } }, "ServerlessRestApi": { @@ -221,13 +218,16 @@ } } }, - "ExplicitApiDeployment5332c373d4": { - "Type": "AWS::ApiGateway::Deployment", + "ExplicitApiProdStage": { + "Type": "AWS::ApiGateway::Stage", "Properties": { + "DeploymentId": { + "Ref": "ExplicitApiDeployment4154e1c30c" + }, "RestApiId": { "Ref": "ExplicitApi" }, - "Description": "RestApi deployment id: 5332c373d45c69e6c0f562b4a419aa8eb311adc7" + "StageName": "Prod" } } } diff --git a/tests/translator/output/aws-cn/api_with_openapi_definition_body_no_flag.json b/tests/translator/output/aws-cn/api_with_openapi_definition_body_no_flag.json index a5ba263166..815e57e930 100644 --- a/tests/translator/output/aws-cn/api_with_openapi_definition_body_no_flag.json +++ b/tests/translator/output/aws-cn/api_with_openapi_definition_body_no_flag.json @@ -47,15 +47,6 @@ } } }, - "ExplicitApiDeployment9252467a1e": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ExplicitApi" - }, - "Description": "RestApi deployment id: 9252467a1edc49ba35cb258640f5e3734cc9fab1" - } - }, "ImplicitApiFunctionGetHtmlPermissionTest": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -77,6 +68,15 @@ } } }, + "ExplicitApiDeployment63a10e26af": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ExplicitApi" + }, + "Description": "RestApi deployment id: 63a10e26af7194aefd61ead891c470ed75ce20be" + } + }, "ExplicitApi": { "Type": "AWS::ApiGateway::RestApi", "Properties": { @@ -180,7 +180,7 @@ }, "CacheClusterEnabled": true, "DeploymentId": { - "Ref": "ExplicitApiDeployment9252467a1e" + "Ref": "ExplicitApiDeployment63a10e26af" } } }, diff --git a/tests/translator/output/aws-cn/explicit_api_openapi_3.json b/tests/translator/output/aws-cn/explicit_api_openapi_3.json index d98d610a6f..b606898c4f 100644 --- a/tests/translator/output/aws-cn/explicit_api_openapi_3.json +++ b/tests/translator/output/aws-cn/explicit_api_openapi_3.json @@ -37,7 +37,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ApiWithInlineSwaggerDeployment09cda3d97b" + "Ref": "ApiWithInlineSwaggerDeployment74abcb3a5b" }, "RestApiId": { "Ref": "ApiWithInlineSwagger" @@ -78,6 +78,15 @@ "StageName": "Stage" } }, + "ApiWithInlineSwaggerDeployment74abcb3a5b": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ApiWithInlineSwagger" + }, + "Description": "RestApi deployment id: 74abcb3a5bbe7ad58dfc543740af3be156736130" + } + }, "GetHtmlFunctionRole": { "Type": "AWS::IAM::Role", "Properties": { @@ -180,15 +189,6 @@ "Ref": "MyStageName" } } - }, - "ApiWithInlineSwaggerDeployment09cda3d97b": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ApiWithInlineSwagger" - }, - "Description": "RestApi deployment id: 09cda3d97b008bed7bd4ebb1b5304ed622492941" - } } } } \ No newline at end of file diff --git a/tests/translator/output/aws-us-gov/api_request_model_openapi_3.json b/tests/translator/output/aws-us-gov/api_request_model_openapi_3.json index 12ffb120cd..f093d78bba 100644 --- a/tests/translator/output/aws-us-gov/api_request_model_openapi_3.json +++ b/tests/translator/output/aws-us-gov/api_request_model_openapi_3.json @@ -21,6 +21,15 @@ } } }, + "HtmlApiDeploymente91bc94e87": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "HtmlApi" + }, + "Description": "RestApi deployment id: e91bc94e874a30084312552d628dd248890ad7f9" + } + }, "HtmlFunctionRole": { "Type": "AWS::IAM::Role", "Properties": { @@ -49,7 +58,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "HtmlApiDeployment73fda15117" + "Ref": "HtmlApiDeploymente91bc94e87" }, "RestApiId": { "Ref": "HtmlApi" @@ -172,15 +181,6 @@ } } }, - "HtmlApiDeployment73fda15117": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "HtmlApi" - }, - "Description": "RestApi deployment id: 73fda151173319fe1f84fa9c2a7ff69514fced3b" - } - }, "HtmlFunctionGetHtmlPermissionTest": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -243,4 +243,4 @@ } } } -} +} \ No newline at end of file diff --git a/tests/translator/output/aws-us-gov/api_with_auth_all_maximum_openapi_3.json b/tests/translator/output/aws-us-gov/api_with_auth_all_maximum_openapi_3.json index c8187e9b8d..da3eefd416 100644 --- a/tests/translator/output/aws-us-gov/api_with_auth_all_maximum_openapi_3.json +++ b/tests/translator/output/aws-us-gov/api_with_auth_all_maximum_openapi_3.json @@ -104,15 +104,6 @@ } } }, - "MyApiDeployment26330d35c8": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "MyApi" - }, - "Description": "RestApi deployment id: 26330d35c82ff087c8d34db2cade570f0e02910f" - } - }, "MyFunctionWithCognitoMultipleUserPoolsAuthorizerPermissionProd": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -470,16 +461,13 @@ } } }, - "MyApiProdStage": { - "Type": "AWS::ApiGateway::Stage", + "MyApiDeployment1340211fad": { + "Type": "AWS::ApiGateway::Deployment", "Properties": { - "DeploymentId": { - "Ref": "MyApiDeployment26330d35c8" - }, "RestApiId": { "Ref": "MyApi" }, - "StageName": "Prod" + "Description": "RestApi deployment id: 1340211fad54a37a0ad8ff3740ecdf6a48107e28" } }, "MyFunctionWithNoAuthorizerPermissionProd": { @@ -503,6 +491,18 @@ } } }, + "MyApiProdStage": { + "Type": "AWS::ApiGateway::Stage", + "Properties": { + "DeploymentId": { + "Ref": "MyApiDeployment1340211fad" + }, + "RestApiId": { + "Ref": "MyApi" + }, + "StageName": "Prod" + } + }, "MyFunctionWithDefaultAuthorizerPermissionProd": { "Type": "AWS::Lambda::Permission", "Properties": { diff --git a/tests/translator/output/aws-us-gov/api_with_auth_all_minimum_openapi.json b/tests/translator/output/aws-us-gov/api_with_auth_all_minimum_openapi.json index 0c7839fa63..b16e2d8c8f 100644 --- a/tests/translator/output/aws-us-gov/api_with_auth_all_minimum_openapi.json +++ b/tests/translator/output/aws-us-gov/api_with_auth_all_minimum_openapi.json @@ -1,14 +1,5 @@ { "Resources": { - "MyApiWithLambdaTokenAuthDeployment0add72ee5b": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "MyApiWithLambdaTokenAuth" - }, - "Description": "RestApi deployment id: 0add72ee5b93d4332ccfaf6b521b1d6c98346235" - } - }, "MyApiWithCognitoAuth": { "Type": "AWS::ApiGateway::RestApi", "Properties": { @@ -71,11 +62,29 @@ } } }, + "MyApiWithLambdaRequestAuthDeployment7c3972b020": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "MyApiWithLambdaRequestAuth" + }, + "Description": "RestApi deployment id: 7c3972b020afc5a3f348a527f9cbf5108557b930" + } + }, + "MyApiWithCognitoAuthDeploymente1765ad6c1": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "MyApiWithCognitoAuth" + }, + "Description": "RestApi deployment id: e1765ad6c129adfb32be52dea3fa053e2ce02d51" + } + }, "MyApiWithLambdaRequestAuthProdStage": { "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "MyApiWithLambdaRequestAuthDeploymente9da24fd8b" + "Ref": "MyApiWithLambdaRequestAuthDeployment7c3972b020" }, "RestApiId": { "Ref": "MyApiWithLambdaRequestAuth" @@ -106,6 +115,15 @@ } } }, + "MyApiWithLambdaTokenAuthDeploymentfc5424e34c": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "MyApiWithLambdaTokenAuth" + }, + "Description": "RestApi deployment id: fc5424e34c86d9c2c71ee87d32bc82555a3c577d" + } + }, "MyFnLambdaRequestPermissionTest": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -220,7 +238,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "MyApiWithCognitoAuthDeploymentc77185482f" + "Ref": "MyApiWithCognitoAuthDeploymente1765ad6c1" }, "RestApiId": { "Ref": "MyApiWithCognitoAuth" @@ -249,27 +267,6 @@ } } }, - "MyUserPool": { - "Type": "AWS::Cognito::UserPool", - "Properties": { - "UsernameAttributes": [ - "email" - ], - "UserPoolName": "UserPoolName", - "Policies": { - "PasswordPolicy": { - "MinimumLength": 8 - } - }, - "Schema": [ - { - "AttributeDataType": "String", - "Required": false, - "Name": "email" - } - ] - } - }, "MyApiWithLambdaRequestAuthMyLambdaRequestAuthAuthorizerPermission": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -402,13 +399,25 @@ } } }, - "MyApiWithCognitoAuthDeploymentc77185482f": { - "Type": "AWS::ApiGateway::Deployment", + "MyUserPool": { + "Type": "AWS::Cognito::UserPool", "Properties": { - "RestApiId": { - "Ref": "MyApiWithCognitoAuth" + "UsernameAttributes": [ + "email" + ], + "UserPoolName": "UserPoolName", + "Policies": { + "PasswordPolicy": { + "MinimumLength": 8 + } }, - "Description": "RestApi deployment id: c77185482f5da13033fc9807c218b651c53a8c6c" + "Schema": [ + { + "AttributeDataType": "String", + "Required": false, + "Name": "email" + } + ] } }, "MyFn": { @@ -434,15 +443,6 @@ ] } }, - "MyApiWithLambdaRequestAuthDeploymente9da24fd8b": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "MyApiWithLambdaRequestAuth" - }, - "Description": "RestApi deployment id: e9da24fd8b2ad6c40b7137492a1a1c9a3cdf1908" - } - }, "MyAuthFnRole": { "Type": "AWS::IAM::Role", "Properties": { @@ -471,7 +471,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "MyApiWithLambdaTokenAuthDeployment0add72ee5b" + "Ref": "MyApiWithLambdaTokenAuthDeploymentfc5424e34c" }, "RestApiId": { "Ref": "MyApiWithLambdaTokenAuth" diff --git a/tests/translator/output/aws-us-gov/api_with_cors_openapi_3.json b/tests/translator/output/aws-us-gov/api_with_cors_openapi_3.json index 9a66ac27de..6527c99b1d 100644 --- a/tests/translator/output/aws-us-gov/api_with_cors_openapi_3.json +++ b/tests/translator/output/aws-us-gov/api_with_cors_openapi_3.json @@ -261,7 +261,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ServerlessRestApiDeployment2cd28b2066" + "Ref": "ServerlessRestApiDeployment5e7d1b38bf" }, "RestApiId": { "Ref": "ServerlessRestApi" @@ -273,7 +273,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ExplicitApiDeployment3a5a78688c" + "Ref": "ExplicitApiDeployment8cc53ffaa5" }, "RestApiId": { "Ref": "ExplicitApi" @@ -326,22 +326,13 @@ } } }, - "ServerlessRestApiDeployment2cd28b2066": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ServerlessRestApi" - }, - "Description": "RestApi deployment id: 2cd28b2066d69ecfb44eb7e024734cab2f3f9dac" - } - }, - "ExplicitApiDeployment3a5a78688c": { + "ExplicitApiDeployment8cc53ffaa5": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": { "Ref": "ExplicitApi" }, - "Description": "RestApi deployment id: 3a5a78688c9bc377d53aa4153a11f0c4f6e7364c" + "Description": "RestApi deployment id: 8cc53ffaa59a19b69e73d5b422142c7396739b16" } }, "RestApiFunction": { @@ -367,6 +358,15 @@ ] } }, + "ServerlessRestApiDeployment5e7d1b38bf": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ServerlessRestApi" + }, + "Description": "RestApi deployment id: 5e7d1b38bf567c46a1fc95b97a22d3cbf171216c" + } + }, "ServerlessRestApi": { "Type": "AWS::ApiGateway::RestApi", "Properties": { diff --git a/tests/translator/output/aws-us-gov/api_with_gateway_responses_all_openapi_3.json b/tests/translator/output/aws-us-gov/api_with_gateway_responses_all_openapi_3.json index 8b758bbd47..baa1ae69c7 100644 --- a/tests/translator/output/aws-us-gov/api_with_gateway_responses_all_openapi_3.json +++ b/tests/translator/output/aws-us-gov/api_with_gateway_responses_all_openapi_3.json @@ -23,15 +23,6 @@ ] } }, - "ExplicitApiDeployment3a19adf892": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ExplicitApi" - }, - "Description": "RestApi deployment id: 3a19adf892fbe70d360659eb3660359ade61913b" - } - }, "FunctionRole": { "Type": "AWS::IAM::Role", "Properties": { @@ -116,7 +107,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ExplicitApiDeployment3a19adf892" + "Ref": "ExplicitApiDeployment0f8408588e" }, "RestApiId": { "Ref": "ExplicitApi" @@ -145,6 +136,15 @@ } } }, + "ExplicitApiDeployment0f8408588e": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ExplicitApi" + }, + "Description": "RestApi deployment id: 0f8408588e16013e6d4fa0f1fd2390d0a7ec15ed" + } + }, "FunctionGetHtmlPermissionTest": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -167,4 +167,4 @@ } } } -} +} \ No newline at end of file diff --git a/tests/translator/output/aws-us-gov/api_with_open_api_version.json b/tests/translator/output/aws-us-gov/api_with_open_api_version.json index 5cd2019b48..7335be520c 100644 --- a/tests/translator/output/aws-us-gov/api_with_open_api_version.json +++ b/tests/translator/output/aws-us-gov/api_with_open_api_version.json @@ -112,23 +112,20 @@ } } }, - "ExplicitApiProdStage": { - "Type": "AWS::ApiGateway::Stage", + "ExplicitApiDeploymentd9a0f2ae4f": { + "Type": "AWS::ApiGateway::Deployment", "Properties": { - "DeploymentId": { - "Ref": "ExplicitApiDeployment01dd43a75f" - }, "RestApiId": { "Ref": "ExplicitApi" }, - "StageName": "Prod" + "Description": "RestApi deployment id: d9a0f2ae4fe2d97b9b91644934a878b6a08cf1c3" } }, "ServerlessRestApiProdStage": { "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ServerlessRestApiDeployment3f1d889857" + "Ref": "ServerlessRestApiDeployment7af82eda48" }, "RestApiId": { "Ref": "ServerlessRestApi" @@ -136,13 +133,13 @@ "StageName": "Prod" } }, - "ServerlessRestApiDeployment3f1d889857": { + "ServerlessRestApiDeployment7af82eda48": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": { "Ref": "ServerlessRestApi" }, - "Description": "RestApi deployment id: 3f1d889857c22227451ab7a02be7ea74b2e9d5b4" + "Description": "RestApi deployment id: 7af82eda48a23d84634abd7aa0865898d3b17810" } }, "ServerlessRestApi": { @@ -221,14 +218,17 @@ } } }, - "ExplicitApiDeployment01dd43a75f": { - "Type": "AWS::ApiGateway::Deployment", + "ExplicitApiProdStage": { + "Type": "AWS::ApiGateway::Stage", "Properties": { + "DeploymentId": { + "Ref": "ExplicitApiDeploymentd9a0f2ae4f" + }, "RestApiId": { "Ref": "ExplicitApi" }, - "Description": "RestApi deployment id: 01dd43a75fc0e125c678d20749bacde95d723928" + "StageName": "Prod" } } } -} +} \ No newline at end of file diff --git a/tests/translator/output/aws-us-gov/api_with_open_api_version_2.json b/tests/translator/output/aws-us-gov/api_with_open_api_version_2.json index 466cc85271..ad8462bc07 100644 --- a/tests/translator/output/aws-us-gov/api_with_open_api_version_2.json +++ b/tests/translator/output/aws-us-gov/api_with_open_api_version_2.json @@ -112,20 +112,11 @@ } } }, - "ServerlessRestApiDeployment3d22acdeb7": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ServerlessRestApi" - }, - "Description": "RestApi deployment id: 3d22acdeb7a3302c0b978e3dbb15c149380fbe77" - } - }, "ExplicitApiProdStage": { "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ExplicitApiDeployment5332c373d4" + "Ref": "ExplicitApiDeployment4154e1c30c" }, "RestApiId": { "Ref": "ExplicitApi" @@ -137,7 +128,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ServerlessRestApiDeployment3d22acdeb7" + "Ref": "ServerlessRestApiDeployment2ce765616b" }, "RestApiId": { "Ref": "ServerlessRestApi" @@ -145,6 +136,15 @@ "StageName": "Prod" } }, + "ExplicitApiDeployment4154e1c30c": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ExplicitApi" + }, + "Description": "RestApi deployment id: 4154e1c30c97469d4946280461125dbfd4324f15" + } + }, "ServerlessRestApi": { "Type": "AWS::ApiGateway::RestApi", "Properties": { @@ -221,13 +221,13 @@ } } }, - "ExplicitApiDeployment5332c373d4": { + "ServerlessRestApiDeployment2ce765616b": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": { - "Ref": "ExplicitApi" + "Ref": "ServerlessRestApi" }, - "Description": "RestApi deployment id: 5332c373d45c69e6c0f562b4a419aa8eb311adc7" + "Description": "RestApi deployment id: 2ce765616b7cfaba8ae0ad0877bd94cfbe0bc0fb" } } } diff --git a/tests/translator/output/aws-us-gov/api_with_openapi_definition_body_no_flag.json b/tests/translator/output/aws-us-gov/api_with_openapi_definition_body_no_flag.json index e47a67dc67..f9513c92fe 100644 --- a/tests/translator/output/aws-us-gov/api_with_openapi_definition_body_no_flag.json +++ b/tests/translator/output/aws-us-gov/api_with_openapi_definition_body_no_flag.json @@ -47,15 +47,6 @@ } } }, - "ExplicitApiDeployment9252467a1e": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ExplicitApi" - }, - "Description": "RestApi deployment id: 9252467a1edc49ba35cb258640f5e3734cc9fab1" - } - }, "ImplicitApiFunctionGetHtmlPermissionTest": { "Type": "AWS::Lambda::Permission", "Properties": { @@ -77,6 +68,15 @@ } } }, + "ExplicitApiDeployment63a10e26af": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ExplicitApi" + }, + "Description": "RestApi deployment id: 63a10e26af7194aefd61ead891c470ed75ce20be" + } + }, "ExplicitApi": { "Type": "AWS::ApiGateway::RestApi", "Properties": { @@ -170,7 +170,7 @@ }, "CacheClusterEnabled": true, "DeploymentId": { - "Ref": "ExplicitApiDeployment9252467a1e" + "Ref": "ExplicitApiDeployment63a10e26af" } } }, diff --git a/tests/translator/output/aws-us-gov/explicit_api_openapi_3.json b/tests/translator/output/aws-us-gov/explicit_api_openapi_3.json index 307a76ae2e..2e5ba08501 100644 --- a/tests/translator/output/aws-us-gov/explicit_api_openapi_3.json +++ b/tests/translator/output/aws-us-gov/explicit_api_openapi_3.json @@ -37,7 +37,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ApiWithInlineSwaggerDeployment09cda3d97b" + "Ref": "ApiWithInlineSwaggerDeployment74abcb3a5b" }, "RestApiId": { "Ref": "ApiWithInlineSwagger" @@ -78,6 +78,15 @@ "StageName": "Stage" } }, + "ApiWithInlineSwaggerDeployment74abcb3a5b": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ApiWithInlineSwagger" + }, + "Description": "RestApi deployment id: 74abcb3a5bbe7ad58dfc543740af3be156736130" + } + }, "GetHtmlFunctionRole": { "Type": "AWS::IAM::Role", "Properties": { @@ -180,15 +189,6 @@ "Ref": "MyStageName" } } - }, - "ApiWithInlineSwaggerDeployment09cda3d97b": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ApiWithInlineSwagger" - }, - "Description": "RestApi deployment id: 09cda3d97b008bed7bd4ebb1b5304ed622492941" - } } } } \ No newline at end of file diff --git a/tests/translator/output/explicit_api_openapi_3.json b/tests/translator/output/explicit_api_openapi_3.json index 327871d4dc..cf92ad161a 100644 --- a/tests/translator/output/explicit_api_openapi_3.json +++ b/tests/translator/output/explicit_api_openapi_3.json @@ -37,7 +37,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "ApiWithInlineSwaggerDeployment09cda3d97b" + "Ref": "ApiWithInlineSwaggerDeployment74abcb3a5b" }, "RestApiId": { "Ref": "ApiWithInlineSwagger" @@ -78,6 +78,15 @@ "StageName": "Stage" } }, + "ApiWithInlineSwaggerDeployment74abcb3a5b": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ApiWithInlineSwagger" + }, + "Description": "RestApi deployment id: 74abcb3a5bbe7ad58dfc543740af3be156736130" + } + }, "GetHtmlFunctionRole": { "Type": "AWS::IAM::Role", "Properties": { @@ -164,15 +173,6 @@ "Ref": "MyStageName" } } - }, - "ApiWithInlineSwaggerDeployment09cda3d97b": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ApiWithInlineSwagger" - }, - "Description": "RestApi deployment id: 09cda3d97b008bed7bd4ebb1b5304ed622492941" - } } } } \ No newline at end of file