Table of Contents

Class LambdaRestApi

Namespace
Amazon.CDK.AWS.APIGateway
Assembly
Amazon.CDK.AWS.APIGateway.dll

Defines an API Gateway REST API with AWS Lambda proxy integration.

public class LambdaRestApi : RestApi, IRestApi, IResource, IConstruct, IConstruct, IDependable
Inheritance
LambdaRestApi
Implements
IResource
IConstruct
IConstruct
IDependable
Inherited Members

Examples

Function backend;

             var api = new LambdaRestApi(this, "myapi", new LambdaRestApiProps {
                 Handler = backend,
                 Proxy = false
             });

             var items = api.Root.AddResource("items");
             items.AddMethod("GET"); // GET /items
             items.AddMethod("POST"); // POST /items

             var item = items.AddResource("{item}");
             item.AddMethod("GET"); // GET /items/{item}

             // the default integration for methods is "handler", but one can
             // customize this behavior per method or even a sub path.
             item.AddMethod("DELETE", new HttpIntegration("http://amazon.com"));

Remarks

Use the proxy property to define a greedy proxy ("{proxy+}") and "ANY" method from the specified path. If not defined, you will need to explicity add resources and methods to the API.

ExampleMetadata: infused

Constructors

LambdaRestApi(Construct, string, ILambdaRestApiProps)

public LambdaRestApi(Construct scope, string id, ILambdaRestApiProps props)

Parameters

scope Construct
id string
props ILambdaRestApiProps