class QueueBase
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.SQS.QueueBase |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awssqs#QueueBase |
Java | software.amazon.awscdk.services.sqs.QueueBase |
Python | aws_cdk.aws_sqs.QueueBase |
TypeScript (source) | aws-cdk-lib » aws_sqs » QueueBase |
Implements
IConstruct
, IDependable
, IResource
, IQueue
Extends
Resource
Implemented by
Queue
Reference to a new or existing Amazon SQS queue.
Initializer
new QueueBase(scope: Construct, id: string, props?: ResourceProps)
Parameters
- scope
Construct
- id
string
- props
Resource
Props
Properties
Name | Type | Description |
---|---|---|
auto | boolean | Controls automatic creation of policy objects. |
env | Resource | The environment this resource belongs to. |
fifo | boolean | Whether this queue is an Amazon SQS FIFO queue. |
node | Node | The tree node. |
queue | string | The ARN of this queue. |
queue | string | The name of this queue. |
queue | string | The URL of this queue. |
stack | Stack | The stack in which this resource is defined. |
encryption | IKey | If this queue is server-side encrypted, this is the KMS encryption key. |
encryption | Queue | Whether the contents of the queue are encrypted, and by what type of key. |
autoCreatePolicy
Type:
boolean
Controls automatic creation of policy objects.
Set by subclasses.
env
Type:
Resource
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.
fifo
Type:
boolean
Whether this queue is an Amazon SQS FIFO queue.
If false, this is a standard queue.
node
Type:
Node
The tree node.
queueArn
Type:
string
The ARN of this queue.
queueName
Type:
string
The name of this queue.
queueUrl
Type:
string
The URL of this queue.
stack
Type:
Stack
The stack in which this resource is defined.
encryptionMasterKey?
Type:
IKey
(optional)
If this queue is server-side encrypted, this is the KMS encryption key.
encryptionType?
Type:
Queue
(optional)
Whether the contents of the queue are encrypted, and by what type of key.
Methods
Name | Description |
---|---|
add | Adds a statement to the IAM resource policy associated with this queue. |
apply | Apply the given removal policy to this resource. |
grant(grantee, ...actions) | Grant the actions defined in queueActions to the identity Principal given on this SQS queue resource. |
grant | Grant permissions to consume messages from a queue. |
grant | Grant an IAM principal permissions to purge all messages from the queue. |
grant | Grant access to send messages to a queue to the given identity. |
metric(metricName, props?) | Return the given named metric for this Queue. |
metric | The approximate age of the oldest non-deleted message in the queue. |
metric | The number of messages in the queue that are delayed and not available for reading immediately. |
metric | The number of messages that are in flight. |
metric | The number of messages available for retrieval from the queue. |
metric | The number of ReceiveMessage API calls that did not return a message. |
metric | The number of messages deleted from the queue. |
metric | The number of messages returned by calls to the ReceiveMessage action. |
metric | The number of messages added to a queue. |
metric | The size of messages added to a queue. |
to | Returns a string representation of this construct. |
ToResourcePolicy(statement)
addpublic addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult
Parameters
- statement
Policy
Statement
Returns
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.
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
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
).
grant(grantee, ...actions)
public grant(grantee: IGrantable, ...actions: string[]): Grant
Parameters
- grantee
IGrantable
— Principal to grant right to. - actions
string
— The actions to grant.
Returns
Grant the actions defined in queueActions to the identity Principal given on this SQS queue resource.
ConsumeMessages(grantee)
grantpublic grantConsumeMessages(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
— Principal to grant consume rights to.
Returns
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
Purge(grantee)
grantpublic grantPurge(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
— Principal to grant send rights to.
Returns
Grant an IAM principal permissions to purge all messages from the queue.
This will grant the following permissions:
- sqs:PurgeQueue
- sqs:GetQueueAttributes
- sqs:GetQueueUrl
SendMessages(grantee)
grantpublic grantSendMessages(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
— Principal to grant send rights to.
Returns
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*
metric(metricName, props?)
public metric(metricName: string, props?: MetricOptions): Metric
Parameters
- metricName
string
- props
Metric
Options
Returns
Return the given named metric for this Queue.
ApproximateAgeOfOldestMessage(props?)
metricpublic metricApproximateAgeOfOldestMessage(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The approximate age of the oldest non-deleted message in the queue.
Maximum over 5 minutes
ApproximateNumberOfMessagesDelayed(props?)
metricpublic metricApproximateNumberOfMessagesDelayed(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The number of messages in the queue that are delayed and not available for reading immediately.
Maximum over 5 minutes
ApproximateNumberOfMessagesNotVisible(props?)
metricpublic metricApproximateNumberOfMessagesNotVisible(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The number of messages that are in flight.
Maximum over 5 minutes
ApproximateNumberOfMessagesVisible(props?)
metricpublic metricApproximateNumberOfMessagesVisible(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The number of messages available for retrieval from the queue.
Maximum over 5 minutes
NumberOfEmptyReceives(props?)
metricpublic metricNumberOfEmptyReceives(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The number of ReceiveMessage API calls that did not return a message.
Sum over 5 minutes
NumberOfMessagesDeleted(props?)
metricpublic metricNumberOfMessagesDeleted(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The number of messages deleted from the queue.
Sum over 5 minutes
NumberOfMessagesReceived(props?)
metricpublic metricNumberOfMessagesReceived(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The number of messages returned by calls to the ReceiveMessage action.
Sum over 5 minutes
NumberOfMessagesSent(props?)
metricpublic metricNumberOfMessagesSent(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The number of messages added to a queue.
Sum over 5 minutes
SentMessageSize(props?)
metricpublic metricSentMessageSize(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The size of messages added to a queue.
Average over 5 minutes
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.