UsagePlan
Provides an API Gateway Usage Plan.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var myapi = new Aws.ApiGateway.RestApi("myapi", new Aws.ApiGateway.RestApiArgs
{
});
var dev = new Aws.ApiGateway.Deployment("dev", new Aws.ApiGateway.DeploymentArgs
{
RestApi = myapi.Id,
StageName = "dev",
});
var prod = new Aws.ApiGateway.Deployment("prod", new Aws.ApiGateway.DeploymentArgs
{
RestApi = myapi.Id,
StageName = "prod",
});
var myUsagePlan = new Aws.ApiGateway.UsagePlan("myUsagePlan", new Aws.ApiGateway.UsagePlanArgs
{
ApiStages =
{
new Aws.ApiGateway.Inputs.UsagePlanApiStageArgs
{
ApiId = myapi.Id,
Stage = dev.StageName,
},
new Aws.ApiGateway.Inputs.UsagePlanApiStageArgs
{
ApiId = myapi.Id,
Stage = prod.StageName,
},
},
Description = "my description",
ProductCode = "MYCODE",
QuotaSettings = new Aws.ApiGateway.Inputs.UsagePlanQuotaSettingsArgs
{
Limit = 20,
Offset = 2,
Period = "WEEK",
},
ThrottleSettings = new Aws.ApiGateway.Inputs.UsagePlanThrottleSettingsArgs
{
BurstLimit = 5,
RateLimit = 10,
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/apigateway"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myapi, err := apigateway.NewRestApi(ctx, "myapi", nil)
if err != nil {
return err
}
dev, err := apigateway.NewDeployment(ctx, "dev", &apigateway.DeploymentArgs{
RestApi: myapi.ID(),
StageName: pulumi.String("dev"),
})
if err != nil {
return err
}
prod, err := apigateway.NewDeployment(ctx, "prod", &apigateway.DeploymentArgs{
RestApi: myapi.ID(),
StageName: pulumi.String("prod"),
})
if err != nil {
return err
}
_, err = apigateway.NewUsagePlan(ctx, "myUsagePlan", &apigateway.UsagePlanArgs{
ApiStages: apigateway.UsagePlanApiStageArray{
&apigateway.UsagePlanApiStageArgs{
ApiId: myapi.ID(),
Stage: dev.StageName,
},
&apigateway.UsagePlanApiStageArgs{
ApiId: myapi.ID(),
Stage: prod.StageName,
},
},
Description: pulumi.String("my description"),
ProductCode: pulumi.String("MYCODE"),
QuotaSettings: &apigateway.UsagePlanQuotaSettingsArgs{
Limit: pulumi.Int(20),
Offset: pulumi.Int(2),
Period: pulumi.String("WEEK"),
},
ThrottleSettings: &apigateway.UsagePlanThrottleSettingsArgs{
BurstLimit: pulumi.Int(5),
RateLimit: pulumi.Float64(10),
},
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
myapi = aws.apigateway.RestApi("myapi")
dev = aws.apigateway.Deployment("dev",
rest_api=myapi.id,
stage_name="dev")
prod = aws.apigateway.Deployment("prod",
rest_api=myapi.id,
stage_name="prod")
my_usage_plan = aws.apigateway.UsagePlan("myUsagePlan",
api_stages=[
{
"api_id": myapi.id,
"stage": dev.stage_name,
},
{
"api_id": myapi.id,
"stage": prod.stage_name,
},
],
description="my description",
product_code="MYCODE",
quota_settings={
"limit": 20,
"offset": 2,
"period": "WEEK",
},
throttle_settings={
"burstLimit": 5,
"rate_limit": 10,
})import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const myapi = new aws.apigateway.RestApi("myapi", {});
const dev = new aws.apigateway.Deployment("dev", {
restApi: myapi.id,
stageName: "dev",
});
const prod = new aws.apigateway.Deployment("prod", {
restApi: myapi.id,
stageName: "prod",
});
const myUsagePlan = new aws.apigateway.UsagePlan("MyUsagePlan", {
apiStages: [
{
apiId: myapi.id,
stage: dev.stageName,
},
{
apiId: myapi.id,
stage: prod.stageName,
},
],
description: "my description",
productCode: "MYCODE",
quotaSettings: {
limit: 20,
offset: 2,
period: "WEEK",
},
throttleSettings: {
burstLimit: 5,
rateLimit: 10,
},
});Create a UsagePlan Resource
new UsagePlan(name: string, args?: UsagePlanArgs, opts?: CustomResourceOptions);def UsagePlan(resource_name, opts=None, api_stages=None, description=None, name=None, product_code=None, quota_settings=None, tags=None, throttle_settings=None, __props__=None);func NewUsagePlan(ctx *Context, name string, args *UsagePlanArgs, opts ...ResourceOption) (*UsagePlan, error)public UsagePlan(string name, UsagePlanArgs? args = null, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args UsagePlanArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args UsagePlanArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args UsagePlanArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
UsagePlan Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The UsagePlan resource accepts the following input properties:
- Api
Stages List<UsagePlan Api Stage Args> The associated API stages of the usage plan.
- Description string
The description of a usage plan.
- Name string
The name of the usage plan.
- Product
Code string The AWS Markeplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
- Quota
Settings UsagePlan Quota Settings Args The quota settings of the usage plan.
- Dictionary<string, string>
Key-value map of resource tags
- Throttle
Settings UsagePlan Throttle Settings Args The throttling limits of the usage plan.
- Api
Stages []UsagePlan Api Stage The associated API stages of the usage plan.
- Description string
The description of a usage plan.
- Name string
The name of the usage plan.
- Product
Code string The AWS Markeplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
- Quota
Settings UsagePlan Quota Settings The quota settings of the usage plan.
- map[string]string
Key-value map of resource tags
- Throttle
Settings UsagePlan Throttle Settings The throttling limits of the usage plan.
- api
Stages UsagePlan Api Stage[] The associated API stages of the usage plan.
- description string
The description of a usage plan.
- name string
The name of the usage plan.
- product
Code string The AWS Markeplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
- quota
Settings UsagePlan Quota Settings The quota settings of the usage plan.
- {[key: string]: string}
Key-value map of resource tags
- throttle
Settings UsagePlan Throttle Settings The throttling limits of the usage plan.
- api_
stages List[UsagePlan Api Stage] The associated API stages of the usage plan.
- description str
The description of a usage plan.
- name str
The name of the usage plan.
- product_
code str The AWS Markeplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
- quota_
settings Dict[UsagePlan Quota Settings] The quota settings of the usage plan.
- Dict[str, str]
Key-value map of resource tags
- throttle_
settings Dict[UsagePlan Throttle Settings] The throttling limits of the usage plan.
Outputs
All input properties are implicitly available as output properties. Additionally, the UsagePlan resource produces the following output properties:
Look up an Existing UsagePlan Resource
Get an existing UsagePlan resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: UsagePlanState, opts?: CustomResourceOptions): UsagePlanstatic get(resource_name, id, opts=None, api_stages=None, arn=None, description=None, name=None, product_code=None, quota_settings=None, tags=None, throttle_settings=None, __props__=None);func GetUsagePlan(ctx *Context, name string, id IDInput, state *UsagePlanState, opts ...ResourceOption) (*UsagePlan, error)public static UsagePlan Get(string name, Input<string> id, UsagePlanState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Api
Stages List<UsagePlan Api Stage Args> The associated API stages of the usage plan.
- Arn string
Amazon Resource Name (ARN)
- Description string
The description of a usage plan.
- Name string
The name of the usage plan.
- Product
Code string The AWS Markeplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
- Quota
Settings UsagePlan Quota Settings Args The quota settings of the usage plan.
- Dictionary<string, string>
Key-value map of resource tags
- Throttle
Settings UsagePlan Throttle Settings Args The throttling limits of the usage plan.
- Api
Stages []UsagePlan Api Stage The associated API stages of the usage plan.
- Arn string
Amazon Resource Name (ARN)
- Description string
The description of a usage plan.
- Name string
The name of the usage plan.
- Product
Code string The AWS Markeplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
- Quota
Settings UsagePlan Quota Settings The quota settings of the usage plan.
- map[string]string
Key-value map of resource tags
- Throttle
Settings UsagePlan Throttle Settings The throttling limits of the usage plan.
- api
Stages UsagePlan Api Stage[] The associated API stages of the usage plan.
- arn string
Amazon Resource Name (ARN)
- description string
The description of a usage plan.
- name string
The name of the usage plan.
- product
Code string The AWS Markeplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
- quota
Settings UsagePlan Quota Settings The quota settings of the usage plan.
- {[key: string]: string}
Key-value map of resource tags
- throttle
Settings UsagePlan Throttle Settings The throttling limits of the usage plan.
- api_
stages List[UsagePlan Api Stage] The associated API stages of the usage plan.
- arn str
Amazon Resource Name (ARN)
- description str
The description of a usage plan.
- name str
The name of the usage plan.
- product_
code str The AWS Markeplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
- quota_
settings Dict[UsagePlan Quota Settings] The quota settings of the usage plan.
- Dict[str, str]
Key-value map of resource tags
- throttle_
settings Dict[UsagePlan Throttle Settings] The throttling limits of the usage plan.
Supporting Types
UsagePlanApiStage
UsagePlanQuotaSettings
UsagePlanThrottleSettings
- Burst
Limit int The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.
- Rate
Limit double The API request steady-state rate limit.
- Burst
Limit int The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.
- Rate
Limit float64 The API request steady-state rate limit.
- burst
Limit number The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.
- rate
Limit number The API request steady-state rate limit.
- burst
Limit float The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.
- rate_
limit float The API request steady-state rate limit.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.