Show / Hide Table of Contents

Interface IIntegrationOptions

Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IIntegrationOptions
Syntax (vb)
Public Interface IIntegrationOptions
Remarks

ExampleMetadata: lit=aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts infused

Examples
using Path;
            using Amazon.CDK.AWS.Lambda;
            using Amazon.CDK;
            using Amazon.CDK.AWS.APIGateway;

            // Against the RestApi endpoint from the stack output, run
            // `curl -s -o /dev/null -w "%{http_code}" <url>` should return 401
            // `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: deny' <url>?allow=yes` should return 403
            // `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: allow' <url>?allow=yes` should return 200

            var app = new App();
            var stack = new Stack(app, "RequestAuthorizerInteg");

            var authorizerFn = new Function(stack, "MyAuthorizerFunction", new FunctionProps {
                Runtime = Runtime.NODEJS_LATEST,
                Handler = "index.handler",
                Code = AssetCode.FromAsset(Join(__dirname, "integ.request-authorizer.handler"))
            });

            var restapi = new RestApi(stack, "MyRestApi", new RestApiProps { CloudWatchRole = true });

            var authorizer = new RequestAuthorizer(stack, "MyAuthorizer", new RequestAuthorizerProps {
                Handler = authorizerFn,
                IdentitySources = new [] { IdentitySource.Header("Authorization"), IdentitySource.QueryString("allow") }
            });

            var secondAuthorizer = new RequestAuthorizer(stack, "MySecondAuthorizer", new RequestAuthorizerProps {
                Handler = authorizerFn,
                IdentitySources = new [] { IdentitySource.Header("Authorization"), IdentitySource.QueryString("allow") }
            });

            restapi.Root.AddMethod("ANY", new MockIntegration(new IntegrationOptions {
                IntegrationResponses = new [] { new IntegrationResponse { StatusCode = "200" } },
                PassthroughBehavior = PassthroughBehavior.NEVER,
                RequestTemplates = new Dictionary<string, string> {
                    { "application/json", "{ \"statusCode\": 200 }" }
                }
            }), new MethodOptions {
                MethodResponses = new [] { new MethodResponse { StatusCode = "200" } },
                Authorizer = authorizer
            });

            restapi.Root.ResourceForPath("auth").AddMethod("ANY", new MockIntegration(new IntegrationOptions {
                IntegrationResponses = new [] { new IntegrationResponse { StatusCode = "200" } },
                PassthroughBehavior = PassthroughBehavior.NEVER,
                RequestTemplates = new Dictionary<string, string> {
                    { "application/json", "{ \"statusCode\": 200 }" }
                }
            }), new MethodOptions {
                MethodResponses = new [] { new MethodResponse { StatusCode = "200" } },
                Authorizer = secondAuthorizer
            });

Synopsis

Properties

CacheKeyParameters

A list of request parameters whose values are to be cached.

CacheNamespace

An API-specific tag group of related cached parameters.

ConnectionType

The type of network connection to the integration endpoint.

ContentHandling

Specifies how to handle request payload content type conversions.

CredentialsPassthrough

Requires that the caller's identity be passed through from the request.

CredentialsRole

An IAM role that API Gateway assumes.

IntegrationResponses

The response that API Gateway provides after a method's backend completes processing a request.

PassthroughBehavior

Specifies the pass-through behavior for incoming requests based on the Content-Type header in the request, and the available mapping templates specified as the requestTemplates property on the Integration resource.

RequestParameters

The request parameters that API Gateway sends with the backend request.

RequestTemplates

A map of Apache Velocity templates that are applied on the request payload.

Timeout

The maximum amount of time an integration will run before it returns without a response.

VpcLink

The VpcLink used for the integration.

Properties

CacheKeyParameters

A list of request parameters whose values are to be cached.

string[]? CacheKeyParameters { get; }
Property Value

string[]

Remarks

It determines request parameters that will make it into the cache key.

CacheNamespace

An API-specific tag group of related cached parameters.

string? CacheNamespace { get; }
Property Value

string

Remarks

ExampleMetadata: lit=aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts infused

ConnectionType

The type of network connection to the integration endpoint.

ConnectionType? ConnectionType { get; }
Property Value

ConnectionType?

Remarks

Default: - ConnectionType.VPC_LINK if vpcLink property is configured; ConnectionType.Internet otherwise.

ContentHandling

Specifies how to handle request payload content type conversions.

ContentHandling? ContentHandling { get; }
Property Value

ContentHandling?

Remarks

Default: none if this property isn't defined, the request payload is passed through from the method request to the integration request without modification, provided that the passthroughBehaviors property is configured to support payload pass-through.

CredentialsPassthrough

Requires that the caller's identity be passed through from the request.

bool? CredentialsPassthrough { get; }
Property Value

bool?

Remarks

Default: Caller identity is not passed through

CredentialsRole

An IAM role that API Gateway assumes.

IRole? CredentialsRole { get; }
Property Value

IRole

Remarks

Mutually exclusive with credentialsPassThrough.

Default: A role is not assumed

IntegrationResponses

The response that API Gateway provides after a method's backend completes processing a request.

IIntegrationResponse[]? IntegrationResponses { get; }
Property Value

IIntegrationResponse[]

Remarks

API Gateway intercepts the response from the backend so that you can control how API Gateway surfaces backend responses. For example, you can map the backend status codes to codes that you define.

PassthroughBehavior

Specifies the pass-through behavior for incoming requests based on the Content-Type header in the request, and the available mapping templates specified as the requestTemplates property on the Integration resource.

PassthroughBehavior? PassthroughBehavior { get; }
Property Value

PassthroughBehavior?

Remarks

There are three valid values: WHEN_NO_MATCH, WHEN_NO_TEMPLATES, and NEVER.

RequestParameters

The request parameters that API Gateway sends with the backend request.

IDictionary<string, string>? RequestParameters { get; }
Property Value

IDictionary<string, string>

Remarks

Specify request parameters as key-value pairs (string-to-string mappings), with a destination as the key and a source as the value.

Specify the destination by using the following pattern integration.request.location.name, where location is querystring, path, or header, and name is a valid, unique parameter name.

The source must be an existing method request parameter or a static value. You must enclose static values in single quotation marks and pre-encode these values based on their destination in the request.

RequestTemplates

A map of Apache Velocity templates that are applied on the request payload.

IDictionary<string, string>? RequestTemplates { get; }
Property Value

IDictionary<string, string>

Remarks

The template that API Gateway uses is based on the value of the Content-Type header that's sent by the client. The content type value is the key, and the template is the value (specified as a string), such as the following snippet:

{ "application/json": "{ \"statusCode\": 200 }" }

See: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html

Timeout

The maximum amount of time an integration will run before it returns without a response.

Duration? Timeout { get; }
Property Value

Duration

Remarks

By default, the value must be between 50 milliseconds and 29 seconds. The upper bound can be increased for regional and private Rest APIs only, via a quota increase request for your acccount. This increase might require a reduction in your account-level throttle quota limit.

See {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html Amazon API Gateway quotas} for more details.

Default: Duration.seconds(29)

VpcLink

The VpcLink used for the integration.

IVpcLink? VpcLink { get; }
Property Value

IVpcLink

Remarks

Required if connectionType is VPC_LINK

Back to top Generated by DocFX