Class GatewayResponseOptions
Options to add gateway response.
Inheritance
System.Object
GatewayResponseOptions
Implements
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.AWS.APIGateway.dll
Syntax (csharp)
public class GatewayResponseOptions : Object, IGatewayResponseOptions
Syntax (vb)
Public Class GatewayResponseOptions
Inherits Object
Implements 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> {
{ "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
Constructors
GatewayResponseOptions() |
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. |
Constructors
GatewayResponseOptions()
public GatewayResponseOptions()
Properties
ResponseHeaders
Custom headers parameters for response.
public IDictionary<string, string> ResponseHeaders { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.String>
Remarks
Default: - no headers
StatusCode
Http status code for response.
public string StatusCode { get; set; }
Property Value
System.String
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
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.
public ResponseType_ Type { get; set; }
Property Value