-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed an issue where delimited string and primitive values in payload…
… were not parsed properly by Lambda Test Tool.
- Loading branch information
1 parent
5d11116
commit 69d7f0f
Showing
12 changed files
with
179 additions
and
6 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
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
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
31 changes: 31 additions & 0 deletions
31
Tools/LambdaTestTool/tests/LambdaFunctions/IntegerFunc/Function.cs
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,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
using Amazon.Lambda.Core; | ||
|
||
|
||
namespace IntegerFunc | ||
{ | ||
public class Function | ||
{ | ||
|
||
/// <summary> | ||
/// A simple function that takes an integer and returns a string. | ||
/// </summary> | ||
/// <param name="input"></param> | ||
/// <param name="context"></param> | ||
/// <returns></returns> | ||
[LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] | ||
public static string FunctionHandler(int input, ILambdaContext context) | ||
{ | ||
context.Logger.LogLine($"Executing function with input: {input}"); | ||
Console.WriteLine("Testing Console Logging"); | ||
|
||
return $"Hello {input}"; | ||
} | ||
} | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
Tools/LambdaTestTool/tests/LambdaFunctions/IntegerFunc/IntegerFunc.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,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net6.0;net8.0</TargetFrameworks> | ||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Amazon.Lambda.Core" Version="1.0.0" /> | ||
<PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.1.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<DotNetCliToolReference Include="Amazon.Lambda.Tools" Version="2.1.3" /> | ||
</ItemGroup> | ||
|
||
</Project> |
45 changes: 45 additions & 0 deletions
45
Tools/LambdaTestTool/tests/LambdaFunctions/IntegerFunc/Readme.md
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,45 @@ | ||
# AWS Lambda Empty Function Project | ||
|
||
This starter project consists of: | ||
* Function.cs - class file containing a class with a single function handler method | ||
* aws-lambda-tools-defaults.json - default argument settings for use with Visual Studio and command line deployment tools for AWS | ||
|
||
You may also have a test project depending on the options selected. | ||
|
||
The generated function handler is a simple method accepting an integer argument that returns a string. Replace the body of this method, and parameters, to suit your needs. | ||
|
||
## Here are some steps to follow from Visual Studio: | ||
|
||
To deploy your function to AWS Lambda, right click the project in Solution Explorer and select *Publish to AWS Lambda*. | ||
|
||
To view your deployed function open its Function View window by double-clicking the function name shown beneath the AWS Lambda node in the AWS Explorer tree. | ||
|
||
To perform testing against your deployed function use the Test Invoke tab in the opened Function View window. | ||
|
||
To configure event sources for your deployed function, for example to have your function invoked when an object is created in an Amazon S3 bucket, use the Event Sources tab in the opened Function View window. | ||
|
||
To update the runtime configuration of your deployed function use the Configuration tab in the opened Function View window. | ||
|
||
To view execution logs of invocations of your function use the Logs tab in the opened Function View window. | ||
|
||
## Here are some steps to follow to get started from the command line: | ||
|
||
Once you have edited your function you can use the following command lines to build, test and deploy your function to AWS Lambda from the command line (these examples assume the project name is *EmptyFunction*): | ||
|
||
Restore dependencies | ||
``` | ||
cd "BlueprintBaseName" | ||
dotnet restore | ||
``` | ||
|
||
Execute unit tests | ||
``` | ||
cd "BlueprintBaseName/test/BlueprintBaseName.Tests" | ||
dotnet test | ||
``` | ||
|
||
Deploy function to AWS Lambda | ||
``` | ||
cd "BlueprintBaseName/src/BlueprintBaseName" | ||
dotnet lambda deploy-function | ||
``` |
19 changes: 19 additions & 0 deletions
19
Tools/LambdaTestTool/tests/LambdaFunctions/IntegerFunc/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,19 @@ | ||
{ | ||
"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": "default", | ||
"region": "us-west-2", | ||
"configuration": "Release", | ||
"framework": "netcoreapp3.1", | ||
"function-runtime": "dotnetcore3.1", | ||
"function-memory-size": 256, | ||
"function-timeout": 30, | ||
"function-handler": "IntegerFunc::IntegerFunc.Function::FunctionHandler" | ||
} |
1 change: 1 addition & 0 deletions
1
Tools/LambdaTestTool/tests/LambdaFunctions/IntegerFunc/payload-sample.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 @@ | ||
42 |