aws-sdk-sqs 1.5.0 → 1.80.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,14 @@
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
+
9
12
  class Queue
10
13
 
11
14
  extend Aws::Deprecations
@@ -21,6 +24,7 @@ module Aws::SQS
21
24
  @url = extract_url(args, options)
22
25
  @data = options.delete(:data)
23
26
  @client = options.delete(:client) || Client.new(options)
27
+ @waiter_block_warned = false
24
28
  end
25
29
 
26
30
  # @!group Read-Only Attributes
@@ -50,10 +54,12 @@ module Aws::SQS
50
54
  #
51
55
  # @return [self]
52
56
  def load
53
- resp = @client.get_queue_attributes(
57
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
58
+ @client.get_queue_attributes(
54
59
  queue_url: @url,
55
60
  attribute_names: ["All"]
56
61
  )
62
+ end
57
63
  @data = resp.data
58
64
  self
59
65
  end
@@ -90,36 +96,22 @@ module Aws::SQS
90
96
  # characters include alphanumeric characters, hyphens (`-`), and
91
97
  # underscores (`_`).
92
98
  # @option options [required, Array<String>] :aws_account_ids
93
- # The AWS account number of the [principal][1] who is given permission.
94
- # The principal must have an AWS account, but does not need to be signed
95
- # up for Amazon SQS. For information about locating the AWS account
96
- # identification, see [Your AWS Identifiers][2] in the *Amazon Simple
97
- # Queue Service Developer Guide*.
99
+ # The Amazon Web Services account numbers of the [principals][1] who are
100
+ # to receive permission. For information about locating the Amazon Web
101
+ # Services account identification, see [Your Amazon Web Services
102
+ # Identifiers][2] in the *Amazon SQS Developer Guide*.
98
103
  #
99
104
  #
100
105
  #
101
- # [1]: http://docs.aws.amazon.com/general/latest/gr/glos-chap.html#P
102
- # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AWSCredentials.html
106
+ # [1]: https://docs.aws.amazon.com/general/latest/gr/glos-chap.html#P
107
+ # [2]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-making-api-requests.html#sqs-api-request-authentication
103
108
  # @option options [required, Array<String>] :actions
104
- # The action the client wants to allow for the specified principal. The
105
- # following values are valid:
106
- #
107
- # * `*`
108
- #
109
- # * `ChangeMessageVisibility`
110
- #
111
- # * `DeleteMessage`
112
- #
113
- # * `GetQueueAttributes`
114
- #
115
- # * `GetQueueUrl`
116
- #
117
- # * `ReceiveMessage`
109
+ # The action the client wants to allow for the specified principal.
110
+ # Valid values: the name of any action or `*`.
118
111
  #
119
- # * `SendMessage`
120
- #
121
- # For more information about these actions, see [Understanding
122
- # Permissions][1] in the *Amazon Simple Queue Service Developer Guide*.
112
+ # For more information about these actions, see [Overview of Managing
113
+ # Access Permissions to Your Amazon Simple Queue Service Resource][1] in
114
+ # the *Amazon SQS Developer Guide*.
123
115
  #
124
116
  # Specifying `SendMessage`, `DeleteMessage`, or
125
117
  # `ChangeMessageVisibility` for `ActionName.n` also grants permissions
@@ -129,11 +121,13 @@ module Aws::SQS
129
121
  #
130
122
  #
131
123
  #
132
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/acp-overview.html#PermissionTypes
124
+ # [1]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-overview-of-managing-access.html
133
125
  # @return [EmptyStructure]
134
126
  def add_permission(options = {})
135
127
  options = options.merge(queue_url: @url)
136
- resp = @client.add_permission(options)
128
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
129
+ @client.add_permission(options)
130
+ end
137
131
  resp.data
138
132
  end
139
133
 
@@ -150,12 +144,14 @@ module Aws::SQS
150
144
  # })
151
145
  # @param [Hash] options ({})
152
146
  # @option options [required, Array<Types::ChangeMessageVisibilityBatchRequestEntry>] :entries
153
- # A list of receipt handles of the messages for which the visibility
147
+ # Lists the receipt handles of the messages for which the visibility
154
148
  # timeout must be changed.
155
149
  # @return [Types::ChangeMessageVisibilityBatchResult]
156
150
  def change_message_visibility_batch(options = {})
157
151
  options = options.merge(queue_url: @url)
158
- resp = @client.change_message_visibility_batch(options)
152
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
153
+ @client.change_message_visibility_batch(options)
154
+ end
159
155
  resp.data
160
156
  end
161
157
 
@@ -166,7 +162,9 @@ module Aws::SQS
166
162
  # @return [EmptyStructure]
167
163
  def delete(options = {})
168
164
  options = options.merge(queue_url: @url)
169
- resp = @client.delete_queue(options)
165
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
166
+ @client.delete_queue(options)
167
+ end
170
168
  resp.data
171
169
  end
172
170
 
@@ -182,11 +180,13 @@ module Aws::SQS
182
180
  # })
183
181
  # @param [Hash] options ({})
184
182
  # @option options [required, Array<Types::DeleteMessageBatchRequestEntry>] :entries
185
- # A list of receipt handles for the messages to be deleted.
183
+ # Lists the receipt handles for the messages to be deleted.
186
184
  # @return [Types::DeleteMessageBatchResult]
187
185
  def delete_messages(options = {})
188
186
  options = options.merge(queue_url: @url)
189
- resp = @client.delete_message_batch(options)
187
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
188
+ @client.delete_message_batch(options)
189
+ end
190
190
  resp.data
191
191
  end
192
192
 
@@ -197,14 +197,17 @@ module Aws::SQS
197
197
  # @return [EmptyStructure]
198
198
  def purge(options = {})
199
199
  options = options.merge(queue_url: @url)
200
- resp = @client.purge_queue(options)
200
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
201
+ @client.purge_queue(options)
202
+ end
201
203
  resp.data
202
204
  end
203
205
 
204
206
  # @example Request syntax with placeholder values
205
207
  #
206
208
  # message = queue.receive_messages({
207
- # attribute_names: ["All"], # accepts All, Policy, VisibilityTimeout, MaximumMessageSize, MessageRetentionPeriod, ApproximateNumberOfMessages, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, LastModifiedTimestamp, QueueArn, ApproximateNumberOfMessagesDelayed, DelaySeconds, ReceiveMessageWaitTimeSeconds, RedrivePolicy, FifoQueue, ContentBasedDeduplication, KmsMasterKeyId, KmsDataKeyReusePeriodSeconds
209
+ # attribute_names: ["All"], # accepts All, Policy, VisibilityTimeout, MaximumMessageSize, MessageRetentionPeriod, ApproximateNumberOfMessages, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, LastModifiedTimestamp, QueueArn, ApproximateNumberOfMessagesDelayed, DelaySeconds, ReceiveMessageWaitTimeSeconds, RedrivePolicy, FifoQueue, ContentBasedDeduplication, KmsMasterKeyId, KmsDataKeyReusePeriodSeconds, DeduplicationScope, FifoThroughputLimit, RedriveAllowPolicy, SqsManagedSseEnabled
210
+ # message_system_attribute_names: ["All"], # accepts All, SenderId, SentTimestamp, ApproximateReceiveCount, ApproximateFirstReceiveTimestamp, SequenceNumber, MessageDeduplicationId, MessageGroupId, AWSTraceHeader, DeadLetterQueueSourceArn
208
211
  # message_attribute_names: ["MessageAttributeName"],
209
212
  # max_number_of_messages: 1,
210
213
  # visibility_timeout: 1,
@@ -213,73 +216,95 @@ module Aws::SQS
213
216
  # })
214
217
  # @param [Hash] options ({})
215
218
  # @option options [Array<String>] :attribute_names
219
+ # This parameter has been deprecated but will be supported for backward
220
+ # compatibility. To provide attribute names, you are encouraged to use
221
+ # `MessageSystemAttributeNames`.
222
+ #
216
223
  # A list of attributes that need to be returned along with each message.
217
224
  # These attributes include:
218
225
  #
219
- # * `All` - Returns all values.
226
+ # * `All` Returns all values.
220
227
  #
221
- # * `ApproximateFirstReceiveTimestamp` - Returns the time the message
228
+ # * `ApproximateFirstReceiveTimestamp` Returns the time the message
222
229
  # was first received from the queue ([epoch time][1] in milliseconds).
223
230
  #
224
- # * `ApproximateReceiveCount` - Returns the number of times a message
225
- # has been received from the queue but not deleted.
231
+ # * `ApproximateReceiveCount` Returns the number of times a message
232
+ # has been received across all queues but not deleted.
233
+ #
234
+ # * `AWSTraceHeader` – Returns the X-Ray trace header string.
226
235
  #
227
236
  # * `SenderId`
228
237
  #
229
- # * For an IAM user, returns the IAM user ID, for example
238
+ # * For a user, returns the user ID, for example
230
239
  # `ABCDEFGHI1JKLMNOPQ23R`.
231
240
  #
232
241
  # * For an IAM role, returns the IAM role ID, for example
233
242
  # `ABCDE1F2GH3I4JK5LMNOP:i-a123b456`.
234
243
  #
235
- # * `SentTimestamp` - Returns the time the message was sent to the queue
244
+ # * `SentTimestamp` Returns the time the message was sent to the queue
236
245
  # ([epoch time][1] in milliseconds).
237
246
  #
238
- # * `MessageDeduplicationId` - Returns the value provided by the sender
239
- # that calls the ` SendMessage ` action.
247
+ # * `SqsManagedSseEnabled` Enables server-side queue encryption using
248
+ # SQS owned encryption keys. Only one server-side encryption option is
249
+ # supported per queue (for example, [SSE-KMS][2] or [SSE-SQS][3]).
250
+ #
251
+ # * `MessageDeduplicationId` – Returns the value provided by the
252
+ # producer that calls the ` SendMessage ` action.
240
253
  #
241
- # * `MessageGroupId` - Returns the value provided by the sender that
254
+ # * `MessageGroupId` Returns the value provided by the producer that
242
255
  # calls the ` SendMessage ` action. Messages with the same
243
256
  # `MessageGroupId` are returned in sequence.
244
257
  #
245
- # * `SequenceNumber` - Returns the value provided by Amazon SQS.
258
+ # * `SequenceNumber` Returns the value provided by Amazon SQS.
246
259
  #
247
- # Any other valid special request parameters (such as the following) are
248
- # ignored:
249
260
  #
250
- # * `ApproximateNumberOfMessages`
251
261
  #
252
- # * `ApproximateNumberOfMessagesDelayed`
253
- #
254
- # * `ApproximateNumberOfMessagesNotVisible`
262
+ # [1]: http://en.wikipedia.org/wiki/Unix_time
263
+ # [2]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sse-existing-queue.html
264
+ # [3]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sqs-sse-queue.html
265
+ # @option options [Array<String>] :message_system_attribute_names
266
+ # A list of attributes that need to be returned along with each message.
267
+ # These attributes include:
255
268
  #
256
- # * `CreatedTimestamp`
269
+ # * `All` – Returns all values.
257
270
  #
258
- # * `ContentBasedDeduplication`
271
+ # * `ApproximateFirstReceiveTimestamp` – Returns the time the message
272
+ # was first received from the queue ([epoch time][1] in milliseconds).
259
273
  #
260
- # * `DelaySeconds`
274
+ # * `ApproximateReceiveCount` – Returns the number of times a message
275
+ # has been received across all queues but not deleted.
261
276
  #
262
- # * `FifoQueue`
277
+ # * `AWSTraceHeader` – Returns the X-Ray trace header string.
263
278
  #
264
- # * `LastModifiedTimestamp`
279
+ # * `SenderId`
265
280
  #
266
- # * `MaximumMessageSize`
281
+ # * For a user, returns the user ID, for example
282
+ # `ABCDEFGHI1JKLMNOPQ23R`.
267
283
  #
268
- # * `MessageRetentionPeriod`
284
+ # * For an IAM role, returns the IAM role ID, for example
285
+ # `ABCDE1F2GH3I4JK5LMNOP:i-a123b456`.
269
286
  #
270
- # * `Policy`
287
+ # * `SentTimestamp` – Returns the time the message was sent to the queue
288
+ # ([epoch time][1] in milliseconds).
271
289
  #
272
- # * `QueueArn`,
290
+ # * `SqsManagedSseEnabled` – Enables server-side queue encryption using
291
+ # SQS owned encryption keys. Only one server-side encryption option is
292
+ # supported per queue (for example, [SSE-KMS][2] or [SSE-SQS][3]).
273
293
  #
274
- # * `ReceiveMessageWaitTimeSeconds`
294
+ # * `MessageDeduplicationId` – Returns the value provided by the
295
+ # producer that calls the ` SendMessage ` action.
275
296
  #
276
- # * `RedrivePolicy`
297
+ # * `MessageGroupId` – Returns the value provided by the producer that
298
+ # calls the ` SendMessage ` action. Messages with the same
299
+ # `MessageGroupId` are returned in sequence.
277
300
  #
278
- # * `VisibilityTimeout`
301
+ # * `SequenceNumber` – Returns the value provided by Amazon SQS.
279
302
  #
280
303
  #
281
304
  #
282
305
  # [1]: http://en.wikipedia.org/wiki/Unix_time
306
+ # [2]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sse-existing-queue.html
307
+ # [3]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sqs-sse-queue.html
283
308
  # @option options [Array<String>] :message_attribute_names
284
309
  # The name of the message attribute, where *N* is the index.
285
310
  #
@@ -304,7 +329,7 @@ module Aws::SQS
304
329
  # @option options [Integer] :max_number_of_messages
305
330
  # The maximum number of messages to return. Amazon SQS never returns
306
331
  # more messages than this value (however, fewer messages might be
307
- # returned). Valid values are 1 to 10. Default is 1.
332
+ # returned). Valid values: 1 to 10. Default: 1.
308
333
  # @option options [Integer] :visibility_timeout
309
334
  # The duration (in seconds) that the received messages are hidden from
310
335
  # subsequent retrieve requests after being retrieved by a
@@ -313,16 +338,27 @@ module Aws::SQS
313
338
  # The duration (in seconds) for which the call waits for a message to
314
339
  # arrive in the queue before returning. If a message is available, the
315
340
  # call returns sooner than `WaitTimeSeconds`. If no messages are
316
- # available and the wait time expires, the call returns successfully
317
- # with an empty list of messages.
341
+ # available and the wait time expires, the call does not return a
342
+ # message list.
343
+ #
344
+ # To avoid HTTP errors, ensure that the HTTP response timeout for
345
+ # `ReceiveMessage` requests is longer than the `WaitTimeSeconds`
346
+ # parameter. For example, with the Java SDK, you can set HTTP transport
347
+ # settings using the [ NettyNioAsyncHttpClient][1] for asynchronous
348
+ # clients, or the [ ApacheHttpClient][2] for synchronous clients.
349
+ #
350
+ #
351
+ #
352
+ # [1]: https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/http/nio/netty/NettyNioAsyncHttpClient.html
353
+ # [2]: https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/http/apache/ApacheHttpClient.html
318
354
  # @option options [String] :receive_request_attempt_id
319
355
  # This parameter applies only to FIFO (first-in-first-out) queues.
320
356
  #
321
357
  # The token used for deduplication of `ReceiveMessage` calls. If a
322
358
  # networking issue occurs after a `ReceiveMessage` action, and instead
323
- # of a response you receive a generic error, you can retry the same
324
- # action with an identical `ReceiveRequestAttemptId` to retrieve the
325
- # same set of messages, even if their visibility timeout has not yet
359
+ # of a response you receive a generic error, it is possible to retry the
360
+ # same action with an identical `ReceiveRequestAttemptId` to retrieve
361
+ # the same set of messages, even if their visibility timeout has not yet
326
362
  # expired.
327
363
  #
328
364
  # * You can use `ReceiveRequestAttemptId` only for 5 minutes after a
@@ -331,11 +367,7 @@ module Aws::SQS
331
367
  # * When you set `FifoQueue`, a caller of the `ReceiveMessage` action
332
368
  # can provide a `ReceiveRequestAttemptId` explicitly.
333
369
  #
334
- # * If a caller of the `ReceiveMessage` action doesn't provide a
335
- # `ReceiveRequestAttemptId`, Amazon SQS generates a
336
- # `ReceiveRequestAttemptId`.
337
- #
338
- # * You can retry the `ReceiveMessage` action with the same
370
+ # * It is possible to retry the `ReceiveMessage` action with the same
339
371
  # `ReceiveRequestAttemptId` if none of the messages have been modified
340
372
  # (deleted or had their visibility changes).
341
373
  #
@@ -343,15 +375,14 @@ module Aws::SQS
343
375
  # `ReceiveRequestAttemptId` return the same messages and receipt
344
376
  # handles. If a retry occurs within the deduplication interval, it
345
377
  # resets the visibility timeout. For more information, see [Visibility
346
- # Timeout][1] in the *Amazon Simple Queue Service Developer Guide*.
378
+ # Timeout][1] in the *Amazon SQS Developer Guide*.
347
379
  #
348
- # If a caller of the `ReceiveMessage` action is still processing
349
- # messages when the visibility timeout expires and messages become
350
- # visible, another worker reading from the same queue can receive the
351
- # same messages and therefore process duplicates. Also, if a reader
352
- # whose message processing time is longer than the visibility timeout
353
- # tries to delete the processed messages, the action fails with an
354
- # error.
380
+ # If a caller of the `ReceiveMessage` action still processes messages
381
+ # when the visibility timeout expires and messages become visible,
382
+ # another worker consuming from the same queue can receive the same
383
+ # messages and therefore process duplicates. Also, if a consumer whose
384
+ # message processing time is longer than the visibility timeout tries
385
+ # to delete the processed messages, the action fails with an error.
355
386
  #
356
387
  # To mitigate this effect, ensure that your application observes a
357
388
  # safe threshold before the visibility timeout expires and extend the
@@ -367,24 +398,26 @@ module Aws::SQS
367
398
  # visibility timeout expires. As a result, delays might occur but the
368
399
  # messages in the queue remain in a strict order.
369
400
  #
370
- # The length of `ReceiveRequestAttemptId` is 128 characters.
401
+ # The maximum length of `ReceiveRequestAttemptId` is 128 characters.
371
402
  # `ReceiveRequestAttemptId` can contain alphanumeric characters (`a-z`,
372
403
  # `A-Z`, `0-9`) and punctuation (`` !"#$%&'()*+,-./:;<=>?@[\]^_`\{|\}~
373
404
  # ``).
374
405
  #
375
406
  # For best practices of using `ReceiveRequestAttemptId`, see [Using the
376
- # ReceiveRequestAttemptId Request Parameter][2] in the *Amazon Simple
377
- # Queue Service Developer Guide*.
407
+ # ReceiveRequestAttemptId Request Parameter][2] in the *Amazon SQS
408
+ # Developer Guide*.
378
409
  #
379
410
  #
380
411
  #
381
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
382
- # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queue-recommendations.html#using-receiverequestattemptid-request-parameter
412
+ # [1]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
413
+ # [2]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-receiverequestattemptid-request-parameter.html
383
414
  # @return [Message::Collection]
384
415
  def receive_messages(options = {})
385
416
  batch = []
386
417
  options = options.merge(queue_url: @url)
387
- resp = @client.receive_message(options)
418
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
419
+ @client.receive_message(options)
420
+ end
388
421
  resp.data.messages.each do |m|
389
422
  batch << Message.new(
390
423
  queue_url: @url,
@@ -408,7 +441,9 @@ module Aws::SQS
408
441
  # @return [EmptyStructure]
409
442
  def remove_permission(options = {})
410
443
  options = options.merge(queue_url: @url)
411
- resp = @client.remove_permission(options)
444
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
445
+ @client.remove_permission(options)
446
+ end
412
447
  resp.data
413
448
  end
414
449
 
@@ -426,21 +461,35 @@ module Aws::SQS
426
461
  # data_type: "String", # required
427
462
  # },
428
463
  # },
464
+ # message_system_attributes: {
465
+ # "AWSTraceHeader" => {
466
+ # string_value: "String",
467
+ # binary_value: "data",
468
+ # string_list_values: ["String"],
469
+ # binary_list_values: ["data"],
470
+ # data_type: "String", # required
471
+ # },
472
+ # },
429
473
  # message_deduplication_id: "String",
430
474
  # message_group_id: "String",
431
475
  # })
432
476
  # @param [Hash] options ({})
433
477
  # @option options [required, String] :message_body
434
- # The message to send. The maximum string size is 256 KB.
478
+ # The message to send. The minimum size is one character. The maximum
479
+ # size is 256 KiB.
435
480
  #
436
481
  # A message can include only XML, JSON, and unformatted text. The
437
- # following Unicode characters are allowed:
482
+ # following Unicode characters are allowed. For more information, see
483
+ # the [W3C specification for characters][1].
438
484
  #
439
485
  # `#x9` \| `#xA` \| `#xD` \| `#x20` to `#xD7FF` \| `#xE000` to `#xFFFD`
440
486
  # \| `#x10000` to `#x10FFFF`
441
487
  #
442
- # Any characters not included in this list will be rejected. For more
443
- # information, see the [W3C specification for characters][1].
488
+ # Amazon SQS does not throw an exception or completely reject the
489
+ # message if it contains invalid characters. Instead, it replaces those
490
+ # invalid characters with `U+FFFD` before storing the message in the
491
+ # queue, as long as the message body contains at least one valid
492
+ # character.
444
493
  #
445
494
  #
446
495
  #
@@ -458,12 +507,22 @@ module Aws::SQS
458
507
  # </note>
459
508
  # @option options [Hash<String,Types::MessageAttributeValue>] :message_attributes
460
509
  # Each message attribute consists of a `Name`, `Type`, and `Value`. For
461
- # more information, see [Message Attribute Items and Validation][1] in
462
- # the *Amazon Simple Queue Service Developer Guide*.
510
+ # more information, see [Amazon SQS message attributes][1] in the
511
+ # *Amazon SQS Developer Guide*.
463
512
  #
464
513
  #
465
514
  #
466
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html#message-attributes-items-validation
515
+ # [1]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-metadata.html#sqs-message-attributes
516
+ # @option options [Hash<String,Types::MessageSystemAttributeValue>] :message_system_attributes
517
+ # The message system attribute to send. Each message system attribute
518
+ # consists of a `Name`, `Type`, and `Value`.
519
+ #
520
+ # * Currently, the only supported message system attribute is
521
+ # `AWSTraceHeader`. Its type must be `String` and its value must be a
522
+ # correctly formatted X-Ray trace header string.
523
+ #
524
+ # * The size of a message system attribute doesn't count towards the
525
+ # total size of a message.
467
526
  # @option options [String] :message_deduplication_id
468
527
  # This parameter applies only to FIFO (first-in-first-out) queues.
469
528
  #
@@ -471,8 +530,8 @@ module Aws::SQS
471
530
  # particular `MessageDeduplicationId` is sent successfully, any messages
472
531
  # sent with the same `MessageDeduplicationId` are accepted successfully
473
532
  # but aren't delivered during the 5-minute deduplication interval. For
474
- # more information, see [ Exactly-Once Processing][1] in the *Amazon
475
- # Simple Queue Service Developer Guide*.
533
+ # more information, see [ Exactly-once processing][1] in the *Amazon SQS
534
+ # Developer Guide*.
476
535
  #
477
536
  # * Every message must have a unique `MessageDeduplicationId`,
478
537
  #
@@ -500,28 +559,31 @@ module Aws::SQS
500
559
  # the two messages are treated as duplicates and only one copy of the
501
560
  # message is delivered.
502
561
  #
503
- # <note markdown="1"> The `MessageDeduplicationId` is available to the recipient of the
562
+ # <note markdown="1"> The `MessageDeduplicationId` is available to the consumer of the
504
563
  # message (this can be useful for troubleshooting delivery issues).
505
564
  #
506
565
  # If a message is sent successfully but the acknowledgement is lost and
507
566
  # the message is resent with the same `MessageDeduplicationId` after the
508
567
  # deduplication interval, Amazon SQS can't detect duplicate messages.
509
568
  #
569
+ # Amazon SQS continues to keep track of the message deduplication ID
570
+ # even after the message is received and deleted.
571
+ #
510
572
  # </note>
511
573
  #
512
- # The length of `MessageDeduplicationId` is 128 characters.
574
+ # The maximum length of `MessageDeduplicationId` is 128 characters.
513
575
  # `MessageDeduplicationId` can contain alphanumeric characters (`a-z`,
514
576
  # `A-Z`, `0-9`) and punctuation (`` !"#$%&'()*+,-./:;<=>?@[\]^_`\{|\}~
515
577
  # ``).
516
578
  #
517
579
  # For best practices of using `MessageDeduplicationId`, see [Using the
518
- # MessageDeduplicationId Property][2] in the *Amazon Simple Queue
519
- # Service Developer Guide*.
580
+ # MessageDeduplicationId Property][2] in the *Amazon SQS Developer
581
+ # Guide*.
520
582
  #
521
583
  #
522
584
  #
523
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing
524
- # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queue-recommendations.html#using-messagededuplicationid-property
585
+ # [1]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-exactly-once-processing.html
586
+ # [2]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-messagededuplicationid-property.html
525
587
  # @option options [String] :message_group_id
526
588
  # This parameter applies only to FIFO (first-in-first-out) queues.
527
589
  #
@@ -530,7 +592,7 @@ module Aws::SQS
530
592
  # a FIFO manner (however, messages in different message groups might be
531
593
  # processed out of order). To interleave multiple ordered streams within
532
594
  # a single queue, use `MessageGroupId` values (for example, session data
533
- # for multiple users). In this scenario, multiple readers can process
595
+ # for multiple users). In this scenario, multiple consumers can process
534
596
  # the queue, but the session data of each user is processed in a FIFO
535
597
  # fashion.
536
598
  #
@@ -541,24 +603,25 @@ module Aws::SQS
541
603
  # `MessageGroupId` values. For each `MessageGroupId`, the messages are
542
604
  # sorted by time sent. The caller can't specify a `MessageGroupId`.
543
605
  #
544
- # The length of `MessageGroupId` is 128 characters. Valid values are
545
- # alphanumeric characters and punctuation ``
606
+ # The maximum length of `MessageGroupId` is 128 characters. Valid
607
+ # values: alphanumeric characters and punctuation ``
546
608
  # (!"#$%&'()*+,-./:;<=>?@[\]^_`\{|\}~) ``.
547
609
  #
548
610
  # For best practices of using `MessageGroupId`, see [Using the
549
- # MessageGroupId Property][1] in the *Amazon Simple Queue Service
550
- # Developer Guide*.
611
+ # MessageGroupId Property][1] in the *Amazon SQS Developer Guide*.
551
612
  #
552
613
  # `MessageGroupId` is required for FIFO queues. You can't use it for
553
614
  # Standard queues.
554
615
  #
555
616
  #
556
617
  #
557
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queue-recommendations.html#using-messagegroupid-property
618
+ # [1]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-messagegroupid-property.html
558
619
  # @return [Types::SendMessageResult]
559
620
  def send_message(options = {})
560
621
  options = options.merge(queue_url: @url)
561
- resp = @client.send_message(options)
622
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
623
+ @client.send_message(options)
624
+ end
562
625
  resp.data
563
626
  end
564
627
 
@@ -579,6 +642,15 @@ module Aws::SQS
579
642
  # data_type: "String", # required
580
643
  # },
581
644
  # },
645
+ # message_system_attributes: {
646
+ # "AWSTraceHeader" => {
647
+ # string_value: "String",
648
+ # binary_value: "data",
649
+ # string_list_values: ["String"],
650
+ # binary_list_values: ["data"],
651
+ # data_type: "String", # required
652
+ # },
653
+ # },
582
654
  # message_deduplication_id: "String",
583
655
  # message_group_id: "String",
584
656
  # },
@@ -590,7 +662,9 @@ module Aws::SQS
590
662
  # @return [Types::SendMessageBatchResult]
591
663
  def send_messages(options = {})
592
664
  options = options.merge(queue_url: @url)
593
- resp = @client.send_message_batch(options)
665
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
666
+ @client.send_message_batch(options)
667
+ end
594
668
  resp.data
595
669
  end
596
670
 
@@ -608,78 +682,119 @@ module Aws::SQS
608
682
  # The following lists the names, descriptions, and values of the special
609
683
  # request parameters that the `SetQueueAttributes` action uses:
610
684
  #
611
- # * `DelaySeconds` - The length of time, in seconds, for which the
685
+ # * `DelaySeconds` The length of time, in seconds, for which the
612
686
  # delivery of all messages in the queue is delayed. Valid values: An
613
- # integer from 0 to 900 (15 minutes). The default is 0 (zero).
687
+ # integer from 0 to 900 (15 minutes). Default: 0.
614
688
  #
615
- # * `MaximumMessageSize` - The limit of how many bytes a message can
689
+ # * `MaximumMessageSize` The limit of how many bytes a message can
616
690
  # contain before Amazon SQS rejects it. Valid values: An integer from
617
- # 1,024 bytes (1 KiB) up to 262,144 bytes (256 KiB). The default is
618
- # 262,144 (256 KiB).
691
+ # 1,024 bytes (1 KiB) up to 262,144 bytes (256 KiB). Default: 262,144
692
+ # (256 KiB).
619
693
  #
620
- # * `MessageRetentionPeriod` - The length of time, in seconds, for which
694
+ # * `MessageRetentionPeriod` The length of time, in seconds, for which
621
695
  # Amazon SQS retains a message. Valid values: An integer representing
622
- # seconds, from 60 (1 minute) to 1,209,600 (14 days). The default is
623
- # 345,600 (4 days).
696
+ # seconds, from 60 (1 minute) to 1,209,600 (14 days). Default: 345,600
697
+ # (4 days). When you change a queue's attributes, the change can take
698
+ # up to 60 seconds for most of the attributes to propagate throughout
699
+ # the Amazon SQS system. Changes made to the `MessageRetentionPeriod`
700
+ # attribute can take up to 15 minutes and will impact existing
701
+ # messages in the queue potentially causing them to be expired and
702
+ # deleted if the `MessageRetentionPeriod` is reduced below the age of
703
+ # existing messages.
704
+ #
705
+ # * `Policy` – The queue's policy. A valid Amazon Web Services policy.
706
+ # For more information about policy structure, see [Overview of Amazon
707
+ # Web Services IAM Policies][1] in the *Identity and Access Management
708
+ # User Guide*.
709
+ #
710
+ # * `ReceiveMessageWaitTimeSeconds` – The length of time, in seconds,
711
+ # for which a ` ReceiveMessage ` action waits for a message to arrive.
712
+ # Valid values: An integer from 0 to 20 (seconds). Default: 0.
624
713
  #
625
- # * `Policy` - The queue's policy. A valid AWS policy. For more
626
- # information about policy structure, see [Overview of AWS IAM
627
- # Policies][1] in the *Amazon IAM User Guide*.
714
+ # * `VisibilityTimeout` The visibility timeout for the queue, in
715
+ # seconds. Valid values: An integer from 0 to 43,200 (12 hours).
716
+ # Default: 30. For more information about the visibility timeout, see
717
+ # [Visibility Timeout][2] in the *Amazon SQS Developer Guide*.
628
718
  #
629
- # * `ReceiveMessageWaitTimeSeconds` - The length of time, in seconds,
630
- # for which a ` ReceiveMessage ` action waits for a message to arrive.
631
- # Valid values: an integer from 0 to 20 (seconds). The default is 0.
719
+ # The following attributes apply only to [dead-letter queues:][3]
632
720
  #
633
- # * `RedrivePolicy` - The string that includes the parameters for the
634
- # dead-letter queue functionality of the source queue. For more
635
- # information about the redrive policy and dead-letter queues, see
636
- # [Using Amazon SQS Dead-Letter Queues][2] in the *Amazon Simple Queue
637
- # Service Developer Guide*.
721
+ # * `RedrivePolicy` The string that includes the parameters for the
722
+ # dead-letter queue functionality of the source queue as a JSON
723
+ # object. The parameters are as follows:
638
724
  #
639
- # * `deadLetterTargetArn` - The Amazon Resource Name (ARN) of the
725
+ # * `deadLetterTargetArn` The Amazon Resource Name (ARN) of the
640
726
  # dead-letter queue to which Amazon SQS moves messages after the
641
727
  # value of `maxReceiveCount` is exceeded.
642
728
  #
643
- # * `maxReceiveCount` - The number of times a message is delivered to
729
+ # * `maxReceiveCount` The number of times a message is delivered to
644
730
  # the source queue before being moved to the dead-letter queue.
731
+ # Default: 10. When the `ReceiveCount` for a message exceeds the
732
+ # `maxReceiveCount` for a queue, Amazon SQS moves the message to the
733
+ # dead-letter-queue.
734
+ #
735
+ # * `RedriveAllowPolicy` – The string that includes the parameters for
736
+ # the permissions for the dead-letter queue redrive permission and
737
+ # which source queues can specify dead-letter queues as a JSON object.
738
+ # The parameters are as follows:
739
+ #
740
+ # * `redrivePermission` – The permission type that defines which
741
+ # source queues can specify the current queue as the dead-letter
742
+ # queue. Valid values are:
645
743
  #
646
- # <note markdown="1"> The dead-letter queue of a FIFO queue must also be a FIFO queue.
647
- # Similarly, the dead-letter queue of a standard queue must also be a
648
- # standard queue.
744
+ # * `allowAll` (Default) Any source queues in this Amazon Web
745
+ # Services account in the same Region can specify this queue as
746
+ # the dead-letter queue.
649
747
  #
650
- # </note>
748
+ # * `denyAll` – No source queues can specify this queue as the
749
+ # dead-letter queue.
651
750
  #
652
- # * `VisibilityTimeout` - The visibility timeout for the queue. Valid
653
- # values: an integer from 0 to 43,200 (12 hours). The default is 30.
654
- # For more information about the visibility timeout, see [Visibility
655
- # Timeout][3] in the *Amazon Simple Queue Service Developer Guide*.
751
+ # * `byQueue` Only queues specified by the `sourceQueueArns`
752
+ # parameter can specify this queue as the dead-letter queue.
656
753
  #
657
- # The following attributes apply only to [server-side-encryption][4]\:
754
+ # * `sourceQueueArns` – The Amazon Resource Names (ARN)s of the source
755
+ # queues that can specify this queue as the dead-letter queue and
756
+ # redrive messages. You can specify this parameter only when the
757
+ # `redrivePermission` parameter is set to `byQueue`. You can specify
758
+ # up to 10 source queue ARNs. To allow more than 10 source queues to
759
+ # specify dead-letter queues, set the `redrivePermission` parameter
760
+ # to `allowAll`.
658
761
  #
659
- # * `KmsMasterKeyId` - The ID of an AWS-managed customer master key
660
- # (CMK) for Amazon SQS or a custom CMK. For more information, see [Key
661
- # Terms][5]. While the alias of the AWS-managed CMK for Amazon SQS is
662
- # always `alias/aws/sqs`, the alias of a custom CMK can, for example,
663
- # be `alias/MyAlias `. For more examples, see [KeyId][6] in the *AWS
664
- # Key Management Service API Reference*.
762
+ # <note markdown="1"> The dead-letter queue of a FIFO queue must also be a FIFO queue.
763
+ # Similarly, the dead-letter queue of a standard queue must also be a
764
+ # standard queue.
665
765
  #
666
- # * `KmsDataKeyReusePeriodSeconds` - The length of time, in seconds, for
766
+ # </note>
767
+ #
768
+ # The following attributes apply only to [server-side-encryption][4]:
769
+ #
770
+ # * `KmsMasterKeyId` – The ID of an Amazon Web Services managed customer
771
+ # master key (CMK) for Amazon SQS or a custom CMK. For more
772
+ # information, see [Key Terms][5]. While the alias of the AWS-managed
773
+ # CMK for Amazon SQS is always `alias/aws/sqs`, the alias of a custom
774
+ # CMK can, for example, be `alias/MyAlias `. For more examples, see
775
+ # [KeyId][6] in the *Key Management Service API Reference*.
776
+ #
777
+ # * `KmsDataKeyReusePeriodSeconds` – The length of time, in seconds, for
667
778
  # which Amazon SQS can reuse a [data key][7] to encrypt or decrypt
668
- # messages before calling AWS KMS again. An integer representing
669
- # seconds, between 60 seconds (1 minute) and 86,400 seconds (24
670
- # hours). The default is 300 (5 minutes). A shorter time period
671
- # provides better security but results in more calls to KMS which
672
- # might incur charges after Free Tier. For more information, see [How
673
- # Does the Data Key Reuse Period Work?][8].
779
+ # messages before calling KMS again. An integer representing seconds,
780
+ # between 60 seconds (1 minute) and 86,400 seconds (24 hours).
781
+ # Default: 300 (5 minutes). A shorter time period provides better
782
+ # security but results in more calls to KMS which might incur charges
783
+ # after Free Tier. For more information, see [How Does the Data Key
784
+ # Reuse Period Work?][8].
785
+ #
786
+ # * `SqsManagedSseEnabled` – Enables server-side queue encryption using
787
+ # SQS owned encryption keys. Only one server-side encryption option is
788
+ # supported per queue (for example, [SSE-KMS][9] or [SSE-SQS][10]).
674
789
  #
675
790
  # The following attribute applies only to [FIFO (first-in-first-out)
676
- # queues][9]\:
791
+ # queues][11]:
677
792
  #
678
- # * `ContentBasedDeduplication` - Enables content-based deduplication.
679
- # For more information, see [Exactly-Once Processing][10] in the
680
- # *Amazon Simple Queue Service Developer Guide*.
793
+ # * `ContentBasedDeduplication` Enables content-based deduplication.
794
+ # For more information, see [Exactly-once processing][12] in the
795
+ # *Amazon SQS Developer Guide*. Note the following:
681
796
  #
682
- # * Every message must have a unique `MessageDeduplicationId`,
797
+ # * Every message must have a unique `MessageDeduplicationId`.
683
798
  #
684
799
  # * You may provide a `MessageDeduplicationId` explicitly.
685
800
  #
@@ -707,37 +822,54 @@ module Aws::SQS
707
822
  # `MessageDeduplicationId`, the two messages are treated as
708
823
  # duplicates and only one copy of the message is delivered.
709
824
  #
710
- # Any other valid special request parameters (such as the following) are
711
- # ignored:
825
+ # The following attributes apply only to [high throughput for FIFO
826
+ # queues][13]:
827
+ #
828
+ # * `DeduplicationScope` – Specifies whether message deduplication
829
+ # occurs at the message group or queue level. Valid values are
830
+ # `messageGroup` and `queue`.
712
831
  #
713
- # * `ApproximateNumberOfMessages`
832
+ # * `FifoThroughputLimit` – Specifies whether the FIFO queue throughput
833
+ # quota applies to the entire queue or per message group. Valid values
834
+ # are `perQueue` and `perMessageGroupId`. The `perMessageGroupId`
835
+ # value is allowed only when the value for `DeduplicationScope` is
836
+ # `messageGroup`.
714
837
  #
715
- # * `ApproximateNumberOfMessagesDelayed`
838
+ # To enable high throughput for FIFO queues, do the following:
716
839
  #
717
- # * `ApproximateNumberOfMessagesNotVisible`
840
+ # * Set `DeduplicationScope` to `messageGroup`.
718
841
  #
719
- # * `CreatedTimestamp`
842
+ # * Set `FifoThroughputLimit` to `perMessageGroupId`.
720
843
  #
721
- # * `LastModifiedTimestamp`
844
+ # If you set these attributes to anything other than the values shown
845
+ # for enabling high throughput, normal throughput is in effect and
846
+ # deduplication occurs as specified.
722
847
  #
723
- # * `QueueArn`
848
+ # For information on throughput quotas, see [Quotas related to
849
+ # messages][14] in the *Amazon SQS Developer Guide*.
724
850
  #
725
851
  #
726
852
  #
727
- # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html
728
- # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
729
- # [3]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
730
- # [4]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html
731
- # [5]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-sse-key-terms
732
- # [6]: http://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html#API_DescribeKey_RequestParameters
733
- # [7]: http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#data-keys
734
- # [8]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-how-does-the-data-key-reuse-period-work
735
- # [9]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html
736
- # [10]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing
853
+ # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html
854
+ # [2]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
855
+ # [3]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
856
+ # [4]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html
857
+ # [5]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-sse-key-terms
858
+ # [6]: https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html#API_DescribeKey_RequestParameters
859
+ # [7]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#data-keys
860
+ # [8]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-how-does-the-data-key-reuse-period-work
861
+ # [9]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sse-existing-queue.html
862
+ # [10]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sqs-sse-queue.html
863
+ # [11]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html
864
+ # [12]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-exactly-once-processing.html
865
+ # [13]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/high-throughput-fifo.html
866
+ # [14]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/quotas-messages.html
737
867
  # @return [EmptyStructure]
738
868
  def set_attributes(options = {})
739
869
  options = options.merge(queue_url: @url)
740
- resp = @client.set_queue_attributes(options)
870
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
871
+ @client.set_queue_attributes(options)
872
+ end
741
873
  resp.data
742
874
  end
743
875
 
@@ -750,16 +882,20 @@ module Aws::SQS
750
882
  # @return [Queue::Collection]
751
883
  def dead_letter_source_queues(options = {})
752
884
  batches = Enumerator.new do |y|
753
- batch = []
754
885
  options = options.merge(queue_url: @url)
755
- resp = @client.list_dead_letter_source_queues(options)
756
- resp.data.queue_urls.each do |q|
757
- batch << Queue.new(
758
- url: q,
759
- client: @client
760
- )
886
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
887
+ @client.list_dead_letter_source_queues(options)
888
+ end
889
+ resp.each_page do |page|
890
+ batch = []
891
+ page.data.queue_urls.each do |q|
892
+ batch << Queue.new(
893
+ url: q,
894
+ client: @client
895
+ )
896
+ end
897
+ y.yield(batch)
761
898
  end
762
- y.yield(batch)
763
899
  end
764
900
  Queue::Collection.new(batches)
765
901
  end