Skip to content

Commit d10634f

Browse files
committed
PR comments
1 parent 7824a93 commit d10634f

4 files changed

Lines changed: 12 additions & 24 deletions

File tree

Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Writers/CloudFormationWriter.cs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -626,30 +626,19 @@ private string ProcessS3Attribute(ILambdaFunctionSerializable lambdaFunction, S3
626626
// Filter - S3 key filter rules
627627
if (att.IsFilterPrefixSet || att.IsFilterSuffixSet)
628628
{
629+
var rules = new List<Dictionary<string, string>>();
630+
629631
if (att.IsFilterPrefixSet)
630632
{
631-
var prefixRules = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "Name", "prefix" }, { "Value", att.FilterPrefix } } };
632-
SetEventProperty(syncedEventProperties, lambdaFunction.ResourceName, eventName, "Filter.S3Key.Rules", prefixRules, TokenType.List);
633+
rules.Add(new Dictionary<string, string> { { "Name", "prefix" }, { "Value", att.FilterPrefix } });
633634
}
635+
634636
if (att.IsFilterSuffixSet)
635637
{
636-
var suffixRule = new Dictionary<string, string> { { "Name", "suffix" }, { "Value", att.FilterSuffix } };
637-
if (att.IsFilterPrefixSet)
638-
{
639-
// Append suffix rule to existing rules list
640-
var rules = new List<Dictionary<string, string>>
641-
{
642-
new Dictionary<string, string> { { "Name", "prefix" }, { "Value", att.FilterPrefix } },
643-
suffixRule
644-
};
645-
SetEventProperty(syncedEventProperties, lambdaFunction.ResourceName, eventName, "Filter.S3Key.Rules", rules, TokenType.List);
646-
}
647-
else
648-
{
649-
var suffixRules = new List<Dictionary<string, string>> { suffixRule };
650-
SetEventProperty(syncedEventProperties, lambdaFunction.ResourceName, eventName, "Filter.S3Key.Rules", suffixRules, TokenType.List);
651-
}
638+
rules.Add(new Dictionary<string, string> { { "Name", "suffix" }, { "Value", att.FilterSuffix } });
652639
}
640+
641+
SetEventProperty(syncedEventProperties, lambdaFunction.ResourceName, eventName, "Filter.S3Key.Rules", rules, TokenType.List);
653642
}
654643

655644
// Enabled

Libraries/src/Amazon.Lambda.Annotations/S3/S3EventAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Amazon.Lambda.Annotations.S3
77
/// <summary>
88
/// This attribute defines the S3 event source configuration for a Lambda function.
99
/// </summary>
10-
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
10+
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
1111
public class S3EventAttribute : Attribute
1212
{
1313
private static readonly Regex _resourceNameRegex = new Regex("^[a-zA-Z0-9]+$");

Libraries/test/IntegrationTests.Helpers/S3Helper.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Threading.Tasks;
33
using Amazon.S3;
44
using Amazon.S3.Model;
5-
using Amazon.S3.Util;
65

76
namespace IntegrationTests.Helpers
87
{

Libraries/test/TestServerlessApp/aws-lambda-tools-defaults.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"template": "serverless.template",
1414
"template-parameters": "",
1515
"docker-host-build-output-dir": "./bin/Release/lambda-publish",
16-
"s3-bucket" : "test-serverless-app-843e7392",
17-
"stack-name" : "test-serverless-app-843e7392",
18-
"function-architecture" : "x86_64"
19-
}
16+
"s3-bucket": "test-serverless-app",
17+
"stack-name": "test-serverless-app",
18+
"function-architecture": "x86_64"
19+
}

0 commit comments

Comments
 (0)