aws-cdk-lib.aws_apigateway.MethodResponse

interface MethodResponse

LanguageType name
.NETAmazon.CDK.AWS.APIGateway.MethodResponse
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#MethodResponse
Javasoftware.amazon.awscdk.services.apigateway.MethodResponse
Pythonaws_cdk.aws_apigateway.MethodResponse
TypeScript (source)aws-cdk-lib » aws_apigateway » MethodResponse

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';

declare const model: apigateway.Model;
const methodResponse: apigateway.MethodResponse = {
  statusCode: 'statusCode',

  // the properties below are optional
  responseModels: {
    responseModelsKey: model,
  },
  responseParameters: {
    responseParametersKey: false,
  },
};

Properties

NameTypeDescription
statusCodestringThe method response's status code, which you map to an IntegrationResponse.
responseModels?{ [string]: IModel }The resources used for the response's content type.
responseParameters?{ [string]: boolean }Response parameters that API Gateway sends to the client that called a method.

statusCode

Type: string

The method response's status code, which you map to an IntegrationResponse.

Required.


responseModels?

Type: { [string]: IModel } (optional, default: None)

The resources used for the response's content type.

Specify response models as key-value pairs (string-to-string maps), with a content type as the key and a Model resource name as the value.


responseParameters?

Type: { [string]: boolean } (optional, default: None)

Response parameters that API Gateway sends to the client that called a method.

Specify response parameters as key-value pairs (string-to-Boolean maps), with a destination as the key and a Boolean as the value. Specify the destination using the following pattern: method.response.header.name, where the name is a valid, unique header name. The Boolean specifies whether a parameter is required.