StageArgs

data class StageArgs(val accessLogSettings: Output<StageAccessLogSettingsArgs>? = null, val cacheClusterEnabled: Output<Boolean>? = null, val cacheClusterSize: Output<String>? = null, val canarySettings: Output<StageCanarySettingsArgs>? = null, val clientCertificateId: Output<String>? = null, val deployment: Output<String>? = null, val description: Output<String>? = null, val documentationVersion: Output<String>? = null, val restApi: Output<String>? = null, val stageName: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val variables: Output<Map<String, String>>? = null, val xrayTracingEnabled: Output<Boolean>? = null) : ConvertibleToJava<StageArgs>

Manages an API Gateway Stage. A stage is a named reference to a deployment, which can be done via the aws.apigateway.Deployment resource. Stages can be optionally managed further with the aws.apigateway.BasePathMapping resource, aws.apigateway.DomainName resource, and aws_api_method_settings resource. For more information, see the API Gateway Developer Guide.

Managing the API Logging CloudWatch Log Group

API Gateway provides the ability to enable CloudWatch API logging. To manage the CloudWatch Log Group when this feature is enabled, the aws.cloudwatch.LogGroup resource can be used where the name matches the API Gateway naming convention. If the CloudWatch Log Group previously exists, import the aws.cloudwatch.LogGroup resource into Pulumi as a one time operation. You can recreate the environment without import.

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const config = new pulumi.Config();
const stageName = config.get("stageName") || "example";
const example = new aws.apigateway.RestApi("example", {});
const exampleLogGroup = new aws.cloudwatch.LogGroup("example", {
name: pulumi.interpolate`API-Gateway-Execution-Logs_${example.id}/${stageName}`,
retentionInDays: 7,
});
const exampleStage = new aws.apigateway.Stage("example", {stageName: stageName}, {
dependsOn: [exampleLogGroup],
});
import pulumi
import pulumi_aws as aws
config = pulumi.Config()
stage_name = config.get("stageName")
if stage_name is None:
stage_name = "example"
example = aws.apigateway.RestApi("example")
example_log_group = aws.cloudwatch.LogGroup("example",
name=example.id.apply(lambda id: f"API-Gateway-Execution-Logs_{id}/{stage_name}"),
retention_in_days=7)
example_stage = aws.apigateway.Stage("example", stage_name=stage_name,
opts = pulumi.ResourceOptions(depends_on=[example_log_group]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var stageName = config.Get("stageName") ?? "example";
var example = new Aws.ApiGateway.RestApi("example");
var exampleLogGroup = new Aws.CloudWatch.LogGroup("example", new()
{
Name = example.Id.Apply(id => $"API-Gateway-Execution-Logs_{id}/{stageName}"),
RetentionInDays = 7,
});
var exampleStage = new Aws.ApiGateway.Stage("example", new()
{
StageName = stageName,
}, new CustomResourceOptions
{
DependsOn =
{
exampleLogGroup,
},
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigateway"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
stageName := "example"
if param := cfg.Get("stageName"); param != "" {
stageName = param
}
example, err := apigateway.NewRestApi(ctx, "example", nil)
if err != nil {
return err
}
exampleLogGroup, err := cloudwatch.NewLogGroup(ctx, "example", &cloudwatch.LogGroupArgs{
Name: example.ID().ApplyT(func(id string) (string, error) {
return fmt.Sprintf("API-Gateway-Execution-Logs_%v/%v", id, stageName), nil
}).(pulumi.StringOutput),
RetentionInDays: pulumi.Int(7),
})
if err != nil {
return err
}
_, err = apigateway.NewStage(ctx, "example", &apigateway.StageArgs{
StageName: pulumi.String(stageName),
}, pulumi.DependsOn([]pulumi.Resource{
exampleLogGroup,
}))
if err != nil {
return err
}
return nil
})
}
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.cloudwatch.LogGroup;
import com.pulumi.aws.cloudwatch.LogGroupArgs;
import com.pulumi.aws.apigateway.Stage;
import com.pulumi.aws.apigateway.StageArgs;
import com.pulumi.resources.CustomResourceOptions;
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) {
final var config = ctx.config();
final var stageName = config.get("stageName").orElse("example");
var example = new RestApi("example");
var exampleLogGroup = new LogGroup("exampleLogGroup", LogGroupArgs.builder()
.name(example.id().applyValue(_id -> String.format("API-Gateway-Execution-Logs_%s/%s", _id,stageName)))
.retentionInDays(7)
.build());
var exampleStage = new Stage("exampleStage", StageArgs.builder()
.stageName(stageName)
.build(), CustomResourceOptions.builder()
.dependsOn(exampleLogGroup)
.build());
}
}
configuration:
stageName:
type: string
default: example
resources:
example:
type: aws:apigateway:RestApi
exampleStage:
type: aws:apigateway:Stage
name: example
properties:
stageName: ${stageName}
options:
dependsOn:
- ${exampleLogGroup}
exampleLogGroup:
type: aws:cloudwatch:LogGroup
name: example
properties:
name: API-Gateway-Execution-Logs_${example.id}/${stageName}
retentionInDays: 7 # ... potentially other configuration ...

Import

Using pulumi import, import aws_api_gateway_stage using REST-API-ID/STAGE-NAME. For example:

$ pulumi import aws:apigateway/stage:Stage example 12345abcde/example

Constructors

Link copied to clipboard
constructor(accessLogSettings: Output<StageAccessLogSettingsArgs>? = null, cacheClusterEnabled: Output<Boolean>? = null, cacheClusterSize: Output<String>? = null, canarySettings: Output<StageCanarySettingsArgs>? = null, clientCertificateId: Output<String>? = null, deployment: Output<String>? = null, description: Output<String>? = null, documentationVersion: Output<String>? = null, restApi: Output<String>? = null, stageName: Output<String>? = null, tags: Output<Map<String, String>>? = null, variables: Output<Map<String, String>>? = null, xrayTracingEnabled: Output<Boolean>? = null)

Properties

Link copied to clipboard

Enables access logs for the API stage. See Access Log Settings below.

Link copied to clipboard
val cacheClusterEnabled: Output<Boolean>? = null

Whether a cache cluster is enabled for the stage

Link copied to clipboard
val cacheClusterSize: Output<String>? = null

Size of the cache cluster for the stage, if enabled. Allowed values include 0.5, 1.6, 6.1, 13.5, 28.4, 58.2, 118 and 237.

Link copied to clipboard

Configuration settings of a canary deployment. See Canary Settings below.

Link copied to clipboard
val clientCertificateId: Output<String>? = null

Identifier of a client certificate for the stage.

Link copied to clipboard
val deployment: Output<String>? = null

ID of the deployment that the stage points to

Link copied to clipboard
val description: Output<String>? = null

Description of the stage.

Link copied to clipboard
val documentationVersion: Output<String>? = null

Version of the associated API documentation

Link copied to clipboard
val restApi: Output<String>? = null

ID of the associated REST API

Link copied to clipboard
val stageName: Output<String>? = null

Name of the stage

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val variables: Output<Map<String, String>>? = null

Map that defines the stage variables

Link copied to clipboard
val xrayTracingEnabled: Output<Boolean>? = null

Whether active tracing with X-ray is enabled. Defaults to false.

Functions

Link copied to clipboard
open override fun toJava(): StageArgs