aws-sdk-sqs 1.9.0 → 1.70.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'set'
2
4
 
3
5
  module Aws
4
6
  module SQS
5
-
6
7
  # A utility class for long polling messages in a loop. **Messages are
7
8
  # automatically deleted from the queue at the end of the given block.**
8
9
  #
@@ -179,6 +180,16 @@ module Aws
179
180
  # end
180
181
  # ```
181
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
+ #
182
193
  # * Accept a 2nd argument in the poll block, for example:
183
194
  #
184
195
  # ```
@@ -201,7 +212,6 @@ module Aws
201
212
  # ```
202
213
  #
203
214
  class QueuePoller
204
-
205
215
  # @param [String] queue_url
206
216
  # @option options [Client] :client
207
217
  # @option (see #poll)
@@ -253,7 +263,22 @@ module Aws
253
263
  #
254
264
  # @return [void]
255
265
  def before_request(&block)
256
- @default_config = @default_config.with(before_request: Proc.new)
266
+ @default_config = @default_config.with(before_request: block) if block_given?
267
+ end
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?
257
282
  end
258
283
 
259
284
  # Polls the queue, yielded a message, or an array of messages.
@@ -288,7 +313,7 @@ module Aws
288
313
  # @option options [Integer] :visibility_timeout (nil)
289
314
  # The number of seconds you have to process a message before
290
315
  # it is put back into the queue and can be received again.
291
- # By default, the queue's
316
+ # By default, the queue's visibility timeout is not set.
292
317
  #
293
318
  # @option options [Array<String>] :attribute_names ([])
294
319
  # The list of attributes that need to be returned along with each
@@ -331,7 +356,8 @@ module Aws
331
356
  loop do
332
357
  messages = get_messages(config, stats)
333
358
  if messages.empty?
334
- check_idle_timeout(config, stats, messages)
359
+ check_idle_timeout(config, stats)
360
+ config.after_empty_receive&.call(stats)
335
361
  else
336
362
  process_messages(config, stats, messages, &block)
337
363
  end
@@ -346,21 +372,21 @@ module Aws
346
372
  # `#receipt_handle`.
347
373
  # @param [Integer] seconds
348
374
  def change_message_visibility_timeout(message, seconds)
349
- @client.change_message_visibility({
375
+ @client.change_message_visibility(
350
376
  queue_url: @queue_url,
351
377
  receipt_handle: message.receipt_handle,
352
- visibility_timeout: seconds,
353
- })
378
+ visibility_timeout: seconds
379
+ )
354
380
  end
355
381
 
356
382
  # @note This method should be called from inside a {#poll} block.
357
383
  # @param [#receipt_handle] message An object that responds to
358
384
  # `#receipt_handle`.
359
385
  def delete_message(message)
360
- @client.delete_message({
386
+ @client.delete_message(
361
387
  queue_url: @queue_url,
362
- receipt_handle: message.receipt_handle,
363
- })
388
+ receipt_handle: message.receipt_handle
389
+ )
364
390
  end
365
391
 
366
392
  # @note This method should be called from inside a {#poll} block.
@@ -370,16 +396,16 @@ module Aws
370
396
  def delete_messages(messages)
371
397
  @client.delete_message_batch(
372
398
  queue_url: @queue_url,
373
- entries: messages.map { |msg|
399
+ entries: messages.map do |msg|
374
400
  { id: msg.message_id, receipt_handle: msg.receipt_handle }
375
- }
401
+ end
376
402
  )
377
403
  end
378
404
 
379
405
  private
380
406
 
381
407
  def get_messages(config, stats)
382
- config.before_request.call(stats) if config.before_request
408
+ config.before_request&.call(stats)
383
409
  messages = send_request(config).messages
384
410
  stats.request_count += 1
385
411
  messages
@@ -390,17 +416,22 @@ module Aws
390
416
  @client.receive_message(params)
391
417
  end
392
418
 
393
- def check_idle_timeout(config, stats, messages)
394
- if config.idle_timeout
395
- since = stats.last_message_received_at || stats.polling_started_at
396
- idle_time = Time.now - since
397
- throw :stop_polling if idle_time > config.idle_timeout
398
- end
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
399
425
  end
400
426
 
401
427
  def process_messages(config, stats, messages, &block)
402
428
  stats.received_message_count += messages.count
403
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!
404
435
  catch(:skip_delete) do
405
436
  yield_messages(config, messages, stats, &block)
406
437
  delete_messages(messages) unless config.skip_delete
@@ -419,7 +450,6 @@ module Aws
419
450
 
420
451
  # Statistics tracked client-side by the {QueuePoller}.
421
452
  class PollerStats
422
-
423
453
  def initialize
424
454
  @request_count = 0
425
455
  @received_message_count = 0
@@ -442,27 +472,26 @@ module Aws
442
472
 
443
473
  # @return [Time,nil]
444
474
  attr_accessor :polling_stopped_at
445
-
446
475
  end
447
476
 
448
477
  # A read-only set of configuration used by the QueuePoller.
449
478
  class PollerConfig
450
-
451
479
  # @api private
452
- CONFIG_OPTIONS = Set.new([
453
- :idle_timeout,
454
- :skip_delete,
455
- :before_request,
456
- ])
480
+ CONFIG_OPTIONS = Set.new %i[
481
+ idle_timeout
482
+ skip_delete
483
+ before_request
484
+ after_empty_receive
485
+ ]
457
486
 
458
487
  # @api private
459
- PARAM_OPTIONS = Set.new([
460
- :wait_time_seconds,
461
- :max_number_of_messages,
462
- :visibility_timeout,
463
- :attribute_names,
464
- :message_attribute_names,
465
- ])
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
+ ]
466
495
 
467
496
  # @return [Integer,nil]
468
497
  attr_reader :idle_timeout
@@ -473,6 +502,9 @@ module Aws
473
502
  # @return [Proc,nil]
474
503
  attr_reader :before_request
475
504
 
505
+ # @return [Proc,nil]
506
+ attr_reader :after_empty_receive
507
+
476
508
  # @return [Hash]
477
509
  attr_reader :request_params
478
510
 
@@ -480,12 +512,13 @@ module Aws
480
512
  @idle_timeout = nil
481
513
  @skip_delete = false
482
514
  @before_request = nil
515
+ @after_empty_receive = nil
483
516
  @request_params = {
484
517
  wait_time_seconds: 20,
485
518
  max_number_of_messages: 1,
486
519
  visibility_timeout: nil,
487
520
  attribute_names: ['All'],
488
- message_attribute_names: ['All'],
521
+ message_attribute_names: ['All']
489
522
  }
490
523
  options.each do |opt_name, value|
491
524
  if CONFIG_OPTIONS.include?(opt_name)
@@ -496,6 +529,12 @@ module Aws
496
529
  raise ArgumentError, "invalid option #{opt_name.inspect}"
497
530
  end
498
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
+
499
538
  @request_params.freeze
500
539
  freeze
501
540
  end
@@ -514,7 +553,6 @@ module Aws
514
553
  PARAM_OPTIONS.each { |key| hash[key] = @request_params[key] }
515
554
  hash
516
555
  end
517
-
518
556
  end
519
557
  end
520
558
  end
@@ -1,11 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # WARNING ABOUT GENERATED CODE
2
4
  #
3
5
  # This file is generated. See the contributing guide for more information:
4
- # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
5
7
  #
6
8
  # WARNING ABOUT GENERATED CODE
7
9
 
8
10
  module Aws::SQS
11
+
12
+ # This class provides a resource oriented interface for SQS.
13
+ # To create a resource object:
14
+ #
15
+ # resource = Aws::SQS::Resource.new(region: 'us-west-2')
16
+ #
17
+ # You can supply a client object with custom configuration that will be used for all resource operations.
18
+ # If you do not pass `:client`, a default client will be constructed.
19
+ #
20
+ # client = Aws::SQS::Client.new(region: 'us-west-2')
21
+ # resource = Aws::SQS::Resource.new(client: client)
22
+ #
9
23
  class Resource
10
24
 
11
25
  # @param options ({})
@@ -28,6 +42,9 @@ module Aws::SQS
28
42
  # attributes: {
29
43
  # "All" => "String",
30
44
  # },
45
+ # tags: {
46
+ # "TagKey" => "TagValue",
47
+ # },
31
48
  # })
32
49
  # @param [Hash] options ({})
33
50
  # @option options [required, String] :queue_name
@@ -47,91 +64,130 @@ module Aws::SQS
47
64
  # The following lists the names, descriptions, and values of the special
48
65
  # request parameters that the `CreateQueue` action uses:
49
66
  #
50
- # * `DelaySeconds` - The length of time, in seconds, for which the
67
+ # * `DelaySeconds` The length of time, in seconds, for which the
51
68
  # delivery of all messages in the queue is delayed. Valid values: An
52
69
  # integer from 0 to 900 seconds (15 minutes). Default: 0.
53
70
  #
54
- # * `MaximumMessageSize` - The limit of how many bytes a message can
71
+ # * `MaximumMessageSize` The limit of how many bytes a message can
55
72
  # contain before Amazon SQS rejects it. Valid values: An integer from
56
73
  # 1,024 bytes (1 KiB) to 262,144 bytes (256 KiB). Default: 262,144
57
74
  # (256 KiB).
58
75
  #
59
- # * `MessageRetentionPeriod` - The length of time, in seconds, for which
76
+ # * `MessageRetentionPeriod` The length of time, in seconds, for which
60
77
  # Amazon SQS retains a message. Valid values: An integer from 60
61
78
  # seconds (1 minute) to 1,209,600 seconds (14 days). Default: 345,600
62
- # (4 days).
63
- #
64
- # * `Policy` - The queue's policy. A valid AWS policy. For more
65
- # information about policy structure, see [Overview of AWS IAM
66
- # Policies][1] in the *Amazon IAM User Guide*.
67
- #
68
- # * `ReceiveMessageWaitTimeSeconds` - The length of time, in seconds,
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*.
90
+ #
91
+ # * `ReceiveMessageWaitTimeSeconds` – The length of time, in seconds,
69
92
  # for which a ` ReceiveMessage ` action waits for a message to arrive.
70
93
  # Valid values: An integer from 0 to 20 (seconds). Default: 0.
71
94
  #
72
- # * `RedrivePolicy` - The string that includes the parameters for the
73
- # dead-letter queue functionality of the source queue. For more
74
- # information about the redrive policy and dead-letter queues, see
75
- # [Using Amazon SQS Dead-Letter Queues][2] in the *Amazon Simple Queue
76
- # Service Developer Guide*.
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
+ #
102
+ # * `RedrivePolicy` – The string that includes the parameters for the
103
+ # dead-letter queue functionality of the source queue as a JSON
104
+ # object. The parameters are as follows:
77
105
  #
78
- # * `deadLetterTargetArn` - The Amazon Resource Name (ARN) of the
106
+ # * `deadLetterTargetArn` The Amazon Resource Name (ARN) of the
79
107
  # dead-letter queue to which Amazon SQS moves messages after the
80
108
  # value of `maxReceiveCount` is exceeded.
81
109
  #
82
- # * `maxReceiveCount` - The number of times a message is delivered to
83
- # the source queue before being moved to the dead-letter queue. When
84
- # the `ReceiveCount` for a message exceeds the `maxReceiveCount` for
85
- # a queue, Amazon SQS moves the message to the dead-letter-queue.
110
+ # * `maxReceiveCount` The number of times a message is delivered to
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.
86
115
  #
87
- # <note markdown="1"> The dead-letter queue of a FIFO queue must also be a FIFO queue.
88
- # Similarly, the dead-letter queue of a standard queue must also be a
89
- # standard queue.
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:
90
120
  #
91
- # </note>
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:
92
124
  #
93
- # * `VisibilityTimeout` - The visibility timeout for the queue, in
94
- # seconds. Valid values: An integer from 0 to 43,200 (12 hours).
95
- # Default: 30. For more information about the visibility timeout, see
96
- # [Visibility Timeout][3] in the *Amazon Simple Queue Service
97
- # Developer Guide*.
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.
146
+ #
147
+ # </note>
98
148
  #
99
- # The following attributes apply only to [server-side-encryption][4]\:
149
+ # The following attributes apply only to [server-side-encryption][4]:
100
150
  #
101
- # * `KmsMasterKeyId` - The ID of an AWS-managed customer master key
102
- # (CMK) for Amazon SQS or a custom CMK. For more information, see [Key
103
- # Terms][5]. While the alias of the AWS-managed CMK for Amazon SQS is
104
- # always `alias/aws/sqs`, the alias of a custom CMK can, for example,
105
- # be `alias/MyAlias `. For more examples, see [KeyId][6] in the *AWS
106
- # Key Management Service API Reference*.
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*.
107
158
  #
108
- # * `KmsDataKeyReusePeriodSeconds` - The length of time, in seconds, for
159
+ # * `KmsDataKeyReusePeriodSeconds` The length of time, in seconds, for
109
160
  # which Amazon SQS can reuse a [data key][7] to encrypt or decrypt
110
- # messages before calling AWS KMS again. An integer representing
111
- # seconds, between 60 seconds (1 minute) and 86,400 seconds (24
112
- # hours). Default: 300 (5 minutes). A shorter time period provides
113
- # better security but results in more calls to KMS which might incur
114
- # charges after Free Tier. For more information, see [How Does the
115
- # Data Key Reuse Period Work?][8].
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]
116
167
  #
117
- # The following attributes apply only to [FIFO (first-in-first-out)
118
- # queues][9]\:
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]).
119
171
  #
120
- # * `FifoQueue` - Designates a queue as FIFO. Valid values: `true`,
121
- # `false`. You can provide this attribute only during queue creation.
122
- # You can't change it for an existing queue. When you set this
123
- # attribute, you must also provide the `MessageGroupId` for your
124
- # messages explicitly.
172
+ # The following attributes apply only to [FIFO (first-in-first-out)
173
+ # queues][11]:
125
174
  #
126
- # For more information, see [FIFO Queue Logic][10] in the *Amazon
127
- # Simple Queue Service Developer Guide*.
175
+ # * `FifoQueue` Designates a queue as FIFO. Valid values are `true`
176
+ # and `false`. If you don't specify the `FifoQueue` attribute, Amazon
177
+ # SQS creates a standard queue. You can provide this attribute only
178
+ # during queue creation. You can't change it for an existing queue.
179
+ # When you set this attribute, you must also provide the
180
+ # `MessageGroupId` for your messages explicitly.
128
181
  #
129
- # * `ContentBasedDeduplication` - Enables content-based deduplication.
130
- # Valid values: `true`, `false`. For more information, see
131
- # [Exactly-Once Processing][11] in the *Amazon Simple Queue Service
182
+ # For more information, see [FIFO queue logic][12] in the *Amazon SQS
132
183
  # Developer Guide*.
133
184
  #
134
- # * Every message must have a unique `MessageDeduplicationId`,
185
+ # * `ContentBasedDeduplication` Enables content-based deduplication.
186
+ # Valid values are `true` and `false`. For more information, see
187
+ # [Exactly-once processing][13] in the *Amazon SQS Developer Guide*.
188
+ # Note the following:
189
+ #
190
+ # * Every message must have a unique `MessageDeduplicationId`.
135
191
  #
136
192
  # * You may provide a `MessageDeduplicationId` explicitly.
137
193
  #
@@ -159,22 +215,88 @@ module Aws::SQS
159
215
  # `MessageDeduplicationId`, the two messages are treated as
160
216
  # duplicates and only one copy of the message is delivered.
161
217
  #
218
+ # The following attributes apply only to [high throughput for FIFO
219
+ # queues][14]:
220
+ #
221
+ # * `DeduplicationScope` – Specifies whether message deduplication
222
+ # occurs at the message group or queue level. Valid values are
223
+ # `messageGroup` and `queue`.
224
+ #
225
+ # * `FifoThroughputLimit` – Specifies whether the FIFO queue throughput
226
+ # quota applies to the entire queue or per message group. Valid values
227
+ # are `perQueue` and `perMessageGroupId`. The `perMessageGroupId`
228
+ # value is allowed only when the value for `DeduplicationScope` is
229
+ # `messageGroup`.
162
230
  #
231
+ # To enable high throughput for FIFO queues, do the following:
163
232
  #
164
- # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html
165
- # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
166
- # [3]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
167
- # [4]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html
168
- # [5]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-sse-key-terms
169
- # [6]: http://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html#API_DescribeKey_RequestParameters
170
- # [7]: http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#data-keys
171
- # [8]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-how-does-the-data-key-reuse-period-work
172
- # [9]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html
173
- # [10]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-understanding-logic
174
- # [11]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing
233
+ # * Set `DeduplicationScope` to `messageGroup`.
234
+ #
235
+ # * Set `FifoThroughputLimit` to `perMessageGroupId`.
236
+ #
237
+ # If you set these attributes to anything other than the values shown
238
+ # for enabling high throughput, normal throughput is in effect and
239
+ # deduplication occurs as specified.
240
+ #
241
+ # For information on throughput quotas, see [Quotas related to
242
+ # messages][15] in the *Amazon SQS Developer Guide*.
243
+ #
244
+ #
245
+ #
246
+ # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html
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
249
+ # [4]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html
250
+ # [5]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-sse-key-terms
251
+ # [6]: https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html#API_DescribeKey_RequestParameters
252
+ # [7]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#data-keys
253
+ # [8]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-how-does-the-data-key-reuse-period-work
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
261
+ # @option options [Hash<String,String>] :tags
262
+ # Add cost allocation tags to the specified Amazon SQS queue. For an
263
+ # overview, see [Tagging Your Amazon SQS Queues][1] in the *Amazon SQS
264
+ # Developer Guide*.
265
+ #
266
+ # When you use queue tags, keep the following guidelines in mind:
267
+ #
268
+ # * Adding more than 50 tags to a queue isn't recommended.
269
+ #
270
+ # * Tags don't have any semantic meaning. Amazon SQS interprets tags as
271
+ # character strings.
272
+ #
273
+ # * Tags are case-sensitive.
274
+ #
275
+ # * A new tag with a key identical to that of an existing tag overwrites
276
+ # the existing tag.
277
+ #
278
+ # For a full list of tag restrictions, see [Quotas related to queues][2]
279
+ # in the *Amazon SQS Developer Guide*.
280
+ #
281
+ # <note markdown="1"> To be able to tag a queue on creation, you must have the
282
+ # `sqs:CreateQueue` and `sqs:TagQueue` permissions.
283
+ #
284
+ # Cross-account permissions don't apply to this action. For more
285
+ # information, see [Grant cross-account permissions to a role and a
286
+ # username][3] in the *Amazon SQS Developer Guide*.
287
+ #
288
+ # </note>
289
+ #
290
+ #
291
+ #
292
+ # [1]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-queue-tags.html
293
+ # [2]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-limits.html#limits-queues
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
175
295
  # @return [Queue]
176
296
  def create_queue(options = {})
177
- resp = @client.create_queue(options)
297
+ resp = Aws::Plugins::UserAgent.feature('resource') do
298
+ @client.create_queue(options)
299
+ end
178
300
  Queue.new(
179
301
  url: resp.data.queue_url,
180
302
  client: @client
@@ -195,10 +317,13 @@ module Aws::SQS
195
317
  #
196
318
  # Queue URLs and names are case-sensitive.
197
319
  # @option options [String] :queue_owner_aws_account_id
198
- # The AWS account ID of the account that created the queue.
320
+ # The Amazon Web Services account ID of the account that created the
321
+ # queue.
199
322
  # @return [Queue]
200
323
  def get_queue_by_name(options = {})
201
- resp = @client.get_queue_url(options)
324
+ resp = Aws::Plugins::UserAgent.feature('resource') do
325
+ @client.get_queue_url(options)
326
+ end
202
327
  Queue.new(
203
328
  url: resp.data.queue_url,
204
329
  client: @client
@@ -230,15 +355,19 @@ module Aws::SQS
230
355
  # @return [Queue::Collection]
231
356
  def queues(options = {})
232
357
  batches = Enumerator.new do |y|
233
- batch = []
234
- resp = @client.list_queues(options)
235
- resp.data.queue_urls.each do |q|
236
- batch << Queue.new(
237
- url: q,
238
- client: @client
239
- )
358
+ resp = Aws::Plugins::UserAgent.feature('resource') do
359
+ @client.list_queues(options)
360
+ end
361
+ resp.each_page do |page|
362
+ batch = []
363
+ page.data.queue_urls.each do |q|
364
+ batch << Queue.new(
365
+ url: q,
366
+ client: @client
367
+ )
368
+ end
369
+ y.yield(batch)
240
370
  end
241
- y.yield(batch)
242
371
  end
243
372
  Queue::Collection.new(batches)
244
373
  end