Module: AWSCDK::SQS::IQueue

Includes:
IResource, Interfaces::AWSSQS::IQueueRef
Included in:
QueueBase
Defined in:
sqs/i_queue.rb

Overview

Represents an SQS queue.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'sqs/i_queue.rb', line 313

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :queue_ref => { kind: :property, name: "queueRef", is_optional: false },
    :fifo => { kind: :property, name: "fifo", is_optional: false },
    :queue_arn => { kind: :property, name: "queueArn", is_optional: false },
    :queue_name => { kind: :property, name: "queueName", is_optional: false },
    :queue_url => { kind: :property, name: "queueUrl", is_optional: false },
    :encryption_master_key => { kind: :property, name: "encryptionMasterKey", is_optional: true },
    :encryption_type => { kind: :property, name: "encryptionType", is_optional: true },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :add_to_resource_policy => { kind: :method, name: "addToResourcePolicy", is_optional: false },
    :grant => { kind: :method, name: "grant", is_optional: false },
    :grant_consume_messages => { kind: :method, name: "grantConsumeMessages", is_optional: false },
    :grant_purge => { kind: :method, name: "grantPurge", is_optional: false },
    :grant_send_messages => { kind: :method, name: "grantSendMessages", is_optional: false },
    :metric => { kind: :method, name: "metric", is_optional: false },
    :metric_approximate_age_of_oldest_message => { kind: :method, name: "metricApproximateAgeOfOldestMessage", is_optional: false },
    :metric_approximate_number_of_messages_delayed => { kind: :method, name: "metricApproximateNumberOfMessagesDelayed", is_optional: false },
    :metric_approximate_number_of_messages_not_visible => { kind: :method, name: "metricApproximateNumberOfMessagesNotVisible", is_optional: false },
    :metric_approximate_number_of_messages_visible => { kind: :method, name: "metricApproximateNumberOfMessagesVisible", is_optional: false },
    :metric_number_of_empty_receives => { kind: :method, name: "metricNumberOfEmptyReceives", is_optional: false },
    :metric_number_of_messages_deleted => { kind: :method, name: "metricNumberOfMessagesDeleted", is_optional: false },
    :metric_number_of_messages_received => { kind: :method, name: "metricNumberOfMessagesReceived", is_optional: false },
    :metric_number_of_messages_sent => { kind: :method, name: "metricNumberOfMessagesSent", is_optional: false },
    :metric_sent_message_size => { kind: :method, name: "metricSentMessageSize", is_optional: false },
  }
end

Instance Method Details

#add_to_resource_policy(statement) ⇒ AWSCDK::IAM::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 add_to_policy. If the queue is imported (Queue.import), then this is a no-op.



128
129
130
131
# File 'sqs/i_queue.rb', line 128

def add_to_resource_policy(statement)
  Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement")
  jsii_call_method("addToResourcePolicy", [statement])
end

#apply_removal_policy(policy) ⇒ void

This method returns an undefined value.

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).

Parameters:



115
116
117
118
# File 'sqs/i_queue.rb', line 115

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
end

#encryption_master_keyAWSCDK::KMS::IKey?

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

Returns:



78
79
80
# File 'sqs/i_queue.rb', line 78

def encryption_master_key()
  jsii_get_property("encryptionMasterKey")
end

#encryption_typeAWSCDK::SQS::QueueEncryption?

Whether the contents of the queue are encrypted, and by what type of key.



85
86
87
# File 'sqs/i_queue.rb', line 85

def encryption_type()
  jsii_get_property("encryptionType")
end

#envAWSCDK::Interfaces::ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.



27
28
29
# File 'sqs/i_queue.rb', line 27

def env()
  jsii_get_property("env")
end

#fifoBoolean

Whether this queue is an Amazon SQS FIFO queue.

If false, this is a standard queue.

Returns:

  • (Boolean)


50
51
52
# File 'sqs/i_queue.rb', line 50

def fifo()
  jsii_get_property("fifo")
end

#grant(grantee, *queue_actions) ⇒ AWSCDK::IAM::Grant

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

Parameters:

  • grantee (AWSCDK::IAM::IGrantable)

    Principal to grant right to.

  • queue_actions (Array<String>)

    The actions to grant.

Returns:



138
139
140
141
142
143
144
# File 'sqs/i_queue.rb', line 138

def grant(grantee, *queue_actions)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  queue_actions.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "queueActions[#{index}]")
  end
  jsii_call_method("grant", [grantee, *queue_actions])
end

#grant_consume_messages(grantee) ⇒ AWSCDK::IAM::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

Parameters:

Returns:



158
159
160
161
# File 'sqs/i_queue.rb', line 158

def grant_consume_messages(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantConsumeMessages", [grantee])
end

#grant_purge(grantee) ⇒ AWSCDK::IAM::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

Parameters:

Returns:



173
174
175
176
# File 'sqs/i_queue.rb', line 173

def grant_purge(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantPurge", [grantee])
end

#grant_send_messages(grantee) ⇒ AWSCDK::IAM::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

Parameters:

Returns:



188
189
190
191
# File 'sqs/i_queue.rb', line 188

def grant_send_messages(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantSendMessages", [grantee])
end

#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return the given named metric for this Queue.

Parameters:

Returns:



198
199
200
201
202
203
# File 'sqs/i_queue.rb', line 198

def metric(metric_name, props = nil)
  Jsii::Type.check_type(metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metric", [metric_name, props])
end

#metric_approximate_age_of_oldest_message(props = nil) ⇒ AWSCDK::CloudWatch::Metric

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

Maximum over 5 minutes

Parameters:

Returns:



211
212
213
214
215
# File 'sqs/i_queue.rb', line 211

def metric_approximate_age_of_oldest_message(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricApproximateAgeOfOldestMessage", [props])
end

#metric_approximate_number_of_messages_delayed(props = nil) ⇒ AWSCDK::CloudWatch::Metric

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

Maximum over 5 minutes

Parameters:

Returns:



223
224
225
226
227
# File 'sqs/i_queue.rb', line 223

def metric_approximate_number_of_messages_delayed(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricApproximateNumberOfMessagesDelayed", [props])
end

#metric_approximate_number_of_messages_not_visible(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The number of messages that are in flight.

Maximum over 5 minutes

Parameters:

Returns:



235
236
237
238
239
# File 'sqs/i_queue.rb', line 235

def metric_approximate_number_of_messages_not_visible(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricApproximateNumberOfMessagesNotVisible", [props])
end

#metric_approximate_number_of_messages_visible(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The number of messages available for retrieval from the queue.

Maximum over 5 minutes

Parameters:

Returns:



247
248
249
250
251
# File 'sqs/i_queue.rb', line 247

def metric_approximate_number_of_messages_visible(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricApproximateNumberOfMessagesVisible", [props])
end

#metric_number_of_empty_receives(props = nil) ⇒ AWSCDK::CloudWatch::Metric

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

Sum over 5 minutes

Parameters:

Returns:



259
260
261
262
263
# File 'sqs/i_queue.rb', line 259

def metric_number_of_empty_receives(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricNumberOfEmptyReceives", [props])
end

#metric_number_of_messages_deleted(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The number of messages deleted from the queue.

Sum over 5 minutes

Parameters:

Returns:



271
272
273
274
275
# File 'sqs/i_queue.rb', line 271

def metric_number_of_messages_deleted(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricNumberOfMessagesDeleted", [props])
end

#metric_number_of_messages_received(props = nil) ⇒ AWSCDK::CloudWatch::Metric

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

Sum over 5 minutes

Parameters:

Returns:



283
284
285
286
287
# File 'sqs/i_queue.rb', line 283

def metric_number_of_messages_received(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricNumberOfMessagesReceived", [props])
end

#metric_number_of_messages_sent(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The number of messages added to a queue.

Sum over 5 minutes

Parameters:

Returns:



295
296
297
298
299
# File 'sqs/i_queue.rb', line 295

def metric_number_of_messages_sent(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricNumberOfMessagesSent", [props])
end

#metric_sent_message_size(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The size of messages added to a queue.

Average over 5 minutes

Parameters:

Returns:



307
308
309
310
311
# File 'sqs/i_queue.rb', line 307

def metric_sent_message_size(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricSentMessageSize", [props])
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


12
13
14
# File 'sqs/i_queue.rb', line 12

def node()
  jsii_get_property("node")
end

#queue_arnString

The ARN of this queue.

Returns:

  • (String)


57
58
59
# File 'sqs/i_queue.rb', line 57

def queue_arn()
  jsii_get_property("queueArn")
end

#queue_nameString

The name of this queue.

Returns:

  • (String)


64
65
66
# File 'sqs/i_queue.rb', line 64

def queue_name()
  jsii_get_property("queueName")
end

#queue_refAWSCDK::Interfaces::AWSSQS::QueueReference

A reference to a Queue resource.



41
42
43
# File 'sqs/i_queue.rb', line 41

def queue_ref()
  jsii_get_property("queueRef")
end

#queue_urlString

The URL of this queue.

Returns:

  • (String)


71
72
73
# File 'sqs/i_queue.rb', line 71

def queue_url()
  jsii_get_property("queueUrl")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



34
35
36
# File 'sqs/i_queue.rb', line 34

def stack()
  jsii_get_property("stack")
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



96
97
98
99
100
101
# File 'sqs/i_queue.rb', line 96

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end