MethodDeploymentOptions Struct
Example
ts
const api = new apigateway.RestApi(this, 'books');
const deployment = new apigateway.Deployment(this, 'my-deployment', { api });
const stage = new apigateway.Stage(this, 'my-stage', {
deployment,
methodOptions: {
'/*/*': { // This special path applies to all resource paths and all HTTP methods
throttlingRateLimit: 100,
throttlingBurstLimit: 200
}
}
});
python
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)
}
)
java
RestApi api = new RestApi(this, "books");
Deployment deployment = Deployment.Builder.create(this, "my-deployment").api(api).build();
Stage stage = Stage.Builder.create(this, "my-stage")
.deployment(deployment)
.methodOptions(Map.of(
"/*/*", MethodDeploymentOptions.builder() // This special path applies to all resource paths and all HTTP methods
.throttlingRateLimit(100)
.throttlingBurstLimit(200).build()))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var api = new RestApi(this, "books");
var deployment = new Deployment(this, "my-deployment", new DeploymentProps { Api = api });
var stage = new Stage(this, "my-stage", new StageProps {
Deployment = deployment,
MethodOptions = new Dictionary<string, MethodDeploymentOptions> {
{ "/*/*", new MethodDeploymentOptions { // This special path applies to all resource paths and all HTTP methods
ThrottlingRateLimit = 100,
ThrottlingBurstLimit = 200 } }
}
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
api := apigateway.NewRestApi(this, jsii.String("books"))
deployment := apigateway.NewDeployment(this, jsii.String("my-deployment"), &DeploymentProps{
Api: Api,
})
stage := apigateway.NewStage(this, jsii.String("my-stage"), &StageProps{
Deployment: Deployment,
MethodOptions: map[string]MethodDeploymentOptions{
"/*/*": &MethodDeploymentOptions{
// This special path applies to all resource paths and all HTTP methods
"throttlingRateLimit": jsii.Number(100),
"throttlingBurstLimit": jsii.Number(200),
},
},
})
Properties
cacheDataEncryptedoptionalbooleancache_data_encryptedoptionalboolcacheDataEncryptedoptionalBooleanCacheDataEncryptedoptionalboolCacheDataEncryptedoptional*bool= false#Indicates whether the cached responses are encrypted.
cacheTtloptionalDurationcache_ttloptionalDurationcacheTtloptionalDurationCacheTtloptionalDurationCacheTtloptionalDuration= Duration.minutes(5)#Specifies the time to live (TTL), in seconds, for cached responses.
The higher the TTL, the longer the response will be cached.
cachingEnabledoptionalbooleancaching_enabledoptionalboolcachingEnabledoptionalBooleanCachingEnabledoptionalboolCachingEnabledoptional*bool#Specifies whether responses should be cached and returned for requests.
Default: Caching is Disabled.
A cache cluster must be enabled on the stage for responses to be cached.
dataTraceEnabledoptionalbooleandata_trace_enabledoptionalbooldataTraceEnabledoptionalBooleanDataTraceEnabledoptionalboolDataTraceEnabledoptional*bool= false#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.
loggingLeveloptionalMethodLoggingLevellogging_leveloptionalMethodLoggingLevelloggingLeveloptionalMethodLoggingLevelLoggingLeveloptionalMethodLoggingLevelLoggingLeveloptionalMethodLoggingLevel= Off#Specifies the logging level for this method, which effects the log entries pushed to Amazon CloudWatch Logs.
metricsEnabledoptionalbooleanmetrics_enabledoptionalboolmetricsEnabledoptionalBooleanMetricsEnabledoptionalboolMetricsEnabledoptional*bool= false#Specifies whether Amazon CloudWatch metrics are enabled for this method.
throttlingBurstLimitoptionalnumberthrottling_burst_limitoptionalint | floatthrottlingBurstLimitoptionalNumberThrottlingBurstLimitoptionaldoubleThrottlingBurstLimitoptional*float64#Specifies the throttling burst limit.
Default: No additional restriction.
The total rate of all requests in your AWS account is limited to 5,000 requests.
throttlingRateLimitoptionalnumberthrottling_rate_limitoptionalint | floatthrottlingRateLimitoptionalNumberThrottlingRateLimitoptionaldoubleThrottlingRateLimitoptional*float64#Specifies the throttling rate limit.
Default: No additional restriction.
The total rate of all requests in your AWS account is limited to 10,000 requests per second (rps).