import { TweetQueue } from 'cdk-tweet-queue'
new TweetQueue(parent: Construct, id: string, props: TweetQueueProps)
Name | Type | Description |
---|---|---|
parent |
constructs.Construct |
No description. |
id |
string |
No description. |
props |
TweetQueueProps |
No description. |
- Type: constructs.Construct
- Type: string
- Type: TweetQueueProps
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
applyRemovalPolicy |
Apply the given removal policy to this resource. |
addToResourcePolicy |
Adds a statement to the IAM resource policy associated with this queue. |
grant |
Grant the actions defined in queueActions to the identity Principal given on this SQS queue resource. |
grantConsumeMessages |
Grant permissions to consume messages from a queue. |
grantPurge |
Grant an IAM principal permissions to purge all messages from the queue. |
grantSendMessages |
Grant access to send messages to a queue to the given identity. |
metric |
Return the given named metric for this Queue. |
metricApproximateAgeOfOldestMessage |
The approximate age of the oldest non-deleted message in the queue. |
metricApproximateNumberOfMessagesDelayed |
The number of messages in the queue that are delayed and not available for reading immediately. |
metricApproximateNumberOfMessagesNotVisible |
The number of messages that are in flight. |
metricApproximateNumberOfMessagesVisible |
The number of messages available for retrieval from the queue. |
metricNumberOfEmptyReceives |
The number of ReceiveMessage API calls that did not return a message. |
metricNumberOfMessagesDeleted |
The number of messages deleted from the queue. |
metricNumberOfMessagesReceived |
The number of messages returned by calls to the ReceiveMessage action. |
metricNumberOfMessagesSent |
The number of messages added to a queue. |
metricSentMessageSize |
The size of messages added to a queue. |
public toString(): string
Returns a string representation of this construct.
public applyRemovalPolicy(policy: RemovalPolicy): void
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
- Type: aws-cdk-lib.RemovalPolicy
public addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult
Adds a statement to the IAM resource policy associated with this queue.
If this queue was created in this stack (new Queue
), a queue policy
will be automatically created upon the first call to addToPolicy
. If
the queue is imported (Queue.import
), then this is a no-op.
- Type: aws-cdk-lib.aws_iam.PolicyStatement
public grant(grantee: IGrantable, actions: ...string[]): Grant
Grant the actions defined in queueActions to the identity Principal given on this SQS queue resource.
- Type: aws-cdk-lib.aws_iam.IGrantable
Principal to grant right to.
- Type: ...string[]
The actions to grant.
public grantConsumeMessages(grantee: IGrantable): Grant
Grant permissions to consume messages from a queue.
This will grant the following permissions:
- sqs:ChangeMessageVisibility
- sqs:DeleteMessage
- sqs:ReceiveMessage
- sqs:GetQueueAttributes
- sqs:GetQueueUrl
If encryption is used, permission to use the key to decrypt the contents of the queue will also be granted to the same principal.
This will grant the following KMS permissions:
- kms:Decrypt
- Type: aws-cdk-lib.aws_iam.IGrantable
Principal to grant consume rights to.
public grantPurge(grantee: IGrantable): Grant
Grant an IAM principal permissions to purge all messages from the queue.
This will grant the following permissions:
- sqs:PurgeQueue
- sqs:GetQueueAttributes
- sqs:GetQueueUrl
- Type: aws-cdk-lib.aws_iam.IGrantable
Principal to grant send rights to.
public grantSendMessages(grantee: IGrantable): Grant
Grant access to send messages to a queue to the given identity.
This will grant the following permissions:
- sqs:SendMessage
- sqs:GetQueueAttributes
- sqs:GetQueueUrl
If encryption is used, permission to use the key to encrypt/decrypt the contents of the queue will also be granted to the same principal.
This will grant the following KMS permissions:
- kms:Decrypt
- kms:Encrypt
- kms:ReEncrypt*
- kms:GenerateDataKey*
- Type: aws-cdk-lib.aws_iam.IGrantable
Principal to grant send rights to.
public metric(metricName: string, props?: MetricOptions): Metric
Return the given named metric for this Queue.
- Type: string
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricApproximateAgeOfOldestMessage(props?: MetricOptions): Metric
The approximate age of the oldest non-deleted message in the queue.
Maximum over 5 minutes
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricApproximateNumberOfMessagesDelayed(props?: MetricOptions): Metric
The number of messages in the queue that are delayed and not available for reading immediately.
Maximum over 5 minutes
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricApproximateNumberOfMessagesNotVisible(props?: MetricOptions): Metric
The number of messages that are in flight.
Maximum over 5 minutes
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricApproximateNumberOfMessagesVisible(props?: MetricOptions): Metric
The number of messages available for retrieval from the queue.
Maximum over 5 minutes
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricNumberOfEmptyReceives(props?: MetricOptions): Metric
The number of ReceiveMessage API calls that did not return a message.
Sum over 5 minutes
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricNumberOfMessagesDeleted(props?: MetricOptions): Metric
The number of messages deleted from the queue.
Sum over 5 minutes
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricNumberOfMessagesReceived(props?: MetricOptions): Metric
The number of messages returned by calls to the ReceiveMessage action.
Sum over 5 minutes
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricNumberOfMessagesSent(props?: MetricOptions): Metric
The number of messages added to a queue.
Sum over 5 minutes
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricSentMessageSize(props?: MetricOptions): Metric
The size of messages added to a queue.
Average over 5 minutes
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isOwnedResource |
Returns true if the construct was created by CDK, and false otherwise. |
isResource |
Check whether the given construct is a Resource. |
fromQueueArn |
Import an existing SQS queue provided an ARN. |
fromQueueAttributes |
Import an existing queue. |
import { TweetQueue } from 'cdk-tweet-queue'
TweetQueue.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
- Type: any
Any object.
import { TweetQueue } from 'cdk-tweet-queue'
TweetQueue.isOwnedResource(construct: IConstruct)
Returns true if the construct was created by CDK, and false otherwise.
- Type: constructs.IConstruct
import { TweetQueue } from 'cdk-tweet-queue'
TweetQueue.isResource(construct: IConstruct)
Check whether the given construct is a Resource.
- Type: constructs.IConstruct
import { TweetQueue } from 'cdk-tweet-queue'
TweetQueue.fromQueueArn(scope: Construct, id: string, queueArn: string)
Import an existing SQS queue provided an ARN.
- Type: constructs.Construct
The parent creating construct.
- Type: string
The construct's name.
- Type: string
queue ARN (i.e. arn:aws:sqs:us-east-2:444455556666:queue1).
import { TweetQueue } from 'cdk-tweet-queue'
TweetQueue.fromQueueAttributes(scope: Construct, id: string, attrs: QueueAttributes)
Import an existing queue.
- Type: constructs.Construct
- Type: string
- Type: aws-cdk-lib.aws_sqs.QueueAttributes
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
env |
aws-cdk-lib.ResourceEnvironment |
The environment this resource belongs to. |
stack |
aws-cdk-lib.Stack |
The stack in which this resource is defined. |
fifo |
boolean |
Whether this queue is an Amazon SQS FIFO queue. |
queueArn |
string |
The ARN of this queue. |
queueName |
string |
The name of this queue. |
queueUrl |
string |
The URL of this queue. |
encryptionMasterKey |
aws-cdk-lib.aws_kms.IKey |
If this queue is encrypted, this is the KMS key. |
encryptionType |
aws-cdk-lib.aws_sqs.QueueEncryption |
Whether the contents of the queue are encrypted, and by what type of key. |
deadLetterQueue |
aws-cdk-lib.aws_sqs.DeadLetterQueue |
If this queue is configured with a dead-letter queue, this is the dead-letter queue settings. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
public readonly env: ResourceEnvironment;
- Type: aws-cdk-lib.ResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
public readonly stack: Stack;
- Type: aws-cdk-lib.Stack
The stack in which this resource is defined.
public readonly fifo: boolean;
- Type: boolean
Whether this queue is an Amazon SQS FIFO queue.
If false, this is a standard queue.
public readonly queueArn: string;
- Type: string
The ARN of this queue.
public readonly queueName: string;
- Type: string
The name of this queue.
public readonly queueUrl: string;
- Type: string
The URL of this queue.
public readonly encryptionMasterKey: IKey;
- Type: aws-cdk-lib.aws_kms.IKey
If this queue is encrypted, this is the KMS key.
public readonly encryptionType: QueueEncryption;
- Type: aws-cdk-lib.aws_sqs.QueueEncryption
Whether the contents of the queue are encrypted, and by what type of key.
public readonly deadLetterQueue: DeadLetterQueue;
- Type: aws-cdk-lib.aws_sqs.DeadLetterQueue
If this queue is configured with a dead-letter queue, this is the dead-letter queue settings.
import { TweetQueueProps } from 'cdk-tweet-queue'
const tweetQueueProps: TweetQueueProps = { ... }
Name | Type | Description |
---|---|---|
query |
string |
The twitter query string to stream. |
secretArn |
string |
The SecretsManager secret that contains Twitter authentication credentials from https://apps.twitter.com/ with the following attributes (exact names): - consumer_key - consumer_secret - access_token_key - access_token_secret. |
intervalMin |
number |
Polling interval in minutes. |
retentionPeriodSec |
number |
Number of seconds for messages to wait in the queue for processing. |
visibilityTimeoutSec |
number |
Number of seconds for messages to be invisible while they are processed. |
public readonly query: string;
- Type: string
The twitter query string to stream.
public readonly secretArn: string;
- Type: string
The SecretsManager secret that contains Twitter authentication credentials from https://apps.twitter.com/ with the following attributes (exact names): - consumer_key - consumer_secret - access_token_key - access_token_secret.
public readonly intervalMin: number;
- Type: number
- Default: 1min
Polling interval in minutes.
Set to 0 to disable polling.
public readonly retentionPeriodSec: number;
- Type: number
- Default: 60 seconds
Number of seconds for messages to wait in the queue for processing.
After this time, messages will be removed from the queue.
public readonly visibilityTimeoutSec: number;
- Type: number
- Default: 60 seconds
Number of seconds for messages to be invisible while they are processed.
Based on the amount of time it would require to process a single message.