From c576de1a32db6e1ab4b5ef84a7435a6c1f1c5202 Mon Sep 17 00:00:00 2001 From: Renato Golia Date: Wed, 29 Apr 2020 12:06:38 +0200 Subject: [PATCH] Update to .NET Core 3.1 runtime (#14) * Libraries now target .NET Core 3.1 instead of .NET Standard 2.0 * Templates now target .NET Core 3.1 * Templates now use `System.Text.Json` instead of `Newtonsoft.Json` for handling JSON * Update to README --- README.md | 16 ++++---- appveyor.yml | 2 +- build.cake | 40 +++++++++++++++++-- build/types.cake | 34 ---------------- samples/EventFunction/EventFunction.csproj | 2 +- samples/EventFunction/Function.cs | 2 +- samples/RequestResponseFunction/Function.cs | 2 +- .../RequestResponseFunction.csproj | 2 +- samples/SnsEventFunction/Function.cs | 5 +-- .../SnsEventFunction/SnsEventFunction.csproj | 2 +- .../Kralizek.Lambda.Template.Sns.csproj | 2 +- .../SnsEventHandler.cs | 5 +-- .../Kralizek.Lambda.Template.Sqs.csproj | 2 +- .../SqsEventHandler.cs | 4 +- .../Kralizek.Lambda.Template.csproj | 10 ++--- .../EmptyEventFunction.csproj | 6 +-- .../content/EmptyEventFunction/Function.cs | 2 +- .../aws-lambda-tools-defaults.json | 4 +- .../EmptyRequestResponseFunction.csproj | 6 +-- .../EmptyRequestResponseFunction/Function.cs | 2 +- .../aws-lambda-tools-defaults.json | 4 +- .../content/RichEventFunction/Function.cs | 2 +- .../RichEventFunction.csproj | 16 ++++---- .../aws-lambda-tools-defaults.json | 4 +- .../RichRequestResponseFunction/Function.cs | 2 +- .../RichRequestResponseFunction.csproj | 14 +++---- .../aws-lambda-tools-defaults.json | 4 +- .../content/SnsEventFunction/Function.cs | 2 +- .../content/SnsEventFunction/Notification.cs | 4 +- .../SnsEventFunction/SnsEventFunction.csproj | 8 ++-- .../aws-lambda-tools-defaults.json | 4 +- .../content/SqsEventFunction/Function.cs | 2 +- .../SqsEventFunction/SqsEventFunction.csproj | 6 +-- .../content/SqsEventFunction/TestMessage.cs | 4 +- .../aws-lambda-tools-defaults.json | 4 +- .../Tests.Lambda.Template.csproj | 2 +- 36 files changed, 114 insertions(+), 118 deletions(-) delete mode 100644 build/types.cake diff --git a/README.md b/README.md index 14646f8..e4108b6 100644 --- a/README.md +++ b/README.md @@ -17,17 +17,17 @@ This is what a minimal Lambda function will look like ```csharp public class Function : EventFunction { - protected override void Configure(IConfigurationBuilder builder) + protected override void Configure(IConfigurationBuilder builder) { } - protected override void ConfigureLogging(ILoggerFactory loggerFactory, IExecutionEnvironment executionEnvironment) + protected override void ConfigureLogging(ILoggingBuilder logging, IExecutionEnvironment executionEnvironment) { } - protected override void ConfigureServices(IServiceCollection services) + protected override void ConfigureServices(IServiceCollection services, IExecutionEnvironment executionEnvironment) { RegisterHandler(services); } @@ -35,7 +35,7 @@ public class Function : EventFunction ``` The only method required is `ConfigureServices` that you use to register your handler. -You can use `ConfigureLogging` to add log providers to the provided `LoggerFactory`. +You can use `ConfigureLogging` to add log providers to the provided `ILoggingBuilder`. `Configure` allows you to customize where your settings are taken from. Very much like ASP.NET Core web applications, you can use environment variables, configuration files and in-memory collections. # Type of functions and handlers @@ -83,8 +83,8 @@ public interface IEventHandler The best way to create a new AWS Lambda that uses this structure is to use the `dotnet new` template provided via NuGet. -1. Ensure you have the [.NET Core SDK 1.0.0+](https://www.microsoft.com/net/download/core) installed. -2. Open your console prompt of choice and type `dotnet new -i "Kralizek.Lambda.Templates::*"`. This will install the latest version of the templates. Depending on your previous usage of `dotnet new`, it might take some time. +1. Ensure you have the latest [.NET Core SDK](https://www.microsoft.com/net/download/core) installed. +2. Open your console prompt of choice and type `dotnet new -i "Kralizek.Lambda.Templates"`. This will install the latest version of the templates. Depending on your previous usage of `dotnet new`, it might take some time. 3. List all available templates by typing `dotnet new -all`. You will see 4 new entries, all starting with Lambda. 4. Create a new project using the template of your choice by typing `dotnet new {short name of the template} -n NameOfYourProject`. E.g. `dotnet new lambda-template-event-empty -n Sample` 5. Start hacking! @@ -110,7 +110,7 @@ The empty templates are created with just the minimum required dependencies. These include: * `Amazon.Lambda.Core` -* `Amazon.Lambda.Serialization.Json` +* `Amazon.Lambda.Serialization.SystemTextJson` * `Kralizek.Lambda.Template` * `Amazon.Lambda.Tools` @@ -124,7 +124,7 @@ The boilerplate templates are an enriched version of the empty templates. They c Besides the basic dependencies of the empty templates, the boilerplate templates have some extra dependencies. The extra dependencies are: -* `Amazon.Lambda.Serialization.Json` is used to push logs into AWS CloudWatch +* `Amazon.Lambda.Serialization.SystemTextJson` is used to push logs into AWS CloudWatch * `Kralizek.Extensions.Logging` contains several helper methods for better logging * `Microsoft.Extensions.Configuration.EnvironmentVariables` used to load configuration values from environment variables * `Microsoft.Extensions.Configuration.Json` used to load configuration values from json files diff --git a/appveyor.yml b/appveyor.yml index 65e9888..09ecef2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ max_jobs: 1 -image: Visual Studio 2017 +image: Visual Studio 2019 environment: MYGET_TOKEN: diff --git a/build.cake b/build.cake index df85c34..68e3181 100644 --- a/build.cake +++ b/build.cake @@ -1,10 +1,9 @@ #tool "nuget:?package=ReportGenerator&version=4.0.5" -#tool "nuget:?package=JetBrains.dotCover.CommandLineTools&version=2018.3.1" +#tool "nuget:?package=JetBrains.dotCover.CommandLineTools&version=2019.3.4" #tool "nuget:?package=GitVersion.CommandLine&version=4.0.0" #tool "nuget:?package=NuGet.CommandLine&version=4.9.2" #addin "Cake.FileHelpers" -#load "./build/types.cake" var target = Argument("Target", "Full"); @@ -242,4 +241,39 @@ Task("Full") .IsDependentOn("Pack") .IsDependentOn("Push"); -RunTarget(target); \ No newline at end of file +RunTarget(target); + +public class BuildState +{ + public VersionInfo Version { get; set; } + + public BuildPaths Paths { get; set; } +} + +public class BuildPaths +{ + public FilePath SolutionFile { get; set; } + + public DirectoryPath SolutionFolder => SolutionFile.GetDirectory(); + + public DirectoryPath TestFolder => SolutionFolder.Combine("tests"); + + public DirectoryPath OutputFolder => SolutionFolder.Combine("outputs"); + + public DirectoryPath TestOutputFolder => OutputFolder.Combine("tests"); + + public DirectoryPath ReportFolder => TestOutputFolder.Combine("report"); + + public FilePath DotCoverOutputFile => TestOutputFolder.CombineWithFilePath("coverage.dcvr"); + + public FilePath DotCoverOutputFileXml => TestOutputFolder.CombineWithFilePath("coverage.xml"); + + public FilePath OpenCoverResultFile => OutputFolder.CombineWithFilePath("OpenCover.xml"); +} + +public class VersionInfo +{ + public string PackageVersion { get; set; } + + public string BuildVersion {get; set; } +} diff --git a/build/types.cake b/build/types.cake deleted file mode 100644 index 62c74e4..0000000 --- a/build/types.cake +++ /dev/null @@ -1,34 +0,0 @@ -public class BuildState -{ - public VersionInfo Version { get; set; } - - public BuildPaths Paths { get; set; } -} - -public class BuildPaths -{ - public FilePath SolutionFile { get; set; } - - public DirectoryPath SolutionFolder => SolutionFile.GetDirectory(); - - public DirectoryPath TestFolder => SolutionFolder.Combine("tests"); - - public DirectoryPath OutputFolder => SolutionFolder.Combine("outputs"); - - public DirectoryPath TestOutputFolder => OutputFolder.Combine("tests"); - - public DirectoryPath ReportFolder => TestOutputFolder.Combine("report"); - - public FilePath DotCoverOutputFile => TestOutputFolder.CombineWithFilePath("coverage.dcvr"); - - public FilePath DotCoverOutputFileXml => TestOutputFolder.CombineWithFilePath("coverage.xml"); - - public FilePath OpenCoverResultFile => OutputFolder.CombineWithFilePath("OpenCover.xml"); -} - -public class VersionInfo -{ - public string PackageVersion { get; set; } - - public string BuildVersion {get; set; } -} diff --git a/samples/EventFunction/EventFunction.csproj b/samples/EventFunction/EventFunction.csproj index 414344a..38c7c02 100644 --- a/samples/EventFunction/EventFunction.csproj +++ b/samples/EventFunction/EventFunction.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp3.1 true Lambda diff --git a/samples/EventFunction/Function.cs b/samples/EventFunction/Function.cs index c63d7bb..e021050 100644 --- a/samples/EventFunction/Function.cs +++ b/samples/EventFunction/Function.cs @@ -6,7 +6,7 @@ using Microsoft.Extensions.Logging; // Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. -[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] namespace EventFunction { diff --git a/samples/RequestResponseFunction/Function.cs b/samples/RequestResponseFunction/Function.cs index e0362d7..04854d8 100644 --- a/samples/RequestResponseFunction/Function.cs +++ b/samples/RequestResponseFunction/Function.cs @@ -7,7 +7,7 @@ using Microsoft.Extensions.Logging; // Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. -[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] namespace RequestResponseFunction { diff --git a/samples/RequestResponseFunction/RequestResponseFunction.csproj b/samples/RequestResponseFunction/RequestResponseFunction.csproj index 681091d..1157929 100644 --- a/samples/RequestResponseFunction/RequestResponseFunction.csproj +++ b/samples/RequestResponseFunction/RequestResponseFunction.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp3.1 true Lambda diff --git a/samples/SnsEventFunction/Function.cs b/samples/SnsEventFunction/Function.cs index f82e92f..7722891 100644 --- a/samples/SnsEventFunction/Function.cs +++ b/samples/SnsEventFunction/Function.cs @@ -1,17 +1,14 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using Amazon.Lambda.Core; -using Amazon.Lambda.Serialization; using Amazon.Lambda.SNSEvents; using Kralizek.Lambda; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] namespace SnsEventFunction { diff --git a/samples/SnsEventFunction/SnsEventFunction.csproj b/samples/SnsEventFunction/SnsEventFunction.csproj index 241af62..950ffaf 100644 --- a/samples/SnsEventFunction/SnsEventFunction.csproj +++ b/samples/SnsEventFunction/SnsEventFunction.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp3.1 true Lambda diff --git a/src/Kralizek.Lambda.Template.Sns/Kralizek.Lambda.Template.Sns.csproj b/src/Kralizek.Lambda.Template.Sns/Kralizek.Lambda.Template.Sns.csproj index 29873af..ffdf0a7 100644 --- a/src/Kralizek.Lambda.Template.Sns/Kralizek.Lambda.Template.Sns.csproj +++ b/src/Kralizek.Lambda.Template.Sns/Kralizek.Lambda.Template.Sns.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netcoreapp3.1 Kralizek.Lambda.Template.Sns aws-lambda-csharp;dotnet-core;aws-lambda;aws;lambda;csharp;sns Extension to Kralizek.Lambda.Template to better support AWS Lambda functions that respond to SNS notifications. diff --git a/src/Kralizek.Lambda.Template.Sns/SnsEventHandler.cs b/src/Kralizek.Lambda.Template.Sns/SnsEventHandler.cs index a83bf64..937227b 100644 --- a/src/Kralizek.Lambda.Template.Sns/SnsEventHandler.cs +++ b/src/Kralizek.Lambda.Template.Sns/SnsEventHandler.cs @@ -6,8 +6,7 @@ using Amazon.Lambda.SNSEvents; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Newtonsoft.Json; - +using System.Text.Json; namespace Kralizek.Lambda { @@ -29,7 +28,7 @@ public async Task HandleAsync(SNSEvent input, ILambdaContext context) using (_serviceProvider.CreateScope()) { var message = record.Sns.Message; - var notification = JsonConvert.DeserializeObject(message); + var notification = JsonSerializer.Deserialize(message); var handler = _serviceProvider.GetService>(); diff --git a/src/Kralizek.Lambda.Template.Sqs/Kralizek.Lambda.Template.Sqs.csproj b/src/Kralizek.Lambda.Template.Sqs/Kralizek.Lambda.Template.Sqs.csproj index 581f553..0b70f52 100644 --- a/src/Kralizek.Lambda.Template.Sqs/Kralizek.Lambda.Template.Sqs.csproj +++ b/src/Kralizek.Lambda.Template.Sqs/Kralizek.Lambda.Template.Sqs.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netcoreapp3.1 Kralizek.Lambda.Template.Sqs aws-lambda-csharp;dotnet-core;aws-lambda;aws;lambda;csharp;sqs Extension to Kralizek.Lambda.Template to better support AWS Lambda functions that respond to SQS messages. diff --git a/src/Kralizek.Lambda.Template.Sqs/SqsEventHandler.cs b/src/Kralizek.Lambda.Template.Sqs/SqsEventHandler.cs index 119f6c1..ac23537 100644 --- a/src/Kralizek.Lambda.Template.Sqs/SqsEventHandler.cs +++ b/src/Kralizek.Lambda.Template.Sqs/SqsEventHandler.cs @@ -4,7 +4,7 @@ using Amazon.Lambda.SQSEvents; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Newtonsoft.Json; +using System.Text.Json; namespace Kralizek.Lambda { @@ -26,7 +26,7 @@ public async Task HandleAsync(SQSEvent input, ILambdaContext context) using (_serviceProvider.CreateScope()) { var sqsMessage = record.Body; - var message = JsonConvert.DeserializeObject(sqsMessage); + var message = JsonSerializer.Deserialize(sqsMessage); var handler = _serviceProvider.GetService>(); diff --git a/src/Kralizek.Lambda.Template/Kralizek.Lambda.Template.csproj b/src/Kralizek.Lambda.Template/Kralizek.Lambda.Template.csproj index db3b287..f070f30 100644 --- a/src/Kralizek.Lambda.Template/Kralizek.Lambda.Template.csproj +++ b/src/Kralizek.Lambda.Template/Kralizek.Lambda.Template.csproj @@ -1,18 +1,18 @@  - netstandard2.0 + netcoreapp3.1 Kralizek.Lambda.Template aws-lambda-csharp;dotnet-core;aws-lambda;aws;lambda;csharp A structured template to create AWS Lambda in C#. It supports Logging, Dependency Injection and Configuration like ASP.NET Core projects do. - + - - - + + + \ No newline at end of file diff --git a/templates/content/EmptyEventFunction/EmptyEventFunction.csproj b/templates/content/EmptyEventFunction/EmptyEventFunction.csproj index efa6fb1..1e2f4d1 100644 --- a/templates/content/EmptyEventFunction/EmptyEventFunction.csproj +++ b/templates/content/EmptyEventFunction/EmptyEventFunction.csproj @@ -1,13 +1,13 @@ - + - netcoreapp2.1 + netcoreapp3.1 true Lambda - + diff --git a/templates/content/EmptyEventFunction/Function.cs b/templates/content/EmptyEventFunction/Function.cs index 90935e2..bda2b71 100644 --- a/templates/content/EmptyEventFunction/Function.cs +++ b/templates/content/EmptyEventFunction/Function.cs @@ -4,7 +4,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] namespace EmptyEventFunction { diff --git a/templates/content/EmptyEventFunction/aws-lambda-tools-defaults.json b/templates/content/EmptyEventFunction/aws-lambda-tools-defaults.json index 0705eaf..6201fdc 100644 --- a/templates/content/EmptyEventFunction/aws-lambda-tools-defaults.json +++ b/templates/content/EmptyEventFunction/aws-lambda-tools-defaults.json @@ -11,10 +11,10 @@ "profile": "DefaultProfile", "region": "DefaultRegion", "configuration": "Release", - "framework": "netcoreapp2.0", + "framework": "netcoreapp3.1", "function-name": "EmptyEventFunction", "function-role": "DefaultRole", - "function-runtime": "dotnetcore2.0", + "function-runtime": "dotnetcore3.1", "function-memory-size": 128, "function-timeout": 30, "function-handler": "EmptyEventFunction::EmptyEventFunction.Function::FunctionHandlerAsync" diff --git a/templates/content/EmptyRequestResponseFunction/EmptyRequestResponseFunction.csproj b/templates/content/EmptyRequestResponseFunction/EmptyRequestResponseFunction.csproj index decb390..d429e19 100644 --- a/templates/content/EmptyRequestResponseFunction/EmptyRequestResponseFunction.csproj +++ b/templates/content/EmptyRequestResponseFunction/EmptyRequestResponseFunction.csproj @@ -1,13 +1,13 @@ - + - netcoreapp2.1 + netcoreapp3.1 true Lambda - + \ No newline at end of file diff --git a/templates/content/EmptyRequestResponseFunction/Function.cs b/templates/content/EmptyRequestResponseFunction/Function.cs index 05fc605..16d261e 100644 --- a/templates/content/EmptyRequestResponseFunction/Function.cs +++ b/templates/content/EmptyRequestResponseFunction/Function.cs @@ -4,7 +4,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] namespace EmptyRequestResponseFunction { diff --git a/templates/content/EmptyRequestResponseFunction/aws-lambda-tools-defaults.json b/templates/content/EmptyRequestResponseFunction/aws-lambda-tools-defaults.json index 70706c5..826a93d 100644 --- a/templates/content/EmptyRequestResponseFunction/aws-lambda-tools-defaults.json +++ b/templates/content/EmptyRequestResponseFunction/aws-lambda-tools-defaults.json @@ -11,10 +11,10 @@ "profile": "DefaultProfile", "region": "DefaultRegion", "configuration": "Release", - "framework": "netcoreapp2.1", + "framework": "netcoreapp3.1", "function-name": "EmptyRequestResponseFunction", "function-role": "DefaultRole", - "function-runtime": "dotnetcore2.1", + "function-runtime": "dotnetcore3.1", "function-memory-size": 128, "function-timeout": 30, "function-handler": "EmptyRequestResponseFunction::EmptyRequestResponseFunction.Function::FunctionHandlerAsync" diff --git a/templates/content/RichEventFunction/Function.cs b/templates/content/RichEventFunction/Function.cs index a21c00a..ceca879 100644 --- a/templates/content/RichEventFunction/Function.cs +++ b/templates/content/RichEventFunction/Function.cs @@ -5,7 +5,7 @@ using Microsoft.Extensions.Logging; using System.IO; -[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] namespace RichEventFunction { diff --git a/templates/content/RichEventFunction/RichEventFunction.csproj b/templates/content/RichEventFunction/RichEventFunction.csproj index 19988bb..a1f1203 100644 --- a/templates/content/RichEventFunction/RichEventFunction.csproj +++ b/templates/content/RichEventFunction/RichEventFunction.csproj @@ -1,20 +1,20 @@ - + - netcoreapp2.1 + netcoreapp3.1 true Lambda - - + + - + - - - + + + diff --git a/templates/content/RichEventFunction/aws-lambda-tools-defaults.json b/templates/content/RichEventFunction/aws-lambda-tools-defaults.json index 3aef9d4..a5b4dc4 100644 --- a/templates/content/RichEventFunction/aws-lambda-tools-defaults.json +++ b/templates/content/RichEventFunction/aws-lambda-tools-defaults.json @@ -11,10 +11,10 @@ "profile": "DefaultProfile", "region": "DefaultRegion", "configuration": "Release", - "framework": "netcoreapp2.1", + "framework": "netcoreapp3.1", "function-name": "RichEventFunction", "function-role": "DefaultRole", - "function-runtime": "dotnetcore2.1", + "function-runtime": "dotnetcore3.1", "function-memory-size": 128, "function-timeout": 30, "function-handler": "RichEventFunction::RichEventFunction.Function::FunctionHandlerAsync" diff --git a/templates/content/RichRequestResponseFunction/Function.cs b/templates/content/RichRequestResponseFunction/Function.cs index 8c93e9c..87c3914 100644 --- a/templates/content/RichRequestResponseFunction/Function.cs +++ b/templates/content/RichRequestResponseFunction/Function.cs @@ -5,7 +5,7 @@ using Microsoft.Extensions.Logging; using System.IO; -[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] namespace RichRequestResponseFunction { diff --git a/templates/content/RichRequestResponseFunction/RichRequestResponseFunction.csproj b/templates/content/RichRequestResponseFunction/RichRequestResponseFunction.csproj index 19988bb..1e9430e 100644 --- a/templates/content/RichRequestResponseFunction/RichRequestResponseFunction.csproj +++ b/templates/content/RichRequestResponseFunction/RichRequestResponseFunction.csproj @@ -1,20 +1,20 @@ - + - netcoreapp2.1 + netcoreapp3.1 true Lambda - + - + - - - + + + diff --git a/templates/content/RichRequestResponseFunction/aws-lambda-tools-defaults.json b/templates/content/RichRequestResponseFunction/aws-lambda-tools-defaults.json index a5ce50b..9e8a2d4 100644 --- a/templates/content/RichRequestResponseFunction/aws-lambda-tools-defaults.json +++ b/templates/content/RichRequestResponseFunction/aws-lambda-tools-defaults.json @@ -11,10 +11,10 @@ "profile": "DefaultProfile", "region": "DefaultRegion", "configuration": "Release", - "framework": "netcoreapp2.1", + "framework": "netcoreapp3.1", "function-name": "RichRequestResponseFunction", "function-role": "DefaultRole", - "function-runtime": "dotnetcore2.1", + "function-runtime": "dotnetcore3.1", "function-memory-size": 128, "function-timeout": 30, "function-handler": "RichRequestResponseFunction::RichRequestResponseFunction.Function::FunctionHandlerAsync" diff --git a/templates/content/SnsEventFunction/Function.cs b/templates/content/SnsEventFunction/Function.cs index cffc823..32c7365 100644 --- a/templates/content/SnsEventFunction/Function.cs +++ b/templates/content/SnsEventFunction/Function.cs @@ -5,7 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] namespace SnsEventFunction { diff --git a/templates/content/SnsEventFunction/Notification.cs b/templates/content/SnsEventFunction/Notification.cs index 4ce6769..bdabf01 100644 --- a/templates/content/SnsEventFunction/Notification.cs +++ b/templates/content/SnsEventFunction/Notification.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json; namespace SnsEventFunction { @@ -8,7 +8,7 @@ Add properties so that the message can be properly deserialized. */ public class Notification { - [JsonProperty("message")] + [JsonPropertyName("message")] public string Message { get; set; } } } \ No newline at end of file diff --git a/templates/content/SnsEventFunction/SnsEventFunction.csproj b/templates/content/SnsEventFunction/SnsEventFunction.csproj index 9e57797..a115bb7 100644 --- a/templates/content/SnsEventFunction/SnsEventFunction.csproj +++ b/templates/content/SnsEventFunction/SnsEventFunction.csproj @@ -1,14 +1,14 @@ - + - netcoreapp2.1 + netcoreapp3.1 true Lambda - - + + \ No newline at end of file diff --git a/templates/content/SnsEventFunction/aws-lambda-tools-defaults.json b/templates/content/SnsEventFunction/aws-lambda-tools-defaults.json index 8a9250d..9c7f895 100644 --- a/templates/content/SnsEventFunction/aws-lambda-tools-defaults.json +++ b/templates/content/SnsEventFunction/aws-lambda-tools-defaults.json @@ -11,10 +11,10 @@ "profile": "", "region": "", "configuration": "Release", - "framework": "netcoreapp2.1", + "framework": "netcoreapp3.1", "function-name": "SnsEventFunction", "function-role": "", - "function-runtime": "dotnetcore2.1", + "function-runtime": "dotnetcore3.1", "function-memory-size": 128, "function-timeout": 30, "function-handler": "SnsEventFunction::SnsEventFunction.Function::FunctionHandlerAsync" diff --git a/templates/content/SqsEventFunction/Function.cs b/templates/content/SqsEventFunction/Function.cs index 00d32f6..c65c2b9 100644 --- a/templates/content/SqsEventFunction/Function.cs +++ b/templates/content/SqsEventFunction/Function.cs @@ -5,7 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] namespace SqsEventFunction { diff --git a/templates/content/SqsEventFunction/SqsEventFunction.csproj b/templates/content/SqsEventFunction/SqsEventFunction.csproj index c2d16f6..9807e3c 100644 --- a/templates/content/SqsEventFunction/SqsEventFunction.csproj +++ b/templates/content/SqsEventFunction/SqsEventFunction.csproj @@ -1,4 +1,4 @@ - + netcoreapp2.1 @@ -7,8 +7,8 @@ - - + + \ No newline at end of file diff --git a/templates/content/SqsEventFunction/TestMessage.cs b/templates/content/SqsEventFunction/TestMessage.cs index 1c5e4d3..19dbdcd 100644 --- a/templates/content/SqsEventFunction/TestMessage.cs +++ b/templates/content/SqsEventFunction/TestMessage.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json; namespace SqsEventFunction { @@ -8,7 +8,7 @@ Add properties so that the message can be properly deserialized. */ public class TestMessage { - [JsonProperty("message")] + [JsonPropertyName("message")] public string Message { get; set; } } } \ No newline at end of file diff --git a/templates/content/SqsEventFunction/aws-lambda-tools-defaults.json b/templates/content/SqsEventFunction/aws-lambda-tools-defaults.json index bbb1437..d2f4ab7 100644 --- a/templates/content/SqsEventFunction/aws-lambda-tools-defaults.json +++ b/templates/content/SqsEventFunction/aws-lambda-tools-defaults.json @@ -11,10 +11,10 @@ "profile": "", "region": "", "configuration": "Release", - "framework": "netcoreapp2.1", + "framework": "netcoreapp3.1", "function-name": "SqsEventFunction", "function-role": "", - "function-runtime": "dotnetcore2.1", + "function-runtime": "dotnetcore3.1", "function-memory-size": 128, "function-timeout": 30, "function-handler": "SqsEventFunction::SqsEventFunction.Function::FunctionHandlerAsync" diff --git a/tests/Tests.Lambda.Template/Tests.Lambda.Template.csproj b/tests/Tests.Lambda.Template/Tests.Lambda.Template.csproj index 7dbb2e4..5e8c779 100644 --- a/tests/Tests.Lambda.Template/Tests.Lambda.Template.csproj +++ b/tests/Tests.Lambda.Template/Tests.Lambda.Template.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0 + netcoreapp3.1 false Tests.Lambda