Class UsagePlan
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.apigateway.UsagePlan
- All Implemented Interfaces:
IUsagePlanRef,IEnvironmentAware,IResource,IUsagePlan,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-13T16:09:57.955Z")
@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);
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.apigateway.IUsagePlan
IUsagePlan.Jsii$Default, IUsagePlan.Jsii$Proxy -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedUsagePlan(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedUsagePlan(software.amazon.jsii.JsiiObjectRef objRef) UsagePlan(software.constructs.Construct scope, String id, UsagePlanProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddApiKey(IApiKeyRef apiKey) Adds an ApiKey.voidaddApiKey(IApiKeyRef apiKey, AddApiKeyOptions options) Adds an ApiKey.voidaddApiStage(UsagePlanPerApiStage apiStage) Adds an apiStage.static IUsagePlanfromUsagePlanId(software.constructs.Construct scope, String id, String usagePlanId) Import an externally defined usage plan using its ARN.Id of the usage plan.A reference to a UsagePlan resource.Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.awscdk.services.apigateway.IUsagePlan
getEnv, getNodeMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
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 IApiKeyRef apiKey, @Nullable AddApiKeyOptions options) Adds an ApiKey.- Specified by:
addApiKeyin interfaceIUsagePlan- 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
Adds an ApiKey.- Specified by:
addApiKeyin interfaceIUsagePlan- Parameters:
apiKey- the api key to associate with this usage plan. This parameter is required.
-
addApiStage
Adds an apiStage.- Parameters:
apiStage- This parameter is required.
-
getUsagePlanId
Id of the usage plan.- Specified by:
getUsagePlanIdin interfaceIUsagePlan
-
getUsagePlanRef
A reference to a UsagePlan resource.- Specified by:
getUsagePlanRefin interfaceIUsagePlanRef
-