aws-sdk-core 3.260.0 → 3.271.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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +85 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-core/json/error_handler.rb +1 -1
  5. data/lib/aws-sdk-core/log/formatter.rb +3 -2
  6. data/lib/aws-sdk-core/log/param_filter.rb +73 -9
  7. data/lib/aws-sdk-core/login_credentials.rb +21 -6
  8. data/lib/aws-sdk-core/pageable_response.rb +8 -1
  9. data/lib/aws-sdk-core/plugins/checksum_algorithm.rb +53 -20
  10. data/lib/aws-sdk-core/plugins/retries/clock_skew.rb +8 -9
  11. data/lib/aws-sdk-core/plugins/retries/retry_quota.rb +3 -9
  12. data/lib/aws-sdk-core/plugins/retry_errors.rb +36 -49
  13. data/lib/aws-sdk-core/plugins/stub_responses.rb +1 -1
  14. data/lib/aws-sdk-core/plugins/user_agent.rb +2 -1
  15. data/lib/aws-sdk-core/response.rb +23 -0
  16. data/lib/aws-sdk-core/rest/response/headers.rb +4 -3
  17. data/lib/aws-sdk-core/rpc_v2/error_handler.rb +1 -1
  18. data/lib/aws-sdk-core/xml/error_handler.rb +1 -1
  19. data/lib/aws-sdk-core.rb +1 -0
  20. data/lib/aws-sdk-signin/client.rb +503 -75
  21. data/lib/aws-sdk-signin/client_api.rb +218 -3
  22. data/lib/aws-sdk-signin/endpoints.rb +55 -0
  23. data/lib/aws-sdk-signin/errors.rb +67 -0
  24. data/lib/aws-sdk-signin/types.rb +611 -132
  25. data/lib/aws-sdk-signin.rb +2 -2
  26. data/lib/aws-sdk-sso/client.rb +7 -6
  27. data/lib/aws-sdk-sso.rb +1 -1
  28. data/lib/aws-sdk-ssooidc/client.rb +7 -6
  29. data/lib/aws-sdk-ssooidc.rb +1 -1
  30. data/lib/aws-sdk-sts/client.rb +240 -122
  31. data/lib/aws-sdk-sts/client_api.rb +84 -0
  32. data/lib/aws-sdk-sts/errors.rb +57 -0
  33. data/lib/aws-sdk-sts/types.rb +461 -141
  34. data/lib/aws-sdk-sts.rb +1 -1
  35. data/lib/seahorse/client/configuration.rb +68 -1
  36. data/lib/seahorse/client/h2/connection.rb +9 -1
  37. data/lib/seahorse/client/http/request.rb +19 -0
  38. data/lib/seahorse/client/net_http/handler.rb +1 -1
  39. data/lib/seahorse/model/shapes.rb +6 -6
  40. metadata +2 -1
@@ -96,18 +96,18 @@ module Aws
96
96
 
97
97
  option(
98
98
  :retry_mode,
99
- default: 'legacy', # TODO: Change to 'standard' when new retries become default
99
+ default: 'standard',
100
100
  doc_type: String,
101
101
  rbs_type: '("legacy" | "standard" | "adaptive")',
102
102
  docstring: <<~DOCS) do |cfg|
103
103
  Specifies which retry algorithm to use. Values are:
104
104
 
105
- * `legacy` - The pre-existing retry behavior. This is the default
106
- value if no retry mode is provided.
105
+ * `legacy` - The pre-existing retry behavior.
107
106
 
108
107
  * `standard` - A standardized set of retry rules across the AWS SDKs.
109
108
  This includes support for retry quotas, which limit the number of
110
- unsuccessful retries a client can make.
109
+ unsuccessful retries a client can make. This is the default value
110
+ if no retry mode is provided.
111
111
 
112
112
  * `adaptive` - A retry mode that includes all the functionality of
113
113
  `standard` mode along with automatic client side throttling.
@@ -123,7 +123,8 @@ module Aws
123
123
  An integer representing the maximum number attempts that will be made for
124
124
  a single request, including the initial attempt. For example,
125
125
  setting this value to 5 will result in a request being retried up to
126
- 4 times. Used in `standard` and `adaptive` retry modes.
126
+ 4 times. Used in `standard` and `adaptive` retry modes. Defaults to 3,
127
+ except for DynamoDB and DynamoDB Streams, which default to 4.
127
128
  DOCS
128
129
  resolve_max_attempts(cfg)
129
130
  end
@@ -177,15 +178,14 @@ module Aws
177
178
  DYNAMODB_SERVICES = Set['DynamoDB', 'DynamoDB Streams'].freeze
178
179
 
179
180
  class << self
180
- # TODO: Remove this gate and hardcode new retry behavior once
181
- # AWS_NEW_RETRIES_2026 is enabled by default, which includes:
182
- # - Default retry_mode to 'standard'
183
- # - Default max_attempts to 4 for DynamoDB
184
- # - Remove the old retries branch in Handler#call
185
- # - Remove the old retries branch in #exponential_backoff
186
- # - Remove LEGACY_RETRY_COST and TIMEOUT_RETRY_COST from RetryQuota
187
- def new_retries?
188
- ENV.fetch('AWS_NEW_RETRIES_2026', 'false').downcase == 'true'
181
+ # @api private
182
+ # HTTP retries preserve the listener, so register it only once.
183
+ def track_response_time(context)
184
+ return unless context.retries.zero?
185
+
186
+ context.http_response.on_headers do
187
+ context.metadata[:response_received_at] = Time.now.utc
188
+ end
189
189
  end
190
190
 
191
191
  def resolve_retry_mode(cfg)
@@ -197,7 +197,7 @@ module Aws
197
197
  value = ENV['AWS_RETRY_MODE'] ||
198
198
  Aws.shared_config.retry_mode(profile: cfg.profile) ||
199
199
  default_mode_value ||
200
- (new_retries? ? 'standard' : 'legacy') # TODO: default to 'standard' when new retries become default
200
+ 'standard'
201
201
  # Raise if provided value is not one of the retry modes
202
202
  if value != 'legacy' && value != 'standard' && value != 'adaptive'
203
203
  raise ArgumentError,
@@ -225,9 +225,6 @@ module Aws
225
225
  end
226
226
 
227
227
  def default_max_attempts(cfg)
228
- # TODO: Remove gate and keep only the new retries branch
229
- return 3 unless new_retries?
230
-
231
228
  service_id = cfg.api.metadata['serviceId'] if cfg.respond_to?(:api)
232
229
  DYNAMODB_SERVICES.include?(service_id) ? 4 : 3
233
230
  end
@@ -287,6 +284,7 @@ module Aws
287
284
  # longPoll trait. To be removed when trait is enabled.
288
285
  LONG_POLLING_OPERATIONS = {
289
286
  'SQS' => Set[:receive_message],
287
+ 'Kinesis' => Set[:receive_queue_records, :receive_dead_letter_queue_records],
290
288
  'SFN' => Set[:get_activity_task],
291
289
  'SWF' => Set[:poll_for_activity_task, :poll_for_decision_task]
292
290
  }.freeze
@@ -294,6 +292,7 @@ module Aws
294
292
  def call(context)
295
293
  context.metadata[:retries] ||= {}
296
294
  config = context.config
295
+ RetryErrors.track_response_time(context)
297
296
 
298
297
  get_send_token(config)
299
298
  add_retry_headers(context)
@@ -327,31 +326,21 @@ module Aws
327
326
  capacity_amount = config.retry_quota.checkout_capacity(error_inspector)
328
327
  context.metadata[:retries][:capacity_amount] = capacity_amount
329
328
 
330
- # TODO: Remove gate and keep only the new retries branch
331
- if new_retries?
332
- return response if capacity_amount <= 0 && !long_polling_operation?(context)
329
+ # Long polling operations back off even once the retry quota is
330
+ # depleted, so the delay is applied before the capacity check.
331
+ return response if capacity_amount <= 0 && !long_polling_operation?(context)
333
332
 
334
- service_id = context.config.api.metadata['serviceId']
335
- delay = backoff(context, error_inspector, service_id)
336
- Kernel.sleep(delay)
333
+ service_id = context.config.api.metadata['serviceId']
334
+ delay = backoff(context, error_inspector, service_id)
335
+ Kernel.sleep(delay)
337
336
 
338
- return response if capacity_amount <= 0
339
- else
340
- return response unless capacity_amount > 0
341
-
342
- delay = exponential_backoff(context.retries)
343
- Kernel.sleep(delay)
344
- end
337
+ return response if capacity_amount <= 0
345
338
 
346
339
  retry_request(context, error_inspector)
347
340
  end
348
341
 
349
342
  private
350
343
 
351
- def new_retries?
352
- RetryErrors.new_retries?
353
- end
354
-
355
344
  # True when clock skew correction is turned off. The fallback
356
345
  # correct_clock_skew option is folded in by the option resolver.
357
346
  def clock_skew_correction_disabled?(config)
@@ -416,20 +405,15 @@ module Aws
416
405
  [backoff_duration, exp_backoff + 5].min
417
406
  end
418
407
 
419
- # TODO: Remove gate, remove default nil params, keep only new retries branch
420
- def exponential_backoff(retries, error_inspector = nil, service_id = nil)
421
- if new_retries?
422
- backoff_scalar = if error_inspector.throttling_error?
423
- 1
424
- elsif DYNAMODB_SERVICES.include?(service_id)
425
- 0.025
426
- else
427
- 0.05
428
- end
429
- Kernel.rand * [backoff_scalar * 2**retries, MAX_BACKOFF].min
430
- else
431
- [Kernel.rand * 2**retries, MAX_BACKOFF].min
432
- end
408
+ def exponential_backoff(retries, error_inspector, service_id)
409
+ backoff_scalar = if error_inspector.throttling_error?
410
+ 1
411
+ elsif DYNAMODB_SERVICES.include?(service_id)
412
+ 0.025
413
+ else
414
+ 0.05
415
+ end
416
+ Kernel.rand * [backoff_scalar * 2**retries, MAX_BACKOFF].min
433
417
  end
434
418
 
435
419
  def parse_retry_after(context)
@@ -451,6 +435,7 @@ module Aws
451
435
  context.config.credentials.refresh! if refresh_credentials?(context, error)
452
436
  context.http_request.body.rewind
453
437
  context.http_response.reset
438
+ context.metadata.delete(:response_received_at)
454
439
  call(context)
455
440
  end
456
441
 
@@ -492,6 +477,7 @@ module Aws
492
477
  class LegacyHandler < Seahorse::Client::Handler
493
478
 
494
479
  def call(context)
480
+ RetryErrors.track_response_time(context)
495
481
  response = with_metric { @handler.call(context) }
496
482
  if response.error
497
483
  error_inspector = Retries::ErrorInspector.new(
@@ -530,6 +516,7 @@ module Aws
530
516
  context.config.credentials.refresh! if refresh_credentials?(context, error)
531
517
  context.http_request.body.rewind
532
518
  context.http_response.reset
519
+ context.metadata.delete(:response_received_at)
533
520
  call(context)
534
521
  end
535
522
 
@@ -83,7 +83,7 @@ requests are made, and retries are disabled.
83
83
  private
84
84
 
85
85
  def stub_responses(context)
86
- resp = Seahorse::Client::Response.new(context: context)
86
+ resp = Aws::Response.new(context: context)
87
87
  async_mode = context.client.is_a? Seahorse::Client::AsyncBase
88
88
  stub = context.client.next_stub(context)
89
89
  stub[:mutex].synchronize { apply_stub(stub, resp, async_mode) }
@@ -203,7 +203,8 @@ variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
203
203
  end
204
204
 
205
205
  # Frameworks may be aws-record, aws-sdk-rails, etc.
206
- regex = /gems\/(?<name>#{frameworks_cfg.join('|')})-(?<version>\d+\.\d+\.\d+)/.freeze
206
+ names = frameworks_cfg.map { |f| Regexp.escape(f.to_s) }.join('|')
207
+ regex = /gems\/(?<name>#{names})-(?<version>\d+\.\d+\.\d+)/.freeze
207
208
  frameworks = {}
208
209
  Kernel.caller.each do |line|
209
210
  match = line.match(regex)
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aws
4
+ # Represents the response from an AWS service operation.
5
+ # Provides the Seahorse response interface and paging convenience methods.
6
+ #
7
+ # SDK clients return responses with paging ready to use. When constructing
8
+ # a response directly or inspecting it before paging setup in a custom handler,
9
+ # use {#data} to access or enumerate its fields. {#first} returns the response
10
+ # itself; page-state checks and complete page enumeration require a pager.
11
+ #
12
+ # @see PageableResponse
13
+ class Response < Seahorse::Client::Response
14
+ include PageableResponse::Extension
15
+
16
+ def initialize(options = {})
17
+ super
18
+ @pager = nil
19
+ @last_page = nil
20
+ @more_results = nil
21
+ end
22
+ end
23
+ end
@@ -67,9 +67,10 @@ module Aws
67
67
  data[name] = {}
68
68
  prefix = ref.location_name || ''
69
69
  headers.each do |header_name, header_value|
70
- if match = header_name.match(/^#{prefix}(.+)/i)
71
- data[name][match[1]] = header_value
72
- end
70
+ next unless header_name.length > prefix.length &&
71
+ header_name[0, prefix.length].casecmp?(prefix)
72
+
73
+ data[name][header_name[prefix.length..-1]] = header_value
73
74
  end
74
75
  end
75
76
 
@@ -69,7 +69,7 @@ module Aws
69
69
 
70
70
  def remove_prefix(error_code, context)
71
71
  if (prefix = context.config.api.metadata['errorPrefix'])
72
- error_code.sub(/^#{prefix}/, '')
72
+ error_code.delete_prefix(prefix)
73
73
  else
74
74
  error_code
75
75
  end
@@ -73,7 +73,7 @@ module Aws
73
73
 
74
74
  def remove_prefix(error_code, context)
75
75
  if (prefix = context.config.api.metadata['errorPrefix'])
76
- error_code.sub(/^#{prefix}/, '')
76
+ error_code.delete_prefix(prefix)
77
77
  else
78
78
  error_code
79
79
  end
data/lib/aws-sdk-core.rb CHANGED
@@ -45,6 +45,7 @@ module Aws
45
45
  autoload :Pager, 'aws-sdk-core/pager'
46
46
  autoload :ParamConverter, 'aws-sdk-core/param_converter'
47
47
  autoload :ParamValidator, 'aws-sdk-core/param_validator'
48
+ autoload :Response, 'aws-sdk-core/response'
48
49
  autoload :SharedConfig, 'aws-sdk-core/shared_config'
49
50
  autoload :Structure, 'aws-sdk-core/structure'
50
51
  autoload :EmptyStructure, 'aws-sdk-core/structure'