aws-sdk-sqs 1.30.0 → 1.89.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.
@@ -1,4 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # utility classes
4
- require 'aws-sdk-sqs/queue_poller'
4
+ module Aws
5
+ module SQS
6
+ autoload :QueuePoller, 'aws-sdk-sqs/queue_poller'
7
+ end
8
+ end
@@ -0,0 +1,69 @@
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
+ module Aws::SQS
11
+ # Endpoint parameters used to influence endpoints per request.
12
+ #
13
+ # @!attribute region
14
+ # The AWS region used to dispatch the request.
15
+ #
16
+ # @return [String]
17
+ #
18
+ # @!attribute use_dual_stack
19
+ # When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
20
+ #
21
+ # @return [Boolean]
22
+ #
23
+ # @!attribute use_fips
24
+ # When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.
25
+ #
26
+ # @return [Boolean]
27
+ #
28
+ # @!attribute endpoint
29
+ # Override the endpoint used to send this request
30
+ #
31
+ # @return [String]
32
+ #
33
+ EndpointParameters = Struct.new(
34
+ :region,
35
+ :use_dual_stack,
36
+ :use_fips,
37
+ :endpoint,
38
+ ) do
39
+ include Aws::Structure
40
+
41
+ # @api private
42
+ class << self
43
+ PARAM_MAP = {
44
+ 'Region' => :region,
45
+ 'UseDualStack' => :use_dual_stack,
46
+ 'UseFIPS' => :use_fips,
47
+ 'Endpoint' => :endpoint,
48
+ }.freeze
49
+ end
50
+
51
+ def initialize(options = {})
52
+ self[:region] = options[:region]
53
+ self[:use_dual_stack] = options[:use_dual_stack]
54
+ self[:use_dual_stack] = false if self[:use_dual_stack].nil?
55
+ self[:use_fips] = options[:use_fips]
56
+ self[:use_fips] = false if self[:use_fips].nil?
57
+ self[:endpoint] = options[:endpoint]
58
+ end
59
+
60
+ def self.create(config, options={})
61
+ new({
62
+ region: config.region,
63
+ use_dual_stack: config.use_dualstack_endpoint,
64
+ use_fips: config.use_fips_endpoint,
65
+ endpoint: (config.endpoint.to_s unless config.regional_endpoint),
66
+ }.merge(options))
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,57 @@
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
+ module Aws::SQS
11
+ class EndpointProvider
12
+ def resolve_endpoint(parameters)
13
+ region = parameters.region
14
+ use_dual_stack = parameters.use_dual_stack
15
+ use_fips = parameters.use_fips
16
+ endpoint = parameters.endpoint
17
+ if Aws::Endpoints::Matchers.set?(endpoint)
18
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
19
+ raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
20
+ end
21
+ if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
22
+ raise ArgumentError, "Invalid Configuration: Dualstack and custom endpoint are not supported"
23
+ end
24
+ return Aws::Endpoints::Endpoint.new(url: endpoint, headers: {}, properties: {})
25
+ end
26
+ if Aws::Endpoints::Matchers.set?(region)
27
+ if (partition_result = Aws::Endpoints::Matchers.aws_partition(region))
28
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true) && Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
29
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS")) && Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
30
+ return Aws::Endpoints::Endpoint.new(url: "https://sqs-fips.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
31
+ end
32
+ raise ArgumentError, "FIPS and DualStack are enabled, but this partition does not support one or both"
33
+ end
34
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
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
+ return Aws::Endpoints::Endpoint.new(url: "https://sqs.#{region}.amazonaws.com", headers: {}, properties: {})
38
+ end
39
+ return Aws::Endpoints::Endpoint.new(url: "https://sqs-fips.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
40
+ end
41
+ raise ArgumentError, "FIPS is enabled but this partition does not support FIPS"
42
+ end
43
+ if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
44
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
45
+ return Aws::Endpoints::Endpoint.new(url: "https://sqs.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
46
+ end
47
+ raise ArgumentError, "DualStack is enabled but this partition does not support DualStack"
48
+ end
49
+ return Aws::Endpoints::Endpoint.new(url: "https://sqs.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
50
+ end
51
+ end
52
+ raise ArgumentError, "Invalid Configuration: Missing Region"
53
+ raise ArgumentError, 'No endpoint could be resolved'
54
+
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,20 @@
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
+ # @api private
13
+ module Endpoints
14
+
15
+
16
+ def self.parameters_for_operation(context)
17
+ Aws::SQS::EndpointParameters.create(context.config)
18
+ end
19
+ end
20
+ end
@@ -3,7 +3,7 @@
3
3
  # WARNING ABOUT GENERATED CODE
4
4
  #
5
5
  # This file is generated. See the contributing guide for more information:
6
- # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
7
  #
8
8
  # WARNING ABOUT GENERATED CODE
9
9
 
@@ -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,8 @@ module Aws::SQS
41
51
  # * {QueueDoesNotExist}
42
52
  # * {QueueNameExists}
43
53
  # * {ReceiptHandleIsInvalid}
54
+ # * {RequestThrottled}
55
+ # * {ResourceNotFoundException}
44
56
  # * {TooManyEntriesInBatchRequest}
45
57
  # * {UnsupportedOperation}
46
58
  #
@@ -58,6 +70,11 @@ module Aws::SQS
58
70
  def initialize(context, message, data = Aws::EmptyStructure.new)
59
71
  super(context, message, data)
60
72
  end
73
+
74
+ # @return [String]
75
+ def message
76
+ @message || @data[:message]
77
+ end
61
78
  end
62
79
 
63
80
  class BatchRequestTooLong < ServiceError
@@ -68,6 +85,11 @@ module Aws::SQS
68
85
  def initialize(context, message, data = Aws::EmptyStructure.new)
69
86
  super(context, message, data)
70
87
  end
88
+
89
+ # @return [String]
90
+ def message
91
+ @message || @data[:message]
92
+ end
71
93
  end
72
94
 
73
95
  class EmptyBatchRequest < ServiceError
@@ -78,6 +100,26 @@ module Aws::SQS
78
100
  def initialize(context, message, data = Aws::EmptyStructure.new)
79
101
  super(context, message, data)
80
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
81
123
  end
82
124
 
83
125
  class InvalidAttributeName < ServiceError
@@ -88,6 +130,26 @@ module Aws::SQS
88
130
  def initialize(context, message, data = Aws::EmptyStructure.new)
89
131
  super(context, message, data)
90
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
91
153
  end
92
154
 
93
155
  class InvalidBatchEntryId < ServiceError
@@ -98,6 +160,11 @@ module Aws::SQS
98
160
  def initialize(context, message, data = Aws::EmptyStructure.new)
99
161
  super(context, message, data)
100
162
  end
163
+
164
+ # @return [String]
165
+ def message
166
+ @message || @data[:message]
167
+ end
101
168
  end
102
169
 
103
170
  class InvalidIdFormat < ServiceError
@@ -118,6 +185,131 @@ module Aws::SQS
118
185
  def initialize(context, message, data = Aws::EmptyStructure.new)
119
186
  super(context, message, data)
120
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
121
313
  end
122
314
 
123
315
  class MessageNotInflight < ServiceError
@@ -138,6 +330,11 @@ module Aws::SQS
138
330
  def initialize(context, message, data = Aws::EmptyStructure.new)
139
331
  super(context, message, data)
140
332
  end
333
+
334
+ # @return [String]
335
+ def message
336
+ @message || @data[:message]
337
+ end
141
338
  end
142
339
 
143
340
  class PurgeQueueInProgress < ServiceError
@@ -148,6 +345,11 @@ module Aws::SQS
148
345
  def initialize(context, message, data = Aws::EmptyStructure.new)
149
346
  super(context, message, data)
150
347
  end
348
+
349
+ # @return [String]
350
+ def message
351
+ @message || @data[:message]
352
+ end
151
353
  end
152
354
 
153
355
  class QueueDeletedRecently < ServiceError
@@ -158,6 +360,11 @@ module Aws::SQS
158
360
  def initialize(context, message, data = Aws::EmptyStructure.new)
159
361
  super(context, message, data)
160
362
  end
363
+
364
+ # @return [String]
365
+ def message
366
+ @message || @data[:message]
367
+ end
161
368
  end
162
369
 
163
370
  class QueueDoesNotExist < ServiceError
@@ -168,6 +375,11 @@ module Aws::SQS
168
375
  def initialize(context, message, data = Aws::EmptyStructure.new)
169
376
  super(context, message, data)
170
377
  end
378
+
379
+ # @return [String]
380
+ def message
381
+ @message || @data[:message]
382
+ end
171
383
  end
172
384
 
173
385
  class QueueNameExists < ServiceError
@@ -178,6 +390,11 @@ module Aws::SQS
178
390
  def initialize(context, message, data = Aws::EmptyStructure.new)
179
391
  super(context, message, data)
180
392
  end
393
+
394
+ # @return [String]
395
+ def message
396
+ @message || @data[:message]
397
+ end
181
398
  end
182
399
 
183
400
  class ReceiptHandleIsInvalid < ServiceError
@@ -188,6 +405,41 @@ module Aws::SQS
188
405
  def initialize(context, message, data = Aws::EmptyStructure.new)
189
406
  super(context, message, data)
190
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
191
443
  end
192
444
 
193
445
  class TooManyEntriesInBatchRequest < ServiceError
@@ -198,6 +450,11 @@ module Aws::SQS
198
450
  def initialize(context, message, data = Aws::EmptyStructure.new)
199
451
  super(context, message, data)
200
452
  end
453
+
454
+ # @return [String]
455
+ def message
456
+ @message || @data[:message]
457
+ end
201
458
  end
202
459
 
203
460
  class UnsupportedOperation < ServiceError
@@ -208,6 +465,11 @@ module Aws::SQS
208
465
  def initialize(context, message, data = Aws::EmptyStructure.new)
209
466
  super(context, message, data)
210
467
  end
468
+
469
+ # @return [String]
470
+ def message
471
+ @message || @data[:message]
472
+ end
211
473
  end
212
474
 
213
475
  end
@@ -3,7 +3,7 @@
3
3
  # WARNING ABOUT GENERATED CODE
4
4
  #
5
5
  # This file is generated. See the contributing guide for more information:
6
- # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
7
  #
8
8
  # WARNING ABOUT GENERATED CODE
9
9
 
@@ -43,7 +43,8 @@ module Aws::SQS
43
43
  end
44
44
 
45
45
  # A unique identifier for the message. A `MessageId`is considered unique
46
- # across all AWS accounts for an extended period of time.
46
+ # across all Amazon Web Services accounts for an extended period of
47
+ # time.
47
48
  # @return [String]
48
49
  def message_id
49
50
  data[:message_id]
@@ -104,12 +105,12 @@ module Aws::SQS
104
105
  end
105
106
 
106
107
  # Each message attribute consists of a `Name`, `Type`, and `Value`. For
107
- # more information, see [Amazon SQS Message Attributes][1] in the
108
- # *Amazon Simple Queue Service Developer Guide*.
108
+ # more information, see [Amazon SQS message attributes][1] in the
109
+ # *Amazon SQS Developer Guide*.
109
110
  #
110
111
  #
111
112
  #
112
- # [1]: https://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
113
114
  # @return [Hash<String,Types::MessageAttributeValue>]
114
115
  def message_attributes
115
116
  data[:message_attributes]
@@ -155,14 +156,16 @@ module Aws::SQS
155
156
  # @param [Hash] options ({})
156
157
  # @option options [required, Integer] :visibility_timeout
157
158
  # The new value for the message's visibility timeout (in seconds).
158
- # Values values: `0` to `43200`. Maximum: 12 hours.
159
+ # Values range: `0` to `43200`. Maximum: 12 hours.
159
160
  # @return [EmptyStructure]
160
161
  def change_visibility(options = {})
161
162
  options = options.merge(
162
163
  queue_url: @queue_url,
163
164
  receipt_handle: @receipt_handle
164
165
  )
165
- resp = @client.change_message_visibility(options)
166
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
167
+ @client.change_message_visibility(options)
168
+ end
166
169
  resp.data
167
170
  end
168
171
 
@@ -176,7 +179,9 @@ module Aws::SQS
176
179
  queue_url: @queue_url,
177
180
  receipt_handle: @receipt_handle
178
181
  )
179
- resp = @client.delete_message(options)
182
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
183
+ @client.delete_message(options)
184
+ end
180
185
  resp.data
181
186
  end
182
187
 
@@ -241,7 +246,9 @@ module Aws::SQS
241
246
  receipt_handle: item.receipt_handle
242
247
  }
243
248
  end
244
- batch[0].client.delete_message_batch(params)
249
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
250
+ batch[0].client.delete_message_batch(params)
251
+ end
245
252
  end
246
253
  nil
247
254
  end
@@ -0,0 +1,77 @@
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: <<~DOCS) do |_cfg|
19
+ The endpoint provider used to resolve endpoints. Any object that responds to
20
+ `#resolve_endpoint(parameters)` where `parameters` is a Struct similar to
21
+ `Aws::SQS::EndpointParameters`.
22
+ DOCS
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 = Aws::SQS::Endpoints.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
+ with_metrics(context) { @handler.call(context) }
44
+ end
45
+
46
+ private
47
+
48
+ def with_metrics(context, &block)
49
+ metrics = []
50
+ metrics << 'ENDPOINT_OVERRIDE' unless context.config.regional_endpoint
51
+ if context[:auth_scheme] && context[:auth_scheme]['name'] == 'sigv4a'
52
+ metrics << 'SIGV4A_SIGNING'
53
+ end
54
+ if context.config.credentials&.credentials&.account_id
55
+ metrics << 'RESOLVED_ACCOUNT_ID'
56
+ end
57
+ Aws::Plugins::UserAgent.metric(*metrics, &block)
58
+ end
59
+
60
+ def apply_endpoint_headers(context, headers)
61
+ headers.each do |key, values|
62
+ value = values
63
+ .compact
64
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
65
+ .join(',')
66
+
67
+ context.http_request.headers[key] = value
68
+ end
69
+ end
70
+ end
71
+
72
+ def add_handlers(handlers, _config)
73
+ handlers.add(Handler, step: :build, priority: 75)
74
+ end
75
+ end
76
+ end
77
+ end