-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add support for SQS events in Amazon.Lambda.Annotations #1758
Conversation
Libraries/test/TestServerlessApp/SQSEventExamples/InvalidSQSEvents.cs.error
Show resolved
Hide resolved
Libraries/src/Amazon.Lambda.Annotations/Amazon.Lambda.Annotations.csproj
Outdated
Show resolved
Hide resolved
...c/Amazon.Lambda.Annotations.SourceGenerator/Amazon.Lambda.Annotations.SourceGenerator.csproj
Show resolved
Hide resolved
Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Models/EventTypeBuilder.cs
Show resolved
Hide resolved
Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Models/LambdaMethodModel.cs
Show resolved
Hide resolved
Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Templates/LambdaFunctionTemplate.tt
Show resolved
Hide resolved
Libraries/src/Amazon.Lambda.Annotations/Amazon.Lambda.Annotations.csproj
Show resolved
Hide resolved
Libraries/test/TestServerlessApp/SQSEventExamples/InvalidSQSEvents.cs.error
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just have one small comment but I don't need to review it again.
Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/DiagnosticDescriptors.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a section to the README covering how to use the new attribute?
...c/Amazon.Lambda.Annotations.SourceGenerator/Amazon.Lambda.Annotations.SourceGenerator.csproj
Show resolved
Hide resolved
Libraries/src/Amazon.Lambda.Annotations/Amazon.Lambda.Annotations.csproj
Show resolved
Hide resolved
Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Templates/LambdaFunctionTemplate.tt
Show resolved
Hide resolved
Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Validation/LambdaFunctionValidator.cs
Show resolved
Hide resolved
Updated the Annotations README. |
Could code like this return a cleaner exception without the "This is a bug." language? Like we do for an invalid return type or function signature?
|
I have this definition, using actual queue arns
It builds okay locally, but then the deployment fails with
|
Added a check to verify that the |
I have added a new Also added new unit tests that exercises this logic. |
Could we throw a validation error in advance if invalid settings are applied to a fifo queue?
|
Added the necessary checks for FIFO specific validations. Discussed offline and concluded that we will only perform these checks when the |
Libraries/src/Amazon.Lambda.Annotations/SQS/SQSEventAttribute.cs
Outdated
Show resolved
Hide resolved
1. Add ability to reference the Queue property from a CloudFormation parameter 2. Correctly sync event properties while preserving properties that were manually set. 3. Fix typo in error message.
Issue #, if available:
DOTNET-5526
Description of changes:
This PR adds support for SQS events in Amazon.Lambda.Annotations
SQSEventAttribute
to setup event source mapping between Lambda functions and SQS queues.LambdaFunctionValidator
class that performs all validation on theLambdaFunctionModel
in a centralized location.DiagnosticDescriptors
to indicate invalid usage ofSQSEventAttribute
CloudFormationWriter
to parse theSQSEventAttribute
and set up event source mapping in theserverless.template
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.