GatewayResponseProps Struct
Properties for a new gateway response.
| Source | aws-apigateway/lib/gateway-response.ts |
|---|
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apigateway as apigateway } from 'aws-cdk-lib';
declare const responseType: apigateway.ResponseType;
declare const restApi: apigateway.RestApi;
const gatewayResponseProps: apigateway.GatewayResponseProps = {
restApi: restApi,
type: responseType,
// the properties below are optional
responseHeaders: {
responseHeadersKey: 'responseHeaders',
},
statusCode: 'statusCode',
templates: {
templatesKey: 'templates',
},
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_apigateway as apigateway
# response_type: apigateway.ResponseType
# rest_api: apigateway.RestApi
gateway_response_props = apigateway.GatewayResponseProps(
rest_api=rest_api,
type=response_type,
# the properties below are optional
response_headers={
"response_headers_key": "responseHeaders"
},
status_code="statusCode",
templates={
"templates_key": "templates"
}
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.apigateway.*;
ResponseType responseType;
RestApi restApi;
GatewayResponseProps gatewayResponseProps = GatewayResponseProps.builder()
.restApi(restApi)
.type(responseType)
// the properties below are optional
.responseHeaders(Map.of(
"responseHeadersKey", "responseHeaders"))
.statusCode("statusCode")
.templates(Map.of(
"templatesKey", "templates"))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.APIGateway;
ResponseType responseType;
RestApi restApi;
var gatewayResponseProps = new GatewayResponseProps {
RestApi = restApi,
Type = responseType,
// the properties below are optional
ResponseHeaders = new Dictionary<string, string> {
{ "responseHeadersKey", "responseHeaders" }
},
StatusCode = "statusCode",
Templates = new Dictionary<string, string> {
{ "templatesKey", "templates" }
}
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
var responseType ResponseType
var restApi RestApi
gatewayResponseProps := &GatewayResponseProps{
RestApi: restApi,
Type: responseType,
// the properties below are optional
ResponseHeaders: map[string]*string{
"responseHeadersKey": jsii.String("responseHeaders"),
},
StatusCode: jsii.String("statusCode"),
Templates: map[string]*string{
"templatesKey": jsii.String("templates"),
},
}
Properties
responseHeadersoptional{ [key: string]: string }response_headersoptionaltyping.Mapping[str, str]responseHeadersoptionalMap<String, String>ResponseHeadersoptionalIDictionary<string, string>ResponseHeadersoptional*map[string]*string #Custom headers parameters for response.
Default: no headers
Rest api resource to target.
statusCodeoptionalstringstatus_codeoptionalstrstatusCodeoptionalStringStatusCodeoptionalstringStatusCodeoptional*string #Http status code for response.
Default: standard http status code for the response type.
templatesoptional{ [key: string]: string }templatesoptionaltyping.Mapping[str, str]templatesoptionalMap<String, String>TemplatesoptionalIDictionary<string, string>Templatesoptional*map[string]*string #Custom templates to get mapped as response.
Default: Response from api will be returned without applying any transformation.
Response type to associate with gateway response.