@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:47.786Z") public class UsagePlan extends Resource implements IUsagePlan
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);
Modifier and Type | Class and Description |
---|---|
static class |
UsagePlan.Builder
A fluent builder for
UsagePlan . |
IUsagePlan.Jsii$Default, IUsagePlan.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
UsagePlan(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
UsagePlan(software.amazon.jsii.JsiiObjectRef objRef) |
|
UsagePlan(software.constructs.Construct scope,
java.lang.String id) |
|
UsagePlan(software.constructs.Construct scope,
java.lang.String id,
UsagePlanProps props) |
Modifier and Type | Method and Description |
---|---|
void |
addApiKey(IApiKey apiKey)
Adds an ApiKey.
|
void |
addApiKey(IApiKey apiKey,
AddApiKeyOptions options)
Adds an ApiKey.
|
void |
addApiStage(UsagePlanPerApiStage apiStage)
Adds an apiStage.
|
static IUsagePlan |
fromUsagePlanId(software.constructs.Construct scope,
java.lang.String id,
java.lang.String usagePlanId)
Import an externally defined usage plan using its ARN.
|
java.lang.String |
getUsagePlanId()
Id of the usage plan.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyRemovalPolicy, getEnv, getStack
getNode
protected UsagePlan(software.amazon.jsii.JsiiObjectRef objRef)
protected UsagePlan(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public UsagePlan(software.constructs.Construct scope, java.lang.String id, UsagePlanProps props)
scope
- This parameter is required.id
- This parameter is required.props
- public UsagePlan(software.constructs.Construct scope, java.lang.String id)
scope
- This parameter is required.id
- This parameter is required.public static IUsagePlan fromUsagePlanId(software.constructs.Construct scope, java.lang.String id, java.lang.String usagePlanId)
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.public void addApiKey(IApiKey apiKey, AddApiKeyOptions options)
addApiKey
in interface IUsagePlan
apiKey
- the api key to associate with this usage plan. This parameter is required.options
- options that control the behaviour of this method.public void addApiKey(IApiKey apiKey)
addApiKey
in interface IUsagePlan
apiKey
- the api key to associate with this usage plan. This parameter is required.public void addApiStage(UsagePlanPerApiStage apiStage)
apiStage
- This parameter is required.public java.lang.String getUsagePlanId()
getUsagePlanId
in interface IUsagePlan