UsagePlanProps Struct
Properties for defining an API Gateway Usage Plan for WebSocket APIs.
| Source | aws-apigatewayv2/lib/websocket/usage-plan.ts |
|---|---|
| Type last changed |
Example
ts
const api = new apigwv2.WebSocketApi(this, 'my-api');
const stage = new apigwv2.WebSocketStage(this, 'my-stage', {
webSocketApi: api,
stageName: 'dev',
});
const usagePlan = new apigwv2.UsagePlan(this, 'my-usage-plan', {
usagePlanName: 'Basic',
});
usagePlan.addApiStage({
api: api,
stage: stage,
});
python
api = apigwv2.WebSocketApi(self, "my-api")
stage = apigwv2.WebSocketStage(self, "my-stage",
web_socket_api=api,
stage_name="dev"
)
usage_plan = apigwv2.UsagePlan(self, "my-usage-plan",
usage_plan_name="Basic"
)
usage_plan.add_api_stage(
api=api,
stage=stage
)
java
WebSocketApi api = new WebSocketApi(this, "my-api");
WebSocketStage stage = WebSocketStage.Builder.create(this, "my-stage")
.webSocketApi(api)
.stageName("dev")
.build();
UsagePlan usagePlan = UsagePlan.Builder.create(this, "my-usage-plan")
.usagePlanName("Basic")
.build();
usagePlan.addApiStage(UsagePlanPerApiStage.builder()
.api(api)
.stage(stage)
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
var api = new WebSocketApi(this, "my-api");
var stage = new WebSocketStage(this, "my-stage", new WebSocketStageProps {
WebSocketApi = api,
StageName = "dev"
});
var usagePlan = new UsagePlan(this, "my-usage-plan", new UsagePlanProps {
UsagePlanName = "Basic"
});
usagePlan.AddApiStage(new UsagePlanPerApiStage {
Api = api,
Stage = stage
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
api := apigwv2.NewWebSocketApi(this, jsii.String("my-api"))
stage := apigwv2.NewWebSocketStage(this, jsii.String("my-stage"), &WebSocketStageProps{
WebSocketApi: api,
StageName: jsii.String("dev"),
})
usagePlan := apigwv2.NewUsagePlan(this, jsii.String("my-usage-plan"), &UsagePlanProps{
UsagePlanName: jsii.String("Basic"),
})
usagePlan.AddApiStage(&UsagePlanPerApiStage{
Api: api,
Stage: stage,
})
Properties
apiStagesoptionalUsagePlanPerApiStage[]api_stagesoptionaltyping.List[UsagePlanPerApiStage]apiStagesoptionalList<UsagePlanPerApiStage>ApiStagesoptionalUsagePlanPerApiStage[]ApiStagesoptional*[]UsagePlanPerApiStage = none #API Stages to be associated with the usage plan.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string = none #Represents usage plan purpose.
quotaoptionalQuotaSettingsquotaoptionalQuotaSettingsquotaoptionalQuotaSettingsQuotaoptionalQuotaSettingsQuotaoptionalQuotaSettings = none #Number of requests clients can make in a given time period.
throttleoptionalThrottleSettingsthrottleoptionalThrottleSettingsthrottleoptionalThrottleSettingsThrottleoptionalThrottleSettingsThrottleoptionalThrottleSettings = none #Overall throttle settings for the API.
usagePlanNameoptionalstringusage_plan_nameoptionalstrusagePlanNameoptionalStringUsagePlanNameoptionalstringUsagePlanNameoptional*string = none #Name for this usage plan.