java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.apigateway.UsagePlan
All Implemented Interfaces:
IResource, IUsagePlan, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:23:56.303Z") @Stability(Stable) public class UsagePlan extends Resource implements IUsagePlan
Example:

 LambdaIntegration integration;
 RestApi api = new RestApi(this, "hello-api");
 Resource v1 = api.root.addResource("v1");
 Resource echo = v1.addResource("echo");
 Method echoMethod = echo.addMethod("GET", integration, MethodOptions.builder().apiKeyRequired(true).build());
 UsagePlan plan = api.addUsagePlan("UsagePlan", UsagePlanProps.builder()
         .name("Easy")
         .throttle(ThrottleSettings.builder()
                 .rateLimit(10)
                 .burstLimit(2)
                 .build())
         .build());
 IApiKey key = api.addApiKey("ApiKey");
 plan.addApiKey(key);
 
  • Constructor Details

    • UsagePlan

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

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

      @Stability(Stable) public UsagePlan(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable UsagePlanProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • UsagePlan

      @Stability(Stable) public UsagePlan(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • fromUsagePlanId

      @Stability(Stable) @NotNull public static IUsagePlan fromUsagePlanId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String usagePlanId)
      Import an externally defined usage plan using its ARN.

      Parameters:
      scope - the construct that will "own" the imported usage plan. This parameter is required.
      id - the id of the imported usage plan in the construct tree. This parameter is required.
      usagePlanId - the id of an existing usage plan. This parameter is required.
    • addApiKey

      @Stability(Stable) public void addApiKey(@NotNull IApiKey apiKey, @Nullable AddApiKeyOptions options)
      Adds an ApiKey.

      Specified by:
      addApiKey in interface IUsagePlan
      Parameters:
      apiKey - the api key to associate with this usage plan. This parameter is required.
      options - options that control the behaviour of this method.
    • addApiKey

      @Stability(Stable) public void addApiKey(@NotNull IApiKey apiKey)
      Adds an ApiKey.

      Specified by:
      addApiKey in interface IUsagePlan
      Parameters:
      apiKey - the api key to associate with this usage plan. This parameter is required.
    • addApiStage

      @Stability(Stable) public void addApiStage(@NotNull UsagePlanPerApiStage apiStage)
      Adds an apiStage.

      Parameters:
      apiStage - This parameter is required.
    • getUsagePlanId

      @Stability(Stable) @NotNull public String getUsagePlanId()
      Id of the usage plan.
      Specified by:
      getUsagePlanId in interface IUsagePlan