Skip to content
v2.278.0

UsagePlanPerApiStage Struct ​

Represents the API stages that a usage plan applies to.

Example ​

ts
declare const plan: apigateway.UsagePlan;
declare const api: apigateway.RestApi;
declare const echoMethod: apigateway.Method;

plan.addApiStage({
  stage: api.deploymentStage,
  throttle: [
    {
      method: echoMethod,
      throttle: {
        rateLimit: 10,
        burstLimit: 2
      }
    }
  ]
});
python
# plan: apigateway.UsagePlan
# api: apigateway.RestApi
# echo_method: apigateway.Method


plan.add_api_stage(
    stage=api.deployment_stage,
    throttle=[apigateway.ThrottlingPerMethod(
        method=echo_method,
        throttle=apigateway.ThrottleSettings(
            rate_limit=10,
            burst_limit=2
        )
    )
    ]
)
java
UsagePlan plan;
RestApi api;
Method echoMethod;


plan.addApiStage(UsagePlanPerApiStage.builder()
        .stage(api.getDeploymentStage())
        .throttle(List.of(ThrottlingPerMethod.builder()
                .method(echoMethod)
                .throttle(ThrottleSettings.builder()
                        .rateLimit(10)
                        .burstLimit(2)
                        .build())
                .build()))
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
UsagePlan plan;
RestApi api;
Method echoMethod;


plan.AddApiStage(new UsagePlanPerApiStage {
    Stage = api.DeploymentStage,
    Throttle = new [] { new ThrottlingPerMethod {
        Method = echoMethod,
        Throttle = new ThrottleSettings {
            RateLimit = 10,
            BurstLimit = 2
        }
    } }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var plan UsagePlan
var api RestApi
var echoMethod Method


plan.AddApiStage(&UsagePlanPerApiStage{
	Stage: api.DeploymentStage,
	Throttle: []ThrottlingPerMethod{
		&ThrottlingPerMethod{
			Method: echoMethod,
			Throttle: &ThrottleSettings{
				RateLimit: jsii.Number(10),
				BurstLimit: jsii.Number(2),
			},
		},
	},
})

Properties ​

apioptionalIRestApiapioptionalIRestApiapioptionalIRestApiApioptionalIRestApiApioptionalIRestApi = none #
stageoptionalStagestageoptionalStagestageoptionalStageStageoptionalStageStageoptionalStage = none #
[disable-awslint:ref-via-interface].
throttleoptionalThrottlingPerMethod[]throttleoptionaltyping.List[ThrottlingPerMethod]throttleoptionalList<ThrottlingPerMethod>ThrottleoptionalThrottlingPerMethod[]Throttleoptional*[]ThrottlingPerMethod = none #