Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
22d1469
Task 1
normj Feb 12, 2026
5e0f810
Task 2
normj Feb 12, 2026
20e5ba8
Task 3
normj Feb 12, 2026
0cdb159
Task 4
normj Feb 16, 2026
0aa892b
Task 5
normj Feb 16, 2026
5e29c21
Task 4 (after redesign)
normj Feb 17, 2026
603612d
Task 5
normj Feb 17, 2026
63224bf
Task 6
normj Feb 17, 2026
14c993b
Task 8
normj Feb 18, 2026
0b8dd52
Task 10
normj Feb 18, 2026
414a449
Refactoring
normj Feb 19, 2026
21d82d8
Cleanup
normj Feb 19, 2026
556b726
Remove tests
normj Feb 19, 2026
4d5dee2
Clean up and rework Semaphore locks
normj Mar 5, 2026
d8322ff
Merge branch 'normj/response-streaming' of https://github.com/aws/aws…
normj Mar 5, 2026
645771e
Start working on supporting having a prelude chuck in the response st…
normj Mar 5, 2026
1f17a58
Rework to support class library programming model
normj Mar 5, 2026
99b83c2
Rework encoding and add support for using API Gateway
normj Mar 6, 2026
ab93ce9
Backfill tests after refactor
normj Mar 6, 2026
f679efa
Merge branch 'dev' of https://github.com/aws/aws-lambda-dotnet into dev
normj Mar 6, 2026
bd0170e
Merge branch 'dev' into normj/response-streaming
normj Mar 6, 2026
d60bb93
Add integ tests
normj Mar 11, 2026
9b308ae
Improve test error message
normj Mar 11, 2026
d0861c6
Debugging integ tests
normj Mar 12, 2026
3c86629
Update change file
normj Mar 12, 2026
c637ef1
Address PR comments
normj Mar 17, 2026
42d3212
Rework to have my own HttpClient implementation to handle trailing he…
normj Apr 3, 2026
b7b51bd
Change response stream factory to return LambdaResponseStream instead…
normj Apr 3, 2026
2eb2eb4
Clean up
normj Apr 3, 2026
1a86609
Ensure prelude with delimiter are written as a single chunk
normj Apr 3, 2026
98d2d25
Bug fixes
normj Apr 4, 2026
d86f1af
Application Load Balancer (ALB) (#2318)
GarrettBeatty Apr 8, 2026
dcfacf2
Release 2026-04-08 (#2326)
aws-sdk-dotnet-automation Apr 8, 2026
88ba85a
Add CODEOWNERS file
AlexDaines Apr 9, 2026
e06cfdd
Add [S3Event] annotation attribute and source generator support (#2321)
GarrettBeatty Apr 13, 2026
78afc7a
treat warnings as errors (#2329)
GarrettBeatty Apr 13, 2026
98a1f28
chore: improve test flakiness (#2325)
philasmar Apr 13, 2026
49d8839
Release 2026-04-13 #2 (#2330)
aws-sdk-dotnet-automation Apr 13, 2026
d984c37
Add [FunctionUrl] annotation attribute with CORS support and source g…
GarrettBeatty Apr 14, 2026
ee1a65e
Release 2026-04-14 (#2332)
aws-sdk-dotnet-automation Apr 14, 2026
8c960cc
Merge pull request #2327 from aws/adaines/add-codeowners
AlexDaines Apr 14, 2026
e41aea2
Merge branch 'dev' of https://github.com/aws/aws-lambda-dotnet into dev
normj Apr 14, 2026
4a5e000
Merge branch 'dev' into normj/response-streaming
normj Apr 14, 2026
2e70f8d
Address PR comments
normj Apr 14, 2026
62a9ad7
Remove obsolete unit test
normj Apr 14, 2026
6d5d887
Add support for Lambda Response Streaming in ASP.NET Core bridge pack…
normj Apr 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .autover/changes/c27a62e6-91ca-4a59-9406-394866cdfa62.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"Projects": [
{
"Name": "Amazon.Lambda.RuntimeSupport",
"Type": "Minor",
"ChangelogMessages": [
"(Preview) Add response streaming support"
]
},
{
"Name": "Amazon.Lambda.Core",
"Type": "Minor",
"ChangelogMessages": [
"(Preview) Add response streaming support"
]
}
]
}
27 changes: 27 additions & 0 deletions .autover/changes/f0d5a912-bcfa-4244-96cb-ac3c847f877c.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"Projects": [
{
"Name": "Amazon.Lambda.AspNetCoreServer",
"Type": "Major",
"ChangelogMessages": [
"[Breaking] Update build targets from .NET 6 and 8 to .NET 8 and 10",
"[Preview] Add support for Lambda Response Streaming enabled by setting the EnableResponseStreaming property from the base class AbstractAspNetCoreFunction"
]
},
{
"Name": "Amazon.Lambda.AspNetCoreServer.Hosting",
"Type": "Major",
"ChangelogMessages": [
"[Breaking] Update build targets from .NET 6 and 8 to .NET 8 and 10",
"[Preview] Add support for Lambda Response Streaming enabled by setting the EnableResponseStreaming property on the HostingOptions object passed into the AddAWSLambdaHosting method"
]
},
{
"Name": "Amazon.Lambda.Logging.AspNetCore",
"Type": "Major",
"ChangelogMessages": [
"[Breaking] Update build targets from .NET 6 and 8 to .NET 8 and 10"
]
}
]
}
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @aws/aws-sdk-dotnet-team
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*.suo
*.user

**/.kiro/

####################
# Build/Test folders
####################
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
## Release 2026-04-14

### Amazon.Lambda.TestTool.BlazorTester (0.17.1)
* Minor fixes to improve the testability of the package
### Amazon.Lambda.RuntimeSupport (1.14.3)
* Minor fixes to improve the testability of the package
### Amazon.Lambda.Annotations (1.13.0)
* Added [FunctionUrl] attribute for configuring Lambda functions with Function URL endpoints, including optional CORS support

## Release 2026-04-13 #2

### Amazon.Lambda.Annotations (1.12.0)
* treat warnings as errors and fix unshipped.md
* Added [S3Event] annotation attribute for declaratively configuring S3 event-triggered Lambda functions with support for bucket reference, event types, key prefix/suffix filters, and enabled state.

## Release 2026-04-08

### Amazon.Lambda.Annotations (1.11.0)
* Added [ALBApi] attribute for configuring Lambda functions as targets behind an Application Load Balancer

## Release 2026-03-27

### Amazon.Lambda.Annotations (1.10.0)
Expand Down
5 changes: 4 additions & 1 deletion Libraries/Amazon.Lambda.Annotations.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"test\\TestCustomAuthorizerApp.IntegrationTests\\TestCustomAuthorizerApp.IntegrationTests.csproj",
"test\\TestServerlessApp.IntegrationTests\\TestServerlessApp.IntegrationTests.csproj",
"test\\TestServerlessApp.NET8\\TestServerlessApp.NET8.csproj",
"test\\TestServerlessApp\\TestServerlessApp.csproj"
"src\\Amazon.Lambda.ApplicationLoadBalancerEvents\\Amazon.Lambda.ApplicationLoadBalancerEvents.csproj",
"test\\TestServerlessApp\\TestServerlessApp.csproj",
"test\\TestServerlessApp.ALB\\TestServerlessApp.ALB.csproj",
"test\\TestServerlessApp.ALB.IntegrationTests\\TestServerlessApp.ALB.IntegrationTests.csproj"
]
}
}
5 changes: 3 additions & 2 deletions Libraries/Amazon.Lambda.RuntimeSupport.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
"src\\SnapshotRestore.Registry\\SnapshotRestore.Registry.csproj",
"test\\Amazon.Lambda.RuntimeSupport.Tests\\Amazon.Lambda.RuntimeSupport.IntegrationTests\\Amazon.Lambda.RuntimeSupport.IntegrationTests.csproj",
"test\\Amazon.Lambda.RuntimeSupport.Tests\\Amazon.Lambda.RuntimeSupport.UnitTests\\Amazon.Lambda.RuntimeSupport.UnitTests.csproj",
"test\\Amazon.Lambda.RuntimeSupport.Tests\\AspNetCoreStreamingApiGatewayTest\\AspNetCoreStreamingApiGatewayTest.csproj",
"test\\Amazon.Lambda.RuntimeSupport.Tests\\CustomRuntimeAspNetCoreMinimalApiCustomSerializerTest\\CustomRuntimeAspNetCoreMinimalApiCustomSerializerTest.csproj",
"test\\Amazon.Lambda.RuntimeSupport.Tests\\CustomRuntimeAspNetCoreMinimalApiTest\\CustomRuntimeAspNetCoreMinimalApiTest.csproj",
"test\\Amazon.Lambda.RuntimeSupport.Tests\\CustomRuntimeFunctionTest\\CustomRuntimeFunctionTest.csproj",
"test\\SnapshotRestore.Registry.Tests\\SnapshotRestore.Registry.Tests.csproj",
"test\\HandlerTestNoSerializer\\HandlerTestNoSerializer.csproj",
"test\\HandlerTest\\HandlerTest.csproj"
"test\\HandlerTest\\HandlerTest.csproj",
"test\\SnapshotRestore.Registry.Tests\\SnapshotRestore.Registry.Tests.csproj"
]
}
}
64 changes: 62 additions & 2 deletions Libraries/Libraries.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31717.71
# Visual Studio Version 18
VisualStudioVersion = 18.3.11512.155
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{AAB54E74-20B1-42ED-BC3D-CE9F7BC7FD12}"
EndProject
Expand Down Expand Up @@ -151,6 +151,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestCustomAuthorizerApp.Int
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestCustomAuthorizerApp", "test\TestCustomAuthorizerApp\TestCustomAuthorizerApp.csproj", "{3BFA4B73-BA61-4578-833B-C5B3A16EDA9E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestServerlessApp.ALB", "test\TestServerlessApp.ALB\TestServerlessApp.ALB.csproj", "{8F7C617D-C611-4DC6-A07C-033F13C1835D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestServerlessApp.ALB.IntegrationTests", "test\TestServerlessApp.ALB.IntegrationTests\TestServerlessApp.ALB.IntegrationTests.csproj", "{80594C21-C6EB-469E-83CC-68F9F661CA5E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResponseStreamingFunctionHandlers", "test\Amazon.Lambda.RuntimeSupport.Tests\ResponseStreamingFunctionHandlers\ResponseStreamingFunctionHandlers.csproj", "{E404A7AC-812B-BC03-CA76-02C0BC2BA7F9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNetCoreStreamingApiGatewayTest", "test\Amazon.Lambda.RuntimeSupport.Tests\AspNetCoreStreamingApiGatewayTest\AspNetCoreStreamingApiGatewayTest.csproj", "{0768FA72-CF49-2B59-BC4C-E4CE579E5D93}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -941,6 +949,54 @@ Global
{3BFA4B73-BA61-4578-833B-C5B3A16EDA9E}.Release|x64.Build.0 = Release|Any CPU
{3BFA4B73-BA61-4578-833B-C5B3A16EDA9E}.Release|x86.ActiveCfg = Release|Any CPU
{3BFA4B73-BA61-4578-833B-C5B3A16EDA9E}.Release|x86.Build.0 = Release|Any CPU
{8F7C617D-C611-4DC6-A07C-033F13C1835D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8F7C617D-C611-4DC6-A07C-033F13C1835D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F7C617D-C611-4DC6-A07C-033F13C1835D}.Debug|x64.ActiveCfg = Debug|Any CPU
{8F7C617D-C611-4DC6-A07C-033F13C1835D}.Debug|x64.Build.0 = Debug|Any CPU
{8F7C617D-C611-4DC6-A07C-033F13C1835D}.Debug|x86.ActiveCfg = Debug|Any CPU
{8F7C617D-C611-4DC6-A07C-033F13C1835D}.Debug|x86.Build.0 = Debug|Any CPU
{8F7C617D-C611-4DC6-A07C-033F13C1835D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F7C617D-C611-4DC6-A07C-033F13C1835D}.Release|Any CPU.Build.0 = Release|Any CPU
{8F7C617D-C611-4DC6-A07C-033F13C1835D}.Release|x64.ActiveCfg = Release|Any CPU
{8F7C617D-C611-4DC6-A07C-033F13C1835D}.Release|x64.Build.0 = Release|Any CPU
{8F7C617D-C611-4DC6-A07C-033F13C1835D}.Release|x86.ActiveCfg = Release|Any CPU
{8F7C617D-C611-4DC6-A07C-033F13C1835D}.Release|x86.Build.0 = Release|Any CPU
{80594C21-C6EB-469E-83CC-68F9F661CA5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80594C21-C6EB-469E-83CC-68F9F661CA5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80594C21-C6EB-469E-83CC-68F9F661CA5E}.Debug|x64.ActiveCfg = Debug|Any CPU
{80594C21-C6EB-469E-83CC-68F9F661CA5E}.Debug|x64.Build.0 = Debug|Any CPU
{80594C21-C6EB-469E-83CC-68F9F661CA5E}.Debug|x86.ActiveCfg = Debug|Any CPU
{80594C21-C6EB-469E-83CC-68F9F661CA5E}.Debug|x86.Build.0 = Debug|Any CPU
{80594C21-C6EB-469E-83CC-68F9F661CA5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80594C21-C6EB-469E-83CC-68F9F661CA5E}.Release|Any CPU.Build.0 = Release|Any CPU
{80594C21-C6EB-469E-83CC-68F9F661CA5E}.Release|x64.ActiveCfg = Release|Any CPU
{80594C21-C6EB-469E-83CC-68F9F661CA5E}.Release|x64.Build.0 = Release|Any CPU
{80594C21-C6EB-469E-83CC-68F9F661CA5E}.Release|x86.ActiveCfg = Release|Any CPU
{80594C21-C6EB-469E-83CC-68F9F661CA5E}.Release|x86.Build.0 = Release|Any CPU
{E404A7AC-812B-BC03-CA76-02C0BC2BA7F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E404A7AC-812B-BC03-CA76-02C0BC2BA7F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E404A7AC-812B-BC03-CA76-02C0BC2BA7F9}.Debug|x64.ActiveCfg = Debug|Any CPU
{E404A7AC-812B-BC03-CA76-02C0BC2BA7F9}.Debug|x64.Build.0 = Debug|Any CPU
{E404A7AC-812B-BC03-CA76-02C0BC2BA7F9}.Debug|x86.ActiveCfg = Debug|Any CPU
{E404A7AC-812B-BC03-CA76-02C0BC2BA7F9}.Debug|x86.Build.0 = Debug|Any CPU
{E404A7AC-812B-BC03-CA76-02C0BC2BA7F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E404A7AC-812B-BC03-CA76-02C0BC2BA7F9}.Release|Any CPU.Build.0 = Release|Any CPU
{E404A7AC-812B-BC03-CA76-02C0BC2BA7F9}.Release|x64.ActiveCfg = Release|Any CPU
{E404A7AC-812B-BC03-CA76-02C0BC2BA7F9}.Release|x64.Build.0 = Release|Any CPU
{E404A7AC-812B-BC03-CA76-02C0BC2BA7F9}.Release|x86.ActiveCfg = Release|Any CPU
{E404A7AC-812B-BC03-CA76-02C0BC2BA7F9}.Release|x86.Build.0 = Release|Any CPU
{0768FA72-CF49-2B59-BC4C-E4CE579E5D93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0768FA72-CF49-2B59-BC4C-E4CE579E5D93}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0768FA72-CF49-2B59-BC4C-E4CE579E5D93}.Debug|x64.ActiveCfg = Debug|Any CPU
{0768FA72-CF49-2B59-BC4C-E4CE579E5D93}.Debug|x64.Build.0 = Debug|Any CPU
{0768FA72-CF49-2B59-BC4C-E4CE579E5D93}.Debug|x86.ActiveCfg = Debug|Any CPU
{0768FA72-CF49-2B59-BC4C-E4CE579E5D93}.Debug|x86.Build.0 = Debug|Any CPU
{0768FA72-CF49-2B59-BC4C-E4CE579E5D93}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0768FA72-CF49-2B59-BC4C-E4CE579E5D93}.Release|Any CPU.Build.0 = Release|Any CPU
{0768FA72-CF49-2B59-BC4C-E4CE579E5D93}.Release|x64.ActiveCfg = Release|Any CPU
{0768FA72-CF49-2B59-BC4C-E4CE579E5D93}.Release|x64.Build.0 = Release|Any CPU
{0768FA72-CF49-2B59-BC4C-E4CE579E5D93}.Release|x86.ActiveCfg = Release|Any CPU
{0768FA72-CF49-2B59-BC4C-E4CE579E5D93}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1015,6 +1071,10 @@ Global
{8D03BDF3-7078-4B46-A3F1-C73BE6D6CE0D} = {1DE4EE60-45BA-4EF7-BE00-B9EB861E4C69}
{8EEDD576-7FC4-4FAC-A5A2-F58562753A53} = {1DE4EE60-45BA-4EF7-BE00-B9EB861E4C69}
{3BFA4B73-BA61-4578-833B-C5B3A16EDA9E} = {1DE4EE60-45BA-4EF7-BE00-B9EB861E4C69}
{8F7C617D-C611-4DC6-A07C-033F13C1835D} = {1DE4EE60-45BA-4EF7-BE00-B9EB861E4C69}
{80594C21-C6EB-469E-83CC-68F9F661CA5E} = {1DE4EE60-45BA-4EF7-BE00-B9EB861E4C69}
{E404A7AC-812B-BC03-CA76-02C0BC2BA7F9} = {B5BD0336-7D08-492C-8489-42C987E29B39}
{0768FA72-CF49-2B59-BC4C-E4CE579E5D93} = {B5BD0336-7D08-492C-8489-42C987E29B39}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {503678A4-B8D1-4486-8915-405A3E9CF0EB}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<IncludeBuildOutput>false</IncludeBuildOutput>

<Version>1.10.0</Version>
<Version>1.13.0</Version>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<!-- Delay setting the package id till after resolving dependencies to avoid ambigious errors. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ AWSLambda0128 | AWSLambdaCSharpGenerator | Error | Authorizer Payload Version Mi
AWSLambda0129 | AWSLambdaCSharpGenerator | Error | Missing LambdaFunction Attribute
AWSLambda0130 | AWSLambdaCSharpGenerator | Error | Invalid return type IAuthorizerResult
AWSLambda0131 | AWSLambdaCSharpGenerator | Error | FromBody not supported on Authorizer functions
AWSLambda0132 | AWSLambdaCSharpGenerator | Error | Invalid ALBApiAttribute
AWSLambda0133 | AWSLambdaCSharpGenerator | Error | ALB Listener Reference Not Found
AWSLambda0134 | AWSLambdaCSharpGenerator | Error | FromRoute not supported on ALB functions
AWSLambda0135 | AWSLambdaCSharpGenerator | Error | Unmapped parameter on ALB function
AWSLambda0136 | AWSLambdaCSharpGenerator | Error | Invalid S3EventAttribute
Original file line number Diff line number Diff line change
Expand Up @@ -242,5 +242,44 @@ public static class DiagnosticDescriptors
category: "AWSLambdaCSharpGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static readonly DiagnosticDescriptor InvalidAlbApiAttribute = new DiagnosticDescriptor(
id: "AWSLambda0132",
title: "Invalid ALBApiAttribute",
messageFormat: "Invalid ALBApiAttribute encountered: {0}",
category: "AWSLambdaCSharpGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static readonly DiagnosticDescriptor AlbListenerReferenceNotFound = new DiagnosticDescriptor(
id: "AWSLambda0133",
title: "ALB Listener Reference Not Found",
messageFormat: "The ALBApi ListenerArn references '@{0}', but no resource or parameter named '{0}' was found in the CloudFormation template. Add the listener resource to the template or correct the reference name.",
category: "AWSLambdaCSharpGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static readonly DiagnosticDescriptor FromRouteNotSupportedOnAlb = new DiagnosticDescriptor(
id: "AWSLambda0134",
title: "FromRoute not supported on ALB functions",
messageFormat: "[FromRoute] is not supported on ALB functions. ALB does not support route path template parameters. Use [FromHeader], [FromQuery], or [FromBody] instead.",
category: "AWSLambdaCSharpGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static readonly DiagnosticDescriptor AlbUnmappedParameter = new DiagnosticDescriptor(
id: "AWSLambda0135",
title: "Unmapped parameter on ALB function",
messageFormat: "Parameter '{0}' on ALB function has no binding attribute. Use [FromHeader], [FromQuery], [FromBody], or [FromServices], or use the ApplicationLoadBalancerRequest or ILambdaContext types.",
category: "AWSLambdaCSharpGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static readonly DiagnosticDescriptor InvalidS3EventAttribute = new DiagnosticDescriptor(id: "AWSLambda0136",
title: "Invalid S3EventAttribute",
messageFormat: "Invalid S3EventAttribute encountered: {0}",
category: "AWSLambdaCSharpGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@ public static bool HasConvertibleParameter(this IList<ParameterModel> parameters
return false;
}

// ALB request types are forwarded to lambda method if specified, there is no parameter conversion required.
if (TypeFullNames.ALBRequests.Contains(p.Type.FullName))
{
return false;
}

// ILambdaContext is forwarded to lambda method if specified, there is no parameter conversion required.
if (p.Type.FullName == TypeFullNames.ILambdaContext)
{
return false;
}

// Body parameter with target type as string doesn't require conversion because body is string by nature.
if (p.Attributes.Any(att => att.Type.FullName == TypeFullNames.FromBodyAttribute) && p.Type.IsString())
if (p.Attributes.Any(att => att.Type.FullName == TypeFullNames.FromBodyAttribute || att.Type.FullName == TypeFullNames.ALBFromBodyAttribute) && p.Type.IsString())
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

using Amazon.Lambda.Annotations.ALB;
using Microsoft.CodeAnalysis;
using System;
using System.Linq;

namespace Amazon.Lambda.Annotations.SourceGenerator.Models.Attributes
{
/// <summary>
/// Builder for <see cref="ALBApiAttribute"/>.
/// </summary>
public class ALBApiAttributeBuilder
{
public static ALBApiAttribute Build(AttributeData att)
{
if (att.ConstructorArguments.Length != 3)
{
throw new NotSupportedException($"{TypeFullNames.ALBApiAttribute} must have constructor with 3 arguments.");
}

var listenerArn = att.ConstructorArguments[0].Value as string;
var pathPattern = att.ConstructorArguments[1].Value as string;
var priority = (int)att.ConstructorArguments[2].Value;

var data = new ALBApiAttribute(listenerArn, pathPattern, priority);

foreach (var pair in att.NamedArguments)
{
if (pair.Key == nameof(data.MultiValueHeaders) && pair.Value.Value is bool multiValueHeaders)
{
data.MultiValueHeaders = multiValueHeaders;
}
else if (pair.Key == nameof(data.HostHeader) && pair.Value.Value is string hostHeader)
{
data.HostHeader = hostHeader;
}
else if (pair.Key == nameof(data.HttpMethod) && pair.Value.Value is string httpMethod)
{
data.HttpMethod = httpMethod;
}
else if (pair.Key == nameof(data.ResourceName) && pair.Value.Value is string resourceName)
{
data.ResourceName = resourceName;
}
else if (pair.Key == nameof(data.HttpHeaderConditionName) && pair.Value.Value is string httpHeaderConditionName)
{
data.HttpHeaderConditionName = httpHeaderConditionName;
}
else if (pair.Key == nameof(data.HttpHeaderConditionValues) && !pair.Value.IsNull)
{
data.HttpHeaderConditionValues = pair.Value.Values.Select(v => v.Value as string).ToArray();
}
else if (pair.Key == nameof(data.QueryStringConditions) && !pair.Value.IsNull)
{
data.QueryStringConditions = pair.Value.Values.Select(v => v.Value as string).ToArray();
}
else if (pair.Key == nameof(data.SourceIpConditions) && !pair.Value.IsNull)
{
data.SourceIpConditions = pair.Value.Values.Select(v => v.Value as string).ToArray();
}
}

return data;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

using Amazon.Lambda.Annotations.ALB;
using Microsoft.CodeAnalysis;

namespace Amazon.Lambda.Annotations.SourceGenerator.Models.Attributes
{
/// <summary>
/// Builder for <see cref="ALB.FromHeaderAttribute"/>.
/// </summary>
public class ALBFromHeaderAttributeBuilder
{
public static ALB.FromHeaderAttribute Build(AttributeData att)
{
var data = new ALB.FromHeaderAttribute();
foreach (var pair in att.NamedArguments)
{
if (pair.Key == nameof(data.Name) && pair.Value.Value is string value)
{
data.Name = value;
}
}

return data;
}
}
}
Loading
Loading