aws-sdk-sqs 1.64.0 → 1.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +45 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-sqs/client.rb +143 -70
- data/lib/aws-sdk-sqs/client_api.rb +252 -58
- data/lib/aws-sdk-sqs/endpoint_provider.rb +2 -2
- data/lib/aws-sdk-sqs/errors.rb +251 -0
- data/lib/aws-sdk-sqs/plugins/endpoints.rb +4 -2
- data/lib/aws-sdk-sqs/plugins/md5s.rb +84 -35
- data/lib/aws-sdk-sqs/queue.rb +52 -8
- data/lib/aws-sdk-sqs/queue_poller.rb +31 -0
- data/lib/aws-sdk-sqs/types.rb +346 -25
- data/lib/aws-sdk-sqs.rb +1 -1
- data/sig/client.rbs +364 -0
- data/sig/errors.rbs +98 -0
- data/sig/message.rbs +73 -0
- data/sig/queue.rbs +164 -0
- data/sig/resource.rbs +105 -0
- data/sig/types.rbs +472 -0
- data/sig/waiters.rbs +13 -0
- metadata +16 -9
@@ -32,8 +32,8 @@ module Aws::SQS
|
|
32
32
|
raise ArgumentError, "FIPS and DualStack are enabled, but this partition does not support one or both"
|
33
33
|
end
|
34
34
|
if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
|
35
|
-
if Aws::Endpoints::Matchers.boolean_equals?(
|
36
|
-
if Aws::Endpoints::Matchers.string_equals?(
|
35
|
+
if Aws::Endpoints::Matchers.boolean_equals?(Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"), true)
|
36
|
+
if Aws::Endpoints::Matchers.string_equals?(Aws::Endpoints::Matchers.attr(partition_result, "name"), "aws-us-gov")
|
37
37
|
return Aws::Endpoints::Endpoint.new(url: "https://sqs.#{region}.amazonaws.com", headers: {}, properties: {})
|
38
38
|
end
|
39
39
|
return Aws::Endpoints::Endpoint.new(url: "https://sqs-fips.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
|
data/lib/aws-sdk-sqs/errors.rb
CHANGED
@@ -30,10 +30,20 @@ module Aws::SQS
|
|
30
30
|
# * {BatchEntryIdsNotDistinct}
|
31
31
|
# * {BatchRequestTooLong}
|
32
32
|
# * {EmptyBatchRequest}
|
33
|
+
# * {InvalidAddress}
|
33
34
|
# * {InvalidAttributeName}
|
35
|
+
# * {InvalidAttributeValue}
|
34
36
|
# * {InvalidBatchEntryId}
|
35
37
|
# * {InvalidIdFormat}
|
36
38
|
# * {InvalidMessageContents}
|
39
|
+
# * {InvalidSecurity}
|
40
|
+
# * {KmsAccessDenied}
|
41
|
+
# * {KmsDisabled}
|
42
|
+
# * {KmsInvalidKeyUsage}
|
43
|
+
# * {KmsInvalidState}
|
44
|
+
# * {KmsNotFound}
|
45
|
+
# * {KmsOptInRequired}
|
46
|
+
# * {KmsThrottled}
|
37
47
|
# * {MessageNotInflight}
|
38
48
|
# * {OverLimit}
|
39
49
|
# * {PurgeQueueInProgress}
|
@@ -41,6 +51,7 @@ module Aws::SQS
|
|
41
51
|
# * {QueueDoesNotExist}
|
42
52
|
# * {QueueNameExists}
|
43
53
|
# * {ReceiptHandleIsInvalid}
|
54
|
+
# * {RequestThrottled}
|
44
55
|
# * {ResourceNotFoundException}
|
45
56
|
# * {TooManyEntriesInBatchRequest}
|
46
57
|
# * {UnsupportedOperation}
|
@@ -59,6 +70,11 @@ module Aws::SQS
|
|
59
70
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
60
71
|
super(context, message, data)
|
61
72
|
end
|
73
|
+
|
74
|
+
# @return [String]
|
75
|
+
def message
|
76
|
+
@message || @data[:message]
|
77
|
+
end
|
62
78
|
end
|
63
79
|
|
64
80
|
class BatchRequestTooLong < ServiceError
|
@@ -69,6 +85,11 @@ module Aws::SQS
|
|
69
85
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
70
86
|
super(context, message, data)
|
71
87
|
end
|
88
|
+
|
89
|
+
# @return [String]
|
90
|
+
def message
|
91
|
+
@message || @data[:message]
|
92
|
+
end
|
72
93
|
end
|
73
94
|
|
74
95
|
class EmptyBatchRequest < ServiceError
|
@@ -79,6 +100,26 @@ module Aws::SQS
|
|
79
100
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
80
101
|
super(context, message, data)
|
81
102
|
end
|
103
|
+
|
104
|
+
# @return [String]
|
105
|
+
def message
|
106
|
+
@message || @data[:message]
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
class InvalidAddress < ServiceError
|
111
|
+
|
112
|
+
# @param [Seahorse::Client::RequestContext] context
|
113
|
+
# @param [String] message
|
114
|
+
# @param [Aws::SQS::Types::InvalidAddress] data
|
115
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
116
|
+
super(context, message, data)
|
117
|
+
end
|
118
|
+
|
119
|
+
# @return [String]
|
120
|
+
def message
|
121
|
+
@message || @data[:message]
|
122
|
+
end
|
82
123
|
end
|
83
124
|
|
84
125
|
class InvalidAttributeName < ServiceError
|
@@ -89,6 +130,26 @@ module Aws::SQS
|
|
89
130
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
90
131
|
super(context, message, data)
|
91
132
|
end
|
133
|
+
|
134
|
+
# @return [String]
|
135
|
+
def message
|
136
|
+
@message || @data[:message]
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
class InvalidAttributeValue < ServiceError
|
141
|
+
|
142
|
+
# @param [Seahorse::Client::RequestContext] context
|
143
|
+
# @param [String] message
|
144
|
+
# @param [Aws::SQS::Types::InvalidAttributeValue] data
|
145
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
146
|
+
super(context, message, data)
|
147
|
+
end
|
148
|
+
|
149
|
+
# @return [String]
|
150
|
+
def message
|
151
|
+
@message || @data[:message]
|
152
|
+
end
|
92
153
|
end
|
93
154
|
|
94
155
|
class InvalidBatchEntryId < ServiceError
|
@@ -99,6 +160,11 @@ module Aws::SQS
|
|
99
160
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
100
161
|
super(context, message, data)
|
101
162
|
end
|
163
|
+
|
164
|
+
# @return [String]
|
165
|
+
def message
|
166
|
+
@message || @data[:message]
|
167
|
+
end
|
102
168
|
end
|
103
169
|
|
104
170
|
class InvalidIdFormat < ServiceError
|
@@ -119,6 +185,131 @@ module Aws::SQS
|
|
119
185
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
120
186
|
super(context, message, data)
|
121
187
|
end
|
188
|
+
|
189
|
+
# @return [String]
|
190
|
+
def message
|
191
|
+
@message || @data[:message]
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
class InvalidSecurity < ServiceError
|
196
|
+
|
197
|
+
# @param [Seahorse::Client::RequestContext] context
|
198
|
+
# @param [String] message
|
199
|
+
# @param [Aws::SQS::Types::InvalidSecurity] data
|
200
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
201
|
+
super(context, message, data)
|
202
|
+
end
|
203
|
+
|
204
|
+
# @return [String]
|
205
|
+
def message
|
206
|
+
@message || @data[:message]
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
class KmsAccessDenied < ServiceError
|
211
|
+
|
212
|
+
# @param [Seahorse::Client::RequestContext] context
|
213
|
+
# @param [String] message
|
214
|
+
# @param [Aws::SQS::Types::KmsAccessDenied] data
|
215
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
216
|
+
super(context, message, data)
|
217
|
+
end
|
218
|
+
|
219
|
+
# @return [String]
|
220
|
+
def message
|
221
|
+
@message || @data[:message]
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
class KmsDisabled < ServiceError
|
226
|
+
|
227
|
+
# @param [Seahorse::Client::RequestContext] context
|
228
|
+
# @param [String] message
|
229
|
+
# @param [Aws::SQS::Types::KmsDisabled] data
|
230
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
231
|
+
super(context, message, data)
|
232
|
+
end
|
233
|
+
|
234
|
+
# @return [String]
|
235
|
+
def message
|
236
|
+
@message || @data[:message]
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
class KmsInvalidKeyUsage < ServiceError
|
241
|
+
|
242
|
+
# @param [Seahorse::Client::RequestContext] context
|
243
|
+
# @param [String] message
|
244
|
+
# @param [Aws::SQS::Types::KmsInvalidKeyUsage] data
|
245
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
246
|
+
super(context, message, data)
|
247
|
+
end
|
248
|
+
|
249
|
+
# @return [String]
|
250
|
+
def message
|
251
|
+
@message || @data[:message]
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
class KmsInvalidState < ServiceError
|
256
|
+
|
257
|
+
# @param [Seahorse::Client::RequestContext] context
|
258
|
+
# @param [String] message
|
259
|
+
# @param [Aws::SQS::Types::KmsInvalidState] data
|
260
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
261
|
+
super(context, message, data)
|
262
|
+
end
|
263
|
+
|
264
|
+
# @return [String]
|
265
|
+
def message
|
266
|
+
@message || @data[:message]
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
class KmsNotFound < ServiceError
|
271
|
+
|
272
|
+
# @param [Seahorse::Client::RequestContext] context
|
273
|
+
# @param [String] message
|
274
|
+
# @param [Aws::SQS::Types::KmsNotFound] data
|
275
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
276
|
+
super(context, message, data)
|
277
|
+
end
|
278
|
+
|
279
|
+
# @return [String]
|
280
|
+
def message
|
281
|
+
@message || @data[:message]
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
class KmsOptInRequired < ServiceError
|
286
|
+
|
287
|
+
# @param [Seahorse::Client::RequestContext] context
|
288
|
+
# @param [String] message
|
289
|
+
# @param [Aws::SQS::Types::KmsOptInRequired] data
|
290
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
291
|
+
super(context, message, data)
|
292
|
+
end
|
293
|
+
|
294
|
+
# @return [String]
|
295
|
+
def message
|
296
|
+
@message || @data[:message]
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
class KmsThrottled < ServiceError
|
301
|
+
|
302
|
+
# @param [Seahorse::Client::RequestContext] context
|
303
|
+
# @param [String] message
|
304
|
+
# @param [Aws::SQS::Types::KmsThrottled] data
|
305
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
306
|
+
super(context, message, data)
|
307
|
+
end
|
308
|
+
|
309
|
+
# @return [String]
|
310
|
+
def message
|
311
|
+
@message || @data[:message]
|
312
|
+
end
|
122
313
|
end
|
123
314
|
|
124
315
|
class MessageNotInflight < ServiceError
|
@@ -139,6 +330,11 @@ module Aws::SQS
|
|
139
330
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
140
331
|
super(context, message, data)
|
141
332
|
end
|
333
|
+
|
334
|
+
# @return [String]
|
335
|
+
def message
|
336
|
+
@message || @data[:message]
|
337
|
+
end
|
142
338
|
end
|
143
339
|
|
144
340
|
class PurgeQueueInProgress < ServiceError
|
@@ -149,6 +345,11 @@ module Aws::SQS
|
|
149
345
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
150
346
|
super(context, message, data)
|
151
347
|
end
|
348
|
+
|
349
|
+
# @return [String]
|
350
|
+
def message
|
351
|
+
@message || @data[:message]
|
352
|
+
end
|
152
353
|
end
|
153
354
|
|
154
355
|
class QueueDeletedRecently < ServiceError
|
@@ -159,6 +360,11 @@ module Aws::SQS
|
|
159
360
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
160
361
|
super(context, message, data)
|
161
362
|
end
|
363
|
+
|
364
|
+
# @return [String]
|
365
|
+
def message
|
366
|
+
@message || @data[:message]
|
367
|
+
end
|
162
368
|
end
|
163
369
|
|
164
370
|
class QueueDoesNotExist < ServiceError
|
@@ -169,6 +375,11 @@ module Aws::SQS
|
|
169
375
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
170
376
|
super(context, message, data)
|
171
377
|
end
|
378
|
+
|
379
|
+
# @return [String]
|
380
|
+
def message
|
381
|
+
@message || @data[:message]
|
382
|
+
end
|
172
383
|
end
|
173
384
|
|
174
385
|
class QueueNameExists < ServiceError
|
@@ -179,6 +390,11 @@ module Aws::SQS
|
|
179
390
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
180
391
|
super(context, message, data)
|
181
392
|
end
|
393
|
+
|
394
|
+
# @return [String]
|
395
|
+
def message
|
396
|
+
@message || @data[:message]
|
397
|
+
end
|
182
398
|
end
|
183
399
|
|
184
400
|
class ReceiptHandleIsInvalid < ServiceError
|
@@ -189,6 +405,26 @@ module Aws::SQS
|
|
189
405
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
190
406
|
super(context, message, data)
|
191
407
|
end
|
408
|
+
|
409
|
+
# @return [String]
|
410
|
+
def message
|
411
|
+
@message || @data[:message]
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
415
|
+
class RequestThrottled < ServiceError
|
416
|
+
|
417
|
+
# @param [Seahorse::Client::RequestContext] context
|
418
|
+
# @param [String] message
|
419
|
+
# @param [Aws::SQS::Types::RequestThrottled] data
|
420
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
421
|
+
super(context, message, data)
|
422
|
+
end
|
423
|
+
|
424
|
+
# @return [String]
|
425
|
+
def message
|
426
|
+
@message || @data[:message]
|
427
|
+
end
|
192
428
|
end
|
193
429
|
|
194
430
|
class ResourceNotFoundException < ServiceError
|
@@ -199,6 +435,11 @@ module Aws::SQS
|
|
199
435
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
200
436
|
super(context, message, data)
|
201
437
|
end
|
438
|
+
|
439
|
+
# @return [String]
|
440
|
+
def message
|
441
|
+
@message || @data[:message]
|
442
|
+
end
|
202
443
|
end
|
203
444
|
|
204
445
|
class TooManyEntriesInBatchRequest < ServiceError
|
@@ -209,6 +450,11 @@ module Aws::SQS
|
|
209
450
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
210
451
|
super(context, message, data)
|
211
452
|
end
|
453
|
+
|
454
|
+
# @return [String]
|
455
|
+
def message
|
456
|
+
@message || @data[:message]
|
457
|
+
end
|
212
458
|
end
|
213
459
|
|
214
460
|
class UnsupportedOperation < ServiceError
|
@@ -219,6 +465,11 @@ module Aws::SQS
|
|
219
465
|
def initialize(context, message, data = Aws::EmptyStructure.new)
|
220
466
|
super(context, message, data)
|
221
467
|
end
|
468
|
+
|
469
|
+
# @return [String]
|
470
|
+
def message
|
471
|
+
@message || @data[:message]
|
472
|
+
end
|
222
473
|
end
|
223
474
|
|
224
475
|
end
|
@@ -14,6 +14,7 @@ module Aws::SQS
|
|
14
14
|
option(
|
15
15
|
:endpoint_provider,
|
16
16
|
doc_type: 'Aws::SQS::EndpointProvider',
|
17
|
+
rbs_type: 'untyped',
|
17
18
|
docstring: 'The endpoint provider used to resolve endpoints. Any '\
|
18
19
|
'object that responds to `#resolve_endpoint(parameters)` '\
|
19
20
|
'where `parameters` is a Struct similar to '\
|
@@ -25,16 +26,17 @@ module Aws::SQS
|
|
25
26
|
# @api private
|
26
27
|
class Handler < Seahorse::Client::Handler
|
27
28
|
def call(context)
|
28
|
-
# If endpoint was discovered, do not resolve or apply the endpoint.
|
29
29
|
unless context[:discovered_endpoint]
|
30
30
|
params = parameters_for_operation(context)
|
31
31
|
endpoint = context.config.endpoint_provider.resolve_endpoint(params)
|
32
32
|
|
33
33
|
context.http_request.endpoint = endpoint.url
|
34
34
|
apply_endpoint_headers(context, endpoint.headers)
|
35
|
+
|
36
|
+
context[:endpoint_params] = params
|
37
|
+
context[:endpoint_properties] = endpoint.properties
|
35
38
|
end
|
36
39
|
|
37
|
-
context[:endpoint_params] = params
|
38
40
|
context[:auth_scheme] =
|
39
41
|
Aws::Endpoints.resolve_auth_scheme(context, endpoint)
|
40
42
|
|
@@ -6,7 +6,6 @@ module Aws
|
|
6
6
|
module SQS
|
7
7
|
module Plugins
|
8
8
|
class Md5s < Seahorse::Client::Plugin
|
9
|
-
|
10
9
|
# @api private
|
11
10
|
class Handler < Seahorse::Client::Handler
|
12
11
|
def call(context)
|
@@ -26,16 +25,17 @@ module Aws
|
|
26
25
|
'String' => 1,
|
27
26
|
'Binary' => 2,
|
28
27
|
'Number' => 1
|
29
|
-
}
|
28
|
+
}.freeze
|
30
29
|
|
31
|
-
DATA_TYPE = /\A(String|Binary|Number)(\..+)?\z
|
30
|
+
DATA_TYPE = /\A(String|Binary|Number)(\..+)?\z/.freeze
|
32
31
|
|
33
32
|
NORMALIZED_ENCODING = Encoding::UTF_8
|
34
33
|
|
35
34
|
def validate_send_message(context, response)
|
36
35
|
body = context.params[:message_body]
|
37
36
|
attributes = context.params[:message_attributes]
|
38
|
-
|
37
|
+
system_attributes = context.params[:message_system_attributes]
|
38
|
+
validate_single_message(body, attributes, system_attributes, response)
|
39
39
|
end
|
40
40
|
|
41
41
|
def validate_send_message_batch(context, response)
|
@@ -43,63 +43,87 @@ module Aws
|
|
43
43
|
id = entry[:id]
|
44
44
|
body = entry[:message_body]
|
45
45
|
attributes = entry[:message_attributes]
|
46
|
+
system_attributes = entry[:message_system_attributes]
|
46
47
|
message_response = response.successful.select { |r| r.id == id }[0]
|
47
48
|
unless message_response.nil?
|
48
|
-
validate_single_message(body, attributes, message_response)
|
49
|
+
validate_single_message(body, attributes, system_attributes, message_response)
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
53
|
-
def validate_single_message(body, attributes, response)
|
54
|
+
def validate_single_message(body, attributes, system_attributes, response)
|
54
55
|
validate_body(body, response)
|
55
56
|
unless attributes.nil? || attributes.empty?
|
56
57
|
validate_attributes(attributes, response)
|
57
58
|
end
|
59
|
+
unless system_attributes.nil? || system_attributes.empty?
|
60
|
+
validate_system_attributes(system_attributes, response)
|
61
|
+
end
|
58
62
|
end
|
59
63
|
|
60
64
|
def validate_body(body, response)
|
61
65
|
calculated_md5 = md5_of_message_body(body)
|
62
66
|
returned_md5 = response.md5_of_message_body
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
return unless calculated_md5 != returned_md5
|
68
|
+
|
69
|
+
error_message = mismatch_error_message(
|
70
|
+
'message body',
|
71
|
+
calculated_md5,
|
72
|
+
returned_md5,
|
73
|
+
response
|
74
|
+
)
|
75
|
+
raise Aws::Errors::ChecksumError, error_message
|
71
76
|
end
|
72
77
|
|
73
78
|
def validate_attributes(attributes, response)
|
74
79
|
calculated_md5 = md5_of_message_attributes(attributes)
|
75
80
|
returned_md5 = response.md5_of_message_attributes
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
return unless returned_md5 != calculated_md5
|
82
|
+
|
83
|
+
error_message = mismatch_error_message(
|
84
|
+
'message attributes',
|
85
|
+
calculated_md5,
|
86
|
+
returned_md5,
|
87
|
+
response
|
88
|
+
)
|
89
|
+
raise Aws::Errors::ChecksumError, error_message
|
90
|
+
end
|
91
|
+
|
92
|
+
def validate_system_attributes(system_attributes, response)
|
93
|
+
calculated_md5 = md5_of_message_system_attributes(system_attributes)
|
94
|
+
returned_md5 = response.md5_of_message_system_attributes
|
95
|
+
return unless returned_md5 != calculated_md5
|
96
|
+
|
97
|
+
error_message = mismatch_error_message(
|
98
|
+
'message system attributes',
|
99
|
+
calculated_md5,
|
100
|
+
returned_md5,
|
101
|
+
response
|
102
|
+
)
|
103
|
+
raise Aws::Errors::ChecksumError, error_message
|
84
104
|
end
|
85
105
|
|
86
106
|
def md5_of_message_body(message_body)
|
87
107
|
OpenSSL::Digest::MD5.hexdigest(message_body)
|
88
108
|
end
|
89
109
|
|
110
|
+
# MD5 of Message Attributes and System Attributes are effectively
|
111
|
+
# the same calculation. However, keeping these as two methods because
|
112
|
+
# they are modeled as two different shapes.
|
113
|
+
###
|
90
114
|
def md5_of_message_attributes(message_attributes)
|
91
|
-
encoded = {
|
115
|
+
encoded = {}
|
92
116
|
message_attributes.each do |name, attribute|
|
93
117
|
name = name.to_s
|
94
118
|
encoded[name] = String.new
|
95
119
|
data_type_without_label = DATA_TYPE.match(attribute[:data_type])[1]
|
96
120
|
encoded[name] << encode_length_and_bytes(name) <<
|
97
|
-
|
98
|
-
|
121
|
+
encode_length_and_bytes(attribute[:data_type]) <<
|
122
|
+
[TRANSPORT_TYPE_ENCODINGS[data_type_without_label]].pack('C')
|
99
123
|
|
100
|
-
if attribute[:string_value]
|
124
|
+
if !attribute[:string_value].nil?
|
101
125
|
encoded[name] << encode_length_and_string(attribute[:string_value])
|
102
|
-
elsif attribute[:binary_value]
|
126
|
+
elsif !attribute[:binary_value].nil?
|
103
127
|
encoded[name] << encode_length_and_bytes(attribute[:binary_value])
|
104
128
|
end
|
105
129
|
end
|
@@ -110,6 +134,30 @@ module Aws
|
|
110
134
|
OpenSSL::Digest::MD5.hexdigest(buffer)
|
111
135
|
end
|
112
136
|
|
137
|
+
def md5_of_message_system_attributes(message_system_attributes)
|
138
|
+
encoded = {}
|
139
|
+
message_system_attributes.each do |name, attribute|
|
140
|
+
name = name.to_s
|
141
|
+
encoded[name] = String.new
|
142
|
+
data_type_without_label = DATA_TYPE.match(attribute[:data_type])[1]
|
143
|
+
encoded[name] << encode_length_and_bytes(name) <<
|
144
|
+
encode_length_and_bytes(attribute[:data_type]) <<
|
145
|
+
[TRANSPORT_TYPE_ENCODINGS[data_type_without_label]].pack('C')
|
146
|
+
|
147
|
+
if !attribute[:string_value].nil?
|
148
|
+
encoded[name] << encode_length_and_string(attribute[:string_value])
|
149
|
+
elsif !attribute[:binary_value].nil?
|
150
|
+
encoded[name] << encode_length_and_bytes(attribute[:binary_value])
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
buffer = encoded.keys.sort.reduce(String.new) do |string, name|
|
155
|
+
string << encoded[name]
|
156
|
+
end
|
157
|
+
OpenSSL::Digest::MD5.hexdigest(buffer)
|
158
|
+
end
|
159
|
+
###
|
160
|
+
|
113
161
|
def encode_length_and_string(string)
|
114
162
|
string = String.new(string)
|
115
163
|
string.encode!(NORMALIZED_ENCODING)
|
@@ -117,7 +165,7 @@ module Aws
|
|
117
165
|
end
|
118
166
|
|
119
167
|
def encode_length_and_bytes(bytes)
|
120
|
-
[bytes.bytesize, bytes].pack('L>a*'
|
168
|
+
[bytes.bytesize, bytes].pack('L>a*')
|
121
169
|
end
|
122
170
|
|
123
171
|
def mismatch_error_message(section, local_md5, returned_md5, response)
|
@@ -154,13 +202,14 @@ not match.
|
|
154
202
|
end
|
155
203
|
|
156
204
|
def add_handlers(handlers, config)
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
205
|
+
return unless config.verify_checksums
|
206
|
+
|
207
|
+
handlers.add(
|
208
|
+
Handler,
|
209
|
+
priority: 10,
|
210
|
+
step: :validate,
|
211
|
+
operations: %i[send_message send_message_batch]
|
212
|
+
)
|
164
213
|
end
|
165
214
|
end
|
166
215
|
end
|
data/lib/aws-sdk-sqs/queue.rb
CHANGED
@@ -207,6 +207,7 @@ module Aws::SQS
|
|
207
207
|
#
|
208
208
|
# message = queue.receive_messages({
|
209
209
|
# attribute_names: ["All"], # accepts All, Policy, VisibilityTimeout, MaximumMessageSize, MessageRetentionPeriod, ApproximateNumberOfMessages, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, LastModifiedTimestamp, QueueArn, ApproximateNumberOfMessagesDelayed, DelaySeconds, ReceiveMessageWaitTimeSeconds, RedrivePolicy, FifoQueue, ContentBasedDeduplication, KmsMasterKeyId, KmsDataKeyReusePeriodSeconds, DeduplicationScope, FifoThroughputLimit, RedriveAllowPolicy, SqsManagedSseEnabled
|
210
|
+
# message_system_attribute_names: ["All"], # accepts All, SenderId, SentTimestamp, ApproximateReceiveCount, ApproximateFirstReceiveTimestamp, SequenceNumber, MessageDeduplicationId, MessageGroupId, AWSTraceHeader, DeadLetterQueueSourceArn
|
210
211
|
# message_attribute_names: ["MessageAttributeName"],
|
211
212
|
# max_number_of_messages: 1,
|
212
213
|
# visibility_timeout: 1,
|
@@ -215,6 +216,53 @@ module Aws::SQS
|
|
215
216
|
# })
|
216
217
|
# @param [Hash] options ({})
|
217
218
|
# @option options [Array<String>] :attribute_names
|
219
|
+
# This parameter has been deprecated but will be supported for backward
|
220
|
+
# compatibility. To provide attribute names, you are encouraged to use
|
221
|
+
# `MessageSystemAttributeNames`.
|
222
|
+
#
|
223
|
+
# A list of attributes that need to be returned along with each message.
|
224
|
+
# These attributes include:
|
225
|
+
#
|
226
|
+
# * `All` – Returns all values.
|
227
|
+
#
|
228
|
+
# * `ApproximateFirstReceiveTimestamp` – Returns the time the message
|
229
|
+
# was first received from the queue ([epoch time][1] in milliseconds).
|
230
|
+
#
|
231
|
+
# * `ApproximateReceiveCount` – Returns the number of times a message
|
232
|
+
# has been received across all queues but not deleted.
|
233
|
+
#
|
234
|
+
# * `AWSTraceHeader` – Returns the X-Ray trace header string.
|
235
|
+
#
|
236
|
+
# * `SenderId`
|
237
|
+
#
|
238
|
+
# * For a user, returns the user ID, for example
|
239
|
+
# `ABCDEFGHI1JKLMNOPQ23R`.
|
240
|
+
#
|
241
|
+
# * For an IAM role, returns the IAM role ID, for example
|
242
|
+
# `ABCDE1F2GH3I4JK5LMNOP:i-a123b456`.
|
243
|
+
#
|
244
|
+
# * `SentTimestamp` – Returns the time the message was sent to the queue
|
245
|
+
# ([epoch time][1] in milliseconds).
|
246
|
+
#
|
247
|
+
# * `SqsManagedSseEnabled` – Enables server-side queue encryption using
|
248
|
+
# SQS owned encryption keys. Only one server-side encryption option is
|
249
|
+
# supported per queue (for example, [SSE-KMS][2] or [SSE-SQS][3]).
|
250
|
+
#
|
251
|
+
# * `MessageDeduplicationId` – Returns the value provided by the
|
252
|
+
# producer that calls the ` SendMessage ` action.
|
253
|
+
#
|
254
|
+
# * `MessageGroupId` – Returns the value provided by the producer that
|
255
|
+
# calls the ` SendMessage ` action. Messages with the same
|
256
|
+
# `MessageGroupId` are returned in sequence.
|
257
|
+
#
|
258
|
+
# * `SequenceNumber` – Returns the value provided by Amazon SQS.
|
259
|
+
#
|
260
|
+
#
|
261
|
+
#
|
262
|
+
# [1]: http://en.wikipedia.org/wiki/Unix_time
|
263
|
+
# [2]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sse-existing-queue.html
|
264
|
+
# [3]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sqs-sse-queue.html
|
265
|
+
# @option options [Array<String>] :message_system_attribute_names
|
218
266
|
# A list of attributes that need to be returned along with each message.
|
219
267
|
# These attributes include:
|
220
268
|
#
|
@@ -290,8 +338,8 @@ module Aws::SQS
|
|
290
338
|
# The duration (in seconds) for which the call waits for a message to
|
291
339
|
# arrive in the queue before returning. If a message is available, the
|
292
340
|
# call returns sooner than `WaitTimeSeconds`. If no messages are
|
293
|
-
# available and the wait time expires, the call
|
294
|
-
#
|
341
|
+
# available and the wait time expires, the call does not return a
|
342
|
+
# message list.
|
295
343
|
#
|
296
344
|
# To avoid HTTP errors, ensure that the HTTP response timeout for
|
297
345
|
# `ReceiveMessage` requests is longer than the `WaitTimeSeconds`
|
@@ -319,10 +367,6 @@ module Aws::SQS
|
|
319
367
|
# * When you set `FifoQueue`, a caller of the `ReceiveMessage` action
|
320
368
|
# can provide a `ReceiveRequestAttemptId` explicitly.
|
321
369
|
#
|
322
|
-
# * If a caller of the `ReceiveMessage` action doesn't provide a
|
323
|
-
# `ReceiveRequestAttemptId`, Amazon SQS generates a
|
324
|
-
# `ReceiveRequestAttemptId`.
|
325
|
-
#
|
326
370
|
# * It is possible to retry the `ReceiveMessage` action with the same
|
327
371
|
# `ReceiveRequestAttemptId` if none of the messages have been modified
|
328
372
|
# (deleted or had their visibility changes).
|
@@ -555,8 +599,8 @@ module Aws::SQS
|
|
555
599
|
# `MessageGroupId` values. For each `MessageGroupId`, the messages are
|
556
600
|
# sorted by time sent. The caller can't specify a `MessageGroupId`.
|
557
601
|
#
|
558
|
-
# The length of `MessageGroupId` is 128 characters. Valid
|
559
|
-
# alphanumeric characters and punctuation ``
|
602
|
+
# The maximum length of `MessageGroupId` is 128 characters. Valid
|
603
|
+
# values: alphanumeric characters and punctuation ``
|
560
604
|
# (!"#$%&'()*+,-./:;<=>?@[\]^_`\{|\}~) ``.
|
561
605
|
#
|
562
606
|
# For best practices of using `MessageGroupId`, see [Using the
|