Show / Hide Table of Contents

Interface IGatewayResponseOptions

Options to add gateway response.

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

ExampleMetadata: infused

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> {
        // Note that values must be enclosed within a pair of single quotes
        { "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\" }" }
    }
});

Synopsis

Properties

ResponseHeaders

Custom headers parameters for response.

StatusCode

Http status code for response.

Templates

Custom templates to get mapped as response.

Type

Response type to associate with gateway response.

Properties

ResponseHeaders

Custom headers parameters for response.

virtual IDictionary<string, string> ResponseHeaders { get; }
Property Value

System.Collections.Generic.IDictionary<System.String, System.String>

Remarks

Default: - no headers

StatusCode

Http status code for response.

virtual string StatusCode { get; }
Property Value

System.String

Remarks

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

Templates

Custom templates to get mapped as response.

virtual IDictionary<string, string> Templates { get; }
Property Value

System.Collections.Generic.IDictionary<System.String, System.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

See: https://docs.aws.amazon.com/apigateway/latest/developerguide/supported-gateway-response-types.html

Back to top Generated by DocFX