You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Libraries/src/Amazon.Lambda.APIGatewayEvents/README.md
+6-27Lines changed: 6 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,13 @@ API Gateway events consist of a request that was routed to a Lambda function by
6
6
7
7
# Classes
8
8
9
-
## APIGatewayProxyRequest
9
+
|Class|Description|
10
+
|-----|-----------|
11
+
|[APIGatewayProxyRequest](./APIGatewayProxyRequest.cs)| Represents proxy request coming from REST API, HTTP API payload format 1.0 or WebSocket API. |
12
+
|[APIGatewayProxyResponse](./APIGatewayProxyResponse.cs)| The return object for functions handling requests for REST API, HTTP API payload format 1.0 or WebSocket API. |
13
+
|[APIGatewayHttpApiV2ProxyRequest](./APIGatewayHttpApiV2ProxyRequest.cs)| Represents proxy request coming from HTTP API payload format 2.0. |
14
+
|[APIGatewayHttpApiV2ProxyResponse](./APIGatewayHttpApiV2ProxyResponse.cs)| The return object for functions handling requests for HTTP API payload format 2.0. |
10
15
11
-
The [APIGatewayProxyRequest](./APIGatewayProxyRequest.cs) class contains information relating to the proxy request coming from the [Amazon API Gateway](https://aws.amazon.com/api-gateway/).
12
16
13
17
# Sample Functions
14
18
@@ -35,28 +39,3 @@ public class Function
35
39
}
36
40
```
37
41
38
-
### Microsoft.AspNetCore.Mvc controller
39
-
40
-
In a AspNetCore controller, An instance of this interface is attached to any `ControllerBase.Request.HttpContext` instances via the `Items` property using the key "[APIGATEWAY_REQUEST / APIGatewayRequest](../Amazon.Lambda.AspNetCoreServer/APIGatewayProxyFunction.cs)".
41
-
42
-
The following is an example of accessing an instance of this class in a controller method.
43
-
44
-
```csharp
45
-
[ApiController]
46
-
publicclassTestController : ControllerBase
47
-
{
48
-
[HttpGet("/[controller]")]
49
-
publicIActionResultGet()
50
-
{
51
-
Response.Headers.Add("Access-Control-Allow-Origin", "*"); // NOTE: Should be configured via app.UseCors in Startup.cs
/// The builder has configuration, logging and Amazon API Gateway already configured. The startup class
58
+
/// needs to be configured in this method using the UseStartup<>() method.
59
+
/// </summary>
60
+
/// <paramname="builder"></param>
27
61
protectedoverridevoidInit(IWebHostBuilderbuilder)
28
62
{
29
63
builder
@@ -35,31 +69,22 @@ namespace TestWebApp
35
69
36
70
The function handler for the Lambda function will be **TestWebApp::TestWebApp.LambdaFunction::FunctionHandlerAsync**.
37
71
38
-
Once the function is deployed configure API Gateway with a HTTP Proxy to call the Lambda Function. Refer to the API Gateway
39
-
[developer guide](http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-api-as-simple-proxy.html) for more information.
40
72
41
-
### Application Load Balancer Example
73
+
##Access to Lambda Objects from HttpContext
42
74
43
-
To be used with an Application Load Balancer from ELB the base class needs to be changed from APIGatewayProxyFunction to **ApplicationLoadBalancerFunction**.
75
+
The original lambda request object and the `ILambdaContext` object can be accessed from the `HttpContext.Items` collection.
0 commit comments