Skip to content

Commit 564d7ad

Browse files
authored
Merge pull request #3688 from aws/release-v1.93.0
Release 1.93.0 (to main)
2 parents 4960606 + b5df724 commit 564d7ad

File tree

58 files changed

+3962
-569
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3962
-569
lines changed

.cfnlintrc.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ ignore_templates:
137137
- tests/translator/output/**/function_with_intrinsics_resource_attribute.json # CFN now supports intrinsics in DeletionPolicy
138138
- tests/translator/output/**/function_with_snapstart.json # Snapstart intentionally not attached to a lambda version which causes lint issues
139139
- tests/translator/output/**/managed_policies_everything.json # intentionally contains wrong arns
140+
- tests/translator/output/**/function_with_metrics_config.json
140141
ignore_checks:
141142
- E2531 # Deprecated runtime; not relevant for transform tests
142143
- E2533 # Another deprecated runtime; not relevant for transform tests

docs/globals.rst

+5
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Currently, the following resources and properties are being supported:
7575
EphemeralStorage:
7676
RuntimeManagementConfig:
7777
LoggingConfig:
78+
FileSystemConfigs:
7879
7980
Api:
8081
# Properties of AWS::Serverless::Api
@@ -113,6 +114,10 @@ Currently, the following resources and properties are being supported:
113114
# Properties of AWS::Serverless::SimpleTable
114115
SSESpecification:
115116
117+
LayerVersion:
118+
# Properties of AWS::Serverless::LayerVersion
119+
PublishLambdaVersion:
120+
116121
Implicit APIs
117122
~~~~~~~~~~~~~
118123

integration/combination/test_connectors.py

-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ def tearDown(self):
8080
("combination/connector_event_rule_to_sqs_write",),
8181
("combination/connector_event_rule_to_sns_write",),
8282
("combination/connector_event_rule_to_sfn_write",),
83-
("combination/connector_event_rule_to_eb_default_write",),
84-
("combination/connector_event_rule_to_eb_custom_write",),
8583
("combination/connector_event_rule_to_lambda_write",),
8684
("combination/connector_event_rule_to_lambda_write_multiple",),
8785
("combination/connector_sqs_to_function",),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
from unittest import SkipTest
2+
from unittest.case import skipIf
3+
4+
from parameterized import parameterized
5+
from tenacity import retry, retry_if_exception, stop_after_attempt
6+
7+
from integration.config.service_names import EVENT_RULE_WITH_EVENT_BUS
8+
from integration.conftest import clean_bucket
9+
from integration.helpers.base_test import BaseTest
10+
from integration.helpers.resource import current_region_does_not_support
11+
12+
retry_once = retry(
13+
stop=stop_after_attempt(2),
14+
# unittest raises SkipTest for skipping tests
15+
retry=retry_if_exception(lambda e: not isinstance(e, SkipTest)),
16+
)
17+
18+
19+
@skipIf(
20+
current_region_does_not_support([EVENT_RULE_WITH_EVENT_BUS]),
21+
"EVENT_RULE_WITH_EVENT_BUS is not supported in this testing region",
22+
)
23+
class TestConnectorsWithEventRuleToEB(BaseTest):
24+
def tearDown(self):
25+
# Some tests will create items in S3 Bucket, which result in stack DELETE_FAILED state
26+
# manually empty the bucket to allow stacks to be deleted successfully.
27+
bucket_name = self.get_physical_id_by_type("AWS::S3::Bucket")
28+
if bucket_name:
29+
clean_bucket(bucket_name, self.client_provider.s3_client)
30+
super().tearDown()
31+
32+
@parameterized.expand(
33+
[
34+
("combination/connector_event_rule_to_eb_default_write",),
35+
("combination/connector_event_rule_to_eb_custom_write",),
36+
]
37+
)
38+
@retry_once
39+
def test_connector_event_rule_eb_by_invoking_a_function(self, template_file_path):
40+
self.skip_using_service_detector(template_file_path)
41+
self.create_and_verify_stack(template_file_path)
42+
43+
lambda_function_name = self.get_physical_id_by_logical_id("TriggerFunction")
44+
lambda_client = self.client_provider.lambda_client
45+
46+
request_params = {
47+
"FunctionName": lambda_function_name,
48+
"InvocationType": "RequestResponse",
49+
"Payload": "{}",
50+
}
51+
response = lambda_client.invoke(**request_params)
52+
self.assertEqual(response.get("StatusCode"), 200)
53+
self.assertEqual(response.get("FunctionError"), None)

integration/combination/test_function_with_alias.py

+36
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,42 @@ def test_alias_with_event_sources_get_correct_permissions(self):
160160
function_policy = json.loads(function_policy_str)
161161
self.assertEqual(len(function_policy["Statement"]), len(permission_resources))
162162

163+
def test_function_with_alias_and_layer_version(self):
164+
self.create_and_verify_stack("combination/function_with_alias_all_properties_and_layer_version")
165+
alias_name = "Live"
166+
function_name = self.get_physical_id_by_type("AWS::Lambda::Function")
167+
version_ids = self.get_function_version_by_name(function_name)
168+
self.assertEqual(["1"], version_ids)
169+
170+
alias = self.get_alias(function_name, alias_name)
171+
self.assertEqual("1", alias["FunctionVersion"])
172+
173+
# Changing Description in the LayerVersion should create a new version, and leave the existing version intact
174+
self.set_template_resource_property("MyLayer", "Description", "test123")
175+
self.update_stack()
176+
177+
version_ids = self.get_function_version_by_name(function_name)
178+
self.assertEqual(["1", "2"], version_ids)
179+
180+
alias = self.get_alias(function_name, alias_name)
181+
self.assertEqual("2", alias["FunctionVersion"])
182+
183+
# Changing ContentUri in LayerVersion should create a new version, and leave the existing version intact
184+
self.set_template_resource_property("MyLayer", "ContentUri", self.file_to_s3_uri_map["layer2.zip"]["uri"])
185+
self.update_stack()
186+
187+
version_ids = self.get_function_version_by_name(function_name)
188+
self.assertEqual(["1", "2", "3"], version_ids)
189+
190+
alias = self.get_alias(function_name, alias_name)
191+
self.assertEqual("3", alias["FunctionVersion"])
192+
193+
# Make sure the stack has only One Version & One Alias resource
194+
alias = self.get_stack_resources("AWS::Lambda::Alias")
195+
versions = self.get_stack_resources("AWS::Lambda::Version")
196+
self.assertEqual(len(alias), 1)
197+
self.assertEqual(len(versions), 1)
198+
163199
def get_function_version_by_name(self, function_name):
164200
lambda_client = self.client_provider.lambda_client
165201
versions = lambda_client.list_versions_by_function(FunctionName=function_name)["Versions"]

integration/config/file_to_s3_map.json

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
"type": "s3",
2424
"uri": ""
2525
},
26+
"layer2.zip": {
27+
"type": "s3",
28+
"uri": ""
29+
},
2630
"swagger1.json": {
2731
"type": "s3",
2832
"uri": ""

integration/config/service_names.py

+1
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@
3636
APP_SYNC = "AppSync"
3737
SNS_FILTER_POLICY_SCOPE = "SnsFilterPolicyScope"
3838
LOGS = "Logs"
39+
EVENT_RULE_WITH_EVENT_BUS = "EventRuleWithEventBus"

integration/helpers/file_resources.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"code.zip": {"type": "s3", "uri": ""},
33
"code2.zip": {"type": "s3", "uri": ""},
44
"layer1.zip": {"type": "s3", "uri": ""},
5+
"layer2.zip": {"type": "s3", "uri": ""},
56
"swagger1.json": {"type": "s3", "uri": ""},
67
"swagger2.json": {"type": "s3", "uri": ""},
78
"binary-media.zip": {"type": "s3", "uri": ""},

integration/resources/code/layer2.zip

2.12 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[
2+
{
3+
"LogicalResourceId": "MyLambdaFunction",
4+
"ResourceType": "AWS::Lambda::Function"
5+
},
6+
{
7+
"LogicalResourceId": "MyLambdaFunctionRole",
8+
"ResourceType": "AWS::IAM::Role"
9+
},
10+
{
11+
"LogicalResourceId": "MyLambdaFunctionAliasLive",
12+
"ResourceType": "AWS::Lambda::Alias"
13+
},
14+
{
15+
"LogicalResourceId": "MyLambdaFunctionVersion",
16+
"ResourceType": "AWS::Lambda::Version"
17+
},
18+
{
19+
"LogicalResourceId": "MyLayer",
20+
"ResourceType": "AWS::Lambda::LayerVersion"
21+
}
22+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[
2+
{
3+
"LogicalResourceId": "SuperCoolAPI",
4+
"ResourceType": "AWS::AppSync::GraphQLApi"
5+
},
6+
{
7+
"LogicalResourceId": "SuperCoolAPICloudWatchRole",
8+
"ResourceType": "AWS::IAM::Role"
9+
},
10+
{
11+
"LogicalResourceId": "SuperCoolAPISchema",
12+
"ResourceType": "AWS::AppSync::GraphQLSchema"
13+
},
14+
{
15+
"LogicalResourceId": "SuperCoolAPIQuerygetBook",
16+
"ResourceType": "AWS::AppSync::Resolver"
17+
},
18+
{
19+
"LogicalResourceId": "SuperCoolAPINoneDataSource",
20+
"ResourceType": "AWS::AppSync::DataSource"
21+
},
22+
{
23+
"LogicalResourceId": "SuperCoolAPIprocessQuery",
24+
"ResourceType": "AWS::AppSync::FunctionConfiguration"
25+
},
26+
{
27+
"LogicalResourceId": "SuperCoolAPIMyApiKey",
28+
"ResourceType": "AWS::AppSync::ApiKey"
29+
},
30+
{
31+
"LogicalResourceId": "IntrospectionDisableSuperCoolAPI",
32+
"ResourceType": "AWS::AppSync::GraphQLApi"
33+
},
34+
{
35+
"LogicalResourceId": "IntrospectionDisableSuperCoolAPICloudWatchRole",
36+
"ResourceType": "AWS::IAM::Role"
37+
},
38+
{
39+
"LogicalResourceId": "IntrospectionDisableSuperCoolAPISchema",
40+
"ResourceType": "AWS::AppSync::GraphQLSchema"
41+
},
42+
{
43+
"LogicalResourceId": "IntrospectionDisableSuperCoolAPIQuerygetBook",
44+
"ResourceType": "AWS::AppSync::Resolver"
45+
},
46+
{
47+
"LogicalResourceId": "IntrospectionDisableSuperCoolAPINoneDataSource",
48+
"ResourceType": "AWS::AppSync::DataSource"
49+
},
50+
{
51+
"LogicalResourceId": "IntrospectionDisableSuperCoolAPIprocessQuery",
52+
"ResourceType": "AWS::AppSync::FunctionConfiguration"
53+
},
54+
{
55+
"LogicalResourceId": "IntrospectionDisableSuperCoolAPIMyApiKey",
56+
"ResourceType": "AWS::AppSync::ApiKey"
57+
}
58+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Resources:
2+
MyLambdaFunction:
3+
Type: AWS::Serverless::Function
4+
Properties:
5+
CodeUri: ${codeuri}
6+
Handler: index.handler
7+
Runtime: nodejs20.x
8+
AutoPublishAlias: Live
9+
AutoPublishAliasAllProperties: true
10+
Layers:
11+
- !Ref MyLayer
12+
13+
MyLayer:
14+
Type: AWS::Serverless::LayerVersion
15+
Properties:
16+
ContentUri: ${contenturi}
17+
RetentionPolicy: Delete
18+
PublishLambdaVersion: true
19+
Description: test
20+
Metadata:
21+
SamTransformTest: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
Transform: AWS::Serverless-2016-10-31
2+
Resources:
3+
SuperCoolAPI:
4+
Type: AWS::Serverless::GraphQLApi
5+
Properties:
6+
SchemaInline: |
7+
type Book {
8+
bookName: String
9+
id: ID
10+
}
11+
type Query { getBook(bookName: String): Book }
12+
OwnerContact: blah-blah
13+
Auth:
14+
Type: API_KEY
15+
ApiKeys:
16+
MyApiKey: {}
17+
Functions:
18+
processQuery:
19+
Runtime:
20+
Name: APPSYNC_JS
21+
Version: 1.0.0
22+
DataSource: NONE
23+
InlineCode: |
24+
import { util } from '@aws-appsync/utils';
25+
26+
export function request(ctx) {
27+
const id = util.autoId();
28+
return { payload: { ...ctx.args, id } };
29+
}
30+
31+
export function response(ctx) {
32+
return ctx.result;
33+
}
34+
Resolvers:
35+
Query:
36+
getBook:
37+
Pipeline:
38+
- processQuery
39+
40+
IntrospectionDisableSuperCoolAPI:
41+
Type: AWS::Serverless::GraphQLApi
42+
Properties:
43+
SchemaInline: |
44+
type Book {
45+
bookName: String
46+
id: ID
47+
}
48+
type Query { getBook(bookName: String): Book }
49+
OwnerContact: blah-blah
50+
IntrospectionConfig: DISABLED
51+
QueryDepthLimit: 10
52+
ResolverCountLimit: 100
53+
Auth:
54+
Type: API_KEY
55+
ApiKeys:
56+
MyApiKey: {}
57+
Functions:
58+
processQuery:
59+
Runtime:
60+
Name: APPSYNC_JS
61+
Version: 1.0.0
62+
DataSource: NONE
63+
InlineCode: |
64+
import { util } from '@aws-appsync/utils';
65+
66+
export function request(ctx) {
67+
const id = util.autoId();
68+
return { payload: { ...ctx.args, id } };
69+
}
70+
71+
export function response(ctx) {
72+
return ctx.result;
73+
}
74+
Resolvers:
75+
Query:
76+
getBook:
77+
Pipeline:
78+
- processQuery
79+
Outputs:
80+
SuperCoolAPI:
81+
Description: AppSync API
82+
Value: !GetAtt SuperCoolAPI.GraphQLUrl
83+
MyApiKey:
84+
Description: API Id
85+
Value: !GetAtt SuperCoolAPIMyApiKey.ApiKey
86+
IntrospectionDisableSuperCoolAPI:
87+
Description: AppSync API
88+
Value: !GetAtt IntrospectionDisableSuperCoolAPI.GraphQLUrl
89+
IntrospectionDisableSuperCoolAPIMyApiKey:
90+
Description: API Id
91+
Value: !GetAtt IntrospectionDisableSuperCoolAPIMyApiKey.ApiKey
92+
93+
Metadata:
94+
SamTransformTest: true

0 commit comments

Comments
 (0)