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

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1a976936571b39e54844fbecb7a41f108b12b58
4
- data.tar.gz: f7a3e598f421172a1493b600fd918e9f5adf69cc
3
+ metadata.gz: 9d232f50e69e2d60d06b6c1f3d6f3cf23caa5532
4
+ data.tar.gz: 920800fa031f95339ab16ce4d8f2d23c4373f0b4
5
5
  SHA512:
6
- metadata.gz: e42b4f56e000779d2493ccba19042bf0d75ebc0bff0664318c5b05d11a58849c2212aa9aed59f08edfdde73c65ded17e32970da23ac83d178271dc10f8791147
7
- data.tar.gz: 825afec01a99ead084ccaebc802848fd24ae6f1ff0e199026489286caf9faf710913e72b113f58b3163bc060cf1163efdf28b81aca951311b2b92dcb3a5d6acd
6
+ metadata.gz: f86b40ff14e296f74fb63f74257aaab03d022c6f3f927fd69ce5e187aee52cd07dd64e25dd88365f053f78c12bca9a4c5e3a2c64a7c6bdaac15135a7dc84e359
7
+ data.tar.gz: 64cf18afe90fc4610e73f9a300b425e643b8ff6df9184c2888544b753dc1a215811033dd62ae30e3fe971399185e3ac74a13d14cf9a8cd4e2988a3c3c85d9d52
@@ -13,6 +13,8 @@ require_relative 'aws-sdk-sqs/client_api'
13
13
  require_relative 'aws-sdk-sqs/client'
14
14
  require_relative 'aws-sdk-sqs/errors'
15
15
  require_relative 'aws-sdk-sqs/resource'
16
+ require_relative 'aws-sdk-sqs/message'
17
+ require_relative 'aws-sdk-sqs/queue'
16
18
  require_relative 'aws-sdk-sqs/customizations'
17
19
 
18
20
  # This module provides support for Amazon Simple Queue Service. This module is available in the
@@ -42,6 +44,6 @@ require_relative 'aws-sdk-sqs/customizations'
42
44
  # @service
43
45
  module Aws::SQS
44
46
 
45
- GEM_VERSION = '1.0.0.rc1'
47
+ GEM_VERSION = '1.0.0.rc2'
46
48
 
47
49
  end
@@ -237,23 +237,25 @@ module Aws
237
237
  # of 12 hours. If you try to extend beyond 12 hours, the request will be
238
238
  # rejected.
239
239
  #
240
- # <note markdown="1"> There is a 120,000 limit for the number of inflight messages per
241
- # queue. Messages are inflight after they have been received from the
242
- # queue by a consuming component, but have not yet been deleted from the
243
- # queue. If you reach the 120,000 limit, you will receive an OverLimit
244
- # error message from Amazon SQS. To help avoid reaching the limit, you
245
- # should delete the messages from the queue after they have been
246
- # processed. You can also increase the number of queues you use to
247
- # process the messages.
240
+ # A message is considered to be *in flight* after it's received from a
241
+ # queue by a consumer, but not yet deleted from the queue.
248
242
  #
249
- # </note>
243
+ # For standard queues, there can be a maximum of 120,000 inflight
244
+ # messages per queue. If you reach this limit, Amazon SQS returns the
245
+ # `OverLimit` error message. To avoid reaching the limit, you should
246
+ # delete messages from the queue after they're processed. You can also
247
+ # increase the number of queues you use to process your messages.
248
+ #
249
+ # For FIFO queues, there can be a maximum of 20,000 inflight messages
250
+ # per queue. If you reach this limit, Amazon SQS returns no error
251
+ # messages.
250
252
  #
251
253
  # If you attempt to set the `VisibilityTimeout` to an amount more than
252
254
  # the maximum time left, Amazon SQS returns an error. It will not
253
255
  # automatically recalculate and increase the timeout to the maximum time
254
256
  # remaining.
255
257
  #
256
- # Unlike with a queue, when you change the visibility timeout for a
258
+ # Unlike with a queue, when you change the visibility timeout for a
257
259
  # specific message, that timeout value is applied immediately but is not
258
260
  # saved in memory for that message. If you don't delete a message after
259
261
  # it is received, the visibility timeout for the message the next time
@@ -262,7 +264,7 @@ module Aws
262
264
  #
263
265
  #
264
266
  #
265
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html
267
+ # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
266
268
  # @option params [required, String] :queue_url
267
269
  # The URL of the Amazon SQS queue to take action on.
268
270
  #
@@ -392,7 +394,7 @@ module Aws
392
394
  #
393
395
  #
394
396
  #
395
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-moving.html
397
+ # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-moving
396
398
  # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/limits-queues.html
397
399
  # @option params [required, String] :queue_name
398
400
  # The name of the new queue. The following limits apply to this name:
@@ -502,8 +504,8 @@ module Aws
502
504
  #
503
505
  #
504
506
  # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html
505
- # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html
506
- # [3]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html
507
+ # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
508
+ # [3]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
507
509
  # [4]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html
508
510
  # [5]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-understanding-logic
509
511
  # [6]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing
@@ -646,7 +648,7 @@ module Aws
646
648
  #
647
649
  #
648
650
  #
649
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSConcepts.html
651
+ # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-how-it-works.html
650
652
  # @option params [required, String] :queue_url
651
653
  # The URL of the Amazon SQS queue to take action on.
652
654
  #
@@ -748,9 +750,9 @@ module Aws
748
750
  #
749
751
  #
750
752
  #
751
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/ApproximateNumber.html
752
- # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html
753
- # [3]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html
753
+ # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-resources-required-process-messages.html
754
+ # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
755
+ # [3]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
754
756
  # [4]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html
755
757
  # [5]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-understanding-logic
756
758
  # [6]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing
@@ -822,7 +824,7 @@ module Aws
822
824
  #
823
825
  #
824
826
  #
825
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html
827
+ # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
826
828
  # @option params [required, String] :queue_url
827
829
  # The queue URL of a dead letter queue.
828
830
  #
@@ -906,7 +908,7 @@ module Aws
906
908
  # Retrieves one or more messages, with a maximum limit of 10 messages,
907
909
  # from the specified queue. Long poll support is enabled by using the
908
910
  # `WaitTimeSeconds` parameter. For more information, see [Amazon SQS
909
- # Long Poll][1] in the *Amazon SQS Developer Guide*.
911
+ # Long Polling][1] in the *Amazon SQS Developer Guide*.
910
912
  #
911
913
  # Short poll is the default behavior where a weighted random set of
912
914
  # machines is sampled on a `ReceiveMessage` call. This means only the
@@ -958,8 +960,8 @@ module Aws
958
960
  #
959
961
  # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-long-polling.html
960
962
  # [2]: https://www.ietf.org/rfc/rfc1321.txt
961
- # [3]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/ImportantIdentifiers.html
962
- # [4]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html
963
+ # [3]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-queue-message-identifiers.html
964
+ # [4]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
963
965
  # @option params [required, String] :queue_url
964
966
  # The URL of the Amazon SQS queue to take action on.
965
967
  #
@@ -1120,7 +1122,7 @@ module Aws
1120
1122
  #
1121
1123
  #
1122
1124
  #
1123
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html
1125
+ # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
1124
1126
  # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queue-recommendations.html#using-receiverequestattemptid-request-parameter
1125
1127
  # @return [Types::ReceiveMessageResult] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1126
1128
  #
@@ -1217,12 +1219,12 @@ module Aws
1217
1219
  # </note>
1218
1220
  # @option params [Hash<String,Types::MessageAttributeValue>] :message_attributes
1219
1221
  # Each message attribute consists of a Name, Type, and Value. For more
1220
- # information, see [Message Attribute Items][1] in the *Amazon SQS
1221
- # Developer Guide*.
1222
+ # information, see [Message Attribute Items and Validation][1] in the
1223
+ # *Amazon SQS Developer Guide*.
1222
1224
  #
1223
1225
  #
1224
1226
  #
1225
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSMessageAttributes.html#SQSMessageAttributesNTV
1227
+ # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html#message-attributes-items-validation
1226
1228
  # @option params [String] :message_deduplication_id
1227
1229
  # This parameter applies only to FIFO (first-in-first-out) queues.
1228
1230
  #
@@ -1545,8 +1547,8 @@ module Aws
1545
1547
  #
1546
1548
  #
1547
1549
  # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html
1548
- # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html
1549
- # [3]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html
1550
+ # [2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
1551
+ # [3]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
1550
1552
  # [4]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html
1551
1553
  # [5]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing
1552
1554
  # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
@@ -1578,7 +1580,7 @@ module Aws
1578
1580
  params: params,
1579
1581
  config: config)
1580
1582
  context[:gem_name] = 'aws-sdk-sqs'
1581
- context[:gem_version] = '1.0.0.rc1'
1583
+ context[:gem_version] = '1.0.0.rc2'
1582
1584
  Seahorse::Client::Request.new(handlers, context)
1583
1585
  end
1584
1586
 
@@ -0,0 +1,238 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing for info on making contributions:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ module Aws
9
+ module SQS
10
+ class Message
11
+
12
+ extend Aws::Deprecations
13
+
14
+ # @overload def initialize(queue_url, receipt_handle, options = {})
15
+ # @param [String] queue_url
16
+ # @param [String] receipt_handle
17
+ # @option options [Client] :client
18
+ # @overload def initialize(options = {})
19
+ # @option options [required, String] :queue_url
20
+ # @option options [required, String] :receipt_handle
21
+ # @option options [Client] :client
22
+ def initialize(*args)
23
+ options = Hash === args.last ? args.pop.dup : {}
24
+ @queue_url = extract_queue_url(args, options)
25
+ @receipt_handle = extract_receipt_handle(args, options)
26
+ @data = options.delete(:data)
27
+ @client = options.delete(:client) || Client.new(options)
28
+ end
29
+
30
+ # @!group Read-Only Attributes
31
+
32
+ # @return [String]
33
+ def queue_url
34
+ @queue_url
35
+ end
36
+
37
+ # @return [String]
38
+ def receipt_handle
39
+ @receipt_handle
40
+ end
41
+
42
+ # A unique identifier for the message. Message IDs are considered unique
43
+ # across all AWS accounts for an extended period of time.
44
+ # @return [String]
45
+ def message_id
46
+ data.message_id
47
+ end
48
+
49
+ # An MD5 digest of the non-URL-encoded message body string.
50
+ # @return [String]
51
+ def md5_of_body
52
+ data.md5_of_body
53
+ end
54
+
55
+ # The message's contents (not URL-encoded).
56
+ # @return [String]
57
+ def body
58
+ data.body
59
+ end
60
+
61
+ # `SenderId`, `SentTimestamp`, `ApproximateReceiveCount`, and/or
62
+ # `ApproximateFirstReceiveTimestamp`. `SentTimestamp` and
63
+ # `ApproximateFirstReceiveTimestamp` are each returned as an integer
64
+ # representing the [epoch time][1] in milliseconds.
65
+ #
66
+ #
67
+ #
68
+ # [1]: http://en.wikipedia.org/wiki/Unix_time
69
+ # @return [Hash<String,String>]
70
+ def attributes
71
+ data.attributes
72
+ end
73
+
74
+ # An MD5 digest of the non-URL-encoded message attribute string. This
75
+ # can be used to verify that Amazon SQS received the message correctly.
76
+ # Amazon SQS first URL decodes the message before creating the MD5
77
+ # digest. For information about MD5, see [RFC1321][1].
78
+ #
79
+ #
80
+ #
81
+ # [1]: https://www.ietf.org/rfc/rfc1321.txt
82
+ # @return [String]
83
+ def md5_of_message_attributes
84
+ data.md5_of_message_attributes
85
+ end
86
+
87
+ # Each message attribute consists of a Name, Type, and Value. For more
88
+ # information, see [Message Attribute Items and Validation][1] in the
89
+ # *Amazon SQS Developer Guide*.
90
+ #
91
+ #
92
+ #
93
+ # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html#message-attributes-items-validation
94
+ # @return [Hash<String,Types::MessageAttributeValue>]
95
+ def message_attributes
96
+ data.message_attributes
97
+ end
98
+
99
+ # @!endgroup
100
+
101
+ # @return [Client]
102
+ def client
103
+ @client
104
+ end
105
+
106
+ # @raise [Errors::ResourceNotLoadable]
107
+ # @api private
108
+ def load
109
+ msg = "#load is not implemented, data only available via enumeration"
110
+ raise Errors::ResourceNotLoadable, msg
111
+ end
112
+ alias :reload :load
113
+
114
+ # @raise [Errors::ResourceNotLoadableError] Raises when {#data_loaded?} is `false`.
115
+ # @return [Types::Message]
116
+ # Returns the data for this {Message}.
117
+ def data
118
+ load unless @data
119
+ @data
120
+ end
121
+
122
+ # @return [Boolean]
123
+ # Returns `true` if this resource is loaded. Accessing attributes or
124
+ # {#data} on an unloaded resource will trigger a call to {#load}.
125
+ def data_loaded?
126
+ !!@data
127
+ end
128
+
129
+ # @!group Actions
130
+
131
+ # @example Request syntax with placeholder values
132
+ #
133
+ # message.change_visibility({
134
+ # visibility_timeout: 1, # required
135
+ # })
136
+ # @param [Hash] options ({})
137
+ # @option options [required, Integer] :visibility_timeout
138
+ # The new value (in seconds - from 0 to 43200 - maximum 12 hours) for
139
+ # the message's visibility timeout.
140
+ # @return [EmptyStructure]
141
+ def change_visibility(options = {})
142
+ options = options.merge(
143
+ queue_url: @queue_url,
144
+ receipt_handle: @receipt_handle
145
+ )
146
+ resp = @client.change_message_visibility(options)
147
+ resp.data
148
+ end
149
+
150
+ # @example Request syntax with placeholder values
151
+ #
152
+ # message.delete()
153
+ # @param [Hash] options ({})
154
+ # @return [EmptyStructure]
155
+ def delete(options = {})
156
+ options = options.merge(
157
+ queue_url: @queue_url,
158
+ receipt_handle: @receipt_handle
159
+ )
160
+ resp = @client.delete_message(options)
161
+ resp.data
162
+ end
163
+
164
+ # @!group Associations
165
+
166
+ # @return [Queue]
167
+ def queue
168
+ Queue.new(
169
+ url: @queue_url,
170
+ client: @client
171
+ )
172
+ end
173
+
174
+ # @deprecated
175
+ # @api private
176
+ def identifiers
177
+ {
178
+ queue_url: @queue_url,
179
+ receipt_handle: @receipt_handle
180
+ }
181
+ end
182
+ deprecated(:identifiers)
183
+
184
+ private
185
+
186
+ def extract_queue_url(args, options)
187
+ value = args[0] || options.delete(:queue_url)
188
+ case value
189
+ when String then value
190
+ when nil then raise ArgumentError, "missing required option :queue_url"
191
+ else
192
+ msg = "expected :queue_url to be a String, got #{value.class}"
193
+ raise ArgumentError, msg
194
+ end
195
+ end
196
+
197
+ def extract_receipt_handle(args, options)
198
+ value = args[1] || options.delete(:receipt_handle)
199
+ case value
200
+ when String then value
201
+ when nil then raise ArgumentError, "missing required option :receipt_handle"
202
+ else
203
+ msg = "expected :receipt_handle to be a String, got #{value.class}"
204
+ raise ArgumentError, msg
205
+ end
206
+ end
207
+
208
+ class Collection < Aws::Resources::Collection
209
+
210
+ # @!group Batch Actions
211
+
212
+ # @example Request syntax with placeholder values
213
+ #
214
+ # message.batch_delete!()
215
+ # @param options ({})
216
+ # @return [void]
217
+ def batch_delete!(options = {})
218
+ batch_enum.each do |batch|
219
+ params = Aws::Util.copy_hash(options)
220
+ params[:queue_url] = batch[0].queue_url
221
+ params[:entries] ||= []
222
+ batch.each do |item|
223
+ params[:entries] << {
224
+ id: item.message_id,
225
+ receipt_handle: item.receipt_handle
226
+ }
227
+ end
228
+ batch[0].client.delete_message_batch(params)
229
+ end
230
+ nil
231
+ end
232
+
233
+ # @!endgroup
234
+
235
+ end
236
+ end
237
+ end
238
+ end
@@ -0,0 +1,724 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing for info on making contributions:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ module Aws
9
+ module SQS
10
+ class Queue
11
+
12
+ extend Aws::Deprecations
13
+
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
26
+
27
+ # @!group Read-Only Attributes
28
+
29
+ # @return [String]
30
+ def url
31
+ @url
32
+ end
33
+
34
+ # A map of attributes to the respective values.
35
+ # @return [Hash<String,String>]
36
+ def attributes
37
+ data.attributes
38
+ end
39
+
40
+ # @!endgroup
41
+
42
+ # @return [Client]
43
+ def client
44
+ @client
45
+ end
46
+
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
62
+
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
70
+
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
77
+
78
+ # @!group Actions
79
+
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
125
+
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
147
+
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
158
+
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
178
+
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
189
+
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)
373
+ end
374
+
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
390
+
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
527
+
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
559
+
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
667
+
668
+ # @!group Associations
669
+
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)
687
+ end
688
+ Queue::Collection.new(batches)
689
+ end
690
+
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
700
+
701
+ # @deprecated
702
+ # @api private
703
+ def identifiers
704
+ { url: @url }
705
+ end
706
+ deprecated(:identifiers)
707
+
708
+ private
709
+
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
719
+ end
720
+
721
+ class Collection < Aws::Resources::Collection; end
722
+ end
723
+ end
724
+ end