aws-sdk-sqs 1.39.0 → 1.86.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +248 -1
- data/VERSION +1 -1
- data/lib/aws-sdk-sqs/client.rb +800 -329
- data/lib/aws-sdk-sqs/client_api.rb +325 -52
- data/lib/aws-sdk-sqs/customizations.rb +5 -1
- data/lib/aws-sdk-sqs/endpoint_parameters.rb +66 -0
- data/lib/aws-sdk-sqs/endpoint_provider.rb +57 -0
- data/lib/aws-sdk-sqs/endpoints.rb +269 -0
- data/lib/aws-sdk-sqs/errors.rb +262 -0
- data/lib/aws-sdk-sqs/message.rb +13 -6
- data/lib/aws-sdk-sqs/plugins/endpoints.rb +128 -0
- data/lib/aws-sdk-sqs/plugins/md5s.rb +84 -35
- data/lib/aws-sdk-sqs/plugins/queue_urls.rb +20 -18
- data/lib/aws-sdk-sqs/queue.rb +209 -93
- data/lib/aws-sdk-sqs/queue_poller.rb +71 -35
- data/lib/aws-sdk-sqs/resource.rb +106 -59
- data/lib/aws-sdk-sqs/types.rb +827 -502
- data/lib/aws-sdk-sqs.rb +17 -9
- data/sig/client.rbs +367 -0
- data/sig/errors.rbs +98 -0
- data/sig/message.rbs +73 -0
- data/sig/queue.rbs +164 -0
- data/sig/resource.rbs +108 -0
- data/sig/types.rbs +472 -0
- data/sig/waiters.rbs +13 -0
- metadata +22 -11
@@ -4,7 +4,6 @@ require 'set'
|
|
4
4
|
|
5
5
|
module Aws
|
6
6
|
module SQS
|
7
|
-
|
8
7
|
# A utility class for long polling messages in a loop. **Messages are
|
9
8
|
# automatically deleted from the queue at the end of the given block.**
|
10
9
|
#
|
@@ -181,6 +180,16 @@ module Aws
|
|
181
180
|
# end
|
182
181
|
# ```
|
183
182
|
#
|
183
|
+
# * Configure an {#after_empty_receive} callback.
|
184
|
+
#
|
185
|
+
# ```
|
186
|
+
# poller.after_empty_receive do |stats|
|
187
|
+
# logger.info("requests: #{stats.request_count}")
|
188
|
+
# logger.info("messages: #{stats.received_message_count}")
|
189
|
+
# logger.info("last-timestamp: #{stats.last_message_received_at}")
|
190
|
+
# end
|
191
|
+
# ```
|
192
|
+
#
|
184
193
|
# * Accept a 2nd argument in the poll block, for example:
|
185
194
|
#
|
186
195
|
# ```
|
@@ -203,7 +212,6 @@ module Aws
|
|
203
212
|
# ```
|
204
213
|
#
|
205
214
|
class QueuePoller
|
206
|
-
|
207
215
|
# @param [String] queue_url
|
208
216
|
# @option options [Client] :client
|
209
217
|
# @option (see #poll)
|
@@ -258,6 +266,21 @@ module Aws
|
|
258
266
|
@default_config = @default_config.with(before_request: block) if block_given?
|
259
267
|
end
|
260
268
|
|
269
|
+
# Registers a callback that is invoked when the poll requests returns with no messages.
|
270
|
+
# This callback is invoked after the idle timeout is checked.
|
271
|
+
#
|
272
|
+
# poller.after_empty_receive do |stats|
|
273
|
+
# # Handle empty receive
|
274
|
+
# end
|
275
|
+
#
|
276
|
+
# @yieldparam [PollerStats] stats An object that tracks a few
|
277
|
+
# client-side statistics about the queue polling.
|
278
|
+
#
|
279
|
+
# @return [void]
|
280
|
+
def after_empty_receive(&block)
|
281
|
+
@default_config = @default_config.with(after_empty_receive: block) if block_given?
|
282
|
+
end
|
283
|
+
|
261
284
|
# Polls the queue, yielded a message, or an array of messages.
|
262
285
|
# Messages are automatically deleted from the queue at the
|
263
286
|
# end of the given block. See the class documentation on
|
@@ -333,7 +356,8 @@ module Aws
|
|
333
356
|
loop do
|
334
357
|
messages = get_messages(config, stats)
|
335
358
|
if messages.empty?
|
336
|
-
check_idle_timeout(config, stats
|
359
|
+
check_idle_timeout(config, stats)
|
360
|
+
config.after_empty_receive&.call(stats)
|
337
361
|
else
|
338
362
|
process_messages(config, stats, messages, &block)
|
339
363
|
end
|
@@ -348,21 +372,21 @@ module Aws
|
|
348
372
|
# `#receipt_handle`.
|
349
373
|
# @param [Integer] seconds
|
350
374
|
def change_message_visibility_timeout(message, seconds)
|
351
|
-
@client.change_message_visibility(
|
375
|
+
@client.change_message_visibility(
|
352
376
|
queue_url: @queue_url,
|
353
377
|
receipt_handle: message.receipt_handle,
|
354
|
-
visibility_timeout: seconds
|
355
|
-
|
378
|
+
visibility_timeout: seconds
|
379
|
+
)
|
356
380
|
end
|
357
381
|
|
358
382
|
# @note This method should be called from inside a {#poll} block.
|
359
383
|
# @param [#receipt_handle] message An object that responds to
|
360
384
|
# `#receipt_handle`.
|
361
385
|
def delete_message(message)
|
362
|
-
@client.delete_message(
|
386
|
+
@client.delete_message(
|
363
387
|
queue_url: @queue_url,
|
364
|
-
receipt_handle: message.receipt_handle
|
365
|
-
|
388
|
+
receipt_handle: message.receipt_handle
|
389
|
+
)
|
366
390
|
end
|
367
391
|
|
368
392
|
# @note This method should be called from inside a {#poll} block.
|
@@ -372,16 +396,16 @@ module Aws
|
|
372
396
|
def delete_messages(messages)
|
373
397
|
@client.delete_message_batch(
|
374
398
|
queue_url: @queue_url,
|
375
|
-
entries: messages.map
|
399
|
+
entries: messages.map do |msg|
|
376
400
|
{ id: msg.message_id, receipt_handle: msg.receipt_handle }
|
377
|
-
|
401
|
+
end
|
378
402
|
)
|
379
403
|
end
|
380
404
|
|
381
405
|
private
|
382
406
|
|
383
407
|
def get_messages(config, stats)
|
384
|
-
config.before_request
|
408
|
+
config.before_request&.call(stats)
|
385
409
|
messages = send_request(config).messages
|
386
410
|
stats.request_count += 1
|
387
411
|
messages
|
@@ -392,17 +416,22 @@ module Aws
|
|
392
416
|
@client.receive_message(params)
|
393
417
|
end
|
394
418
|
|
395
|
-
def check_idle_timeout(config, stats
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
419
|
+
def check_idle_timeout(config, stats)
|
420
|
+
return unless config.idle_timeout
|
421
|
+
|
422
|
+
since = stats.last_message_received_at || stats.polling_started_at
|
423
|
+
idle_time = Time.now - since
|
424
|
+
throw :stop_polling if idle_time > config.idle_timeout
|
401
425
|
end
|
402
426
|
|
403
427
|
def process_messages(config, stats, messages, &block)
|
404
428
|
stats.received_message_count += messages.count
|
405
429
|
stats.last_message_received_at = Time.now
|
430
|
+
|
431
|
+
# duplicated messages will have a different receipt handle
|
432
|
+
# so we need to provide the most recent receipt to
|
433
|
+
# delete a batch - thus, filtering below by message_id
|
434
|
+
messages = messages.reverse.uniq(&:message_id).reverse!
|
406
435
|
catch(:skip_delete) do
|
407
436
|
yield_messages(config, messages, stats, &block)
|
408
437
|
delete_messages(messages) unless config.skip_delete
|
@@ -421,7 +450,6 @@ module Aws
|
|
421
450
|
|
422
451
|
# Statistics tracked client-side by the {QueuePoller}.
|
423
452
|
class PollerStats
|
424
|
-
|
425
453
|
def initialize
|
426
454
|
@request_count = 0
|
427
455
|
@received_message_count = 0
|
@@ -444,27 +472,26 @@ module Aws
|
|
444
472
|
|
445
473
|
# @return [Time,nil]
|
446
474
|
attr_accessor :polling_stopped_at
|
447
|
-
|
448
475
|
end
|
449
476
|
|
450
477
|
# A read-only set of configuration used by the QueuePoller.
|
451
478
|
class PollerConfig
|
452
|
-
|
453
479
|
# @api private
|
454
|
-
CONFIG_OPTIONS = Set.new
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
480
|
+
CONFIG_OPTIONS = Set.new %i[
|
481
|
+
idle_timeout
|
482
|
+
skip_delete
|
483
|
+
before_request
|
484
|
+
after_empty_receive
|
485
|
+
]
|
459
486
|
|
460
487
|
# @api private
|
461
|
-
PARAM_OPTIONS = Set.new
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
]
|
488
|
+
PARAM_OPTIONS = Set.new %i[
|
489
|
+
wait_time_seconds
|
490
|
+
max_number_of_messages
|
491
|
+
visibility_timeout
|
492
|
+
attribute_names
|
493
|
+
message_attribute_names
|
494
|
+
]
|
468
495
|
|
469
496
|
# @return [Integer,nil]
|
470
497
|
attr_reader :idle_timeout
|
@@ -475,6 +502,9 @@ module Aws
|
|
475
502
|
# @return [Proc,nil]
|
476
503
|
attr_reader :before_request
|
477
504
|
|
505
|
+
# @return [Proc,nil]
|
506
|
+
attr_reader :after_empty_receive
|
507
|
+
|
478
508
|
# @return [Hash]
|
479
509
|
attr_reader :request_params
|
480
510
|
|
@@ -482,12 +512,13 @@ module Aws
|
|
482
512
|
@idle_timeout = nil
|
483
513
|
@skip_delete = false
|
484
514
|
@before_request = nil
|
515
|
+
@after_empty_receive = nil
|
485
516
|
@request_params = {
|
486
517
|
wait_time_seconds: 20,
|
487
518
|
max_number_of_messages: 1,
|
488
519
|
visibility_timeout: nil,
|
489
520
|
attribute_names: ['All'],
|
490
|
-
message_attribute_names: ['All']
|
521
|
+
message_attribute_names: ['All']
|
491
522
|
}
|
492
523
|
options.each do |opt_name, value|
|
493
524
|
if CONFIG_OPTIONS.include?(opt_name)
|
@@ -498,6 +529,12 @@ module Aws
|
|
498
529
|
raise ArgumentError, "invalid option #{opt_name.inspect}"
|
499
530
|
end
|
500
531
|
end
|
532
|
+
|
533
|
+
max_number_of_messages = @request_params[:max_number_of_messages]
|
534
|
+
unless max_number_of_messages.is_a?(Integer) && max_number_of_messages.positive?
|
535
|
+
raise ArgumentError, ':max_number_of_messages must be a positive integer'
|
536
|
+
end
|
537
|
+
|
501
538
|
@request_params.freeze
|
502
539
|
freeze
|
503
540
|
end
|
@@ -516,7 +553,6 @@ module Aws
|
|
516
553
|
PARAM_OPTIONS.each { |key| hash[key] = @request_params[key] }
|
517
554
|
hash
|
518
555
|
end
|
519
|
-
|
520
556
|
end
|
521
557
|
end
|
522
558
|
end
|
data/lib/aws-sdk-sqs/resource.rb
CHANGED
@@ -76,63 +76,101 @@ module Aws::SQS
|
|
76
76
|
# * `MessageRetentionPeriod` – The length of time, in seconds, for which
|
77
77
|
# Amazon SQS retains a message. Valid values: An integer from 60
|
78
78
|
# seconds (1 minute) to 1,209,600 seconds (14 days). Default: 345,600
|
79
|
-
# (4 days).
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
79
|
+
# (4 days). When you change a queue's attributes, the change can take
|
80
|
+
# up to 60 seconds for most of the attributes to propagate throughout
|
81
|
+
# the Amazon SQS system. Changes made to the `MessageRetentionPeriod`
|
82
|
+
# attribute can take up to 15 minutes and will impact existing
|
83
|
+
# messages in the queue potentially causing them to be expired and
|
84
|
+
# deleted if the `MessageRetentionPeriod` is reduced below the age of
|
85
|
+
# existing messages.
|
86
|
+
#
|
87
|
+
# * `Policy` – The queue's policy. A valid Amazon Web Services policy.
|
88
|
+
# For more information about policy structure, see [Overview of Amazon
|
89
|
+
# Web Services IAM Policies][1] in the *IAM User Guide*.
|
84
90
|
#
|
85
91
|
# * `ReceiveMessageWaitTimeSeconds` – The length of time, in seconds,
|
86
92
|
# for which a ` ReceiveMessage ` action waits for a message to arrive.
|
87
93
|
# Valid values: An integer from 0 to 20 (seconds). Default: 0.
|
88
94
|
#
|
95
|
+
# * `VisibilityTimeout` – The visibility timeout for the queue, in
|
96
|
+
# seconds. Valid values: An integer from 0 to 43,200 (12 hours).
|
97
|
+
# Default: 30. For more information about the visibility timeout, see
|
98
|
+
# [Visibility Timeout][2] in the *Amazon SQS Developer Guide*.
|
99
|
+
#
|
100
|
+
# The following attributes apply only to [dead-letter queues:][3]
|
101
|
+
#
|
89
102
|
# * `RedrivePolicy` – The string that includes the parameters for the
|
90
103
|
# dead-letter queue functionality of the source queue as a JSON
|
91
|
-
# object.
|
92
|
-
# dead-letter queues, see [Using Amazon SQS Dead-Letter Queues][2] in
|
93
|
-
# the *Amazon Simple Queue Service Developer Guide*.
|
104
|
+
# object. The parameters are as follows:
|
94
105
|
#
|
95
106
|
# * `deadLetterTargetArn` – The Amazon Resource Name (ARN) of the
|
96
107
|
# dead-letter queue to which Amazon SQS moves messages after the
|
97
108
|
# value of `maxReceiveCount` is exceeded.
|
98
109
|
#
|
99
110
|
# * `maxReceiveCount` – The number of times a message is delivered to
|
100
|
-
# the source queue before being moved to the dead-letter queue.
|
101
|
-
# the `ReceiveCount` for a message exceeds the
|
102
|
-
# a queue, Amazon SQS moves the message to the
|
103
|
-
#
|
104
|
-
#
|
105
|
-
#
|
106
|
-
#
|
111
|
+
# the source queue before being moved to the dead-letter queue.
|
112
|
+
# Default: 10. When the `ReceiveCount` for a message exceeds the
|
113
|
+
# `maxReceiveCount` for a queue, Amazon SQS moves the message to the
|
114
|
+
# dead-letter-queue.
|
115
|
+
#
|
116
|
+
# * `RedriveAllowPolicy` – The string that includes the parameters for
|
117
|
+
# the permissions for the dead-letter queue redrive permission and
|
118
|
+
# which source queues can specify dead-letter queues as a JSON object.
|
119
|
+
# The parameters are as follows:
|
120
|
+
#
|
121
|
+
# * `redrivePermission` – The permission type that defines which
|
122
|
+
# source queues can specify the current queue as the dead-letter
|
123
|
+
# queue. Valid values are:
|
124
|
+
#
|
125
|
+
# * `allowAll` – (Default) Any source queues in this Amazon Web
|
126
|
+
# Services account in the same Region can specify this queue as
|
127
|
+
# the dead-letter queue.
|
128
|
+
#
|
129
|
+
# * `denyAll` – No source queues can specify this queue as the
|
130
|
+
# dead-letter queue.
|
131
|
+
#
|
132
|
+
# * `byQueue` – Only queues specified by the `sourceQueueArns`
|
133
|
+
# parameter can specify this queue as the dead-letter queue.
|
134
|
+
#
|
135
|
+
# * `sourceQueueArns` – The Amazon Resource Names (ARN)s of the source
|
136
|
+
# queues that can specify this queue as the dead-letter queue and
|
137
|
+
# redrive messages. You can specify this parameter only when the
|
138
|
+
# `redrivePermission` parameter is set to `byQueue`. You can specify
|
139
|
+
# up to 10 source queue ARNs. To allow more than 10 source queues to
|
140
|
+
# specify dead-letter queues, set the `redrivePermission` parameter
|
141
|
+
# to `allowAll`.
|
142
|
+
#
|
143
|
+
# <note markdown="1"> The dead-letter queue of a FIFO queue must also be a FIFO queue.
|
144
|
+
# Similarly, the dead-letter queue of a standard queue must also be a
|
145
|
+
# standard queue.
|
107
146
|
#
|
108
|
-
#
|
109
|
-
#
|
110
|
-
# * `VisibilityTimeout` – The visibility timeout for the queue, in
|
111
|
-
# seconds. Valid values: An integer from 0 to 43,200 (12 hours).
|
112
|
-
# Default: 30. For more information about the visibility timeout, see
|
113
|
-
# [Visibility Timeout][3] in the *Amazon Simple Queue Service
|
114
|
-
# Developer Guide*.
|
147
|
+
# </note>
|
115
148
|
#
|
116
|
-
# The following attributes apply only to [server-side-encryption][4]
|
149
|
+
# The following attributes apply only to [server-side-encryption][4]:
|
117
150
|
#
|
118
|
-
# * `KmsMasterKeyId` – The ID of an
|
119
|
-
# (CMK) for Amazon SQS or a custom CMK. For more
|
120
|
-
# Terms][5]. While the alias of the
|
121
|
-
# always `alias/aws/sqs`, the
|
122
|
-
#
|
123
|
-
# Key Management Service API
|
151
|
+
# * `KmsMasterKeyId` – The ID of an Amazon Web Services managed customer
|
152
|
+
# master key (CMK) for Amazon SQS or a custom CMK. For more
|
153
|
+
# information, see [Key Terms][5]. While the alias of the Amazon Web
|
154
|
+
# Services managed CMK for Amazon SQS is always `alias/aws/sqs`, the
|
155
|
+
# alias of a custom CMK can, for example, be `alias/MyAlias `. For
|
156
|
+
# more examples, see [KeyId][6] in the *Key Management Service API
|
157
|
+
# Reference*.
|
124
158
|
#
|
125
159
|
# * `KmsDataKeyReusePeriodSeconds` – The length of time, in seconds, for
|
126
160
|
# which Amazon SQS can reuse a [data key][7] to encrypt or decrypt
|
127
|
-
# messages before calling
|
128
|
-
#
|
129
|
-
#
|
130
|
-
#
|
131
|
-
#
|
132
|
-
#
|
161
|
+
# messages before calling KMS again. An integer representing seconds,
|
162
|
+
# between 60 seconds (1 minute) and 86,400 seconds (24 hours).
|
163
|
+
# Default: 300 (5 minutes). A shorter time period provides better
|
164
|
+
# security but results in more calls to KMS which might incur charges
|
165
|
+
# after Free Tier. For more information, see [How Does the Data Key
|
166
|
+
# Reuse Period Work?][8]
|
167
|
+
#
|
168
|
+
# * `SqsManagedSseEnabled` – Enables server-side queue encryption using
|
169
|
+
# SQS owned encryption keys. Only one server-side encryption option is
|
170
|
+
# supported per queue (for example, [SSE-KMS][9] or [SSE-SQS][10]).
|
133
171
|
#
|
134
172
|
# The following attributes apply only to [FIFO (first-in-first-out)
|
135
|
-
# queues][
|
173
|
+
# queues][11]:
|
136
174
|
#
|
137
175
|
# * `FifoQueue` – Designates a queue as FIFO. Valid values are `true`
|
138
176
|
# and `false`. If you don't specify the `FifoQueue` attribute, Amazon
|
@@ -141,13 +179,13 @@ module Aws::SQS
|
|
141
179
|
# When you set this attribute, you must also provide the
|
142
180
|
# `MessageGroupId` for your messages explicitly.
|
143
181
|
#
|
144
|
-
# For more information, see [FIFO queue logic][
|
145
|
-
#
|
182
|
+
# For more information, see [FIFO queue logic][12] in the *Amazon SQS
|
183
|
+
# Developer Guide*.
|
146
184
|
#
|
147
185
|
# * `ContentBasedDeduplication` – Enables content-based deduplication.
|
148
186
|
# Valid values are `true` and `false`. For more information, see
|
149
|
-
# [Exactly-once processing][
|
150
|
-
#
|
187
|
+
# [Exactly-once processing][13] in the *Amazon SQS Developer Guide*.
|
188
|
+
# Note the following:
|
151
189
|
#
|
152
190
|
# * Every message must have a unique `MessageDeduplicationId`.
|
153
191
|
#
|
@@ -178,7 +216,7 @@ module Aws::SQS
|
|
178
216
|
# duplicates and only one copy of the message is delivered.
|
179
217
|
#
|
180
218
|
# The following attributes apply only to [high throughput for FIFO
|
181
|
-
# queues][
|
219
|
+
# queues][14]:
|
182
220
|
#
|
183
221
|
# * `DeduplicationScope` – Specifies whether message deduplication
|
184
222
|
# occurs at the message group or queue level. Valid values are
|
@@ -201,27 +239,29 @@ module Aws::SQS
|
|
201
239
|
# deduplication occurs as specified.
|
202
240
|
#
|
203
241
|
# For information on throughput quotas, see [Quotas related to
|
204
|
-
# messages][
|
242
|
+
# messages][15] in the *Amazon SQS Developer Guide*.
|
205
243
|
#
|
206
244
|
#
|
207
245
|
#
|
208
246
|
# [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html
|
209
|
-
# [2]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-
|
210
|
-
# [3]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-
|
247
|
+
# [2]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
|
248
|
+
# [3]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
|
211
249
|
# [4]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html
|
212
250
|
# [5]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-sse-key-terms
|
213
251
|
# [6]: https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html#API_DescribeKey_RequestParameters
|
214
252
|
# [7]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#data-keys
|
215
253
|
# [8]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-how-does-the-data-key-reuse-period-work
|
216
|
-
# [9]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/
|
217
|
-
# [10]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/
|
218
|
-
# [11]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues
|
219
|
-
# [12]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/
|
220
|
-
# [13]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/
|
254
|
+
# [9]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sse-existing-queue.html
|
255
|
+
# [10]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sqs-sse-queue.html
|
256
|
+
# [11]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html
|
257
|
+
# [12]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-understanding-logic.html
|
258
|
+
# [13]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-exactly-once-processing.html
|
259
|
+
# [14]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/high-throughput-fifo.html
|
260
|
+
# [15]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/quotas-messages.html
|
221
261
|
# @option options [Hash<String,String>] :tags
|
222
262
|
# Add cost allocation tags to the specified Amazon SQS queue. For an
|
223
|
-
# overview, see [Tagging Your Amazon SQS Queues][1] in the *Amazon
|
224
|
-
#
|
263
|
+
# overview, see [Tagging Your Amazon SQS Queues][1] in the *Amazon SQS
|
264
|
+
# Developer Guide*.
|
225
265
|
#
|
226
266
|
# When you use queue tags, keep the following guidelines in mind:
|
227
267
|
#
|
@@ -235,15 +275,15 @@ module Aws::SQS
|
|
235
275
|
# * A new tag with a key identical to that of an existing tag overwrites
|
236
276
|
# the existing tag.
|
237
277
|
#
|
238
|
-
# For a full list of tag restrictions, see [
|
239
|
-
# in the *Amazon
|
278
|
+
# For a full list of tag restrictions, see [Quotas related to queues][2]
|
279
|
+
# in the *Amazon SQS Developer Guide*.
|
240
280
|
#
|
241
281
|
# <note markdown="1"> To be able to tag a queue on creation, you must have the
|
242
282
|
# `sqs:CreateQueue` and `sqs:TagQueue` permissions.
|
243
283
|
#
|
244
284
|
# Cross-account permissions don't apply to this action. For more
|
245
|
-
# information, see [Grant cross-account permissions to a role and a
|
246
|
-
#
|
285
|
+
# information, see [Grant cross-account permissions to a role and a
|
286
|
+
# username][3] in the *Amazon SQS Developer Guide*.
|
247
287
|
#
|
248
288
|
# </note>
|
249
289
|
#
|
@@ -254,7 +294,9 @@ module Aws::SQS
|
|
254
294
|
# [3]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-customer-managed-policy-examples.html#grant-cross-account-permissions-to-role-and-user-name
|
255
295
|
# @return [Queue]
|
256
296
|
def create_queue(options = {})
|
257
|
-
resp =
|
297
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
298
|
+
@client.create_queue(options)
|
299
|
+
end
|
258
300
|
Queue.new(
|
259
301
|
url: resp.data.queue_url,
|
260
302
|
client: @client
|
@@ -275,10 +317,13 @@ module Aws::SQS
|
|
275
317
|
#
|
276
318
|
# Queue URLs and names are case-sensitive.
|
277
319
|
# @option options [String] :queue_owner_aws_account_id
|
278
|
-
# The
|
320
|
+
# The Amazon Web Services account ID of the account that created the
|
321
|
+
# queue.
|
279
322
|
# @return [Queue]
|
280
323
|
def get_queue_by_name(options = {})
|
281
|
-
resp =
|
324
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
325
|
+
@client.get_queue_url(options)
|
326
|
+
end
|
282
327
|
Queue.new(
|
283
328
|
url: resp.data.queue_url,
|
284
329
|
client: @client
|
@@ -310,7 +355,9 @@ module Aws::SQS
|
|
310
355
|
# @return [Queue::Collection]
|
311
356
|
def queues(options = {})
|
312
357
|
batches = Enumerator.new do |y|
|
313
|
-
resp =
|
358
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
359
|
+
@client.list_queues(options)
|
360
|
+
end
|
314
361
|
resp.each_page do |page|
|
315
362
|
batch = []
|
316
363
|
page.data.queue_urls.each do |q|
|