UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

125 lines 7.24 kB
"use strict"; // *** 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, Object.assign(Object.assign({}, 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 ? state.accessLogSettings : undefined; resourceInputs["arn"] = state ? state.arn : undefined; resourceInputs["cacheClusterEnabled"] = state ? state.cacheClusterEnabled : undefined; resourceInputs["cacheClusterSize"] = state ? state.cacheClusterSize : undefined; resourceInputs["canarySettings"] = state ? state.canarySettings : undefined; resourceInputs["clientCertificateId"] = state ? state.clientCertificateId : undefined; resourceInputs["deployment"] = state ? state.deployment : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["documentationVersion"] = state ? state.documentationVersion : undefined; resourceInputs["executionArn"] = state ? state.executionArn : undefined; resourceInputs["invokeUrl"] = state ? state.invokeUrl : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["restApi"] = state ? state.restApi : undefined; resourceInputs["stageName"] = state ? state.stageName : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tagsAll"] = state ? state.tagsAll : undefined; resourceInputs["variables"] = state ? state.variables : undefined; resourceInputs["webAclArn"] = state ? state.webAclArn : undefined; resourceInputs["xrayTracingEnabled"] = state ? state.xrayTracingEnabled : undefined; } else { const args = argsOrState; if ((!args || args.deployment === undefined) && !opts.urn) { throw new Error("Missing required property 'deployment'"); } if ((!args || args.restApi === undefined) && !opts.urn) { throw new Error("Missing required property 'restApi'"); } if ((!args || args.stageName === undefined) && !opts.urn) { throw new Error("Missing required property 'stageName'"); } resourceInputs["accessLogSettings"] = args ? args.accessLogSettings : undefined; resourceInputs["cacheClusterEnabled"] = args ? args.cacheClusterEnabled : undefined; resourceInputs["cacheClusterSize"] = args ? args.cacheClusterSize : undefined; resourceInputs["canarySettings"] = args ? args.canarySettings : undefined; resourceInputs["clientCertificateId"] = args ? args.clientCertificateId : undefined; resourceInputs["deployment"] = args ? args.deployment : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["documentationVersion"] = args ? args.documentationVersion : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["restApi"] = args ? args.restApi : undefined; resourceInputs["stageName"] = args ? args.stageName : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["variables"] = args ? args.variables : undefined; resourceInputs["xrayTracingEnabled"] = args ? args.xrayTracingEnabled : undefined; 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