From 5f818d47104bbfde63141cef2160a7aa5477850b Mon Sep 17 00:00:00 2001 From: aws-sam-cli-bot <46753707+aws-sam-cli-bot@users.noreply.github.com> Date: Fri, 31 Mar 2023 10:24:48 -0700 Subject: [PATCH] chore: Bump SamTranslator version to 1.63.0 (#4933) --- requirements/base.txt | 2 +- requirements/reproducible-linux.txt | 6 +- .../lib/models/all_policy_templates.yaml | 4 + .../lib/models/api_with_cors_and_apikey.yaml | 87 +++++++++++++++++++ ..._cors_and_apikey_defined_at_api_level.yaml | 66 ++++++++++++++ ...stom_domains_regional_latency_routing.yaml | 57 ++++++++++++ ...domains_regional_latency_routing_ipv6.yaml | 58 +++++++++++++ ..._with_sns_event_source_all_parameters.yaml | 1 + ...lambda_auth_with_permissions_resource.yaml | 62 +++++++++++++ ...stom_domains_regional_latency_routing.yaml | 57 ++++++++++++ ...domains_regional_latency_routing_ipv6.yaml | 58 +++++++++++++ .../validate/lib/models/sns_existing_sqs.yaml | 1 + .../validate/lib/models/sns_intrinsics.yaml | 1 + .../validate/lib/models/sns_outside_sqs.yaml | 1 + .../commands/validate/lib/models/sns_sqs.yaml | 1 + 15 files changed, 458 insertions(+), 4 deletions(-) create mode 100644 tests/functional/commands/validate/lib/models/api_with_cors_and_apikey.yaml create mode 100644 tests/functional/commands/validate/lib/models/api_with_cors_and_apikey_defined_at_api_level.yaml create mode 100644 tests/functional/commands/validate/lib/models/api_with_custom_domains_regional_latency_routing.yaml create mode 100644 tests/functional/commands/validate/lib/models/api_with_custom_domains_regional_latency_routing_ipv6.yaml create mode 100644 tests/functional/commands/validate/lib/models/http_api_lambda_auth_with_permissions_resource.yaml create mode 100644 tests/functional/commands/validate/lib/models/http_api_with_custom_domains_regional_latency_routing.yaml create mode 100644 tests/functional/commands/validate/lib/models/http_api_with_custom_domains_regional_latency_routing_ipv6.yaml diff --git a/requirements/base.txt b/requirements/base.txt index 38f9c702fc..ab0455fbbc 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -7,7 +7,7 @@ jmespath~=0.10.0 ruamel_yaml==0.17.21 PyYAML>=5.4.1,==5.* cookiecutter~=2.1.1 -aws-sam-translator==1.62.0 +aws-sam-translator==1.63.0 #docker minor version updates can include breaking changes. Auto update micro version only. docker~=4.2.0 dateparser~=1.1 diff --git a/requirements/reproducible-linux.txt b/requirements/reproducible-linux.txt index ccee196c7c..1435f62f21 100644 --- a/requirements/reproducible-linux.txt +++ b/requirements/reproducible-linux.txt @@ -19,9 +19,9 @@ aws-lambda-builders==1.28.0 \ --hash=sha256:6ea2fb607057436f03e2a8a857b5c5cbd18f7b2b907c53c2b461e65f843a4f38 \ --hash=sha256:bd6566772e7c5d887d05f32cf7e61a57293658388eef4fe8301f65bef432fe39 # via aws-sam-cli (setup.py) -aws-sam-translator==1.62.0 \ - --hash=sha256:2db24633fbc76b8e6eb76adaf0c1001a0d749288af91d85e7d9007e3b05479fa \ - --hash=sha256:5d198c8b4097b9210e1a44a64f55c4ee53b84f35d16ef1671b340242c41379cf +aws-sam-translator==1.63.0 \ + --hash=sha256:723683828d38e8769e4db0b0566ce56e923570b2cfdb88b965ce796a4554200f \ + --hash=sha256:bf3cca23b0e08e483956649302e53ae15e2021ef74a8fa1f9ecb2c53d8ce324c # via # aws-sam-cli (setup.py) # cfn-lint diff --git a/tests/functional/commands/validate/lib/models/all_policy_templates.yaml b/tests/functional/commands/validate/lib/models/all_policy_templates.yaml index 90de2acbe9..e39ffd4e9e 100644 --- a/tests/functional/commands/validate/lib/models/all_policy_templates.yaml +++ b/tests/functional/commands/validate/lib/models/all_policy_templates.yaml @@ -180,3 +180,7 @@ Resources: - StepFunctionsExecutionPolicy_v2: StateMachineName: name + + - SESBulkTemplatedCrudPolicy_v2: + IdentityName: name + TemplateName: template_name diff --git a/tests/functional/commands/validate/lib/models/api_with_cors_and_apikey.yaml b/tests/functional/commands/validate/lib/models/api_with_cors_and_apikey.yaml new file mode 100644 index 0000000000..d005a14293 --- /dev/null +++ b/tests/functional/commands/validate/lib/models/api_with_cors_and_apikey.yaml @@ -0,0 +1,87 @@ +AWSTemplateFormatVersion: '2010-09-09' + +Transform: +- AWS::Serverless-2016-10-31 + +Globals: + Api: + Auth: + ApiKeyRequired: true + AddApiKeyRequiredToCorsPreflight: false + +Resources: + + MyFunction: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + InlineCode: | + exports.handler = async function (event) { + return { + statusCode: 200, + body: JSON.stringify({ message: "Hello, SAM!" }), + } + } + Runtime: nodejs16.x + + ApiGatewayLambdaRole: + Type: AWS::IAM::Role + Properties: + AssumeRolePolicyDocument: + Version: '2012-10-17' + Statement: + - Effect: Allow + Principal: {Service: apigateway.amazonaws.com} + Action: sts:AssumeRole + Policies: + - PolicyName: AllowInvokeLambdaFunctions + PolicyDocument: + Version: '2012-10-17' + Statement: + - Effect: Allow + Action: lambda:InvokeFunction + Resource: '*' + + MyApi: + Type: AWS::Serverless::Api + Properties: + Cors: + AllowMethods: "'methods'" + AllowHeaders: "'headers'" + AllowOrigin: "'origins'" + MaxAge: "'600'" + Auth: + ApiKeyRequired: true + StageName: dev + DefinitionBody: + openapi: 3.0.1 + paths: + /apione: + get: + x-amazon-apigateway-integration: + credentials: + Fn::Sub: ${ApiGatewayLambdaRole.Arn} + uri: + Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyFunction.Arn}/invocations + passthroughBehavior: when_no_match + httpMethod: POST + type: aws_proxy + /apitwo: + get: + x-amazon-apigateway-integration: + credentials: + Fn::Sub: ${ApiGatewayLambdaRole.Arn} + uri: + Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyFunction.Arn}/invocations + passthroughBehavior: when_no_match + httpMethod: POST + type: aws_proxy + + + +Outputs: + ApiUrl: + Description: URL of your API endpoint + Value: !Sub "https://${MyApi}.execute-api.${AWS::Region}.amazonaws.com/dev/" +Metadata: + SamTransformTest: true diff --git a/tests/functional/commands/validate/lib/models/api_with_cors_and_apikey_defined_at_api_level.yaml b/tests/functional/commands/validate/lib/models/api_with_cors_and_apikey_defined_at_api_level.yaml new file mode 100644 index 0000000000..dcabe6bfb2 --- /dev/null +++ b/tests/functional/commands/validate/lib/models/api_with_cors_and_apikey_defined_at_api_level.yaml @@ -0,0 +1,66 @@ +AWSTemplateFormatVersion: '2010-09-09' + +Transform: +- AWS::Serverless-2016-10-31 + +Resources: + + MyFunction: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + InlineCode: | + exports.handler = async function (event) { + return { + statusCode: 200, + body: JSON.stringify({ message: "Hello, SAM!" }), + } + } + Runtime: nodejs16.x + + ApiGatewayLambdaRole: + Type: AWS::IAM::Role + Properties: + AssumeRolePolicyDocument: + Version: '2012-10-17' + Statement: + - Effect: Allow + Principal: {Service: apigateway.amazonaws.com} + Action: sts:AssumeRole + Policies: + - PolicyName: AllowInvokeLambdaFunctions + PolicyDocument: + Version: '2012-10-17' + Statement: + - Effect: Allow + Action: lambda:InvokeFunction + Resource: '*' + + MyApi: + Type: AWS::Serverless::Api + Properties: + Cors: "'*'" + Auth: + ApiKeyRequired: true + AddApiKeyRequiredToCorsPreflight: false + StageName: dev + DefinitionBody: + openapi: 3.0.1 + paths: + /hello: + get: + x-amazon-apigateway-integration: + credentials: + Fn::Sub: ${ApiGatewayLambdaRole.Arn} + uri: + Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyFunction.Arn}/invocations + passthroughBehavior: when_no_match + httpMethod: POST + type: aws_proxy + + + +Outputs: + WebEndpoint: + Description: API Gateway endpoint URL + Value: !Sub "https://${MyApi}.execute-api.${AWS::Region}.amazonaws.com/dev/hello" diff --git a/tests/functional/commands/validate/lib/models/api_with_custom_domains_regional_latency_routing.yaml b/tests/functional/commands/validate/lib/models/api_with_custom_domains_regional_latency_routing.yaml new file mode 100644 index 0000000000..24bd94678a --- /dev/null +++ b/tests/functional/commands/validate/lib/models/api_with_custom_domains_regional_latency_routing.yaml @@ -0,0 +1,57 @@ +Parameters: + MyRestRegionalDomainName: + Type: String + MyRestRegionalDomainCert: + Type: String + HostedZoneId: + Type: String + +Globals: + Api: + Domain: + DomainName: + Ref: MyRestRegionalDomainName + CertificateArn: + Ref: MyRestRegionalDomainCert + EndpointConfiguration: REGIONAL + MutualTlsAuthentication: + TruststoreUri: ${mtlsuri} + TruststoreVersion: 0 + SecurityPolicy: TLS_1_2 + BasePath: + - /get + - /post + Route53: + HostedZoneId: + Ref: HostedZoneId + Region: eu-west-2 + SetIdentifier: eu-west-2 + DistributionDomainName: test.domain.com + +Resources: + MyFunction: + Type: AWS::Serverless::Function + Properties: + InlineCode: | + exports.handler = async (event) => { + const response = { + statusCode: 200, + body: JSON.stringify('Hello from Lambda!'), + }; + return response; + }; + Handler: index.handler + Runtime: nodejs14.x + Events: + ImplicitGet: + Type: Api + Properties: + Method: Get + Path: /get + ImplicitPost: + Type: Api + Properties: + Method: Post + Path: /post +Metadata: + SamTransformTest: true diff --git a/tests/functional/commands/validate/lib/models/api_with_custom_domains_regional_latency_routing_ipv6.yaml b/tests/functional/commands/validate/lib/models/api_with_custom_domains_regional_latency_routing_ipv6.yaml new file mode 100644 index 0000000000..ab5334a3d0 --- /dev/null +++ b/tests/functional/commands/validate/lib/models/api_with_custom_domains_regional_latency_routing_ipv6.yaml @@ -0,0 +1,58 @@ +Parameters: + MyRestRegionalDomainName: + Type: String + MyRestRegionalDomainCert: + Type: String + HostedZoneId: + Type: String + +Globals: + Api: + Domain: + DomainName: + Ref: MyRestRegionalDomainName + CertificateArn: + Ref: MyRestRegionalDomainCert + EndpointConfiguration: REGIONAL + MutualTlsAuthentication: + TruststoreUri: ${mtlsuri} + TruststoreVersion: 0 + SecurityPolicy: TLS_1_2 + BasePath: + - /get + - /post + Route53: + HostedZoneId: + Ref: HostedZoneId + Region: eu-west-2 + SetIdentifier: eu-west-2 + DistributionDomainName: test.domain.com + IpV6: true + +Resources: + MyFunction: + Type: AWS::Serverless::Function + Properties: + InlineCode: | + exports.handler = async (event) => { + const response = { + statusCode: 200, + body: JSON.stringify('Hello from Lambda!'), + }; + return response; + }; + Handler: index.handler + Runtime: nodejs14.x + Events: + ImplicitGet: + Type: Api + Properties: + Method: Get + Path: /get + ImplicitPost: + Type: Api + Properties: + Method: Post + Path: /post +Metadata: + SamTransformTest: true diff --git a/tests/functional/commands/validate/lib/models/function_with_sns_event_source_all_parameters.yaml b/tests/functional/commands/validate/lib/models/function_with_sns_event_source_all_parameters.yaml index 51285790dc..e2624c75e2 100644 --- a/tests/functional/commands/validate/lib/models/function_with_sns_event_source_all_parameters.yaml +++ b/tests/functional/commands/validate/lib/models/function_with_sns_event_source_all_parameters.yaml @@ -25,3 +25,4 @@ Resources: - numeric: - '>=' - 100 + FilterPolicyScope: MessageAttributes diff --git a/tests/functional/commands/validate/lib/models/http_api_lambda_auth_with_permissions_resource.yaml b/tests/functional/commands/validate/lib/models/http_api_lambda_auth_with_permissions_resource.yaml new file mode 100644 index 0000000000..cb7155d8a9 --- /dev/null +++ b/tests/functional/commands/validate/lib/models/http_api_lambda_auth_with_permissions_resource.yaml @@ -0,0 +1,62 @@ +Resources: + HttpApiFunction: + Type: AWS::Serverless::Function + Properties: + CodeUri: s3://sam-demo-bucket/todo_list.zip + Handler: index.restapi + Runtime: python3.7 + Events: + Basic: + Type: HttpApi + Properties: + Path: /basic + Method: GET + ApiId: !Ref MyApi + + MyAuthFn: + Type: AWS::Serverless::Function + Properties: + CodeUri: s3://bucket/key + Handler: index.handler + Runtime: nodejs12.x + + MyApi: + Type: AWS::Serverless::HttpApi + Properties: + Tags: + Tag1: value1 + Tag2: value2 + Auth: + Authorizers: + LambdaAuthWithEnablePropertyTrue: + # should create permissions resource for this auth + FunctionArn: !GetAtt MyAuthFn.Arn + EnableFunctionDefaultPermissions: true + AuthorizerPayloadFormatVersion: 1.0 + LambdaAuthNoEnableProperty: + # should not create permissions resource for this auth as http api doesn't create the resource by default + FunctionArn: !GetAtt MyAuthFn.Arn + AuthorizerPayloadFormatVersion: 1.0 + LambdaAuthWithEnablePropertySetFalse: + # should not create permissions resource for this auth + FunctionArn: !GetAtt MyAuthFn.Arn + AuthorizerPayloadFormatVersion: 1.0 + EnableFunctionDefaultPermissions: false + LambdaAuthFull: + # should create permissions resource for this auth + FunctionArn: !GetAtt MyAuthFn.Arn + FunctionInvokeRole: !GetAtt MyAuthFnRole.Arn + EnableFunctionDefaultPermissions: true + Identity: + Context: + - contextVar + Headers: + - Authorization + QueryStrings: + - petId + StageVariables: + - stageVar + ReauthorizeEvery: 60 + AuthorizerPayloadFormatVersion: 2.0 + EnableSimpleResponses: true + DefaultAuthorizer: LambdaAuthWithEnablePropertyTrue diff --git a/tests/functional/commands/validate/lib/models/http_api_with_custom_domains_regional_latency_routing.yaml b/tests/functional/commands/validate/lib/models/http_api_with_custom_domains_regional_latency_routing.yaml new file mode 100644 index 0000000000..a2b4626aaf --- /dev/null +++ b/tests/functional/commands/validate/lib/models/http_api_with_custom_domains_regional_latency_routing.yaml @@ -0,0 +1,57 @@ +Parameters: + MyRestRegionalDomainName: + Type: String + MyRestRegionalDomainCert: + Type: String + HostedZoneId: + Type: String + +Globals: + HttpApi: + Domain: + DomainName: + Ref: MyRestRegionalDomainName + CertificateArn: + Ref: MyRestRegionalDomainCert + EndpointConfiguration: REGIONAL + MutualTlsAuthentication: + TruststoreUri: ${mtlsuri} + TruststoreVersion: 0 + SecurityPolicy: TLS_1_2 + BasePath: + - /get + - /post + Route53: + HostedZoneId: + Ref: HostedZoneId + Region: eu-west-2 + SetIdentifier: eu-west-2 + DistributionDomainName: test.domain.com + +Resources: + MyFunction: + Type: AWS::Serverless::Function + Properties: + InlineCode: | + exports.handler = async (event) => { + const response = { + statusCode: 200, + body: JSON.stringify('Hello from Lambda!'), + }; + return response; + }; + Handler: index.handler + Runtime: nodejs14.x + Events: + ImplicitGet: + Type: Api + Properties: + Method: Get + Path: /get + ImplicitPost: + Type: Api + Properties: + Method: Post + Path: /post +Metadata: + SamTransformTest: true diff --git a/tests/functional/commands/validate/lib/models/http_api_with_custom_domains_regional_latency_routing_ipv6.yaml b/tests/functional/commands/validate/lib/models/http_api_with_custom_domains_regional_latency_routing_ipv6.yaml new file mode 100644 index 0000000000..850c64986f --- /dev/null +++ b/tests/functional/commands/validate/lib/models/http_api_with_custom_domains_regional_latency_routing_ipv6.yaml @@ -0,0 +1,58 @@ +Parameters: + MyRestRegionalDomainName: + Type: String + MyRestRegionalDomainCert: + Type: String + HostedZoneId: + Type: String + +Globals: + HttpApi: + Domain: + DomainName: + Ref: MyRestRegionalDomainName + CertificateArn: + Ref: MyRestRegionalDomainCert + EndpointConfiguration: REGIONAL + MutualTlsAuthentication: + TruststoreUri: ${mtlsuri} + TruststoreVersion: 0 + SecurityPolicy: TLS_1_2 + BasePath: + - /get + - /post + Route53: + HostedZoneId: + Ref: HostedZoneId + Region: eu-west-2 + SetIdentifier: eu-west-2 + DistributionDomainName: test.domain.com + IpV6: true + +Resources: + MyFunction: + Type: AWS::Serverless::Function + Properties: + InlineCode: | + exports.handler = async (event) => { + const response = { + statusCode: 200, + body: JSON.stringify('Hello from Lambda!'), + }; + return response; + }; + Handler: index.handler + Runtime: nodejs14.x + Events: + ImplicitGet: + Type: Api + Properties: + Method: Get + Path: /get + ImplicitPost: + Type: Api + Properties: + Method: Post + Path: /post +Metadata: + SamTransformTest: true diff --git a/tests/functional/commands/validate/lib/models/sns_existing_sqs.yaml b/tests/functional/commands/validate/lib/models/sns_existing_sqs.yaml index c4b5cca4a7..3a9f9d2318 100644 --- a/tests/functional/commands/validate/lib/models/sns_existing_sqs.yaml +++ b/tests/functional/commands/validate/lib/models/sns_existing_sqs.yaml @@ -23,6 +23,7 @@ Resources: - numeric: - '>=' - 100 + FilterPolicyScope: MessageAttributes Notifications: Type: AWS::SNS::Topic diff --git a/tests/functional/commands/validate/lib/models/sns_intrinsics.yaml b/tests/functional/commands/validate/lib/models/sns_intrinsics.yaml index 103922db4e..1b04eac6f3 100644 --- a/tests/functional/commands/validate/lib/models/sns_intrinsics.yaml +++ b/tests/functional/commands/validate/lib/models/sns_intrinsics.yaml @@ -31,6 +31,7 @@ Resources: - numeric: - < - 100 + FilterPolicyScope: MessageAttributes Region: Ref: SnsRegion SqsSubscription: true diff --git a/tests/functional/commands/validate/lib/models/sns_outside_sqs.yaml b/tests/functional/commands/validate/lib/models/sns_outside_sqs.yaml index e0d1b8c57f..7cf3552c81 100644 --- a/tests/functional/commands/validate/lib/models/sns_outside_sqs.yaml +++ b/tests/functional/commands/validate/lib/models/sns_outside_sqs.yaml @@ -23,6 +23,7 @@ Resources: - numeric: - '>=' - 100 + FilterPolicyScope: MessageAttributes Notifications: Type: AWS::SNS::Topic diff --git a/tests/functional/commands/validate/lib/models/sns_sqs.yaml b/tests/functional/commands/validate/lib/models/sns_sqs.yaml index 768b6c0880..6afc3ff71a 100644 --- a/tests/functional/commands/validate/lib/models/sns_sqs.yaml +++ b/tests/functional/commands/validate/lib/models/sns_sqs.yaml @@ -18,6 +18,7 @@ Resources: - numeric: - '>=' - 100 + FilterPolicyScope: MessageAttributes Notifications: Type: AWS::SNS::Topic