Table of Contents

Interface IGatewayResponseOptions

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

Options to add gateway response.

public interface IGatewayResponseOptions

Examples

var api = new RestApi(this, "books-api");
            api.AddGatewayResponse("test-response", new GatewayResponseOptions {
                Type = ResponseType.ACCESS_DENIED,
                StatusCode = "500",
                ResponseHeaders = new Dictionary<string, string> {
                    { "Access-Control-Allow-Origin", "test.com" },
                    { "test-key", "test-value" }
                },
                Templates = new Dictionary<string, string> {
                    { "application/json", "{ \"message\": $context.error.messageString, \"statusCode\": \"488\", \"type\": \"$context.error.responseType\" }" }
                }
            });

Remarks

ExampleMetadata: infused

Properties

ResponseHeaders

Custom headers parameters for response.

IDictionary<string, string>? ResponseHeaders { get; }

Property Value

IDictionary<string, string>

Remarks

Default: - no headers

StatusCode

Http status code for response.

string? StatusCode { get; }

Property Value

string

Remarks

Default: - standard http status code for the response type.

Templates

Custom templates to get mapped as response.

IDictionary<string, string>? Templates { get; }

Property Value

IDictionary<string, string>

Remarks

Default: - Response from api will be returned without applying any transformation.

Type

Response type to associate with gateway response.

ResponseType_ Type { get; }

Property Value

ResponseType_

Remarks