IntegrationResponseProperty Struct
IntegrationResponse is a property of the Amazon API Gateway Method Integration property type that specifies the response that API Gateway sends after a method's backend finishes processing a request.
| Source | |
|---|---|
| Type last changed |
Example
// 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';
const integrationResponseProperty: apigateway.CfnMethod.IntegrationResponseProperty = {
statusCode: 'statusCode',
// the properties below are optional
contentHandling: 'contentHandling',
responseParameters: {
responseParametersKey: 'responseParameters',
},
responseTemplates: {
responseTemplatesKey: 'responseTemplates',
},
selectionPattern: 'selectionPattern',
};
# 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
integration_response_property = apigateway.CfnMethod.IntegrationResponseProperty(
status_code="statusCode",
# the properties below are optional
content_handling="contentHandling",
response_parameters={
"response_parameters_key": "responseParameters"
},
response_templates={
"response_templates_key": "responseTemplates"
},
selection_pattern="selectionPattern"
)
// 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.*;
IntegrationResponseProperty integrationResponseProperty = IntegrationResponseProperty.builder()
.statusCode("statusCode")
// the properties below are optional
.contentHandling("contentHandling")
.responseParameters(Map.of(
"responseParametersKey", "responseParameters"))
.responseTemplates(Map.of(
"responseTemplatesKey", "responseTemplates"))
.selectionPattern("selectionPattern")
.build();
// 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;
var integrationResponseProperty = new IntegrationResponseProperty {
StatusCode = "statusCode",
// the properties below are optional
ContentHandling = "contentHandling",
ResponseParameters = new Dictionary<string, string> {
{ "responseParametersKey", "responseParameters" }
},
ResponseTemplates = new Dictionary<string, string> {
{ "responseTemplatesKey", "responseTemplates" }
},
SelectionPattern = "selectionPattern"
};
// 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"
integrationResponseProperty := &IntegrationResponseProperty{
StatusCode: jsii.String("statusCode"),
// the properties below are optional
ContentHandling: jsii.String("contentHandling"),
ResponseParameters: map[string]*string{
"responseParametersKey": jsii.String("responseParameters"),
},
ResponseTemplates: map[string]*string{
"responseTemplatesKey": jsii.String("responseTemplates"),
},
SelectionPattern: jsii.String("selectionPattern"),
}
Properties
contentHandlingoptionalstringcontent_handlingoptionalstrcontentHandlingoptionalStringContentHandlingoptionalstringContentHandlingoptional*string #notes
Supported values are CONVERT_TO_BINARY and CONVERT_TO_TEXT , with the following behaviors:
If this property is not defined, the response payload will be passed through from the integration response to the method response without modification.
responseParametersoptionalIResolvable | { [key: string]: string }response_parametersoptionaltyping.Union[IResolvable, typing.Mapping[str, str]]responseParametersoptionalIResolvableResponseParametersoptionalIResolvableResponseParametersoptionalinterface{} #notes
The key is a method response header parameter name and the mapped value is an integration response header value, a static value enclosed within a pair of single quotes, or a JSON expression from the integration response body. The mapping key must match the pattern of method.response.header.{name} , where name is a valid and unique header name. The mapped non-static value must match the pattern of integration.response.header.{name} or integration.response.body.{JSON-expression} , where name is a valid and unique response header name and JSON-expression is a valid JSON expression without the $ prefix.
responseTemplatesoptionalIResolvable | { [key: string]: string }response_templatesoptionaltyping.Union[IResolvable, typing.Mapping[str, str]]responseTemplatesoptionalIResolvableResponseTemplatesoptionalIResolvableResponseTemplatesoptionalinterface{} #Response templates are represented as a key/value map, with a content-type as the key and a template as the value.
selectionPatternoptionalstringselection_patternoptionalstrselectionPatternoptionalStringSelectionPatternoptionalstringSelectionPatternoptional*string #notes
For example, if the success response returns nothing and the error response returns some string, you could use the .+ regex to match error response. However, make sure that the error response does not contain any newline ( \n ) character in such cases. If the back end is an AWS Lambda function, the AWS Lambda function error header is matched. For all other HTTP and AWS back ends, the HTTP status code is matched.