Class GatewayResponseOptions
- Namespace
- Amazon.CDK.AWS.APIGateway
- Assembly
- Amazon.CDK.AWS.APIGateway.dll
Options to add gateway response.
public class GatewayResponseOptions : IGatewayResponseOptions
- Inheritance
-
GatewayResponseOptions
- Implements
- Inherited Members
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
Constructors
GatewayResponseOptions()
public GatewayResponseOptions()
Properties
ResponseHeaders
Custom headers parameters for response.
public IDictionary<string, string>? ResponseHeaders { get; set; }
Property Value
Remarks
Default: - no headers
StatusCode
Http status code for response.
public string? StatusCode { get; set; }
Property Value
Remarks
Default: - standard http status code for the response type.
Templates
Custom templates to get mapped as response.
public IDictionary<string, string>? Templates { get; set; }
Property Value
Remarks
Default: - Response from api will be returned without applying any transformation.
Type
Response type to associate with gateway response.
public ResponseType_ Type { get; set; }