UNPKG

@pulumi/aws-native

Version:

The Pulumi AWS Cloud Control Provider enables you to build, deploy, and manage [any AWS resource that's supported by the AWS Cloud Control API](https://github.com/pulumi/pulumi-aws-native/blob/master/provider/cmd/pulumi-gen-aws-native/supported-types.txt)

204 lines • 10 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.Queue = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * The ``AWS::SQS::Queue`` resource creates an SQS standard or FIFO queue. * Keep the following caveats in mind: * + If you don't specify the ``FifoQueue`` property, SQS creates a standard queue. * You can't change the queue type after you create it and you can't convert an existing standard queue into a FIFO queue. You must either create a new FIFO queue for your application or delete your existing standard queue and recreate it as a FIFO queue. For more information, see [Moving from a standard queue to a FIFO queue](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-moving.html) in the *Developer Guide*. * + If you don't provide a value for a property, the queue is created with the default value for the property. * + If you delete a queue, you must wait at least 60 seconds before creating a queue with the same name. * + To successfully create a new queue, you must provide a queue name that adheres to the [limits related to queues](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/limits-queues.html) and is unique within the scope of your queues. * * For more information about creating FIFO (first-in-first-out) queues, see [Creating an queue ()](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/create-queue-cloudformation.html) in the *Developer Guide*. * * ## Example Usage * ### Example * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws_native from "@pulumi/aws-native"; * * const config = new pulumi.Config(); * const alarmEmail = config.get("alarmEmail") || "jane.doe@example.com"; * const myQueue = new aws_native.sqs.Queue("myQueue", {queueName: "SampleQueue"}); * const alarmTopic = new aws_native.sns.Topic("alarmTopic", {subscription: [{ * endpoint: alarmEmail, * protocol: "email", * }]}); * const queueDepthAlarm = new aws_native.cloudwatch.Alarm("queueDepthAlarm", { * alarmDescription: "Alarm if queue depth increases to more than 10 messages", * namespace: "AWS/SQS", * metricName: "ApproximateNumberOfMessagesVisible", * dimensions: [{ * name: "QueueName", * value: myQueue.queueName, * }], * statistic: "Sum", * period: 300, * evaluationPeriods: 1, * threshold: 10, * comparisonOperator: "GreaterThanThreshold", * alarmActions: [alarmTopic.id], * insufficientDataActions: [alarmTopic.id], * }); * export const queueURL = myQueue.id; * export const queueARN = myQueue.arn; * export const queueName = myQueue.queueName; * * ``` * ### Example * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws_native from "@pulumi/aws-native"; * * const config = new pulumi.Config(); * const alarmEmail = config.get("alarmEmail") || "jane.doe@example.com"; * const myQueue = new aws_native.sqs.Queue("myQueue", {queueName: "SampleQueue"}); * const alarmTopic = new aws_native.sns.Topic("alarmTopic", {subscription: [{ * endpoint: alarmEmail, * protocol: "email", * }]}); * const queueDepthAlarm = new aws_native.cloudwatch.Alarm("queueDepthAlarm", { * alarmDescription: "Alarm if queue depth increases to more than 10 messages", * namespace: "AWS/SQS", * metricName: "ApproximateNumberOfMessagesVisible", * dimensions: [{ * name: "QueueName", * value: myQueue.queueName, * }], * statistic: "Sum", * period: 300, * evaluationPeriods: 1, * threshold: 10, * comparisonOperator: "GreaterThanThreshold", * alarmActions: [alarmTopic.id], * insufficientDataActions: [alarmTopic.id], * }); * export const queueURL = myQueue.id; * export const queueARN = myQueue.arn; * export const queueName = myQueue.queueName; * * ``` * ### Example * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws_native from "@pulumi/aws-native"; * * const myDeadLetterQueue = new aws_native.sqs.Queue("myDeadLetterQueue", {}); * const mySourceQueue = new aws_native.sqs.Queue("mySourceQueue", {redrivePolicy: { * deadLetterTargetArn: myDeadLetterQueue.arn, * maxReceiveCount: 5, * }}); * export const sourceQueueURL = mySourceQueue.id; * export const sourceQueueARN = mySourceQueue.arn; * export const deadLetterQueueURL = myDeadLetterQueue.id; * export const deadLetterQueueARN = myDeadLetterQueue.arn; * * ``` * ### Example * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws_native from "@pulumi/aws-native"; * * const myDeadLetterQueue = new aws_native.sqs.Queue("myDeadLetterQueue", {}); * const mySourceQueue = new aws_native.sqs.Queue("mySourceQueue", {redrivePolicy: { * deadLetterTargetArn: myDeadLetterQueue.arn, * maxReceiveCount: 5, * }}); * export const sourceQueueURL = mySourceQueue.id; * export const sourceQueueARN = mySourceQueue.arn; * export const deadLetterQueueURL = myDeadLetterQueue.id; * export const deadLetterQueueARN = myDeadLetterQueue.arn; * * ``` */ class Queue extends pulumi.CustomResource { /** * Get an existing Queue 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 opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, opts) { return new Queue(name, undefined, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Queue. 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'] === Queue.__pulumiType; } /** * Create a Queue resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name, args, opts) { let resourceInputs = {}; opts = opts || {}; if (!opts.id) { resourceInputs["contentBasedDeduplication"] = args ? args.contentBasedDeduplication : undefined; resourceInputs["deduplicationScope"] = args ? args.deduplicationScope : undefined; resourceInputs["delaySeconds"] = args ? args.delaySeconds : undefined; resourceInputs["fifoQueue"] = args ? args.fifoQueue : undefined; resourceInputs["fifoThroughputLimit"] = args ? args.fifoThroughputLimit : undefined; resourceInputs["kmsDataKeyReusePeriodSeconds"] = args ? args.kmsDataKeyReusePeriodSeconds : undefined; resourceInputs["kmsMasterKeyId"] = args ? args.kmsMasterKeyId : undefined; resourceInputs["maximumMessageSize"] = args ? args.maximumMessageSize : undefined; resourceInputs["messageRetentionPeriod"] = args ? args.messageRetentionPeriod : undefined; resourceInputs["queueName"] = args ? args.queueName : undefined; resourceInputs["receiveMessageWaitTimeSeconds"] = args ? args.receiveMessageWaitTimeSeconds : undefined; resourceInputs["redriveAllowPolicy"] = args ? args.redriveAllowPolicy : undefined; resourceInputs["redrivePolicy"] = args ? args.redrivePolicy : undefined; resourceInputs["sqsManagedSseEnabled"] = args ? args.sqsManagedSseEnabled : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["visibilityTimeout"] = args ? args.visibilityTimeout : undefined; resourceInputs["arn"] = undefined /*out*/; resourceInputs["queueUrl"] = undefined /*out*/; } else { resourceInputs["arn"] = undefined /*out*/; resourceInputs["contentBasedDeduplication"] = undefined /*out*/; resourceInputs["deduplicationScope"] = undefined /*out*/; resourceInputs["delaySeconds"] = undefined /*out*/; resourceInputs["fifoQueue"] = undefined /*out*/; resourceInputs["fifoThroughputLimit"] = undefined /*out*/; resourceInputs["kmsDataKeyReusePeriodSeconds"] = undefined /*out*/; resourceInputs["kmsMasterKeyId"] = undefined /*out*/; resourceInputs["maximumMessageSize"] = undefined /*out*/; resourceInputs["messageRetentionPeriod"] = undefined /*out*/; resourceInputs["queueName"] = undefined /*out*/; resourceInputs["queueUrl"] = undefined /*out*/; resourceInputs["receiveMessageWaitTimeSeconds"] = undefined /*out*/; resourceInputs["redriveAllowPolicy"] = undefined /*out*/; resourceInputs["redrivePolicy"] = undefined /*out*/; resourceInputs["sqsManagedSseEnabled"] = undefined /*out*/; resourceInputs["tags"] = undefined /*out*/; resourceInputs["visibilityTimeout"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const replaceOnChanges = { replaceOnChanges: ["fifoQueue", "queueName"] }; opts = pulumi.mergeOptions(opts, replaceOnChanges); super(Queue.__pulumiType, name, resourceInputs, opts); } } exports.Queue = Queue; /** @internal */ Queue.__pulumiType = 'aws-native:sqs:Queue'; //# sourceMappingURL=queue.js.map