Skip to content

Commit e9f7dd7

Browse files
committed
Update preview flag with message
1 parent 694c176 commit e9f7dd7

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

Libraries/src/Amazon.Lambda.AspNetCoreServer.Hosting/HostingOptions.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ namespace Amazon.Lambda.AspNetCoreServer.Hosting;
99
/// </summary>
1010
public class HostingOptions
1111
{
12+
internal const string ParameterizedPreviewMessage =
13+
"Response streaming is in preview till a new version of .NET Lambda runtime client that supports response streaming " +
14+
"has been deployed to the .NET Lambda managed runtime. Till deployment has been made the feature can be used by deploying as an " +
15+
"executable including the latest version of Amazon.Lambda.RuntimeSupport and setting the \"EnablePreviewFeatures\" in the Lambda " +
16+
"project file to \"true\"";
17+
1218
/// <summary>
1319
/// The ILambdaSerializer used by Lambda to convert the incoming event JSON into the .NET event type and serialize the .NET response type
1420
/// back to JSON to return to Lambda.
@@ -32,7 +38,7 @@ public class HostingOptions
3238
/// instead of <c>FunctionHandlerAsync</c>, enabling Lambda response streaming.
3339
/// Requires net8.0 or later.
3440
/// </summary>
35-
[System.Runtime.Versioning.RequiresPreviewFeatures]
41+
[System.Runtime.Versioning.RequiresPreviewFeatures(ParameterizedPreviewMessage)]
3642
public bool EnableResponseStreaming { get; set; } = false;
3743

3844
/// <summary>

Libraries/src/Amazon.Lambda.AspNetCoreServer/AbstractAspNetCoreFunction.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ namespace Amazon.Lambda.AspNetCoreServer
2424
/// </summary>
2525
public abstract class AbstractAspNetCoreFunction
2626
{
27+
internal const string ParameterizedPreviewMessage =
28+
"Response streaming is in preview till a new version of .NET Lambda runtime client that supports response streaming " +
29+
"has been deployed to the .NET Lambda managed runtime. Till deployment has been made the feature can be used by deploying as an " +
30+
"executable including the latest version of Amazon.Lambda.RuntimeSupport and setting the \"EnablePreviewFeatures\" in the Lambda " +
31+
"project file to \"true\"";
32+
2733
/// <summary>
2834
/// Key to access the ILambdaContext object from the HttpContext.Items collection.
2935
/// </summary>
@@ -200,7 +206,7 @@ public void RegisterResponseContentEncodingForContentEncoding(string contentEnco
200206
/// buffering it and returning a typed response object (which will be <c>null</c>).
201207
/// Requires net8.0 or later.
202208
/// </summary>
203-
[System.Runtime.Versioning.RequiresPreviewFeatures]
209+
[System.Runtime.Versioning.RequiresPreviewFeatures(ParameterizedPreviewMessage)]
204210
public virtual bool EnableResponseStreaming { get; set; } = false;
205211

206212

@@ -683,7 +689,7 @@ protected virtual void PostMarshallResponseFeature(IHttpResponseFeature aspNetCo
683689
/// </summary>
684690
/// <param name="responseFeature">The ASP.NET Core response feature for the current invocation.</param>
685691
/// <returns>A populated <see cref="Amazon.Lambda.Core.ResponseStreaming.HttpResponseStreamPrelude"/>.</returns>
686-
[System.Runtime.Versioning.RequiresPreviewFeatures]
692+
[System.Runtime.Versioning.RequiresPreviewFeatures(ParameterizedPreviewMessage)]
687693
protected virtual Amazon.Lambda.Core.ResponseStreaming.HttpResponseStreamPrelude BuildStreamingPrelude(IHttpResponseFeature responseFeature)
688694
{
689695
var prelude = new Amazon.Lambda.Core.ResponseStreaming.HttpResponseStreamPrelude
@@ -717,7 +723,7 @@ protected virtual Amazon.Lambda.Core.ResponseStreaming.HttpResponseStreamPrelude
717723
/// </summary>
718724
/// <param name="prelude">The HTTP response prelude containing status code and headers.</param>
719725
/// <returns>A writable <see cref="System.IO.Stream"/> for the response body.</returns>
720-
[System.Runtime.Versioning.RequiresPreviewFeatures]
726+
[System.Runtime.Versioning.RequiresPreviewFeatures(ParameterizedPreviewMessage)]
721727
protected virtual System.IO.Stream CreateLambdaResponseStream(
722728
Amazon.Lambda.Core.ResponseStreaming.HttpResponseStreamPrelude prelude)
723729
{
@@ -729,7 +735,7 @@ protected virtual System.IO.Stream CreateLambdaResponseStream(
729735
/// <see cref="EnableResponseStreaming"/> is <c>true</c>. Writes the response directly to a
730736
/// <see cref="Amazon.Lambda.Core.ResponseStreaming.LambdaResponseStream"/>.
731737
/// </summary>
732-
[System.Runtime.Versioning.RequiresPreviewFeatures]
738+
[System.Runtime.Versioning.RequiresPreviewFeatures(ParameterizedPreviewMessage)]
733739
private async Task ExecuteStreamingRequestAsync(InvokeFeatures features, TREQUEST request, ILambdaContext lambdaContext)
734740
{
735741
var responseFeature = (IHttpResponseFeature)features;

Libraries/src/Amazon.Lambda.AspNetCoreServer/Internal/StreamingResponseBodyFeature.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ namespace Amazon.Lambda.AspNetCoreServer.Internal
2020
/// <see cref="MemoryStream"/>; after <see cref="StartAsync"/> all writes go directly to the
2121
/// <see cref="LambdaResponseStream"/> obtained from the stream opener delegate.
2222
/// </summary>
23-
[RequiresPreviewFeatures(
24-
"Response streaming is in preview till a new version of .NET Lambda runtime client that supports response streaming " +
25-
"has been deployed to the .NET Lambda managed runtime. Till deployment has been made the feature can be used by deploying as an " +
26-
"executable including the latest version of Amazon.Lambda.RuntimeSupport and setting the \"EnablePreviewFeatures\" in the Lambda " +
27-
"project file to \"true\"")]
23+
[RequiresPreviewFeatures(AbstractAspNetCoreFunction.ParameterizedPreviewMessage)]
2824
internal class StreamingResponseBodyFeature : IHttpResponseBodyFeature
2925
{
3026
private readonly ILogger _logger;

0 commit comments

Comments
 (0)