Skip to content

Commit 60f8ff8

Browse files
committed
Add documentation for API Gateway attributes for Lambda Annotations
1 parent 13ee9b6 commit 60f8ff8

12 files changed

+78
-6
lines changed

Libraries/src/Amazon.Lambda.Annotations/APIGateway/FromBodyAttribute.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
namespace Amazon.Lambda.Annotations.APIGateway
44
{
5+
/// <summary>
6+
/// Maps this parameter to the HTTP request body
7+
/// </summary>
8+
/// <remarks>
9+
/// If the parameter is a complex type then the request body will be assumed to be JSON and deserialized into the type.
10+
/// </remarks>
511
[AttributeUsage(AttributeTargets.Parameter)]
612
public class FromBodyAttribute : Attribute
713
{

Libraries/src/Amazon.Lambda.Annotations/APIGateway/FromHeaderAttribute.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22

33
namespace Amazon.Lambda.Annotations.APIGateway
44
{
5+
/// <summary>
6+
/// Maps this parameter to an HTTP header value
7+
/// </summary>
58
[AttributeUsage(AttributeTargets.Parameter)]
69
public class FromHeaderAttribute : Attribute, INamedAttribute
710
{
11+
/// <summary>
12+
/// Name of the parameter
13+
/// </summary>
814
public string Name { get; set; }
915
}
1016
}

Libraries/src/Amazon.Lambda.Annotations/APIGateway/FromQueryAttribute.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22

33
namespace Amazon.Lambda.Annotations.APIGateway
44
{
5+
/// <summary>
6+
/// Maps this parameter to a query string parameter
7+
/// </summary>
58
[AttributeUsage(AttributeTargets.Parameter)]
69
public class FromQueryAttribute : Attribute, INamedAttribute
710
{
11+
/// <summary>
12+
/// Name of the parameter
13+
/// </summary>
814
public string Name { get; set; }
915
}
1016
}

Libraries/src/Amazon.Lambda.Annotations/APIGateway/FromRouteAttribute.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22

33
namespace Amazon.Lambda.Annotations.APIGateway
44
{
5+
/// <summary>
6+
/// Maps this parameter to a resource path segment
7+
/// </summary>
58
[AttributeUsage(AttributeTargets.Parameter)]
69
public class FromRouteAttribute : Attribute, INamedAttribute
710
{
11+
/// <summary>
12+
/// Name of the parameter
13+
/// </summary>
814
public string Name { get; set; }
915
}
1016
}

Libraries/src/Amazon.Lambda.Annotations/APIGateway/HttpApiAttribute.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,24 @@
22

33
namespace Amazon.Lambda.Annotations.APIGateway
44
{
5+
/// <summary>
6+
/// Configures the Lambda function to be called from an API Gateway HTTP API
7+
/// </summary>
8+
/// <remarks>
9+
/// The HTTP method, HTTP API payload version and resource path are required to be set on the attribute.
10+
/// </remarks>
511
[AttributeUsage(AttributeTargets.Method)]
612
public class HttpApiAttribute : Attribute
713
{
14+
/// <inheritdoc cref="HttpApiVersion"/>
815
public HttpApiVersion Version { get; set; } = HttpApiVersion.V2;
16+
17+
/// <summary>
18+
/// Resource path
19+
/// </summary>
920
public string Template { get; set; }
21+
22+
/// <inheritdoc cref="LambdaHttpMethod"/>
1023
public LambdaHttpMethod Method { get; set; }
1124

1225
public HttpApiAttribute(LambdaHttpMethod method, string template)

Libraries/src/Amazon.Lambda.Annotations/APIGateway/HttpApiVersion.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
namespace Amazon.Lambda.Annotations.APIGateway
22
{
3+
/// <summary>
4+
/// The <see href="https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format">
5+
/// Payload Format Version</see> for an API Gateway HTTP API.
6+
/// </summary>
37
public enum HttpApiVersion
48
{
59
V1,

Libraries/src/Amazon.Lambda.Annotations/APIGateway/LambdaHttpMethod.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
namespace Amazon.Lambda.Annotations.APIGateway
22
{
3+
/// <summary>
4+
/// HTTP Method/Verb
5+
/// </summary>
36
public enum LambdaHttpMethod
47
{
58
Any,

Libraries/src/Amazon.Lambda.Annotations/APIGateway/RestApiAttribute.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,21 @@
22

33
namespace Amazon.Lambda.Annotations.APIGateway
44
{
5+
/// <summary>
6+
/// Configures the Lambda function to be called from an API Gateway REST API
7+
/// </summary>
8+
/// <remarks>
9+
/// The HTTP method and resource path are required to be set on the attribute.
10+
/// </remarks>
511
[AttributeUsage(AttributeTargets.Method)]
612
public class RestApiAttribute : Attribute
713
{
14+
/// <summary>
15+
/// Resource path
16+
/// </summary>
817
public string Template { get; set; }
18+
19+
/// <inheritdoc cref="LambdaHttpMethod" />
920
public LambdaHttpMethod Method { get; set; }
1021

1122
public RestApiAttribute(LambdaHttpMethod method, string template)

Libraries/src/Amazon.Lambda.Annotations/FromServicesAttribute.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
namespace Amazon.Lambda.Annotations
44
{
5+
/// <summary>
6+
/// Indicates that this service parameter will be injected into the Lambda function invocation.
7+
/// </summary>
8+
/// <remarks>
9+
/// Services injected using the FromServices attribute are created within the scope
10+
/// that is created for each Lambda invocation.
11+
/// </remarks>
512
[AttributeUsage(AttributeTargets.Parameter)]
613
public class FromServicesAttribute : Attribute
714
{

Libraries/src/Amazon.Lambda.Annotations/LambdaFunctionAttribute.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
42

53
namespace Amazon.Lambda.Annotations
64
{
5+
/// <summary>
6+
/// Indicates this method should be exposed as a Lambda function
7+
/// </summary>
78
[AttributeUsage(AttributeTargets.Method)]
89
public class LambdaFunctionAttribute : Attribute
910
{
@@ -32,10 +33,7 @@ public class LambdaFunctionAttribute : Attribute
3233
/// </summary>
3334
public string Policies { get; set; }
3435

35-
/// <summary>
36-
/// The deployment package type of the Lambda function. The supported values are Zip or Image. The default value is Zip.
37-
/// For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html">here</a>
38-
/// </summary>
36+
/// <inheritdoc cref="LambdaPackageType" />
3937
public LambdaPackageType PackageType { get; set; }
4038
}
4139
}

Libraries/src/Amazon.Lambda.Annotations/LambdaPackageType.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
namespace Amazon.Lambda.Annotations
22
{
3+
/// <summary>
4+
/// The deployment package type of the Lambda function. The supported values are Zip or Image. The default value is Zip.
5+
/// For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html">here</a>
6+
/// </summary>
37
public enum LambdaPackageType
48
{
59
Zip=0,

Libraries/src/Amazon.Lambda.Annotations/LambdaStartupAttribute.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
namespace Amazon.Lambda.Annotations
44
{
5+
/// <summary>
6+
/// Indicates that the class will be used for registering services that
7+
/// can be injected into Lambda functions.
8+
/// </summary>
9+
/// <remarks>
10+
/// The class should implement a ConfigureServices method that
11+
/// adds one or more services to an IServiceCollection.
12+
/// </remarks>
513
[AttributeUsage(AttributeTargets.Class)]
614
public class LambdaStartupAttribute : Attribute
715
{

0 commit comments

Comments
 (0)