Class UsagePlan
Inherited Members
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.AWS.APIGateway.dll
Syntax (csharp)
public class UsagePlan : Resource, IUsagePlan, IResource, IConstruct, IDependable
Syntax (vb)
Public Class UsagePlan
Inherits Resource
Implements IUsagePlan, IResource, IConstruct, IDependable
Remarks
ExampleMetadata: infused
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);
Synopsis
Constructors
UsagePlan(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
UsagePlan(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
UsagePlan(Construct, String, IUsagePlanProps) |
Properties
UsagePlanId | Id of the usage plan. |
Methods
AddApiKey(IApiKey, IAddApiKeyOptions) | Adds an ApiKey. |
AddApiStage(IUsagePlanPerApiStage) | Adds an apiStage. |
FromUsagePlanId(Construct, String, String) | Import an externally defined usage plan using its ARN. |
Constructors
UsagePlan(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected UsagePlan(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
UsagePlan(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected UsagePlan(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
UsagePlan(Construct, String, IUsagePlanProps)
public UsagePlan(Construct scope, string id, IUsagePlanProps props = null)
Parameters
- scope Constructs.Construct
- id System.String
- props IUsagePlanProps
Properties
UsagePlanId
Id of the usage plan.
public virtual string UsagePlanId { get; }
Property Value
System.String
Remarks
Attribute: true
Methods
AddApiKey(IApiKey, IAddApiKeyOptions)
Adds an ApiKey.
public virtual void AddApiKey(IApiKey apiKey, IAddApiKeyOptions options = null)
Parameters
- apiKey IApiKey
the api key to associate with this usage plan.
- options IAddApiKeyOptions
options 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 Constructs.Construct
the construct that will "own" the imported usage plan.
- id System.String
the id of the imported usage plan in the construct tree.
- usagePlanId System.String
the id of an existing usage plan.
Returns