-
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
Update Lambda blueprints for .NET 8 #1673
Conversation
243397b
to
f19623f
Compare
|
||
namespace BlueprintBaseName._1; | ||
|
||
/// <summary> |
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.
This is the serverless Native AOT blueprint. It used to have its own Main
method and logic for switching to the correct method based on an environment variable. Amazon.Lambda.Annotations can now do all of this for us so I removed all of the logic and relied on Lambda Annotations.
I the Lambda methods, JsonSerializerContext and the .NET records in the same file to make it really easy for users that start with this template quickly delete what they don't need once they understand how this works.
@@ -1,12 +1,9 @@ | |||
namespace BlueprintBaseName._1.Tests |
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.
This file has significant changes to deal with change to move to new major version of Amazon.Lambda.DynamoDBEvents which removed the dependency on the SDK.
@@ -1,11 +1,9 @@ | |||
using Xunit; |
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.
This file has significant changes to deal with change to move to new major version of Amazon.Lambda.DynamoDBEvents which removed the dependency on the SDK.
@@ -5,7 +5,7 @@ | |||
"Lambda", | |||
"Function" | |||
], | |||
"name": "Lambda Empty Function (.NET 7 Container Image)", |
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.
You removed "NET"
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.
Fixed
|
||
namespace BlueprintBaseName._1; | ||
|
||
/// <summary> | ||
/// This class is used to register the input event and return type for the FunctionHandler method with the System.Text.Json source generator. |
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.
nit: use doc reference for all the types you mentioned in docs
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'm gonna skip doing this now. We haven't made any effort to doc references in code elements in the other blueprints and if we want to do that we should do that as a separate effort.
I'm a little hesitant to use them here anyways because these comments are meant to be easily readable while reading the code in this file. Not via a doc site or intellisense. Think of these docs as more of a developer guide type content as you are reading the source. I expect users to replace all of this content with the actual content useful to their problem. Having to read the content with a bunch of xml tags useful for a doc site or intellisense makes it harder to read.
|
||
|
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.
nit: remove whitespace
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.
Done
/// <param name="context"></param> | ||
/// <returns></returns> |
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.
nit: add docs to empty attributes
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.
Done
// SDK for .NET does not support trimming. This will result in a larger executable size, and still does not | ||
// guarantee runtime trimming errors won't be hit. | ||
/// This method demonstrates methods being exposed as Lambda functions using Amazon.Lambda.Annotations without API Gateway attributes. | ||
/// The event source for the Lambda function can be configured in the serverless.template. The method can also Lambda function can |
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.
the sentence is weirdly formed "The method can also Lambda function can be invoked manually using the AWS SDKs.
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.
Fixed
For Native AOT Lambda functions the project must be deployed as an executable and bootstrap the Lambda runtime client. Lambda Annotations | ||
will automatically generate the `Main` by using the `GenerateMain` property of `LambdaGlobalProperties` attribute to true. The generated | ||
`Main` method uses the environment variable `ANNOTATIONS_HANDLER` to switch to the correct function handler for the executable. Lambda | ||
Annotations will automatically set the `ANNOTATIONS_HANDLER` environment variable when synchronize the CloudFormation template. If deploying |
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.
nit: typo in "synchronize"
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.
Fixed
Description of changes:
In preparation for .NET 8 Lambda support update the blueprints. The update has the following changes.
net8.0
.dotnet8
dotnet8
runtime instead ofprovided.al2023
. This is done becauseprovided.al2023
does not have the requiredlibicu
system library and avoid having to include it with the deployment bundle. You will see in the project files the removal of the logic to include libicu. This also remove the need to name the assembly asbootstrap
.Testing
Run the msbuild target
/t:test-blueprints-dotnew
that confirms all blueprints can be instantiated and compiledManually deployments of the Native AOT and DynamoDB blueprints that had significant changes.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.