Kanject.Core.CloudFunction.Abstractions 3.9.1

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Kanject.Core.CloudFunction.Abstractions --version 3.9.1
                    
NuGet\Install-Package Kanject.Core.CloudFunction.Abstractions -Version 3.9.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="Kanject.Core.CloudFunction.Abstractions" Version="3.9.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kanject.Core.CloudFunction.Abstractions" Version="3.9.1" />
                    
Directory.Packages.props
<PackageReference Include="Kanject.Core.CloudFunction.Abstractions" />
                    
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 Kanject.Core.CloudFunction.Abstractions --version 3.9.1
                    
#r "nuget: Kanject.Core.CloudFunction.Abstractions, 3.9.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 Kanject.Core.CloudFunction.Abstractions@3.9.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=Kanject.Core.CloudFunction.Abstractions&version=3.9.1
                    
Install as a Cake Addin
#tool nuget:?package=Kanject.Core.CloudFunction.Abstractions&version=3.9.1
                    
Install as a Cake Tool

Kanject.Core.CloudFunction.Abstractions

Provider-neutral contracts for Kanject serverless function hosts: the ICloudFunction host lifecycle, the ICloudFunctionHealthCheck<T> health-check contract, the environment and configuration-source enums, and the [CloudFunctionHost] / [RequireConfigSection<T>] attributes that the Kanject Lambda source generator reads.

Most projects never reference this package directly: Kanject.Core.CloudFunction.Provider.AwsLambda depends on it, so every Lambda project already has it. Reference it on its own when a shared library needs these types without the AWS runtime (for example, a contracts assembly that exposes CloudFunctionEnvironment), or when you implement another host against the same lifecycle.

Installation

dotnet add package Kanject.Core.CloudFunction.Abstractions

Targets .NET 8, .NET 9 and .NET 10. Native AOT / trimming compatible. Depends on Kanject.Core.

Which packages do I need?

You are building Install
An AWS Lambda function with a generated host (recommended) Kanject.Core.CloudFunction.Provider.AwsLambda, Kanject.Core.CloudFunction.Aws.Annotations (with PrivateAssets="all"), Amazon.Lambda.Serialization.SystemTextJson
An AWS Lambda function with a hand-written host Kanject.Core.CloudFunction.Provider.AwsLambda, Amazon.Lambda.Serialization.SystemTextJson
A library that only needs these contracts, enums or attributes Kanject.Core.CloudFunction.Abstractions

AWS Lambda is currently the only provider (CloudProvider.AwsLambda).

Quick start

The two attributes in this package describe a Lambda host declaratively. In a project that also references the AWS Lambda provider and the Kanject.Core.CloudFunction.Aws.Annotations generator, this is a complete host class:

using Kanject.Core.CloudFunction.Abstractions.Attributes;
using Kanject.Core.CloudFunction.Abstractions.Enums;
using Microsoft.Extensions.DependencyInjection;

namespace Orders.Lambda;

public sealed class AppSettings
{
    public string TableName { get; set; } = string.Empty;
}

[CloudFunctionHost(DebugEnvironment = CloudFunctionEnvironment.Development)]
[RequireConfigSection<AppSettings>("AppSettings")]
public partial class Functions
{
    public override void ConfigureServices(IServiceCollection services)
    {
        // AppSettings is a generated property, bound and validated before this method runs.
        services.AddSingleton(AppSettings);
    }
}

The generator supplies the base class, constructor, OnStartup and the assembly-level Lambda serializer. See the Kanject.Core.CloudFunction.Aws.Annotations package for exactly what it emits, and Kanject.Core.CloudFunction.Provider.AwsLambda for how the host runs.

Host lifecycle

ICloudFunction defines four members. The AWS Lambda provider calls them in this order the first time a function instance is constructed:

Step Member Purpose
1 Build() Called from the base constructor; builds the host once per process.
2 OnStartup(IConfigurationBuilder) Add configuration sources (Parameter Store, extra JSON files, and so on).
3 ConfigureServices(IServiceCollection) Register the function's services.
4 Configure(IServiceProvider) Post-container work, such as warming a service at cold start.

With [CloudFunctionHost], the generator writes OnStartup for you and you write ConfigureServices; Configure stays optional.

Environments

CloudFunctionEnvironment names the stage a function runs in: Development, Staging, Test, Qa, Production.

The AWS Lambda provider normally takes the environment name from the ASPNETCORE_LAMBDA_ENVIRONMENT or ASPNETCORE_ENVIRONMENT variable. Passing a CloudFunctionEnvironment to the base constructor, or setting DebugEnvironment on [CloudFunctionHost] (Debug builds only), pins it to the member name instead. The name selects appsettings.{Environment}.json.

Declarative host attributes

  • [CloudFunctionHost] marks a partial class as a function host. Its properties (Provider, DebugEnvironment, ConfigurationSource, DebugFetchSecretPathFromAppSettings, EmitLambdaSerializer, EnableAot) choose what the generator emits. Use one per assembly.
  • [RequireConfigSection<T>(sectionName)] declares that a configuration section must bind to T at cold start. You can apply it more than once. For each occurrence the generator emits a bind-or-throw check and a property that exposes the bound instance. It names that property from PropertyName if you set it, otherwise from the section name (when that is a valid C# identifier), otherwise from T's simple name. The attribute only validates: it does not register IOptions<T>.

ConfigurationSource has two values. None (the default) adds no source. AwsSystemManagerParameterStore wires AWS Systems Manager Parameter Store through the Kanject.Core.Api.Aws.Extensions package, which the consuming project must reference.

The generator package documents the full option reference and its analyzer rules.

Health-check contract

ICloudFunctionHealthCheck<TCloudFunction> is a fluent registration API for startup and on-demand health checks. The AWS Lambda CloudFunction implements it:

Member Purpose
AddHealthCheckEndpoint(name, endpoint, isAccessTokenRequired) Register an HTTP endpoint to probe.
AddHealthCheckEndpoint(name, endpoint, getAuthenticationToken) Register an endpoint that is probed with a bearer token from the delegate.
AddHealthCheckEndpoint(requiresAccessToken, params (name, endpoint)[]) Register several endpoints at once.
AddHealthCheckEndpointAccessTokenFunc(Func<Task<string>>) Set the default token delegate for endpoints that require one.
AddHealthCheckFunction<T>(name, Func<Task<T>>) Register a named delegate to invoke during a health check.
PerformHealthCheck() Run the registered checks and return once they have all finished.
PerformHealthCheckAsync(CancellationToken) The same, as a task. The default interface implementation calls PerformHealthCheck(); the AWS Lambda CloudFunction runs the checks asynchronously.

The registrations are stored as IHealthCheckEndpointModel / IHealthCheckFuncModel instances (both derive from IHealthCheckModel). HealthCheckEndpointModel and HealthCheckFuncWithModel are the concrete implementations.

Public surface at a glance

Type Purpose
ICloudFunction Host lifecycle: Build, OnStartup, ConfigureServices, Configure.
ICloudFunctionHealthCheck<TCloudFunction> Fluent health-check registration and execution.
IEventCloudFunction Contract for functions that publish events: ConfigureEventHubClientName, EventLogger<TEventArgs>. The CloudFunction packages do not ship an implementation.
ICloudEventClient Contract for an event-publishing client: SilentPublish<TPayload>, AddEventHubCredentials. The CloudFunction packages do not ship an implementation.
CloudFunctionHostAttribute Marks a partial class for host generation.
RequireConfigSectionAttribute<T> Declares a configuration section that must bind at cold start.
CloudFunctionEnvironment Development, Staging, Test, Qa, Production.
CloudProvider AwsLambda.
ConfigurationSource None, AwsSystemManagerParameterStore.
IHealthCheckModel, IHealthCheckEndpointModel, IHealthCheckFuncModel Health-check registration shapes.
HealthCheckEndpointModel, HealthCheckFuncWithModel Concrete health-check registrations.

Namespaces: Kanject.Core.CloudFunction.Abstractions.Interfaces, .Attributes, .Enums and .Models.

Package Role Availability
Kanject.Core.CloudFunction.Provider.AwsLambda AWS Lambda host: the CloudFunction base class that implements these contracts nuget.org
Kanject.Core.CloudFunction.Aws.Annotations Source generator and analyzers for [CloudFunctionHost] and [RequireConfigSection<T>] nuget.org
Kanject.Core.Api.Aws.Extensions Parameter Store configuration source used by ConfigurationSource.AwsSystemManagerParameterStore nuget.org
Kanject.Core Core library this package depends on nuget.org

License

Licensed under the Kanject Code Libraries License Agreement (KCLLA); the full text ships in this package as LICENSE.md. Organizations whose trailing-twelve-month gross revenue and total funding raised are each below US$250,000 may use it at no cost under the Free Tier. At or above either threshold a commercial license is required — contact commercial@kanjectbusiness.com.

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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  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 (1)

Showing the top 1 NuGet packages that depend on Kanject.Core.CloudFunction.Abstractions:

Package Downloads
Kanject.Core.CloudFunction.Provider.AwsLambda

Kanject core cloud function aws lambda provider

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.10.0 37 10/2/2026
3.9.1 127 9/27/2026
3.9.0 97 9/27/2026
3.8.7 102 9/26/2026
3.8.6 137 9/7/2026
3.8.5 126 8/27/2026
3.8.4 134 8/22/2026
3.8.3 130 8/10/2026
3.8.2 128 8/9/2026
3.8.1 129 8/5/2026
3.8.0 125 8/5/2026
3.7.0 143 8/3/2026
3.6.7 153 7/30/2026
3.6.6 149 7/18/2026
3.6.5 125 7/13/2026
3.6.4 139 7/11/2026
3.6.3 131 7/11/2026
3.6.2 177 7/9/2026
3.6.1 139 7/9/2026