# MethodResponse

Used as argument in: [Method.addMethodResponse](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.Method.html#addmethodresponse)

- Source: [`aws-apigateway/lib/methodresponse.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-apigateway/lib/methodresponse.ts#L3)

## Example

TypeScript:

```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 model: apigateway.Model;
const methodResponse: apigateway.MethodResponse = {
  statusCode: 'statusCode',

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

Python:

```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

# model: apigateway.Model

method_response = apigateway.MethodResponse(
    status_code="statusCode",

    # the properties below are optional
    response_models={
        "response_models_key": model
    },
    response_parameters={
        "response_parameters_key": False
    }
)
```

Java:

```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.*;

Model model;

MethodResponse methodResponse = MethodResponse.builder()
        .statusCode("statusCode")

        // the properties below are optional
        .responseModels(Map.of(
                "responseModelsKey", model))
        .responseParameters(Map.of(
                "responseParametersKey", false))
        .build();
```

C# / .NET:

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

Model model;

var methodResponse = new MethodResponse {
    StatusCode = "statusCode",

    // the properties below are optional
    ResponseModels = new Dictionary<string, IModel> {
        { "responseModelsKey", model }
    },
    ResponseParameters = new Dictionary<string, boolean> {
        { "responseParametersKey", false }
    }
};
```

Golang:

```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 model Model

methodResponse := &MethodResponse{
	StatusCode: jsii.String("statusCode"),

	// the properties below are optional
	ResponseModels: map[string]IModel{
		"responseModelsKey": model,
	},
	ResponseParameters: map[string]*bool{
		"responseParametersKey": jsii.Boolean(false),
	},
}
```

## Properties

- `responseModels`: { [key: string]: [IModel](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.IModel.html) } = 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`: { [key: string]: boolean } = 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.

- `statusCode`: string (required) — The method response's status code, which you map to an IntegrationResponse.

  Required.
