Usage Plan
Provides an API Gateway Usage Plan.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apigateway.RestApi;
import com.pulumi.aws.apigateway.RestApiArgs;
import com.pulumi.aws.apigateway.Deployment;
import com.pulumi.aws.apigateway.DeploymentArgs;
import com.pulumi.aws.apigateway.Stage;
import com.pulumi.aws.apigateway.StageArgs;
import com.pulumi.aws.apigateway.UsagePlan;
import com.pulumi.aws.apigateway.UsagePlanArgs;
import com.pulumi.aws.apigateway.inputs.UsagePlanApiStageArgs;
import com.pulumi.aws.apigateway.inputs.UsagePlanQuotaSettingsArgs;
import com.pulumi.aws.apigateway.inputs.UsagePlanThrottleSettingsArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleRestApi = new RestApi("exampleRestApi", RestApiArgs.builder()
.body(serializeJson(
jsonObject(
jsonProperty("openapi", "3.0.1"),
jsonProperty("info", jsonObject(
jsonProperty("title", "example"),
jsonProperty("version", "1.0")
)),
jsonProperty("paths", jsonObject(
jsonProperty("/path1", jsonObject(
jsonProperty("get", jsonObject(
jsonProperty("x-amazon-apigateway-integration", jsonObject(
jsonProperty("httpMethod", "GET"),
jsonProperty("payloadFormatVersion", "1.0"),
jsonProperty("type", "HTTP_PROXY"),
jsonProperty("uri", "https://ip-ranges.amazonaws.com/ip-ranges.json")
))
))
))
))
)))
.build());
var exampleDeployment = new Deployment("exampleDeployment", DeploymentArgs.builder()
.restApi(exampleRestApi.id())
.triggers(Map.of("redeployment", exampleRestApi.body().applyValue(body -> serializeJson(
body)).applyValue(toJSON -> computeSHA1(toJSON))))
.build());
var development = new Stage("development", StageArgs.builder()
.deployment(exampleDeployment.id())
.restApi(exampleRestApi.id())
.stageName("development")
.build());
var production = new Stage("production", StageArgs.builder()
.deployment(exampleDeployment.id())
.restApi(exampleRestApi.id())
.stageName("production")
.build());
var exampleUsagePlan = new UsagePlan("exampleUsagePlan", UsagePlanArgs.builder()
.description("my description")
.productCode("MYCODE")
.apiStages(
UsagePlanApiStageArgs.builder()
.apiId(exampleRestApi.id())
.stage(development.stageName())
.build(),
UsagePlanApiStageArgs.builder()
.apiId(exampleRestApi.id())
.stage(production.stageName())
.build())
.quotaSettings(UsagePlanQuotaSettingsArgs.builder()
.limit(20)
.offset(2)
.period("WEEK")
.build())
.throttleSettings(UsagePlanThrottleSettingsArgs.builder()
.burstLimit(5)
.rateLimit(10)
.build())
.build());
}
}
Content copied to clipboard
Import
AWS API Gateway Usage Plan can be imported using the id
, e.g.,
$ pulumi import aws:apigateway/usagePlan:UsagePlan myusageplan <usage_plan_id>
Content copied to clipboard
Properties
Link copied to clipboard
Associated API stages of the usage plan.
Link copied to clipboard
Description of a usage plan.
Link copied to clipboard
AWS Marketplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
The quota settings of the usage plan.
Link copied to clipboard
The throttling limits of the usage plan.