Class CfnUsagePlan

java.lang.Object
software.amazon.jsii.JsiiObject
All Implemented Interfaces:
IConstruct, IDependable, IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:44.911Z") @Stability(Stable) public class CfnUsagePlan extends CfnResource implements IInspectable
A CloudFormation AWS::ApiGateway::UsagePlan.

The AWS::ApiGateway::UsagePlan resource creates a usage plan for deployed APIs. A usage plan sets a target for the throttling and quota limits on individual client API keys. For more information, see Creating and Using API Usage Plans in Amazon API Gateway in the API Gateway Developer Guide .

In some cases clients can exceed the targets that you set. Don’t rely on usage plans to control costs. Consider using AWS Budgets to monitor costs and AWS WAF to manage API requests.

Example:

 // 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.*;
 CfnUsagePlan cfnUsagePlan = CfnUsagePlan.Builder.create(this, "MyCfnUsagePlan")
         .apiStages(List.of(ApiStageProperty.builder()
                 .apiId("apiId")
                 .stage("stage")
                 .throttle(Map.of(
                         "throttleKey", ThrottleSettingsProperty.builder()
                                 .burstLimit(123)
                                 .rateLimit(123)
                                 .build()))
                 .build()))
         .description("description")
         .quota(QuotaSettingsProperty.builder()
                 .limit(123)
                 .offset(123)
                 .period("period")
                 .build())
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .throttle(ThrottleSettingsProperty.builder()
                 .burstLimit(123)
                 .rateLimit(123)
                 .build())
         .usagePlanName("usagePlanName")
         .build();
 
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnUsagePlan

      protected CfnUsagePlan(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnUsagePlan

      protected CfnUsagePlan(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnUsagePlan

      @Stability(Stable) public CfnUsagePlan(@NotNull Construct scope, @NotNull String id, @Nullable CfnUsagePlanProps props)
      Create a new AWS::ApiGateway::UsagePlan.

      Parameters:
      scope -
      • scope in which this resource is defined.
      This parameter is required.
      id -
      • scoped id of the resource.
      This parameter is required.
      props -
      • resource properties.
    • CfnUsagePlan

      @Stability(Stable) public CfnUsagePlan(@NotNull Construct scope, @NotNull String id)
      Create a new AWS::ApiGateway::UsagePlan.

      Parameters:
      scope -
      • scope in which this resource is defined.
      This parameter is required.
      id -
      • scoped id of the resource.
      This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector -
      • tree inspector to collect and process attributes.
      This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrId

      @Stability(Stable) @NotNull public String getAttrId()
      The ID for the usage plan.

      For example: abc123 .

    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      The collection of tags.

      Each tag element is associated with a given resource.

    • getApiStages

      @Stability(Stable) @Nullable public Object getApiStages()
      The associated API stages of a usage plan.
    • setApiStages

      @Stability(Stable) public void setApiStages(@Nullable IResolvable value)
      The associated API stages of a usage plan.
    • setApiStages

      @Stability(Stable) public void setApiStages(@Nullable List<Object> value)
      The associated API stages of a usage plan.
    • getDescription

      @Stability(Stable) @Nullable public String getDescription()
      The description of a usage plan.
    • setDescription

      @Stability(Stable) public void setDescription(@Nullable String value)
      The description of a usage plan.
    • getQuota

      @Stability(Stable) @Nullable public Object getQuota()
      The target maximum number of permitted requests per a given unit time interval.
    • setQuota

      @Stability(Stable) public void setQuota(@Nullable IResolvable value)
      The target maximum number of permitted requests per a given unit time interval.
    • setQuota

      @Stability(Stable) public void setQuota(@Nullable CfnUsagePlan.QuotaSettingsProperty value)
      The target maximum number of permitted requests per a given unit time interval.
    • getThrottle

      @Stability(Stable) @Nullable public Object getThrottle()
      A map containing method level throttling information for API stage in a usage plan.
    • setThrottle

      @Stability(Stable) public void setThrottle(@Nullable IResolvable value)
      A map containing method level throttling information for API stage in a usage plan.
    • setThrottle

      @Stability(Stable) public void setThrottle(@Nullable CfnUsagePlan.ThrottleSettingsProperty value)
      A map containing method level throttling information for API stage in a usage plan.
    • getUsagePlanName

      @Stability(Stable) @Nullable public String getUsagePlanName()
      The name of a usage plan.
    • setUsagePlanName

      @Stability(Stable) public void setUsagePlanName(@Nullable String value)
      The name of a usage plan.