IQueue

class aws_cdk.aws_sqs.IQueue(*args, **kwargs)

Bases: aws_cdk.core.IResource, typing_extensions.Protocol

__init__(*args, **kwargs)

Methods

add_to_resource_policy(statement)

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 improted (Queue.import), then this is a no-op.

Parameters

statement (PolicyStatement) –

Return type

None

grant(grantee, *queue_actions)

Grant the actions defined in queueActions to the identity Principal given on this SQS queue resource.

Parameters
  • grantee (IGrantable) – Principal to grant right to.

  • queue_actions (str) – The actions to grant.

Return type

Grant

grant_consume_messages(grantee)

Grant permissions to consume messages from a queue.

This will grant the following permissions:

  • sqs:ChangeMessageVisibility

  • sqs:DeleteMessage

  • sqs:ReceiveMessage

  • sqs:GetQueueAttributes

  • sqs:GetQueueUrl

Parameters

grantee (IGrantable) – Principal to grant consume rights to.

Return type

Grant

grant_purge(grantee)

Grant an IAM principal permissions to purge all messages from the queue.

This will grant the following permissions:

  • sqs:PurgeQueue

  • sqs:GetQueueAttributes

  • sqs:GetQueueUrl

Parameters

grantee (IGrantable) – Principal to grant send rights to.

Return type

Grant

grant_send_messages(grantee)

Grant access to send messages to a queue to the given identity.

This will grant the following permissions:

  • sqs:SendMessage

  • sqs:GetQueueAttributes

  • sqs:GetQueueUrl

Parameters

grantee (IGrantable) – Principal to grant send rights to.

Return type

Grant

metric(metric_name, *, color=None, dimensions=None, label=None, period=None, statistic=None, unit=None)

Return the given named metric for this Queue.

Parameters
  • metric_name (str) –

  • props

  • color (Optional[str]) – Color for this metric when added to a Graph in a Dashboard.

  • dimensions (Optional[Mapping[str, Any]]) – Dimensions of the metric. Default: - No dimensions.

  • label (Optional[str]) – Label for this metric when added to a Graph in a Dashboard.

  • period (Optional[Duration]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)

  • statistic (Optional[str]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average

  • unit (Optional[Unit]) – Unit for the metric that is associated with the alarm.

Return type

Metric

metric_approximate_age_of_oldest_message(*, color=None, dimensions=None, label=None, period=None, statistic=None, unit=None)

The approximate age of the oldest non-deleted message in the queue.

Maximum over 5 minutes

Parameters
  • props

  • color (Optional[str]) – Color for this metric when added to a Graph in a Dashboard.

  • dimensions (Optional[Mapping[str, Any]]) – Dimensions of the metric. Default: - No dimensions.

  • label (Optional[str]) – Label for this metric when added to a Graph in a Dashboard.

  • period (Optional[Duration]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)

  • statistic (Optional[str]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average

  • unit (Optional[Unit]) – Unit for the metric that is associated with the alarm.

Return type

Metric

metric_approximate_number_of_messages_delayed(*, color=None, dimensions=None, label=None, period=None, statistic=None, unit=None)

The number of messages in the queue that are delayed and not available for reading immediately.

Maximum over 5 minutes

Parameters
  • props

  • color (Optional[str]) – Color for this metric when added to a Graph in a Dashboard.

  • dimensions (Optional[Mapping[str, Any]]) – Dimensions of the metric. Default: - No dimensions.

  • label (Optional[str]) – Label for this metric when added to a Graph in a Dashboard.

  • period (Optional[Duration]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)

  • statistic (Optional[str]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average

  • unit (Optional[Unit]) – Unit for the metric that is associated with the alarm.

Return type

Metric

metric_approximate_number_of_messages_not_visible(*, color=None, dimensions=None, label=None, period=None, statistic=None, unit=None)

The number of messages that are in flight.

Maximum over 5 minutes

Parameters
  • props

  • color (Optional[str]) – Color for this metric when added to a Graph in a Dashboard.

  • dimensions (Optional[Mapping[str, Any]]) – Dimensions of the metric. Default: - No dimensions.

  • label (Optional[str]) – Label for this metric when added to a Graph in a Dashboard.

  • period (Optional[Duration]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)

  • statistic (Optional[str]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average

  • unit (Optional[Unit]) – Unit for the metric that is associated with the alarm.

Return type

Metric

metric_approximate_number_of_messages_visible(*, color=None, dimensions=None, label=None, period=None, statistic=None, unit=None)

The number of messages available for retrieval from the queue.

Maximum over 5 minutes

Parameters
  • props

  • color (Optional[str]) – Color for this metric when added to a Graph in a Dashboard.

  • dimensions (Optional[Mapping[str, Any]]) – Dimensions of the metric. Default: - No dimensions.

  • label (Optional[str]) – Label for this metric when added to a Graph in a Dashboard.

  • period (Optional[Duration]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)

  • statistic (Optional[str]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average

  • unit (Optional[Unit]) – Unit for the metric that is associated with the alarm.

Return type

Metric

metric_number_of_empty_receives(*, color=None, dimensions=None, label=None, period=None, statistic=None, unit=None)

The number of ReceiveMessage API calls that did not return a message.

Sum over 5 minutes

Parameters
  • props

  • color (Optional[str]) – Color for this metric when added to a Graph in a Dashboard.

  • dimensions (Optional[Mapping[str, Any]]) – Dimensions of the metric. Default: - No dimensions.

  • label (Optional[str]) – Label for this metric when added to a Graph in a Dashboard.

  • period (Optional[Duration]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)

  • statistic (Optional[str]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average

  • unit (Optional[Unit]) – Unit for the metric that is associated with the alarm.

Return type

Metric

metric_number_of_messages_deleted(*, color=None, dimensions=None, label=None, period=None, statistic=None, unit=None)

The number of messages deleted from the queue.

Sum over 5 minutes

Parameters
  • props

  • color (Optional[str]) – Color for this metric when added to a Graph in a Dashboard.

  • dimensions (Optional[Mapping[str, Any]]) – Dimensions of the metric. Default: - No dimensions.

  • label (Optional[str]) – Label for this metric when added to a Graph in a Dashboard.

  • period (Optional[Duration]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)

  • statistic (Optional[str]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average

  • unit (Optional[Unit]) – Unit for the metric that is associated with the alarm.

Return type

Metric

metric_number_of_messages_received(*, color=None, dimensions=None, label=None, period=None, statistic=None, unit=None)

The number of messages returned by calls to the ReceiveMessage action.

Sum over 5 minutes

Parameters
  • props

  • color (Optional[str]) – Color for this metric when added to a Graph in a Dashboard.

  • dimensions (Optional[Mapping[str, Any]]) – Dimensions of the metric. Default: - No dimensions.

  • label (Optional[str]) – Label for this metric when added to a Graph in a Dashboard.

  • period (Optional[Duration]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)

  • statistic (Optional[str]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average

  • unit (Optional[Unit]) – Unit for the metric that is associated with the alarm.

Return type

Metric

metric_number_of_messages_sent(*, color=None, dimensions=None, label=None, period=None, statistic=None, unit=None)

The number of messages added to a queue.

Sum over 5 minutes

Parameters
  • props

  • color (Optional[str]) – Color for this metric when added to a Graph in a Dashboard.

  • dimensions (Optional[Mapping[str, Any]]) – Dimensions of the metric. Default: - No dimensions.

  • label (Optional[str]) – Label for this metric when added to a Graph in a Dashboard.

  • period (Optional[Duration]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)

  • statistic (Optional[str]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average

  • unit (Optional[Unit]) – Unit for the metric that is associated with the alarm.

Return type

Metric

metric_sent_message_size(*, color=None, dimensions=None, label=None, period=None, statistic=None, unit=None)

The size of messages added to a queue.

Average over 5 minutes

Parameters
  • props

  • color (Optional[str]) – Color for this metric when added to a Graph in a Dashboard.

  • dimensions (Optional[Mapping[str, Any]]) – Dimensions of the metric. Default: - No dimensions.

  • label (Optional[str]) – Label for this metric when added to a Graph in a Dashboard.

  • period (Optional[Duration]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)

  • statistic (Optional[str]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average

  • unit (Optional[Unit]) – Unit for the metric that is associated with the alarm.

Return type

Metric

Attributes

encryption_master_key

If this queue is server-side encrypted, this is the KMS encryption key.

Return type

Optional[IKey]

fifo

Whether this queue is an Amazon SQS FIFO queue.

If false, this is a standard queue.

Return type

bool

node

The construct node in the tree.

Return type

ConstructNode

queue_arn

The ARN of this queue.

attribute: :attribute:: true

Return type

str

queue_name

The name of this queue.

attribute: :attribute:: true

Return type

str

queue_url

The URL of this queue.

attribute: :attribute:: true

Return type

str

stack

The stack in which this resource is defined.

Return type

Stack