Tiger.Stripes 1.0.0-rc4

This is a prerelease version of Tiger.Stripes.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Tiger.Stripes --version 1.0.0-rc4                
NuGet\Install-Package Tiger.Stripes -Version 1.0.0-rc4                
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="Tiger.Stripes" Version="1.0.0-rc4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tiger.Stripes --version 1.0.0-rc4                
#r "nuget: Tiger.Stripes, 1.0.0-rc4"                
#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.
// Install Tiger.Stripes as a Cake Addin
#addin nuget:?package=Tiger.Stripes&version=1.0.0-rc4&prerelease

// Install Tiger.Stripes as a Cake Tool
#tool nuget:?package=Tiger.Stripes&version=1.0.0-rc4&prerelease                

Tiger.Stripes

What It Is

Tiger.Stripes is a .NET library for simplifying the configuration and development of AWS Lambda Functions written in C# and compiled to NativeAOT. It provides a common host allowing for configuration and dependency injection nearly identical to that of ASP.NET Core.

Why You Want It

Even a non-complicated AWS Lambda Function can quickly gain a tedious amount of setup. An HttpClient requires a set of DelegatingHandlers, each of which requires its own set of dependencies, some of which are IOptions<TOptions>, and didn't Microsoft just release a library to simplify HttpClient?

Tiger.Lambda provides a host very similar to the WebApplicationHost of ASP.NET Core, allowing the application to be configured in all the ways familiar to an ASP.NET Core developer. The most common actions are exposed as overrideable methods on the Function handler. Even appsettings files are supported.

How To Use It

This library only targets .NET 8 and only targets AOT compilation. It simply will not work under the managed dotnet8 runtime. It must be deployed to a provided.* runtime.

The concept of a function handler is exposed by mapping a handler function to a name in the application builder. The following extremely simplified example illustrates a basic setup.

var builder = DownloaderApplication.CreateBuilder();

_ = builder.Services.AddSingleton(TimeProvider.System);
_ = builder.Services
    .AddSingleton<IValidateOptions<VendingMachineOptions>, VendingMachineOptions.Validator>()
    .AddOptions<VendingMachineOptions>()
    .BindConfiguration(VendingMachineOptions.VendingMachine);

await using var app = builder.Build();
_ = app.MapInvoke(
    "Vendor",
    static (object _, IAmazonS3 s3, TimeProvider time, IOptions<VendingMachineOptions> o) =>
    {
        var now = time.GetUtcNow();
        var req = new GetPreSignedUrlRequest
        {
            BucketName = o.Value.BucketName,
            Expires = now.Add(o.Value.CredentialsDuration).UtcDateTime,
            Key = Ulid.NewUlid(now).ToString("G", CI.InvariantCulture),
            Verb = HttpVerb.PUT,
        };
        return Results.Created(s3.GetPreSignedURL(req));
    },
    AwsContext.Default);

await app.RunAsync();

Invocations map a function handler to a name, and also provide the means to serialize input and deserialize outputs. This can be provided by a single instance of a type inheriting from JsonSerializerContext or by two instances of JsonTypeInfo<T>.

Thank You

Seriously, though. Thank you for using this software. The author hopes it performs admirably for you.

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

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-rc6 215 5/30/2024
1.0.0-rc5 56 5/13/2024
1.0.0-rc4 65 5/10/2024
1.0.0-rc3 241 3/28/2024
1.0.0-rc2 145 11/27/2023
1.0.0-rc1 120 11/14/2023

➟ Release 1.0.0
⁃ Everything is new!