UsagePlanProps

class aws_cdk.aws_apigateway.UsagePlanProps(*, api_key=None, api_stages=None, description=None, name=None, quota=None, throttle=None)

Bases: object

Parameters
  • api_key (Optional[IApiKey]) – (deprecated) ApiKey to be associated with the usage plan. Default: none

  • api_stages (Optional[Sequence[UsagePlanPerApiStage]]) – API Stages to be associated with the usage plan. Default: none

  • description (Optional[str]) – Represents usage plan purpose. Default: none

  • name (Optional[str]) – Name for this usage plan. Default: none

  • quota (Optional[QuotaSettings]) – Number of requests clients can make in a given time period. Default: none

  • throttle (Optional[ThrottleSettings]) – Overall throttle settings for the API. Default: none

Example:

# integration is of type LambdaIntegration


api = apigateway.RestApi(self, "hello-api")

v1 = api.root.add_resource("v1")
echo = v1.add_resource("echo")
echo_method = echo.add_method("GET", integration, api_key_required=True)

plan = api.add_usage_plan("UsagePlan",
    name="Easy",
    throttle=apigateway.ThrottleSettings(
        rate_limit=10,
        burst_limit=2
    )
)

key = api.add_api_key("ApiKey")
plan.add_api_key(key)

Attributes

api_key

(deprecated) ApiKey to be associated with the usage plan.

Default

none

Deprecated

use addApiKey()

Stability

deprecated

Return type

Optional[IApiKey]

api_stages

API Stages to be associated with the usage plan.

Default

none

Return type

Optional[List[UsagePlanPerApiStage]]

description

Represents usage plan purpose.

Default

none

Return type

Optional[str]

name

Name for this usage plan.

Default

none

Return type

Optional[str]

quota

Number of requests clients can make in a given time period.

Default

none

Return type

Optional[QuotaSettings]

throttle

Overall throttle settings for the API.

Default

none

Return type

Optional[ThrottleSettings]