-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding
dotnet
build method that is version agnostic
- Loading branch information
1 parent
537f3ce
commit bf7c162
Showing
7 changed files
with
122 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
tests/integration/testdata/buildcmd/Dotnet/HelloWorld.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> | ||
<OutputType>exe</OutputType> | ||
<AssemblyName>bootstrap</AssemblyName> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<SelfContained>true</SelfContained> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.7.1" /> | ||
<PackageReference Include="Amazon.Lambda.RuntimeSupport" Version="1.10.0" /> | ||
<PackageReference Include="Amazon.Lambda.Core" Version="2.3.0" /> | ||
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.3" /> | ||
</ItemGroup> | ||
|
||
</Project> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Amazon.Lambda.APIGatewayEvents; | ||
using Amazon.Lambda.Core; | ||
using Amazon.Lambda.RuntimeSupport; | ||
using Amazon.Lambda.Serialization.SystemTextJson; | ||
using System.Text.Json.Serialization; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Net.Http; | ||
using System.Net.Http.Headers; | ||
|
||
namespace HelloWorld; | ||
|
||
public class Function | ||
{ | ||
/// <summary> | ||
/// The main entry point for the custom runtime. | ||
/// </summary> | ||
/// <param name="args"></param> | ||
private static async Task Main(string[] args) | ||
{ | ||
Func<APIGatewayHttpApiV2ProxyRequest, ILambdaContext, string> handler = FunctionHandler; | ||
await LambdaBootstrapBuilder.Create(handler, new SourceGeneratorLambdaJsonSerializer<MyCustomJsonSerializerContext>()) | ||
.Build() | ||
.RunAsync(); | ||
} | ||
|
||
public static string FunctionHandler(APIGatewayHttpApiV2ProxyRequest apigProxyEvent, ILambdaContext context) | ||
{ | ||
return "{'message': 'Hello World'}"; | ||
} | ||
} | ||
|
||
[JsonSerializable(typeof(APIGatewayHttpApiV2ProxyRequest))] | ||
public partial class MyCustomJsonSerializerContext : JsonSerializerContext | ||
{ | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/integration/testdata/buildcmd/Dotnet/aws-lambda-tools-defaults.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"Information" : [ | ||
"This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.", | ||
"To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.", | ||
|
||
"dotnet lambda help", | ||
|
||
"All the command line options for the Lambda command can be specified in this file." | ||
], | ||
|
||
"profile":"", | ||
"region" : "", | ||
"configuration": "Release", | ||
"function-runtime":"provided.al2023", | ||
"function-memory-size" : 256, | ||
"function-timeout" : 30, | ||
"function-handler" : "HelloWorld::HelloWorld.Function::FunctionHandler" | ||
} |
38 changes: 38 additions & 0 deletions
38
tests/integration/testdata/buildcmd/template_build_method_dotnet.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
iAWSTemplateFormatVersion : '2010-09-09' | ||
Transform: AWS::Serverless-2016-10-31 | ||
|
||
Parameteres: | ||
Runtime: | ||
Type: String | ||
CodeUri: | ||
Type: String | ||
Handler: | ||
Type: String | ||
|
||
Resources: | ||
|
||
Function: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
Handler: !Ref Handler | ||
Runtime: !Ref Runtime | ||
CodeUri: !Ref CodeUri | ||
Timeout: 600 | ||
Metadata: | ||
BuildMethod: dotnet | ||
|
||
OtherRelativePathResource: | ||
Type: AWS::ApiGateway::RestApi | ||
Properties: | ||
BodyS3Location: SomeRelativePath | ||
|
||
GlueResource: | ||
Type: AWS::Glue::Job | ||
Properties: | ||
Command: | ||
ScriptLocation: SomeRelativePath | ||
|
||
ExampleNestedStack: | ||
Type: AWS::CloudFormation::Stack | ||
Properties: | ||
TemplateURL: https://s3.amazonaws.com/examplebucket/exampletemplate.yml |