aws-sdk-sqs 1.9.0 → 1.70.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,476 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # WARNING ABOUT GENERATED CODE
2
4
  #
3
5
  # This file is generated. See the contributing guide for more information:
4
- # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
5
7
  #
6
8
  # WARNING ABOUT GENERATED CODE
7
9
 
8
10
  module Aws::SQS
11
+
12
+ # When SQS returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::SQS::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all SQS errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::SQS::Errors::ServiceError
20
+ # # rescues all SQS API errors
21
+ # end
22
+ #
23
+ #
24
+ # ## Request Context
25
+ # ServiceError objects have a {Aws::Errors::ServiceError#context #context} method that returns
26
+ # information about the request that generated the error.
27
+ # See {Seahorse::Client::RequestContext} for more information.
28
+ #
29
+ # ## Error Classes
30
+ # * {BatchEntryIdsNotDistinct}
31
+ # * {BatchRequestTooLong}
32
+ # * {EmptyBatchRequest}
33
+ # * {InvalidAddress}
34
+ # * {InvalidAttributeName}
35
+ # * {InvalidAttributeValue}
36
+ # * {InvalidBatchEntryId}
37
+ # * {InvalidIdFormat}
38
+ # * {InvalidMessageContents}
39
+ # * {InvalidSecurity}
40
+ # * {KmsAccessDenied}
41
+ # * {KmsDisabled}
42
+ # * {KmsInvalidKeyUsage}
43
+ # * {KmsInvalidState}
44
+ # * {KmsNotFound}
45
+ # * {KmsOptInRequired}
46
+ # * {KmsThrottled}
47
+ # * {MessageNotInflight}
48
+ # * {OverLimit}
49
+ # * {PurgeQueueInProgress}
50
+ # * {QueueDeletedRecently}
51
+ # * {QueueDoesNotExist}
52
+ # * {QueueNameExists}
53
+ # * {ReceiptHandleIsInvalid}
54
+ # * {RequestThrottled}
55
+ # * {ResourceNotFoundException}
56
+ # * {TooManyEntriesInBatchRequest}
57
+ # * {UnsupportedOperation}
58
+ #
59
+ # Additionally, error classes are dynamically generated for service errors based on the error code
60
+ # if they are not defined above.
9
61
  module Errors
10
62
 
11
63
  extend Aws::Errors::DynamicErrors
12
64
 
65
+ class BatchEntryIdsNotDistinct < ServiceError
66
+
67
+ # @param [Seahorse::Client::RequestContext] context
68
+ # @param [String] message
69
+ # @param [Aws::SQS::Types::BatchEntryIdsNotDistinct] data
70
+ def initialize(context, message, data = Aws::EmptyStructure.new)
71
+ super(context, message, data)
72
+ end
73
+
74
+ # @return [String]
75
+ def message
76
+ @message || @data[:message]
77
+ end
78
+ end
79
+
80
+ class BatchRequestTooLong < ServiceError
81
+
82
+ # @param [Seahorse::Client::RequestContext] context
83
+ # @param [String] message
84
+ # @param [Aws::SQS::Types::BatchRequestTooLong] data
85
+ def initialize(context, message, data = Aws::EmptyStructure.new)
86
+ super(context, message, data)
87
+ end
88
+
89
+ # @return [String]
90
+ def message
91
+ @message || @data[:message]
92
+ end
93
+ end
94
+
95
+ class EmptyBatchRequest < ServiceError
96
+
97
+ # @param [Seahorse::Client::RequestContext] context
98
+ # @param [String] message
99
+ # @param [Aws::SQS::Types::EmptyBatchRequest] data
100
+ def initialize(context, message, data = Aws::EmptyStructure.new)
101
+ super(context, message, data)
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
123
+ end
124
+
125
+ class InvalidAttributeName < ServiceError
126
+
127
+ # @param [Seahorse::Client::RequestContext] context
128
+ # @param [String] message
129
+ # @param [Aws::SQS::Types::InvalidAttributeName] data
130
+ def initialize(context, message, data = Aws::EmptyStructure.new)
131
+ super(context, message, data)
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
153
+ end
154
+
155
+ class InvalidBatchEntryId < ServiceError
156
+
157
+ # @param [Seahorse::Client::RequestContext] context
158
+ # @param [String] message
159
+ # @param [Aws::SQS::Types::InvalidBatchEntryId] data
160
+ def initialize(context, message, data = Aws::EmptyStructure.new)
161
+ super(context, message, data)
162
+ end
163
+
164
+ # @return [String]
165
+ def message
166
+ @message || @data[:message]
167
+ end
168
+ end
169
+
170
+ class InvalidIdFormat < ServiceError
171
+
172
+ # @param [Seahorse::Client::RequestContext] context
173
+ # @param [String] message
174
+ # @param [Aws::SQS::Types::InvalidIdFormat] data
175
+ def initialize(context, message, data = Aws::EmptyStructure.new)
176
+ super(context, message, data)
177
+ end
178
+ end
179
+
180
+ class InvalidMessageContents < ServiceError
181
+
182
+ # @param [Seahorse::Client::RequestContext] context
183
+ # @param [String] message
184
+ # @param [Aws::SQS::Types::InvalidMessageContents] data
185
+ def initialize(context, message, data = Aws::EmptyStructure.new)
186
+ super(context, message, data)
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
313
+ end
314
+
315
+ class MessageNotInflight < ServiceError
316
+
317
+ # @param [Seahorse::Client::RequestContext] context
318
+ # @param [String] message
319
+ # @param [Aws::SQS::Types::MessageNotInflight] data
320
+ def initialize(context, message, data = Aws::EmptyStructure.new)
321
+ super(context, message, data)
322
+ end
323
+ end
324
+
325
+ class OverLimit < ServiceError
326
+
327
+ # @param [Seahorse::Client::RequestContext] context
328
+ # @param [String] message
329
+ # @param [Aws::SQS::Types::OverLimit] data
330
+ def initialize(context, message, data = Aws::EmptyStructure.new)
331
+ super(context, message, data)
332
+ end
333
+
334
+ # @return [String]
335
+ def message
336
+ @message || @data[:message]
337
+ end
338
+ end
339
+
340
+ class PurgeQueueInProgress < ServiceError
341
+
342
+ # @param [Seahorse::Client::RequestContext] context
343
+ # @param [String] message
344
+ # @param [Aws::SQS::Types::PurgeQueueInProgress] data
345
+ def initialize(context, message, data = Aws::EmptyStructure.new)
346
+ super(context, message, data)
347
+ end
348
+
349
+ # @return [String]
350
+ def message
351
+ @message || @data[:message]
352
+ end
353
+ end
354
+
355
+ class QueueDeletedRecently < ServiceError
356
+
357
+ # @param [Seahorse::Client::RequestContext] context
358
+ # @param [String] message
359
+ # @param [Aws::SQS::Types::QueueDeletedRecently] data
360
+ def initialize(context, message, data = Aws::EmptyStructure.new)
361
+ super(context, message, data)
362
+ end
363
+
364
+ # @return [String]
365
+ def message
366
+ @message || @data[:message]
367
+ end
368
+ end
369
+
370
+ class QueueDoesNotExist < ServiceError
371
+
372
+ # @param [Seahorse::Client::RequestContext] context
373
+ # @param [String] message
374
+ # @param [Aws::SQS::Types::QueueDoesNotExist] data
375
+ def initialize(context, message, data = Aws::EmptyStructure.new)
376
+ super(context, message, data)
377
+ end
378
+
379
+ # @return [String]
380
+ def message
381
+ @message || @data[:message]
382
+ end
383
+ end
384
+
385
+ class QueueNameExists < ServiceError
386
+
387
+ # @param [Seahorse::Client::RequestContext] context
388
+ # @param [String] message
389
+ # @param [Aws::SQS::Types::QueueNameExists] data
390
+ def initialize(context, message, data = Aws::EmptyStructure.new)
391
+ super(context, message, data)
392
+ end
393
+
394
+ # @return [String]
395
+ def message
396
+ @message || @data[:message]
397
+ end
398
+ end
399
+
400
+ class ReceiptHandleIsInvalid < ServiceError
401
+
402
+ # @param [Seahorse::Client::RequestContext] context
403
+ # @param [String] message
404
+ # @param [Aws::SQS::Types::ReceiptHandleIsInvalid] data
405
+ def initialize(context, message, data = Aws::EmptyStructure.new)
406
+ super(context, message, data)
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
428
+ end
429
+
430
+ class ResourceNotFoundException < ServiceError
431
+
432
+ # @param [Seahorse::Client::RequestContext] context
433
+ # @param [String] message
434
+ # @param [Aws::SQS::Types::ResourceNotFoundException] data
435
+ def initialize(context, message, data = Aws::EmptyStructure.new)
436
+ super(context, message, data)
437
+ end
438
+
439
+ # @return [String]
440
+ def message
441
+ @message || @data[:message]
442
+ end
443
+ end
444
+
445
+ class TooManyEntriesInBatchRequest < ServiceError
446
+
447
+ # @param [Seahorse::Client::RequestContext] context
448
+ # @param [String] message
449
+ # @param [Aws::SQS::Types::TooManyEntriesInBatchRequest] data
450
+ def initialize(context, message, data = Aws::EmptyStructure.new)
451
+ super(context, message, data)
452
+ end
453
+
454
+ # @return [String]
455
+ def message
456
+ @message || @data[:message]
457
+ end
458
+ end
459
+
460
+ class UnsupportedOperation < ServiceError
461
+
462
+ # @param [Seahorse::Client::RequestContext] context
463
+ # @param [String] message
464
+ # @param [Aws::SQS::Types::UnsupportedOperation] data
465
+ def initialize(context, message, data = Aws::EmptyStructure.new)
466
+ super(context, message, data)
467
+ end
468
+
469
+ # @return [String]
470
+ def message
471
+ @message || @data[:message]
472
+ end
473
+ end
474
+
13
475
  end
14
476
  end
@@ -1,11 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # WARNING ABOUT GENERATED CODE
2
4
  #
3
5
  # This file is generated. See the contributing guide for more information:
4
- # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
5
7
  #
6
8
  # WARNING ABOUT GENERATED CODE
7
9
 
8
10
  module Aws::SQS
11
+
9
12
  class Message
10
13
 
11
14
  extend Aws::Deprecations
@@ -24,6 +27,7 @@ module Aws::SQS
24
27
  @receipt_handle = extract_receipt_handle(args, options)
25
28
  @data = options.delete(:data)
26
29
  @client = options.delete(:client) || Client.new(options)
30
+ @waiter_block_warned = false
27
31
  end
28
32
 
29
33
  # @!group Read-Only Attributes
@@ -39,7 +43,8 @@ module Aws::SQS
39
43
  end
40
44
 
41
45
  # A unique identifier for the message. A `MessageId`is considered unique
42
- # across all AWS accounts for an extended period of time.
46
+ # across all Amazon Web Services accounts for an extended period of
47
+ # time.
43
48
  # @return [String]
44
49
  def message_id
45
50
  data[:message_id]
@@ -100,12 +105,12 @@ module Aws::SQS
100
105
  end
101
106
 
102
107
  # Each message attribute consists of a `Name`, `Type`, and `Value`. For
103
- # more information, see [Amazon SQS Message Attributes][1] in the
104
- # *Amazon Simple Queue Service Developer Guide*.
108
+ # more information, see [Amazon SQS message attributes][1] in the
109
+ # *Amazon SQS Developer Guide*.
105
110
  #
106
111
  #
107
112
  #
108
- # [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html
113
+ # [1]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-metadata.html#sqs-message-attributes
109
114
  # @return [Hash<String,Types::MessageAttributeValue>]
110
115
  def message_attributes
111
116
  data[:message_attributes]
@@ -151,14 +156,16 @@ module Aws::SQS
151
156
  # @param [Hash] options ({})
152
157
  # @option options [required, Integer] :visibility_timeout
153
158
  # The new value for the message's visibility timeout (in seconds).
154
- # Values values: `0` to `43200`. Maximum: 12 hours.
159
+ # Values range: `0` to `43200`. Maximum: 12 hours.
155
160
  # @return [EmptyStructure]
156
161
  def change_visibility(options = {})
157
162
  options = options.merge(
158
163
  queue_url: @queue_url,
159
164
  receipt_handle: @receipt_handle
160
165
  )
161
- resp = @client.change_message_visibility(options)
166
+ resp = Aws::Plugins::UserAgent.feature('resource') do
167
+ @client.change_message_visibility(options)
168
+ end
162
169
  resp.data
163
170
  end
164
171
 
@@ -172,7 +179,9 @@ module Aws::SQS
172
179
  queue_url: @queue_url,
173
180
  receipt_handle: @receipt_handle
174
181
  )
175
- resp = @client.delete_message(options)
182
+ resp = Aws::Plugins::UserAgent.feature('resource') do
183
+ @client.delete_message(options)
184
+ end
176
185
  resp.data
177
186
  end
178
187
 
@@ -237,7 +246,9 @@ module Aws::SQS
237
246
  receipt_handle: item.receipt_handle
238
247
  }
239
248
  end
240
- batch[0].client.delete_message_batch(params)
249
+ Aws::Plugins::UserAgent.feature('resource') do
250
+ batch[0].client.delete_message_batch(params)
251
+ end
241
252
  end
242
253
  nil
243
254
  end
@@ -0,0 +1,116 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+
11
+ module Aws::SQS
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::SQS::EndpointProvider',
17
+ rbs_type: 'untyped',
18
+ docstring: 'The endpoint provider used to resolve endpoints. Any '\
19
+ 'object that responds to `#resolve_endpoint(parameters)` '\
20
+ 'where `parameters` is a Struct similar to '\
21
+ '`Aws::SQS::EndpointParameters`'
22
+ ) do |cfg|
23
+ Aws::SQS::EndpointProvider.new
24
+ end
25
+
26
+ # @api private
27
+ class Handler < Seahorse::Client::Handler
28
+ def call(context)
29
+ unless context[:discovered_endpoint]
30
+ params = parameters_for_operation(context)
31
+ endpoint = context.config.endpoint_provider.resolve_endpoint(params)
32
+
33
+ context.http_request.endpoint = endpoint.url
34
+ apply_endpoint_headers(context, endpoint.headers)
35
+
36
+ context[:endpoint_params] = params
37
+ context[:endpoint_properties] = endpoint.properties
38
+ end
39
+
40
+ context[:auth_scheme] =
41
+ Aws::Endpoints.resolve_auth_scheme(context, endpoint)
42
+
43
+ @handler.call(context)
44
+ end
45
+
46
+ private
47
+
48
+ def apply_endpoint_headers(context, headers)
49
+ headers.each do |key, values|
50
+ value = values
51
+ .compact
52
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
53
+ .join(',')
54
+
55
+ context.http_request.headers[key] = value
56
+ end
57
+ end
58
+
59
+ def parameters_for_operation(context)
60
+ case context.operation_name
61
+ when :add_permission
62
+ Aws::SQS::Endpoints::AddPermission.build(context)
63
+ when :cancel_message_move_task
64
+ Aws::SQS::Endpoints::CancelMessageMoveTask.build(context)
65
+ when :change_message_visibility
66
+ Aws::SQS::Endpoints::ChangeMessageVisibility.build(context)
67
+ when :change_message_visibility_batch
68
+ Aws::SQS::Endpoints::ChangeMessageVisibilityBatch.build(context)
69
+ when :create_queue
70
+ Aws::SQS::Endpoints::CreateQueue.build(context)
71
+ when :delete_message
72
+ Aws::SQS::Endpoints::DeleteMessage.build(context)
73
+ when :delete_message_batch
74
+ Aws::SQS::Endpoints::DeleteMessageBatch.build(context)
75
+ when :delete_queue
76
+ Aws::SQS::Endpoints::DeleteQueue.build(context)
77
+ when :get_queue_attributes
78
+ Aws::SQS::Endpoints::GetQueueAttributes.build(context)
79
+ when :get_queue_url
80
+ Aws::SQS::Endpoints::GetQueueUrl.build(context)
81
+ when :list_dead_letter_source_queues
82
+ Aws::SQS::Endpoints::ListDeadLetterSourceQueues.build(context)
83
+ when :list_message_move_tasks
84
+ Aws::SQS::Endpoints::ListMessageMoveTasks.build(context)
85
+ when :list_queue_tags
86
+ Aws::SQS::Endpoints::ListQueueTags.build(context)
87
+ when :list_queues
88
+ Aws::SQS::Endpoints::ListQueues.build(context)
89
+ when :purge_queue
90
+ Aws::SQS::Endpoints::PurgeQueue.build(context)
91
+ when :receive_message
92
+ Aws::SQS::Endpoints::ReceiveMessage.build(context)
93
+ when :remove_permission
94
+ Aws::SQS::Endpoints::RemovePermission.build(context)
95
+ when :send_message
96
+ Aws::SQS::Endpoints::SendMessage.build(context)
97
+ when :send_message_batch
98
+ Aws::SQS::Endpoints::SendMessageBatch.build(context)
99
+ when :set_queue_attributes
100
+ Aws::SQS::Endpoints::SetQueueAttributes.build(context)
101
+ when :start_message_move_task
102
+ Aws::SQS::Endpoints::StartMessageMoveTask.build(context)
103
+ when :tag_queue
104
+ Aws::SQS::Endpoints::TagQueue.build(context)
105
+ when :untag_queue
106
+ Aws::SQS::Endpoints::UntagQueue.build(context)
107
+ end
108
+ end
109
+ end
110
+
111
+ def add_handlers(handlers, _config)
112
+ handlers.add(Handler, step: :build, priority: 75)
113
+ end
114
+ end
115
+ end
116
+ end