@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
125 lines • 6.57 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Stage = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* 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 `awsApiMethodSettings` resource. For more information, see the [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-stages.html).
*
* ### Managing the API Logging CloudWatch Log Group
*
* API Gateway provides the ability to [enable CloudWatch API logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html). 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.
*
* ```typescript
* 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
*
* Using `pulumi import`, import `aws_api_gateway_stage` using `REST-API-ID/STAGE-NAME`. For example:
*
* ```sh
* $ pulumi import aws:apigateway/stage:Stage example 12345abcde/example
* ```
*/
class Stage extends pulumi.CustomResource {
/**
* Get an existing Stage resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new Stage(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Stage. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Stage.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessLogSettings"] = state?.accessLogSettings;
resourceInputs["arn"] = state?.arn;
resourceInputs["cacheClusterEnabled"] = state?.cacheClusterEnabled;
resourceInputs["cacheClusterSize"] = state?.cacheClusterSize;
resourceInputs["canarySettings"] = state?.canarySettings;
resourceInputs["clientCertificateId"] = state?.clientCertificateId;
resourceInputs["deployment"] = state?.deployment;
resourceInputs["description"] = state?.description;
resourceInputs["documentationVersion"] = state?.documentationVersion;
resourceInputs["executionArn"] = state?.executionArn;
resourceInputs["invokeUrl"] = state?.invokeUrl;
resourceInputs["region"] = state?.region;
resourceInputs["restApi"] = state?.restApi;
resourceInputs["stageName"] = state?.stageName;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["variables"] = state?.variables;
resourceInputs["webAclArn"] = state?.webAclArn;
resourceInputs["xrayTracingEnabled"] = state?.xrayTracingEnabled;
}
else {
const args = argsOrState;
if (args?.deployment === undefined && !opts.urn) {
throw new Error("Missing required property 'deployment'");
}
if (args?.restApi === undefined && !opts.urn) {
throw new Error("Missing required property 'restApi'");
}
if (args?.stageName === undefined && !opts.urn) {
throw new Error("Missing required property 'stageName'");
}
resourceInputs["accessLogSettings"] = args?.accessLogSettings;
resourceInputs["cacheClusterEnabled"] = args?.cacheClusterEnabled;
resourceInputs["cacheClusterSize"] = args?.cacheClusterSize;
resourceInputs["canarySettings"] = args?.canarySettings;
resourceInputs["clientCertificateId"] = args?.clientCertificateId;
resourceInputs["deployment"] = args?.deployment;
resourceInputs["description"] = args?.description;
resourceInputs["documentationVersion"] = args?.documentationVersion;
resourceInputs["region"] = args?.region;
resourceInputs["restApi"] = args?.restApi;
resourceInputs["stageName"] = args?.stageName;
resourceInputs["tags"] = args?.tags;
resourceInputs["variables"] = args?.variables;
resourceInputs["xrayTracingEnabled"] = args?.xrayTracingEnabled;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["executionArn"] = undefined /*out*/;
resourceInputs["invokeUrl"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["webAclArn"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Stage.__pulumiType, name, resourceInputs, opts);
}
}
exports.Stage = Stage;
/** @internal */
Stage.__pulumiType = 'aws:apigateway/stage:Stage';
//# sourceMappingURL=stage.js.map