VOOZH about

URL: https://www.nuget.org/packages/LambdaSharp/

⇱ NuGet Gallery | LambdaSharp 0.8.4.1




👁 Image
LambdaSharp 0.8.4.1

dotnet add package LambdaSharp --version 0.8.4.1
 
 
NuGet\Install-Package LambdaSharp -Version 0.8.4.1
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LambdaSharp" Version="0.8.4.1" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LambdaSharp" Version="0.8.4.1" />
 
Directory.Packages.props
<PackageReference Include="LambdaSharp" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LambdaSharp --version 0.8.4.1
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: LambdaSharp, 0.8.4.1"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LambdaSharp@0.8.4.1
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LambdaSharp&version=0.8.4.1
 
Install as a Cake Addin
#tool nuget:?package=LambdaSharp&version=0.8.4.1
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

LambdaSharp

This package contains interfaces and classes used for building Lambda functions on AWS.

Visit LambdaSharp.NET to learn more about building serverless .NET solutions on AWS.

ALambdaFunction

The ALambdaFunction base class provides functionality to initialize and process requests/responses using streams.

public class Function : ALambdaFunction {

 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config) {

 // TO-DO: add function initialization and reading configuration settings
 }

 public override sealed async Task<Stream> ProcessMessageStreamAsync(Stream stream) {
 var responseStream = new MemoryStream();
 responseStream.Write(Encoding.UTF8.GetBytes("Hello World!"));
 responseStream.Position = 0;
 return responseStream;
 }
}

ALambdaFunction<TRequest, TResponse>

The ALambdaFunction<TRequest, TResponse> base class adds functionality to deserialize/serialize the requests/responses with the JSON serializer specified in the constructor.

public sealed class Function : ALambdaFunction<FunctionRequest, FunctionResponse> {

 //--- Constructors ---
 public Function() : base(new LambdaSharp.Serialization.LambdaSystemTextJsonSerializer()) { }

 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config) {

 // TO-DO: add function initialization and reading configuration settings
 }

 public override async Task<FunctionResponse> ProcessMessageAsync(FunctionRequest request) {

 // TO-DO: add business logic

 return new FunctionResponse();
 }
}

JSON Serializers

This packages contains two serializers: LambdaSystemTextJsonSerializer and LambdaSourceGeneratorJsonSerializer.

LambdaSystemTextJsonSerializer is the recommended JSON serializer. LambdaSourceGeneratorJsonSerializer should be considered experimental as JSON source generators have many limitations.

LambdaSystemTextJsonSerializer

The construtor takes an optional callback to customize the JSON serialization options.

new LambdaSharp.Serialization.LambdaSystemTextJsonSerializer(options => {
 options.Converters.Add(new MyJsonConverter());
});

This following options are used by default:

  1. DefaultIgnoreCondition: JsonIgnoreCondition.WhenWritingNull
  2. IncludeFields: true
  3. NumberHandling: JsonNumberHandling.AllowReadingFromString
  4. Encoder: System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping

LambdaSourceGeneratorJsonSerializer

This class uses JSON serialization source generators, which avoids using reflection during runtime by creating the serialization/deserialization logic during compile time instead. Review current limitations of this approach and provide sufficient test coverage to ensure expected behavior.

First declare a partial class to hold the serialization/deserialization logic for the specified types.

[JsonSerializable(typeof(FunctionRequest))]
[JsonSerializable(typeof(FunctionResponse))]
public partial class FunctionJsonSerializerContext : JsonSerializerContext { }

Then pass in the default instance to the constructor.

new LambdaSharp.Serialization.LambdaSourceGeneratorJsonSerializer(FunctionJsonSerializerContext.Default)

LambdaSharp.Serialization.NewtonsoftJson (Additional Package)

The LambdaSharp.Serialization.NewtonsoftJson package is provided as a separate package. It is only recommended for legacy projects that require compatibility with JSON.NET annotations.

The construtor takes an optional callback to customize the JSON.NET serialization settings.

new LambdaSharp.Serialization.NewtonsoftJson(settings => {
 settings.NullValueHandling = NullValueHandling.Include;
})

Logging

The ALambdaFunction base classes includes logging methods to make it easy to report information to CloudWatch Logs and optionally to an error aggregator, such as Rollbar.

  • LogDebug(): Log a debugging message. This message will only appear in the log when debug logging is enabled and will not be forwarded to an error aggregator.
  • LogInfo(): Log an informational message. This message will only appear in the log and not be forwarded to an error aggregator.
  • LogWarn(): Log a warning message. This message will be reported if an error aggregator is configured for the <c>LambdaSharp.Core</c> module.
  • LogError(): Log an exception as an error. This message will be reported if an error aggregator is configured for the <c>LambdaSharp.Core</c> module.
  • LogErrorAsInfo(): Log an exception as an information message. This message will only appear in the log and not be forwarded to an error aggregator.
  • LogErrorAsWarning(): Log an exception as a warning. This message will be reported if an error aggregator is configured for the <c>LambdaSharp.Core</c> module.
  • LogFatal(): Log an exception with a custom message as a fatal error. This message will be reported if an error aggregator is configured for the <c>LambdaSharp.Core</c> module.
  • LogMetric(): Log a CloudWatch metric. The metric is picked up by CloudWatch logs and automatically ingested as a CloudWatch metric.

License

Copyright (c) 2018-2022 LambdaSharp (λ#)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Product Versions Compatible and additional computed target framework versions.
.NET net6.0 net6.0 is compatible.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (8)

Showing the top 5 NuGet packages that depend on LambdaSharp:

Package Downloads
LambdaSharp.Serialization.NewtonsoftJson

Serverless .NET for AWS - Serialization Library using Newtonsoft.Json

LambdaSharp.Schedule

Serverless .NET for AWS - CloudWatch Schedule Lambda Library

LambdaSharp.ApiGateway

Serverless .NET for AWS - API Gateway Lambda Library

LambdaSharp.CustomResource

Serverless .NET for AWS - CloudFormation Custom Resource Library

LambdaSharp.SimpleQueueService

Serverless .NET for AWS - SQS Lambda Library

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.8.4.1 98,706 4/18/2023
0.8.4 31,468 3/10/2022
0.8.3.5 3,302 3/4/2022
0.8.3.4 2,500 7/15/2021
0.8.3.3 1,953 7/15/2021
0.8.3.2 2,033 6/17/2021
0.8.3 1,969 5/19/2021
0.8.2.4 2,118 4/30/2021
0.8.2.3 2,406 4/2/2021
0.8.2.2 2,009 3/18/2021
0.8.2 7,801 2/16/2021
0.8.1.3 12,635 10/21/2020
0.8.1.2 879 10/21/2020
0.8.1 938 8/28/2020
0.8.1-rc1 668 8/24/2020
0.8.0.6 1,178 7/15/2020
0.8.0.5 911 7/2/2020
0.8.0.3 937 6/19/2020
0.8.0.2 920 6/3/2020
0.8.0 942 5/18/2020
Loading failed