MethodDeploymentOptions

class aws_cdk.aws_apigateway.MethodDeploymentOptions(*, cache_data_encrypted=None, cache_ttl=None, caching_enabled=None, data_trace_enabled=None, logging_level=None, metrics_enabled=None, throttling_burst_limit=None, throttling_rate_limit=None)

Bases: object

Parameters:
  • cache_data_encrypted (Optional[bool]) – Indicates whether the cached responses are encrypted. Default: false

  • cache_ttl (Optional[Duration]) – Specifies the time to live (TTL), in seconds, for cached responses. The higher the TTL, the longer the response will be cached. Default: Duration.minutes(5)

  • caching_enabled (Optional[bool]) – Specifies whether responses should be cached and returned for requests. A cache cluster must be enabled on the stage for responses to be cached. Default: - Caching is Disabled.

  • data_trace_enabled (Optional[bool]) – Specifies whether data trace logging is enabled for this method. When enabled, API gateway will log the full API requests and responses. This can be useful to troubleshoot APIs, but can result in logging sensitive data. We recommend that you don’t enable this feature for production APIs. Default: false

  • logging_level (Optional[MethodLoggingLevel]) – Specifies the logging level for this method, which effects the log entries pushed to Amazon CloudWatch Logs. Default: - Off

  • metrics_enabled (Optional[bool]) – Specifies whether Amazon CloudWatch metrics are enabled for this method. Default: false

  • throttling_burst_limit (Union[int, float, None]) – Specifies the throttling burst limit. The total rate of all requests in your AWS account is limited to 5,000 requests. Default: - No additional restriction.

  • throttling_rate_limit (Union[int, float, None]) – Specifies the throttling rate limit. The total rate of all requests in your AWS account is limited to 10,000 requests per second (rps). Default: - No additional restriction.

ExampleMetadata:

infused

Example:

api = apigateway.RestApi(self, "books")
deployment = apigateway.Deployment(self, "my-deployment", api=api)
stage = apigateway.Stage(self, "my-stage",
    deployment=deployment,
    method_options={
        "/*/*": apigateway.MethodDeploymentOptions( # This special path applies to all resource paths and all HTTP methods
            throttling_rate_limit=100,
            throttling_burst_limit=200)
    }
)

Attributes

cache_data_encrypted

Indicates whether the cached responses are encrypted.

Default:

false

cache_ttl

Specifies the time to live (TTL), in seconds, for cached responses.

The higher the TTL, the longer the response will be cached.

Default:

Duration.minutes(5)

See:

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-caching.html

caching_enabled

Specifies whether responses should be cached and returned for requests.

A cache cluster must be enabled on the stage for responses to be cached.

Default:
  • Caching is Disabled.

data_trace_enabled

Specifies whether data trace logging is enabled for this method.

When enabled, API gateway will log the full API requests and responses. This can be useful to troubleshoot APIs, but can result in logging sensitive data. We recommend that you don’t enable this feature for production APIs.

Default:

false

logging_level

Specifies the logging level for this method, which effects the log entries pushed to Amazon CloudWatch Logs.

Default:
  • Off

metrics_enabled

Specifies whether Amazon CloudWatch metrics are enabled for this method.

Default:

false

throttling_burst_limit

Specifies the throttling burst limit.

The total rate of all requests in your AWS account is limited to 5,000 requests.

Default:
  • No additional restriction.

See:

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html

throttling_rate_limit

Specifies the throttling rate limit.

The total rate of all requests in your AWS account is limited to 10,000 requests per second (rps).

Default:
  • No additional restriction.

See:

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html