aws-sdk-sqs 1.0.0.rc2 → 1.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
@@ -71,7 +71,7 @@ module Aws
71
71
  returned_md5 = response.md5_of_message_attributes
72
72
  if returned_md5 != calculated_md5
73
73
  error_message = mismatch_error_message(
74
- 'message atributes',
74
+ 'message attributes',
75
75
  calculated_md5,
76
76
  returned_md5,
77
77
  response)
@@ -1,724 +1,778 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
3
+ # This file is generated. See the contributing guide for more information:
4
4
  # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
5
  #
6
6
  # WARNING ABOUT GENERATED CODE
7
7
 
8
- module Aws
9
- module SQS
10
- class Queue
8
+ module Aws::SQS
9
+ class Queue
11
10
 
12
- extend Aws::Deprecations
11
+ extend Aws::Deprecations
13
12
 
14
- # @overload def initialize(url, options = {})
15
- # @param [String] url
16
- # @option options [Client] :client
17
- # @overload def initialize(options = {})
18
- # @option options [required, String] :url
19
- # @option options [Client] :client
20
- def initialize(*args)
21
- options = Hash === args.last ? args.pop.dup : {}
22
- @url = extract_url(args, options)
23
- @data = options.delete(:data)
24
- @client = options.delete(:client) || Client.new(options)
25
- end
13
+ # @overload def initialize(url, options = {})
14
+ # @param [String] url
15
+ # @option options [Client] :client
16
+ # @overload def initialize(options = {})
17
+ # @option options [required, String] :url
18
+ # @option options [Client] :client
19
+ def initialize(*args)
20
+ options = Hash === args.last ? args.pop.dup : {}
21
+ @url = extract_url(args, options)
22
+ @data = options.delete(:data)
23
+ @client = options.delete(:client) || Client.new(options)
24
+ end
26
25
 
27
- # @!group Read-Only Attributes
26
+ # @!group Read-Only Attributes
28
27
 
29
- # @return [String]
30
- def url
31
- @url
32
- end
28
+ # @return [String]
29
+ def url
30
+ @url
31
+ end
33
32
 
34
- # A map of attributes to the respective values.
35
- # @return [Hash<String,String>]
36
- def attributes
37
- data.attributes
38
- end
33
+ # A map of attributes to their respective values.
34
+ # @return [Hash<String,String>]
35
+ def attributes
36
+ data.attributes
37
+ end
39
38
 
40
- # @!endgroup
39
+ # @!endgroup
41
40
 
42
- # @return [Client]
43
- def client
44
- @client
45
- end
41
+ # @return [Client]
42
+ def client
43
+ @client
44
+ end
46
45
 
47
- # Loads, or reloads {#data} for the current {Queue}.
48
- # Returns `self` making it possible to chain methods.
49
- #
50
- # queue.reload.data
51
- #
52
- # @return [self]
53
- def load
54
- resp = @client.get_queue_attributes(
55
- queue_url: @url,
56
- attribute_names: ["All"]
57
- )
58
- @data = resp.data
59
- self
60
- end
61
- alias :reload :load
46
+ # Loads, or reloads {#data} for the current {Queue}.
47
+ # Returns `self` making it possible to chain methods.
48
+ #
49
+ # queue.reload.data
50
+ #
51
+ # @return [self]
52
+ def load
53
+ resp = @client.get_queue_attributes(
54
+ queue_url: @url,
55
+ attribute_names: ["All"]
56
+ )
57
+ @data = resp.data
58
+ self
59
+ end
60
+ alias :reload :load
62
61
 
63
- # @return [Types::GetQueueAttributesResult]
64
- # Returns the data for this {Queue}. Calls
65
- # {Client#get_queue_attributes} if {#data_loaded?} is `false`.
66
- def data
67
- load unless @data
68
- @data
69
- end
62
+ # @return [Types::GetQueueAttributesResult]
63
+ # Returns the data for this {Queue}. Calls
64
+ # {Client#get_queue_attributes} if {#data_loaded?} is `false`.
65
+ def data
66
+ load unless @data
67
+ @data
68
+ end
70
69
 
71
- # @return [Boolean]
72
- # Returns `true` if this resource is loaded. Accessing attributes or
73
- # {#data} on an unloaded resource will trigger a call to {#load}.
74
- def data_loaded?
75
- !!@data
76
- end
70
+ # @return [Boolean]
71
+ # Returns `true` if this resource is loaded. Accessing attributes or
72
+ # {#data} on an unloaded resource will trigger a call to {#load}.
73
+ def data_loaded?
74
+ !!@data
75
+ end
77
76
 
78
- # @!group Actions
77
+ # @!group Actions
79
78
 
80
- # @example Request syntax with placeholder values
81
- #
82
- # queue.add_permission({
83
- # label: "String", # required
84
- # aws_account_ids: ["String"], # required
85
- # actions: ["String"], # required
86
- # })
87
- # @param [Hash] options ({})
88
- # @option options [required, String] :label
89
- # The unique identification of the permission you're setting (e.g.,
90
- # `AliceSendMessage`). Constraints: Maximum 80 characters; alphanumeric
91
- # characters, hyphens (-), and underscores (\_) are allowed.
92
- # @option options [required, Array<String>] :aws_account_ids
93
- # The AWS account number of the [principal][1] who will be given
94
- # permission. The principal must have an AWS account, but does not need
95
- # to be signed up for Amazon SQS. For information about locating the AWS
96
- # account identification, see [Your AWS Identifiers][2] in the *Amazon
97
- # SQS Developer Guide*.
98
- #
99
- #
100
- #
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
103
- # @option options [required, Array<String>] :actions
104
- # The action the client wants to allow for the specified principal. The
105
- # following are valid values: `* | SendMessage | ReceiveMessage |
106
- # DeleteMessage | ChangeMessageVisibility | GetQueueAttributes |
107
- # GetQueueUrl`. For more information about these actions, see
108
- # [Understanding Permissions][1] in the *Amazon SQS Developer Guide*.
109
- #
110
- # Specifying `SendMessage`, `DeleteMessage`, or
111
- # `ChangeMessageVisibility` for the `ActionName.n` also grants
112
- # permissions for the corresponding batch versions of those actions:
113
- # `SendMessageBatch`, `DeleteMessageBatch`, and
114
- # `ChangeMessageVisibilityBatch`.
115
- #
116
- #
117
- #
118
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/acp-overview.html#PermissionTypes
119
- # @return [EmptyStructure]
120
- def add_permission(options = {})
121
- options = options.merge(queue_url: @url)
122
- resp = @client.add_permission(options)
123
- resp.data
124
- end
79
+ # @example Request syntax with placeholder values
80
+ #
81
+ # queue.add_permission({
82
+ # label: "String", # required
83
+ # aws_account_ids: ["String"], # required
84
+ # actions: ["String"], # required
85
+ # })
86
+ # @param [Hash] options ({})
87
+ # @option options [required, String] :label
88
+ # The unique identification of the permission you're setting (for
89
+ # example, `AliceSendMessage`). Maximum 80 characters. Allowed
90
+ # characters include alphanumeric characters, hyphens (`-`), and
91
+ # underscores (`_`).
92
+ # @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 SQS
97
+ # Developer Guide*.
98
+ #
99
+ #
100
+ #
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
103
+ # @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`
118
+ #
119
+ # * `SendMessage`
120
+ #
121
+ # For more information about these actions, see [Understanding
122
+ # Permissions][1] in the *Amazon SQS Developer Guide*.
123
+ #
124
+ # Specifying `SendMessage`, `DeleteMessage`, or
125
+ # `ChangeMessageVisibility` for `ActionName.n` also grants permissions
126
+ # for the corresponding batch versions of those actions:
127
+ # `SendMessageBatch`, `DeleteMessageBatch`, and
128
+ # `ChangeMessageVisibilityBatch`.
129
+ #
130
+ #
131
+ #
132
+ # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/acp-overview.html#PermissionTypes
133
+ # @return [EmptyStructure]
134
+ def add_permission(options = {})
135
+ options = options.merge(queue_url: @url)
136
+ resp = @client.add_permission(options)
137
+ resp.data
138
+ end
125
139
 
126
- # @example Request syntax with placeholder values
127
- #
128
- # queue.change_message_visibility_batch({
129
- # entries: [ # required
130
- # {
131
- # id: "String", # required
132
- # receipt_handle: "String", # required
133
- # visibility_timeout: 1,
134
- # },
135
- # ],
136
- # })
137
- # @param [Hash] options ({})
138
- # @option options [required, Array<Types::ChangeMessageVisibilityBatchRequestEntry>] :entries
139
- # A list of receipt handles of the messages for which the visibility
140
- # timeout must be changed.
141
- # @return [Types::ChangeMessageVisibilityBatchResult]
142
- def change_message_visibility_batch(options = {})
143
- options = options.merge(queue_url: @url)
144
- resp = @client.change_message_visibility_batch(options)
145
- resp.data
146
- end
140
+ # @example Request syntax with placeholder values
141
+ #
142
+ # queue.change_message_visibility_batch({
143
+ # entries: [ # required
144
+ # {
145
+ # id: "String", # required
146
+ # receipt_handle: "String", # required
147
+ # visibility_timeout: 1,
148
+ # },
149
+ # ],
150
+ # })
151
+ # @param [Hash] options ({})
152
+ # @option options [required, Array<Types::ChangeMessageVisibilityBatchRequestEntry>] :entries
153
+ # A list of receipt handles of the messages for which the visibility
154
+ # timeout must be changed.
155
+ # @return [Types::ChangeMessageVisibilityBatchResult]
156
+ def change_message_visibility_batch(options = {})
157
+ options = options.merge(queue_url: @url)
158
+ resp = @client.change_message_visibility_batch(options)
159
+ resp.data
160
+ end
147
161
 
148
- # @example Request syntax with placeholder values
149
- #
150
- # queue.delete()
151
- # @param [Hash] options ({})
152
- # @return [EmptyStructure]
153
- def delete(options = {})
154
- options = options.merge(queue_url: @url)
155
- resp = @client.delete_queue(options)
156
- resp.data
157
- end
162
+ # @example Request syntax with placeholder values
163
+ #
164
+ # queue.delete()
165
+ # @param [Hash] options ({})
166
+ # @return [EmptyStructure]
167
+ def delete(options = {})
168
+ options = options.merge(queue_url: @url)
169
+ resp = @client.delete_queue(options)
170
+ resp.data
171
+ end
158
172
 
159
- # @example Request syntax with placeholder values
160
- #
161
- # queue.delete_messages({
162
- # entries: [ # required
163
- # {
164
- # id: "String", # required
165
- # receipt_handle: "String", # required
166
- # },
167
- # ],
168
- # })
169
- # @param [Hash] options ({})
170
- # @option options [required, Array<Types::DeleteMessageBatchRequestEntry>] :entries
171
- # A list of receipt handles for the messages to be deleted.
172
- # @return [Types::DeleteMessageBatchResult]
173
- def delete_messages(options = {})
174
- options = options.merge(queue_url: @url)
175
- resp = @client.delete_message_batch(options)
176
- resp.data
177
- end
173
+ # @example Request syntax with placeholder values
174
+ #
175
+ # queue.delete_messages({
176
+ # entries: [ # required
177
+ # {
178
+ # id: "String", # required
179
+ # receipt_handle: "String", # required
180
+ # },
181
+ # ],
182
+ # })
183
+ # @param [Hash] options ({})
184
+ # @option options [required, Array<Types::DeleteMessageBatchRequestEntry>] :entries
185
+ # A list of receipt handles for the messages to be deleted.
186
+ # @return [Types::DeleteMessageBatchResult]
187
+ def delete_messages(options = {})
188
+ options = options.merge(queue_url: @url)
189
+ resp = @client.delete_message_batch(options)
190
+ resp.data
191
+ end
178
192
 
179
- # @example Request syntax with placeholder values
180
- #
181
- # queue.purge()
182
- # @param [Hash] options ({})
183
- # @return [EmptyStructure]
184
- def purge(options = {})
185
- options = options.merge(queue_url: @url)
186
- resp = @client.purge_queue(options)
187
- resp.data
188
- end
193
+ # @example Request syntax with placeholder values
194
+ #
195
+ # queue.purge()
196
+ # @param [Hash] options ({})
197
+ # @return [EmptyStructure]
198
+ def purge(options = {})
199
+ options = options.merge(queue_url: @url)
200
+ resp = @client.purge_queue(options)
201
+ resp.data
202
+ end
189
203
 
190
- # @example Request syntax with placeholder values
191
- #
192
- # message = queue.receive_messages({
193
- # attribute_names: ["All"], # accepts All, Policy, VisibilityTimeout, MaximumMessageSize, MessageRetentionPeriod, ApproximateNumberOfMessages, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, LastModifiedTimestamp, QueueArn, ApproximateNumberOfMessagesDelayed, DelaySeconds, ReceiveMessageWaitTimeSeconds, RedrivePolicy, FifoQueue, ContentBasedDeduplication
194
- # message_attribute_names: ["MessageAttributeName"],
195
- # max_number_of_messages: 1,
196
- # visibility_timeout: 1,
197
- # wait_time_seconds: 1,
198
- # receive_request_attempt_id: "String",
199
- # })
200
- # @param [Hash] options ({})
201
- # @option options [Array<String>] :attribute_names
202
- # A list of attributes that need to be returned along with each message.
203
- # These attributes include:
204
- #
205
- # * `All` - Returns all values.
206
- #
207
- # * `ApproximateFirstReceiveTimestamp` - Returns the time the message
208
- # was first received from the queue (epoch time in milliseconds).
209
- #
210
- # * `ApproximateReceiveCount` - Returns the number of times a message
211
- # has been received from the queue but not deleted.
212
- #
213
- # * `SenderId`
214
- #
215
- # * For an IAM user, returns the IAM user ID, for example
216
- # `ABCDEFGHI1JKLMNOPQ23R`.
217
- #
218
- # * For an IAM role, returns the IAM role ID, for example
219
- # `ABCDE1F2GH3I4JK5LMNOP:i-a123b456`.
220
- #
221
- # * `SentTimestamp` - Returns the time the message was sent to the queue
222
- # (epoch time in milliseconds).
223
- #
224
- # * `MessageDeduplicationId` - Returns the value provided by the sender
225
- # that calls the ` SendMessage ` action.
226
- #
227
- # * `MessageGroupId` - Returns the value provided by the sender that
228
- # calls the ` SendMessage ` action. Messages with the same
229
- # `MessageGroupId` are returned in sequence.
230
- #
231
- # * `SequenceNumber` - Returns the value provided by Amazon SQS.
232
- #
233
- # Any other valid special request parameters (such as the following)
234
- # that are specified are ignored:
235
- #
236
- # * `ApproximateNumberOfMessages`
237
- #
238
- # * `ApproximateNumberOfMessagesDelayed`
239
- #
240
- # * `ApproximateNumberOfMessagesNotVisible`
241
- #
242
- # * `CreatedTimestamp`
243
- #
244
- # * `ContentBasedDeduplication`
245
- #
246
- # * `DelaySeconds`
247
- #
248
- # * `LastModifiedTimestamp`
249
- #
250
- # * `MaximumMessageSize`
251
- #
252
- # * `MessageRetentionPeriod`
253
- #
254
- # * `Policy`
255
- #
256
- # * `QueueArn`,
257
- #
258
- # * `ReceiveMessageWaitTimeSeconds`
259
- #
260
- # * `RedrivePolicy`
261
- #
262
- # * `FifoQueue`
263
- #
264
- # * `VisibilityTimeout`
265
- # @option options [Array<String>] :message_attribute_names
266
- # The name of the message attribute, where *N* is the index. The message
267
- # attribute name can contain the following characters: A-Z, a-z, 0-9,
268
- # underscore (\_), hyphen (-), and period (.). The name must not start
269
- # or end with a period, and it should not have successive periods. The
270
- # name is case sensitive and must be unique among all attribute names
271
- # for the message. The name can be up to 256 characters long. The name
272
- # can't start with "AWS." or "Amazon." (or any variations in
273
- # casing), because these prefixes are reserved for use by Amazon Web
274
- # Services.
275
- #
276
- # When using `ReceiveMessage`, you can send a list of attribute names to
277
- # receive, or you can return all of the attributes by specifying "All"
278
- # or ".*" in your request. You can also use "bar.*" to return all
279
- # message attributes starting with the "bar" prefix.
280
- # @option options [Integer] :max_number_of_messages
281
- # The maximum number of messages to return. Amazon SQS never returns
282
- # more messages than this value but might return fewer. Values can be
283
- # from 1 to 10. Default is 1.
284
- #
285
- # All of the messages are not necessarily returned.
286
- # @option options [Integer] :visibility_timeout
287
- # The duration (in seconds) that the received messages are hidden from
288
- # subsequent retrieve requests after being retrieved by a
289
- # `ReceiveMessage` request.
290
- # @option options [Integer] :wait_time_seconds
291
- # The duration (in seconds) for which the call will wait for a message
292
- # to arrive in the queue before returning. If a message is available,
293
- # the call will return sooner than WaitTimeSeconds.
294
- # @option options [String] :receive_request_attempt_id
295
- # This parameter applies only to FIFO (first-in-first-out) queues.
296
- #
297
- # The token used for deduplication of `ReceiveMessage` calls. If a
298
- # networking issue occurs after a `ReceiveMessage` action, and instead
299
- # of a response you receive a generic error, you can retry the same
300
- # action with an identical `ReceiveRequestAttemptId` to retrieve the
301
- # same set of messages, even if their visibility timeout has not yet
302
- # expired.
303
- #
304
- # * You can use `ReceiveRequestAttemptId` only for 5 minutes after a
305
- # `ReceiveMessage` action.
306
- #
307
- # * When you set `FifoQueue`, a caller of the `ReceiveMessage` action
308
- # can provide a `ReceiveRequestAttemptId` explicitly.
309
- #
310
- # * If a caller of the `ReceiveMessage` action doesn't provide a
311
- # `ReceiveRequestAttemptId`, Amazon SQS generates a
312
- # `ReceiveRequestAttemptId`.
313
- #
314
- # * You can retry the `ReceiveMessage` action with the same
315
- # `ReceiveRequestAttemptId` if none of the messages have been modified
316
- # (deleted or had their visibility changes).
317
- #
318
- # * During a visibility timeout, subsequent calls with the same
319
- # `ReceiveRequestAttemptId` return the same messages and receipt
320
- # handles. If a retry occurs within the deduplication interval, it
321
- # resets the visibility timeout. For more information, see [Visibility
322
- # Timeout][1] in the *Amazon Simple Queue Service Developer Guide*.
323
- #
324
- # If a caller of the `ReceiveMessage` action is still processing
325
- # messages when the visibility timeout expires and messages become
326
- # visible, another worker reading from the same queue can receive the
327
- # same messages and therefore process duplicates. Also, if a reader
328
- # whose message processing time is longer than the visibility timeout
329
- # tries to delete the processed messages, the action fails with an
330
- # error.
331
- #
332
- # To mitigate this effect, ensure that your application observes a
333
- # safe threshold before the visibility timeout expires and extend the
334
- # visibility timeout as necessary.
335
- #
336
- # * While messages with a particular `MessageGroupId` are invisible, no
337
- # more messages belonging to the same `MessageGroupId` are returned
338
- # until the visibility timeout expires. You can still receive messages
339
- # with another `MessageGroupId` as long as it is also visible.
340
- #
341
- # * If a caller of `ReceiveMessage` can't track the
342
- # `ReceiveRequestAttemptId`, no retries will work until the original
343
- # visibility timeout expires. As a result, delays might occur but the
344
- # messages in the queue will remain in a strict order.
345
- #
346
- # The length of `ReceiveRequestAttemptId` is 128 characters.
347
- # `ReceiveRequestAttemptId` can contain alphanumeric characters (`a-z`,
348
- # `A-Z`, `0-9`) and punctuation (`` !"#$%&'()*+,-./:;<=>?@[\]^_`\{|\}~
349
- # ``).
350
- #
351
- # For best practices of using `ReceiveRequestAttemptId`, see [Using the
352
- # ReceiveRequestAttemptId Request Parameter][2] in the *Amazon Simple
353
- # Queue Service Developer Guide*.
354
- #
355
- #
356
- #
357
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
358
- # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queue-recommendations.html#using-receiverequestattemptid-request-parameter
359
- # @return [Message::Collection]
360
- def receive_messages(options = {})
361
- batch = []
362
- options = options.merge(queue_url: @url)
363
- resp = @client.receive_message(options)
364
- resp.data.messages.each do |m|
365
- batch << Message.new(
366
- queue_url: @url,
367
- receipt_handle: m.receipt_handle,
368
- data: m,
369
- client: @client
370
- )
371
- end
372
- Message::Collection.new([batch], size: batch.size)
204
+ # @example Request syntax with placeholder values
205
+ #
206
+ # 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
208
+ # message_attribute_names: ["MessageAttributeName"],
209
+ # max_number_of_messages: 1,
210
+ # visibility_timeout: 1,
211
+ # wait_time_seconds: 1,
212
+ # receive_request_attempt_id: "String",
213
+ # })
214
+ # @param [Hash] options ({})
215
+ # @option options [Array<String>] :attribute_names
216
+ # A list of attributes that need to be returned along with each message.
217
+ # These attributes include:
218
+ #
219
+ # * `All` - Returns all values.
220
+ #
221
+ # * `ApproximateFirstReceiveTimestamp` - Returns the time the message
222
+ # was first received from the queue ([epoch time][1] in milliseconds).
223
+ #
224
+ # * `ApproximateReceiveCount` - Returns the number of times a message
225
+ # has been received from the queue but not deleted.
226
+ #
227
+ # * `SenderId`
228
+ #
229
+ # * For an IAM user, returns the IAM user ID, for example
230
+ # `ABCDEFGHI1JKLMNOPQ23R`.
231
+ #
232
+ # * For an IAM role, returns the IAM role ID, for example
233
+ # `ABCDE1F2GH3I4JK5LMNOP:i-a123b456`.
234
+ #
235
+ # * `SentTimestamp` - Returns the time the message was sent to the queue
236
+ # ([epoch time][1] in milliseconds).
237
+ #
238
+ # * `MessageDeduplicationId` - Returns the value provided by the sender
239
+ # that calls the ` SendMessage ` action.
240
+ #
241
+ # * `MessageGroupId` - Returns the value provided by the sender that
242
+ # calls the ` SendMessage ` action. Messages with the same
243
+ # `MessageGroupId` are returned in sequence.
244
+ #
245
+ # * `SequenceNumber` - Returns the value provided by Amazon SQS.
246
+ #
247
+ # Any other valid special request parameters (such as the following) are
248
+ # ignored:
249
+ #
250
+ # * `ApproximateNumberOfMessages`
251
+ #
252
+ # * `ApproximateNumberOfMessagesDelayed`
253
+ #
254
+ # * `ApproximateNumberOfMessagesNotVisible`
255
+ #
256
+ # * `CreatedTimestamp`
257
+ #
258
+ # * `ContentBasedDeduplication`
259
+ #
260
+ # * `DelaySeconds`
261
+ #
262
+ # * `FifoQueue`
263
+ #
264
+ # * `LastModifiedTimestamp`
265
+ #
266
+ # * `MaximumMessageSize`
267
+ #
268
+ # * `MessageRetentionPeriod`
269
+ #
270
+ # * `Policy`
271
+ #
272
+ # * `QueueArn`,
273
+ #
274
+ # * `ReceiveMessageWaitTimeSeconds`
275
+ #
276
+ # * `RedrivePolicy`
277
+ #
278
+ # * `VisibilityTimeout`
279
+ #
280
+ #
281
+ #
282
+ # [1]: http://en.wikipedia.org/wiki/Unix_time
283
+ # @option options [Array<String>] :message_attribute_names
284
+ # The name of the message attribute, where *N* is the index.
285
+ #
286
+ # * The name can contain alphanumeric characters and the underscore
287
+ # (`_`), hyphen (`-`), and period (`.`).
288
+ #
289
+ # * The name is case-sensitive and must be unique among all attribute
290
+ # names for the message.
291
+ #
292
+ # * The name must not start with AWS-reserved prefixes such as `AWS.` or
293
+ # `Amazon.` (or any casing variants).
294
+ #
295
+ # * The name must not start or end with a period (`.`), and it should
296
+ # not have periods in succession (`..`).
297
+ #
298
+ # * The name can be up to 256 characters long.
299
+ #
300
+ # When using `ReceiveMessage`, you can send a list of attribute names to
301
+ # receive, or you can return all of the attributes by specifying `All`
302
+ # or `.*` in your request. You can also use all message attributes
303
+ # starting with a prefix, for example `bar.*`.
304
+ # @option options [Integer] :max_number_of_messages
305
+ # The maximum number of messages to return. Amazon SQS never returns
306
+ # more messages than this value (however, fewer messages might be
307
+ # returned). Valid values are 1 to 10. Default is 1.
308
+ # @option options [Integer] :visibility_timeout
309
+ # The duration (in seconds) that the received messages are hidden from
310
+ # subsequent retrieve requests after being retrieved by a
311
+ # `ReceiveMessage` request.
312
+ # @option options [Integer] :wait_time_seconds
313
+ # The duration (in seconds) for which the call waits for a message to
314
+ # arrive in the queue before returning. If a message is available, the
315
+ # call returns sooner than `WaitTimeSeconds`.
316
+ # @option options [String] :receive_request_attempt_id
317
+ # This parameter applies only to FIFO (first-in-first-out) queues.
318
+ #
319
+ # The token used for deduplication of `ReceiveMessage` calls. If a
320
+ # networking issue occurs after a `ReceiveMessage` action, and instead
321
+ # of a response you receive a generic error, you can retry the same
322
+ # action with an identical `ReceiveRequestAttemptId` to retrieve the
323
+ # same set of messages, even if their visibility timeout has not yet
324
+ # expired.
325
+ #
326
+ # * You can use `ReceiveRequestAttemptId` only for 5 minutes after a
327
+ # `ReceiveMessage` action.
328
+ #
329
+ # * When you set `FifoQueue`, a caller of the `ReceiveMessage` action
330
+ # can provide a `ReceiveRequestAttemptId` explicitly.
331
+ #
332
+ # * If a caller of the `ReceiveMessage` action doesn't provide a
333
+ # `ReceiveRequestAttemptId`, Amazon SQS generates a
334
+ # `ReceiveRequestAttemptId`.
335
+ #
336
+ # * You can retry the `ReceiveMessage` action with the same
337
+ # `ReceiveRequestAttemptId` if none of the messages have been modified
338
+ # (deleted or had their visibility changes).
339
+ #
340
+ # * During a visibility timeout, subsequent calls with the same
341
+ # `ReceiveRequestAttemptId` return the same messages and receipt
342
+ # handles. If a retry occurs within the deduplication interval, it
343
+ # resets the visibility timeout. For more information, see [Visibility
344
+ # Timeout][1] in the *Amazon Simple Queue Service Developer Guide*.
345
+ #
346
+ # If a caller of the `ReceiveMessage` action is still processing
347
+ # messages when the visibility timeout expires and messages become
348
+ # visible, another worker reading from the same queue can receive the
349
+ # same messages and therefore process duplicates. Also, if a reader
350
+ # whose message processing time is longer than the visibility timeout
351
+ # tries to delete the processed messages, the action fails with an
352
+ # error.
353
+ #
354
+ # To mitigate this effect, ensure that your application observes a
355
+ # safe threshold before the visibility timeout expires and extend the
356
+ # visibility timeout as necessary.
357
+ #
358
+ # * While messages with a particular `MessageGroupId` are invisible, no
359
+ # more messages belonging to the same `MessageGroupId` are returned
360
+ # until the visibility timeout expires. You can still receive messages
361
+ # with another `MessageGroupId` as long as it is also visible.
362
+ #
363
+ # * If a caller of `ReceiveMessage` can't track the
364
+ # `ReceiveRequestAttemptId`, no retries work until the original
365
+ # visibility timeout expires. As a result, delays might occur but the
366
+ # messages in the queue remain in a strict order.
367
+ #
368
+ # The length of `ReceiveRequestAttemptId` is 128 characters.
369
+ # `ReceiveRequestAttemptId` can contain alphanumeric characters (`a-z`,
370
+ # `A-Z`, `0-9`) and punctuation (`` !"#$%&'()*+,-./:;<=>?@[\]^_`\{|\}~
371
+ # ``).
372
+ #
373
+ # For best practices of using `ReceiveRequestAttemptId`, see [Using the
374
+ # ReceiveRequestAttemptId Request Parameter][2] in the *Amazon Simple
375
+ # Queue Service Developer Guide*.
376
+ #
377
+ #
378
+ #
379
+ # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
380
+ # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queue-recommendations.html#using-receiverequestattemptid-request-parameter
381
+ # @return [Message::Collection]
382
+ def receive_messages(options = {})
383
+ batch = []
384
+ options = options.merge(queue_url: @url)
385
+ resp = @client.receive_message(options)
386
+ resp.data.messages.each do |m|
387
+ batch << Message.new(
388
+ queue_url: @url,
389
+ receipt_handle: m.receipt_handle,
390
+ data: m,
391
+ client: @client
392
+ )
373
393
  end
394
+ Message::Collection.new([batch], size: batch.size)
395
+ end
374
396
 
375
- # @example Request syntax with placeholder values
376
- #
377
- # queue.remove_permission({
378
- # label: "String", # required
379
- # })
380
- # @param [Hash] options ({})
381
- # @option options [required, String] :label
382
- # The identification of the permission to remove. This is the label
383
- # added with the AddPermission action.
384
- # @return [EmptyStructure]
385
- def remove_permission(options = {})
386
- options = options.merge(queue_url: @url)
387
- resp = @client.remove_permission(options)
388
- resp.data
389
- end
397
+ # @example Request syntax with placeholder values
398
+ #
399
+ # queue.remove_permission({
400
+ # label: "String", # required
401
+ # })
402
+ # @param [Hash] options ({})
403
+ # @option options [required, String] :label
404
+ # The identification of the permission to remove. This is the label
405
+ # added using the ` AddPermission ` action.
406
+ # @return [EmptyStructure]
407
+ def remove_permission(options = {})
408
+ options = options.merge(queue_url: @url)
409
+ resp = @client.remove_permission(options)
410
+ resp.data
411
+ end
390
412
 
391
- # @example Request syntax with placeholder values
392
- #
393
- # queue.send_message({
394
- # message_body: "String", # required
395
- # delay_seconds: 1,
396
- # message_attributes: {
397
- # "String" => {
398
- # string_value: "String",
399
- # binary_value: "data",
400
- # string_list_values: ["String"],
401
- # binary_list_values: ["data"],
402
- # data_type: "String", # required
403
- # },
404
- # },
405
- # message_deduplication_id: "String",
406
- # message_group_id: "String",
407
- # })
408
- # @param [Hash] options ({})
409
- # @option options [required, String] :message_body
410
- # The message to send. String maximum 256 KB in size. For a list of
411
- # allowed characters, see the preceding note.
412
- # @option options [Integer] :delay_seconds
413
- # The number of seconds (0 to 900 - 15 minutes) to delay a specific
414
- # message. Messages with a positive `DelaySeconds` value become
415
- # available for processing after the delay time is finished. If you
416
- # don't specify a value, the default value for the queue applies.
417
- #
418
- # <note markdown="1"> When you set `FifoQueue`, you can't set `DelaySeconds` per message.
419
- # You can set this parameter only on a queue level.
420
- #
421
- # </note>
422
- # @option options [Hash<String,Types::MessageAttributeValue>] :message_attributes
423
- # Each message attribute consists of a Name, Type, and Value. For more
424
- # information, see [Message Attribute Items and Validation][1] in the
425
- # *Amazon SQS Developer Guide*.
426
- #
427
- #
428
- #
429
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html#message-attributes-items-validation
430
- # @option options [String] :message_deduplication_id
431
- # This parameter applies only to FIFO (first-in-first-out) queues.
432
- #
433
- # The token used for deduplication of sent messages. If a message with a
434
- # particular `MessageDeduplicationId` is sent successfully, any messages
435
- # sent with the same `MessageDeduplicationId` are accepted successfully
436
- # but aren't delivered during the 5-minute deduplication interval. For
437
- # more information, see [ Exactly-Once Processing][1] in the *Amazon SQS
438
- # Developer Guide*.
439
- #
440
- # * Every message must have a unique `MessageDeduplicationId`,
441
- #
442
- # * You may provide a `MessageDeduplicationId` explicitly.
443
- #
444
- # * If you aren't able to provide a `MessageDeduplicationId` and you
445
- # enable `ContentBasedDeduplication` for your queue, Amazon SQS uses
446
- # a SHA-256 hash to generate the `MessageDeduplicationId` using the
447
- # body of the message (but not the attributes of the message).
448
- #
449
- # * If you don't provide a `MessageDeduplicationId` and the queue
450
- # doesn't have `ContentBasedDeduplication` set, the action fails
451
- # with an error.
452
- #
453
- # * If the queue has `ContentBasedDeduplication` set, your
454
- # `MessageDeduplicationId` overrides the generated one.
455
- #
456
- # * When `ContentBasedDeduplication` is in effect, messages with
457
- # identical content sent within the deduplication interval are treated
458
- # as duplicates and only one copy of the message is delivered.
459
- #
460
- # * You can also use `ContentBasedDeduplication` for messages with
461
- # identical content to be treated as duplicates.
462
- #
463
- # * If you send one message with `ContentBasedDeduplication` enabled and
464
- # then another message with a `MessageDeduplicationId` that is the
465
- # same as the one generated for the first `MessageDeduplicationId`,
466
- # the two messages are treated as duplicates and only one copy of the
467
- # message is delivered.
468
- #
469
- # <note markdown="1"> The `MessageDeduplicationId` is available to the recipient of the
470
- # message (this can be useful for troubleshooting delivery issues).
471
- #
472
- # If a message is sent successfully but the acknowledgdment is lost and
473
- # the message is resent with the same `MessageDeduplicationId` after the
474
- # deduplication interval, Amazon SQS can't detect duplicate messages.
475
- #
476
- # </note>
477
- #
478
- # The length of `MessageDeduplicationId` is 128 characters.
479
- # `MessageDeduplicationId` can contain alphanumeric characters (`a-z`,
480
- # `A-Z`, `0-9`) and punctuation (`` !"#$%&'()*+,-./:;<=>?@[\]^_`\{|\}~
481
- # ``).
482
- #
483
- # For best practices of using `MessageDeduplicationId`, see [Using the
484
- # MessageDeduplicationId Property][2] in the *Amazon Simple Queue
485
- # Service Developer Guide*.
486
- #
487
- #
488
- #
489
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing
490
- # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queue-recommendations.html#using-messagededuplicationid-property
491
- # @option options [String] :message_group_id
492
- # This parameter applies only to FIFO (first-in-first-out) queues.
493
- #
494
- # The tag that specifies that a message belongs to a specific message
495
- # group. Messages that belong to the same message group are processed in
496
- # a FIFO manner (however, messages in different message groups might be
497
- # processed out of order). To interleave multiple ordered streams within
498
- # a single queue, use `MessageGroupId` values (for example, session data
499
- # for multiple users). In this scenario, multiple readers can process
500
- # the queue, but the session data of each user is processed in a FIFO
501
- # fashion.
502
- #
503
- # * You must associate a non-empty `MessageGroupId` with a message. If
504
- # you don't provide a `MessageGroupId`, the action fails.
505
- #
506
- # * `ReceiveMessage` might return messages with multiple
507
- # `MessageGroupId` values. For each `MessageGroupId`, the messages are
508
- # sorted by time sent. The caller can't specify a `MessageGroupId`.
509
- #
510
- # The length of `MessageGroupId` is 128 characters. Valid values are
511
- # alphanumeric characters and punctuation ``
512
- # (!"#$%&'()*+,-./:;<=>?@[\]^_`\{|\}~) ``.
513
- #
514
- # For best practices of using `MessageGroupId`, see [Using the
515
- # MessageGroupId Property][1] in the *Amazon Simple Queue Service
516
- # Developer Guide*.
517
- #
518
- #
519
- #
520
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queue-recommendations.html#using-messagegroupid-property
521
- # @return [Types::SendMessageResult]
522
- def send_message(options = {})
523
- options = options.merge(queue_url: @url)
524
- resp = @client.send_message(options)
525
- resp.data
526
- end
413
+ # @example Request syntax with placeholder values
414
+ #
415
+ # queue.send_message({
416
+ # message_body: "String", # required
417
+ # delay_seconds: 1,
418
+ # message_attributes: {
419
+ # "String" => {
420
+ # string_value: "String",
421
+ # binary_value: "data",
422
+ # string_list_values: ["String"],
423
+ # binary_list_values: ["data"],
424
+ # data_type: "String", # required
425
+ # },
426
+ # },
427
+ # message_deduplication_id: "String",
428
+ # message_group_id: "String",
429
+ # })
430
+ # @param [Hash] options ({})
431
+ # @option options [required, String] :message_body
432
+ # The message to send. The maximum string size is 256 KB.
433
+ #
434
+ # The following list shows the characters (in Unicode) that are allowed
435
+ # in your message, according to the W3C XML specification:
436
+ #
437
+ # * `#x9`
438
+ #
439
+ # * `#xA`
440
+ #
441
+ # * `#xD`
442
+ #
443
+ # * `#x20` to `#xD7FF`
444
+ #
445
+ # * `#xE000` to `#xFFFD`
446
+ #
447
+ # * `#x10000` to `#x10FFFF`
448
+ #
449
+ # For more information, see [RFC1321][1]. If you send any characters
450
+ # that aren't included in this list, your request is rejected.
451
+ #
452
+ #
453
+ #
454
+ # [1]: https://www.ietf.org/rfc/rfc1321.txt
455
+ # @option options [Integer] :delay_seconds
456
+ # The number of seconds to delay a specific message. Valid values: 0 to
457
+ # 900. Maximum: 15 minutes. Messages with a positive `DelaySeconds`
458
+ # value become available for processing after the delay period is
459
+ # finished. If you don't specify a value, the default value for the
460
+ # queue applies.
461
+ #
462
+ # <note markdown="1"> When you set `FifoQueue`, you can't set `DelaySeconds` per message.
463
+ # You can set this parameter only on a queue level.
464
+ #
465
+ # </note>
466
+ # @option options [Hash<String,Types::MessageAttributeValue>] :message_attributes
467
+ # Each message attribute consists of a `Name`, `Type`, and `Value`. For
468
+ # more information, see [Message Attribute Items and Validation][1] in
469
+ # the *Amazon SQS Developer Guide*.
470
+ #
471
+ #
472
+ #
473
+ # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html#message-attributes-items-validation
474
+ # @option options [String] :message_deduplication_id
475
+ # This parameter applies only to FIFO (first-in-first-out) queues.
476
+ #
477
+ # The token used for deduplication of sent messages. If a message with a
478
+ # particular `MessageDeduplicationId` is sent successfully, any messages
479
+ # sent with the same `MessageDeduplicationId` are accepted successfully
480
+ # but aren't delivered during the 5-minute deduplication interval. For
481
+ # more information, see [ Exactly-Once Processing][1] in the *Amazon SQS
482
+ # Developer Guide*.
483
+ #
484
+ # * Every message must have a unique `MessageDeduplicationId`,
485
+ #
486
+ # * You may provide a `MessageDeduplicationId` explicitly.
487
+ #
488
+ # * If you aren't able to provide a `MessageDeduplicationId` and you
489
+ # enable `ContentBasedDeduplication` for your queue, Amazon SQS uses
490
+ # a SHA-256 hash to generate the `MessageDeduplicationId` using the
491
+ # body of the message (but not the attributes of the message).
492
+ #
493
+ # * If you don't provide a `MessageDeduplicationId` and the queue
494
+ # doesn't have `ContentBasedDeduplication` set, the action fails
495
+ # with an error.
496
+ #
497
+ # * If the queue has `ContentBasedDeduplication` set, your
498
+ # `MessageDeduplicationId` overrides the generated one.
499
+ #
500
+ # * When `ContentBasedDeduplication` is in effect, messages with
501
+ # identical content sent within the deduplication interval are treated
502
+ # as duplicates and only one copy of the message is delivered.
503
+ #
504
+ # * You can also use `ContentBasedDeduplication` for messages with
505
+ # identical content to be treated as duplicates.
506
+ #
507
+ # * If you send one message with `ContentBasedDeduplication` enabled and
508
+ # then another message with a `MessageDeduplicationId` that is the
509
+ # same as the one generated for the first `MessageDeduplicationId`,
510
+ # the two messages are treated as duplicates and only one copy of the
511
+ # message is delivered.
512
+ #
513
+ # <note markdown="1"> The `MessageDeduplicationId` is available to the recipient of the
514
+ # message (this can be useful for troubleshooting delivery issues).
515
+ #
516
+ # If a message is sent successfully but the acknowledgement is lost and
517
+ # the message is resent with the same `MessageDeduplicationId` after the
518
+ # deduplication interval, Amazon SQS can't detect duplicate messages.
519
+ #
520
+ # </note>
521
+ #
522
+ # The length of `MessageDeduplicationId` is 128 characters.
523
+ # `MessageDeduplicationId` can contain alphanumeric characters (`a-z`,
524
+ # `A-Z`, `0-9`) and punctuation (`` !"#$%&'()*+,-./:;<=>?@[\]^_`\{|\}~
525
+ # ``).
526
+ #
527
+ # For best practices of using `MessageDeduplicationId`, see [Using the
528
+ # MessageDeduplicationId Property][2] in the *Amazon Simple Queue
529
+ # Service Developer Guide*.
530
+ #
531
+ #
532
+ #
533
+ # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing
534
+ # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queue-recommendations.html#using-messagededuplicationid-property
535
+ # @option options [String] :message_group_id
536
+ # This parameter applies only to FIFO (first-in-first-out) queues.
537
+ #
538
+ # The tag that specifies that a message belongs to a specific message
539
+ # group. Messages that belong to the same message group are processed in
540
+ # a FIFO manner (however, messages in different message groups might be
541
+ # processed out of order). To interleave multiple ordered streams within
542
+ # a single queue, use `MessageGroupId` values (for example, session data
543
+ # for multiple users). In this scenario, multiple readers can process
544
+ # the queue, but the session data of each user is processed in a FIFO
545
+ # fashion.
546
+ #
547
+ # * You must associate a non-empty `MessageGroupId` with a message. If
548
+ # you don't provide a `MessageGroupId`, the action fails.
549
+ #
550
+ # * `ReceiveMessage` might return messages with multiple
551
+ # `MessageGroupId` values. For each `MessageGroupId`, the messages are
552
+ # sorted by time sent. The caller can't specify a `MessageGroupId`.
553
+ #
554
+ # The length of `MessageGroupId` is 128 characters. Valid values are
555
+ # alphanumeric characters and punctuation ``
556
+ # (!"#$%&'()*+,-./:;<=>?@[\]^_`\{|\}~) ``.
557
+ #
558
+ # For best practices of using `MessageGroupId`, see [Using the
559
+ # MessageGroupId Property][1] in the *Amazon Simple Queue Service
560
+ # Developer Guide*.
561
+ #
562
+ #
563
+ #
564
+ # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queue-recommendations.html#using-messagegroupid-property
565
+ # @return [Types::SendMessageResult]
566
+ def send_message(options = {})
567
+ options = options.merge(queue_url: @url)
568
+ resp = @client.send_message(options)
569
+ resp.data
570
+ end
527
571
 
528
- # @example Request syntax with placeholder values
529
- #
530
- # queue.send_messages({
531
- # entries: [ # required
532
- # {
533
- # id: "String", # required
534
- # message_body: "String", # required
535
- # delay_seconds: 1,
536
- # message_attributes: {
537
- # "String" => {
538
- # string_value: "String",
539
- # binary_value: "data",
540
- # string_list_values: ["String"],
541
- # binary_list_values: ["data"],
542
- # data_type: "String", # required
543
- # },
544
- # },
545
- # message_deduplication_id: "String",
546
- # message_group_id: "String",
547
- # },
548
- # ],
549
- # })
550
- # @param [Hash] options ({})
551
- # @option options [required, Array<Types::SendMessageBatchRequestEntry>] :entries
552
- # A list of SendMessageBatchRequestEntry items.
553
- # @return [Types::SendMessageBatchResult]
554
- def send_messages(options = {})
555
- options = options.merge(queue_url: @url)
556
- resp = @client.send_message_batch(options)
557
- resp.data
558
- end
572
+ # @example Request syntax with placeholder values
573
+ #
574
+ # queue.send_messages({
575
+ # entries: [ # required
576
+ # {
577
+ # id: "String", # required
578
+ # message_body: "String", # required
579
+ # delay_seconds: 1,
580
+ # message_attributes: {
581
+ # "String" => {
582
+ # string_value: "String",
583
+ # binary_value: "data",
584
+ # string_list_values: ["String"],
585
+ # binary_list_values: ["data"],
586
+ # data_type: "String", # required
587
+ # },
588
+ # },
589
+ # message_deduplication_id: "String",
590
+ # message_group_id: "String",
591
+ # },
592
+ # ],
593
+ # })
594
+ # @param [Hash] options ({})
595
+ # @option options [required, Array<Types::SendMessageBatchRequestEntry>] :entries
596
+ # A list of ` SendMessageBatchRequestEntry ` items.
597
+ # @return [Types::SendMessageBatchResult]
598
+ def send_messages(options = {})
599
+ options = options.merge(queue_url: @url)
600
+ resp = @client.send_message_batch(options)
601
+ resp.data
602
+ end
559
603
 
560
- # @example Request syntax with placeholder values
561
- #
562
- # queue.set_attributes({
563
- # attributes: { # required
564
- # "All" => "String",
565
- # },
566
- # })
567
- # @param [Hash] options ({})
568
- # @option options [required, Hash<String,String>] :attributes
569
- # A map of attributes to set.
570
- #
571
- # The following lists the names, descriptions, and values of the special
572
- # request parameters that the `SetQueueAttributes` action uses:
573
- #
574
- # * `DelaySeconds` - The number of seconds for which the delivery of all
575
- # messages in the queue is delayed. An integer from 0 to 900 (15
576
- # minutes). The default is 0 (zero).
577
- #
578
- # * `MaximumMessageSize` - The limit of how many bytes a message can
579
- # contain before Amazon SQS rejects it. An integer from 1,024 bytes (1
580
- # KiB) up to 262,144 bytes (256 KiB). The default is 262,144 (256
581
- # KiB).
582
- #
583
- # * `MessageRetentionPeriod` - The number of seconds for which Amazon
584
- # SQS retains a message. An integer representing seconds, from 60 (1
585
- # minute) to 120,9600 (14 days). The default is 345,600 (4 days).
586
- #
587
- # * `Policy` - The queue's policy. A valid AWS policy. For more
588
- # information about policy structure, see [Overview of AWS IAM
589
- # Policies][1] in the *Amazon IAM User Guide*.
590
- #
591
- # * `ReceiveMessageWaitTimeSeconds` - The number of seconds for which a
592
- # ReceiveMessage action will wait for a message to arrive. An integer
593
- # from 0 to 20 (seconds). The default is 0.
594
- #
595
- # * `RedrivePolicy` - The parameters for the dead letter queue
596
- # functionality of the source queue. For more information about the
597
- # redrive policy and dead letter queues, see [Using Amazon SQS Dead
598
- # Letter Queues][2] in the *Amazon SQS Developer Guide*.
599
- #
600
- # <note markdown="1"> The dead letter queue of a FIFO queue must also be a FIFO queue.
601
- # Similarly, the dead letter queue of a standard queue must also be a
602
- # standard queue.
603
- #
604
- # </note>
605
- #
606
- # * `VisibilityTimeout` - The visibility timeout for the queue. An
607
- # integer from 0 to 43200 (12 hours). The default is 30. For more
608
- # information about the visibility timeout, see [Visibility
609
- # Timeout][3] in the *Amazon SQS Developer Guide*.
610
- #
611
- # The following attribute applies only to [FIFO (first-in-first-out)
612
- # queues][4]\:
613
- #
614
- # * `ContentBasedDeduplication` - Enables content-based deduplication.
615
- # For more information, see [Exactly-Once Processing][5] in the
616
- # *Amazon SQS Developer Guide*.
617
- #
618
- # * Every message must have a unique `MessageDeduplicationId`,
619
- #
620
- # * You may provide a `MessageDeduplicationId` explicitly.
621
- #
622
- # * If you aren't able to provide a `MessageDeduplicationId` and
623
- # you enable `ContentBasedDeduplication` for your queue, Amazon
624
- # SQS uses a SHA-256 hash to generate the `MessageDeduplicationId`
625
- # using the body of the message (but not the attributes of the
626
- # message).
627
- #
628
- # * If you don't provide a `MessageDeduplicationId` and the queue
629
- # doesn't have `ContentBasedDeduplication` set, the action fails
630
- # with an error.
631
- #
632
- # * If the queue has `ContentBasedDeduplication` set, your
633
- # `MessageDeduplicationId` overrides the generated one.
634
- #
635
- # * When `ContentBasedDeduplication` is in effect, messages with
636
- # identical content sent within the deduplication interval are
637
- # treated as duplicates and only one copy of the message is
638
- # delivered.
639
- #
640
- # * You can also use `ContentBasedDeduplication` for messages with
641
- # identical content to be treated as duplicates.
642
- #
643
- # * If you send one message with `ContentBasedDeduplication` enabled
644
- # and then another message with a `MessageDeduplicationId` that is
645
- # the same as the one generated for the first
646
- # `MessageDeduplicationId`, the two messages are treated as
647
- # duplicates and only one copy of the message is delivered.
648
- #
649
- # Any other valid special request parameters that are specified (such as
650
- # `ApproximateNumberOfMessages`, `ApproximateNumberOfMessagesDelayed`,
651
- # `ApproximateNumberOfMessagesNotVisible`, `CreatedTimestamp`,
652
- # `LastModifiedTimestamp`, and `QueueArn`) will be ignored.
653
- #
654
- #
655
- #
656
- # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html
657
- # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
658
- # [3]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
659
- # [4]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html
660
- # [5]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing
661
- # @return [EmptyStructure]
662
- def set_attributes(options = {})
663
- options = options.merge(queue_url: @url)
664
- resp = @client.set_queue_attributes(options)
665
- resp.data
666
- end
604
+ # @example Request syntax with placeholder values
605
+ #
606
+ # queue.set_attributes({
607
+ # attributes: { # required
608
+ # "All" => "String",
609
+ # },
610
+ # })
611
+ # @param [Hash] options ({})
612
+ # @option options [required, Hash<String,String>] :attributes
613
+ # A map of attributes to set.
614
+ #
615
+ # The following lists the names, descriptions, and values of the special
616
+ # request parameters that the `SetQueueAttributes` action uses:
617
+ #
618
+ # * `DelaySeconds` - The number of seconds for which the delivery of all
619
+ # messages in the queue is delayed. Valid values: An integer from 0 to
620
+ # 900 (15 minutes). The default is 0 (zero).
621
+ #
622
+ # * `MaximumMessageSize` - The limit of how many bytes a message can
623
+ # contain before Amazon SQS rejects it. Valid values: An integer from
624
+ # 1,024 bytes (1 KiB) up to 262,144 bytes (256 KiB). The default is
625
+ # 262,144 (256 KiB).
626
+ #
627
+ # * `MessageRetentionPeriod` - The number of seconds for which Amazon
628
+ # SQS retains a message. Valid values: An integer representing
629
+ # seconds, from 60 (1 minute) to 1,209,600 (14 days). The default is
630
+ # 345,600 (4 days).
631
+ #
632
+ # * `Policy` - The queue's policy. A valid AWS policy. For more
633
+ # information about policy structure, see [Overview of AWS IAM
634
+ # Policies][1] in the *Amazon IAM User Guide*.
635
+ #
636
+ # * `ReceiveMessageWaitTimeSeconds` - The number of seconds for which a
637
+ # ` ReceiveMessage ` action waits for a message to arrive. Valid
638
+ # values: an integer from 0 to 20 (seconds). The default is 0.
639
+ #
640
+ # * `RedrivePolicy` - The parameters for the dead letter queue
641
+ # functionality of the source queue. For more information about the
642
+ # redrive policy and dead letter queues, see [Using Amazon SQS Dead
643
+ # Letter Queues][2] in the *Amazon SQS Developer Guide*.
644
+ #
645
+ # <note markdown="1"> The dead letter queue of a FIFO queue must also be a FIFO queue.
646
+ # Similarly, the dead letter queue of a standard queue must also be a
647
+ # standard queue.
648
+ #
649
+ # </note>
650
+ #
651
+ # * `VisibilityTimeout` - The visibility timeout for the queue. Valid
652
+ # values: an integer from 0 to 43,200 (12 hours). The default is 30.
653
+ # For more information about the visibility timeout, see [Visibility
654
+ # Timeout][3] in the *Amazon SQS Developer Guide*.
655
+ #
656
+ # The following attribute applies only to [FIFO (first-in-first-out)
657
+ # queues][4]\:
658
+ #
659
+ # * `ContentBasedDeduplication` - Enables content-based deduplication.
660
+ # For more information, see [Exactly-Once Processing][5] in the
661
+ # *Amazon SQS Developer Guide*.
662
+ #
663
+ # * Every message must have a unique `MessageDeduplicationId`,
664
+ #
665
+ # * You may provide a `MessageDeduplicationId` explicitly.
666
+ #
667
+ # * If you aren't able to provide a `MessageDeduplicationId` and
668
+ # you enable `ContentBasedDeduplication` for your queue, Amazon
669
+ # SQS uses a SHA-256 hash to generate the `MessageDeduplicationId`
670
+ # using the body of the message (but not the attributes of the
671
+ # message).
672
+ #
673
+ # * If you don't provide a `MessageDeduplicationId` and the queue
674
+ # doesn't have `ContentBasedDeduplication` set, the action fails
675
+ # with an error.
676
+ #
677
+ # * If the queue has `ContentBasedDeduplication` set, your
678
+ # `MessageDeduplicationId` overrides the generated one.
679
+ #
680
+ # * When `ContentBasedDeduplication` is in effect, messages with
681
+ # identical content sent within the deduplication interval are
682
+ # treated as duplicates and only one copy of the message is
683
+ # delivered.
684
+ #
685
+ # * You can also use `ContentBasedDeduplication` for messages with
686
+ # identical content to be treated as duplicates.
687
+ #
688
+ # * If you send one message with `ContentBasedDeduplication` enabled
689
+ # and then another message with a `MessageDeduplicationId` that is
690
+ # the same as the one generated for the first
691
+ # `MessageDeduplicationId`, the two messages are treated as
692
+ # duplicates and only one copy of the message is delivered.
693
+ #
694
+ # Any other valid special request parameters (such as the following) are
695
+ # ignored:
696
+ #
697
+ # * `ApproximateNumberOfMessages`
698
+ #
699
+ # * `ApproximateNumberOfMessagesDelayed`
700
+ #
701
+ # * `ApproximateNumberOfMessagesNotVisible`
702
+ #
703
+ # * `CreatedTimestamp`
704
+ #
705
+ # * `LastModifiedTimestamp`
706
+ #
707
+ # * `QueueArn`
708
+ #
709
+ #
710
+ #
711
+ # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html
712
+ # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
713
+ # [3]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
714
+ # [4]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html
715
+ # [5]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing
716
+ # @return [EmptyStructure]
717
+ def set_attributes(options = {})
718
+ options = options.merge(queue_url: @url)
719
+ resp = @client.set_queue_attributes(options)
720
+ resp.data
721
+ end
667
722
 
668
- # @!group Associations
723
+ # @!group Associations
669
724
 
670
- # @example Request syntax with placeholder values
671
- #
672
- # deadlettersourcequeues = queue.dead_letter_source_queues()
673
- # @param [Hash] options ({})
674
- # @return [Queue::Collection]
675
- def dead_letter_source_queues(options = {})
676
- batches = Enumerator.new do |y|
677
- batch = []
678
- options = options.merge(queue_url: @url)
679
- resp = @client.list_dead_letter_source_queues(options)
680
- resp.data.queue_urls.each do |q|
681
- batch << Queue.new(
682
- url: q,
683
- client: @client
684
- )
685
- end
686
- y.yield(batch)
725
+ # @example Request syntax with placeholder values
726
+ #
727
+ # queue.dead_letter_source_queues()
728
+ # @param [Hash] options ({})
729
+ # @return [Queue::Collection]
730
+ def dead_letter_source_queues(options = {})
731
+ batches = Enumerator.new do |y|
732
+ batch = []
733
+ options = options.merge(queue_url: @url)
734
+ resp = @client.list_dead_letter_source_queues(options)
735
+ resp.data.queue_urls.each do |q|
736
+ batch << Queue.new(
737
+ url: q,
738
+ client: @client
739
+ )
687
740
  end
688
- Queue::Collection.new(batches)
741
+ y.yield(batch)
689
742
  end
743
+ Queue::Collection.new(batches)
744
+ end
690
745
 
691
- # @param [String] receipt_handle
692
- # @return [Message]
693
- def message(receipt_handle)
694
- Message.new(
695
- queue_url: @url,
696
- receipt_handle: receipt_handle,
697
- client: @client
698
- )
699
- end
746
+ # @param [String] receipt_handle
747
+ # @return [Message]
748
+ def message(receipt_handle)
749
+ Message.new(
750
+ queue_url: @url,
751
+ receipt_handle: receipt_handle,
752
+ client: @client
753
+ )
754
+ end
700
755
 
701
- # @deprecated
702
- # @api private
703
- def identifiers
704
- { url: @url }
705
- end
706
- deprecated(:identifiers)
756
+ # @deprecated
757
+ # @api private
758
+ def identifiers
759
+ { url: @url }
760
+ end
761
+ deprecated(:identifiers)
707
762
 
708
- private
763
+ private
709
764
 
710
- def extract_url(args, options)
711
- value = args[0] || options.delete(:url)
712
- case value
713
- when String then value
714
- when nil then raise ArgumentError, "missing required option :url"
715
- else
716
- msg = "expected :url to be a String, got #{value.class}"
717
- raise ArgumentError, msg
718
- end
765
+ def extract_url(args, options)
766
+ value = args[0] || options.delete(:url)
767
+ case value
768
+ when String then value
769
+ when nil then raise ArgumentError, "missing required option :url"
770
+ else
771
+ msg = "expected :url to be a String, got #{value.class}"
772
+ raise ArgumentError, msg
719
773
  end
720
-
721
- class Collection < Aws::Resources::Collection; end
722
774
  end
775
+
776
+ class Collection < Aws::Resources::Collection; end
723
777
  end
724
778
  end