Class UsagePlan
- Namespace
- Amazon.CDK.AWS.APIGateway
- Assembly
- Amazon.CDK.AWS.APIGateway.dll
public class UsagePlan : Resource, IUsagePlan, IResource, IConstruct, IConstruct, IDependable
- Inheritance
-
UsagePlan
- Implements
-
IResourceIConstructIConstructIDependable
Examples
LambdaIntegration integration;
var api = new RestApi(this, "hello-api");
var v1 = api.Root.AddResource("v1");
var echo = v1.AddResource("echo");
var echoMethod = echo.AddMethod("GET", integration, new MethodOptions { ApiKeyRequired = true });
var plan = api.AddUsagePlan("UsagePlan", new UsagePlanProps {
Name = "Easy",
Throttle = new ThrottleSettings {
RateLimit = 10,
BurstLimit = 2
}
});
var key = api.AddApiKey("ApiKey");
plan.AddApiKey(key);
Remarks
ExampleMetadata: infused
Constructors
UsagePlan(Construct, string, IUsagePlanProps?)
public UsagePlan(Construct scope, string id, IUsagePlanProps? props = null)
Parameters
scope
Constructid
stringprops
IUsagePlanProps
Properties
UsagePlanId
Id of the usage plan.
public virtual string UsagePlanId { get; }
Property Value
Remarks
Attribute: true
Methods
AddApiKey(IApiKey, IAddApiKeyOptions?)
Adds an ApiKey.
public virtual void AddApiKey(IApiKey apiKey, IAddApiKeyOptions? options = null)
Parameters
apiKey
IApiKeythe api key to associate with this usage plan.
options
IAddApiKeyOptionsoptions that control the behaviour of this method.
AddApiStage(IUsagePlanPerApiStage)
Adds an apiStage.
public virtual void AddApiStage(IUsagePlanPerApiStage apiStage)
Parameters
apiStage
IUsagePlanPerApiStage
FromUsagePlanId(Construct, string, string)
Import an externally defined usage plan using its ARN.
public static IUsagePlan FromUsagePlanId(Construct scope, string id, string usagePlanId)
Parameters
scope
Constructthe construct that will "own" the imported usage plan.
id
stringthe id of the imported usage plan in the construct tree.
usagePlanId
stringthe id of an existing usage plan.