aws-sdk-core 3.91.0 → 3.91.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: '018176486b2589c3e5643f0517d600048b788239'
4
- data.tar.gz: bf23afa4bc903911cc3a571b318eb38911a4cb62
2
+ SHA256:
3
+ metadata.gz: 3c1fbacace50e0f25fdf2055b3881d1d12ca187a34009b26dc94ceded9ab5cec
4
+ data.tar.gz: b0f1c6b91e78d28b2ae9cc303bf93c4654a8d309a6ce34ac612fe2ce72e9a052
5
5
  SHA512:
6
- metadata.gz: 8c5827b6dfca9a435419df7ec67f006179fe4656e909769e7545dbd4803b6723bdfedc7a9e89f23bff052d3e93428dcd39c9b803a1f35aba3ac26cfc3c33fb87
7
- data.tar.gz: a244072123870020dbca0dee7bbe8f7057367b1ce81e18c7078b994e79a5f48c5ca5639e0df4113d4e68fdbc12627097751d21e45a65c4359e7d0abd4a548474
6
+ metadata.gz: a598be184e28664f405dd2e3dff5ea7562fbaabeafe4b1c3047b6d795510e9e7b613107b90df7f9ff6b8a89070acfb0b35a5e31fd2db219ee3daca8a3497fa2c
7
+ data.tar.gz: 79f72a46988468762042e55a2f543a0faca9ca3cf66b00081e23b335f80ae9440ec49877aa4e1b645c899566a686e0673c261c928f0893cd120c51e4239333c4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.91.0
1
+ 3.91.1
@@ -7,28 +7,24 @@ require_relative 'json/parser'
7
7
  module Aws
8
8
  # @api private
9
9
  module Json
10
-
11
10
  class ParseError < StandardError
12
-
13
11
  def initialize(error)
14
12
  @error = error
15
13
  super(error.message)
16
14
  end
17
15
 
18
16
  attr_reader :error
19
-
20
17
  end
21
18
 
22
19
  class << self
23
-
24
20
  def load(json)
25
21
  ENGINE.load(json, *ENGINE_LOAD_OPTIONS)
26
22
  rescue *ENGINE_ERRORS => e
27
- raise ParseError.new(e)
23
+ raise ParseError, e
28
24
  end
29
25
 
30
26
  def load_file(path)
31
- self.load(File.open(path, 'r', encoding: 'UTF-8') { |f| f.read })
27
+ load(File.open(path, 'r', encoding: 'UTF-8', &:read))
32
28
  end
33
29
 
34
30
  def dump(value)
@@ -39,7 +35,12 @@ module Aws
39
35
 
40
36
  def oj_engine
41
37
  require 'oj'
42
- [Oj, [{mode: :compat, symbol_keys: false}], [{ mode: :compat }], oj_parse_error]
38
+ [
39
+ Oj,
40
+ [{ mode: :compat, symbol_keys: false }],
41
+ [{ mode: :compat }],
42
+ oj_parse_error
43
+ ]
43
44
  rescue LoadError
44
45
  false
45
46
  end
@@ -50,17 +51,15 @@ module Aws
50
51
 
51
52
  def oj_parse_error
52
53
  if Oj.const_defined?('ParseError')
53
- [Oj::ParseError, EncodingError]
54
+ [Oj::ParseError, EncodingError, JSON::ParserError]
54
55
  else
55
56
  [SyntaxError]
56
57
  end
57
58
  end
58
-
59
59
  end
60
60
 
61
61
  # @api private
62
62
  ENGINE, ENGINE_LOAD_OPTIONS, ENGINE_DUMP_OPTIONS, ENGINE_ERRORS =
63
63
  oj_engine || json_engine
64
-
65
64
  end
66
65
  end
@@ -9,7 +9,14 @@ module Aws
9
9
 
10
10
  def initialize
11
11
  @mutex = Mutex.new
12
+ # clock_corrections are recorded only on errors
13
+ # and only when time difference is greater than the
14
+ # CLOCK_SKEW_THRESHOLD
12
15
  @endpoint_clock_corrections = Hash.new(0)
16
+
17
+ # estimated_skew is calculated on every request
18
+ # and is used to estimate a TTL for requests
19
+ @endpoint_estimated_skews = Hash.new(nil)
13
20
  end
14
21
 
15
22
  # Gets the clock_correction in seconds to apply to a given endpoint
@@ -18,11 +25,15 @@ module Aws
18
25
  @mutex.synchronize { @endpoint_clock_corrections[endpoint.to_s] }
19
26
  end
20
27
 
21
- # Sets the clock correction for an endpoint
22
- # @param endpoint [URI / String]
23
- # @param correction [Number]
24
- def set_clock_correction(endpoint, correction)
25
- @mutex.synchronize { @endpoint_clock_corrections[endpoint.to_s] = correction }
28
+ # The estimated skew factors in any clock skew from
29
+ # the service along with any network latency.
30
+ # This provides a more accurate value for the ttl,
31
+ # which should represent when the client will stop
32
+ # waiting for a request.
33
+ # Estimated Skew should not be used to correct clock skew errors
34
+ # it should only be used to estimate TTL for a request
35
+ def estimated_skew(endpoint)
36
+ @mutex.synchronize { @endpoint_estimated_skews[endpoint.to_s] }
26
37
  end
27
38
 
28
39
  # Determines whether a request has clock skew by comparing
@@ -30,13 +41,15 @@ module Aws
30
41
  # @param context [Seahorse::Client::RequestContext]
31
42
  def clock_skewed?(context)
32
43
  server_time = server_time(context.http_response)
33
- !!server_time && (Time.now.utc - server_time).abs > CLOCK_SKEW_THRESHOLD
44
+ !!server_time &&
45
+ (Time.now.utc - server_time).abs > CLOCK_SKEW_THRESHOLD
34
46
  end
35
47
 
36
- # Update the stored clock skew value for an endpoint
48
+ # Called only on clock skew related errors
49
+ # Update the stored clock skew correction value for an endpoint
37
50
  # from the server's time in the response
38
51
  # @param context [Seahorse::Client::RequestContext]
39
- def update_clock_skew(context)
52
+ def update_clock_correction(context)
40
53
  endpoint = context.http_request.endpoint
41
54
  now_utc = Time.now.utc
42
55
  server_time = server_time(context.http_response)
@@ -45,6 +58,20 @@ module Aws
45
58
  end
46
59
  end
47
60
 
61
+ # Called for every request
62
+ # Update our estimated clock skew for the endpoint
63
+ # from the servers time in the response
64
+ # @param context [Seahorse::Client::RequestContext]
65
+ def update_estimated_skew(context)
66
+ endpoint = context.http_request.endpoint
67
+ now_utc = Time.now.utc
68
+ server_time = server_time(context.http_response)
69
+ return unless server_time
70
+ @mutex.synchronize do
71
+ @endpoint_estimated_skews[endpoint.to_s] = server_time - now_utc
72
+ end
73
+ end
74
+
48
75
  private
49
76
 
50
77
  # @param response [Seahorse::Client::Http::Response:]
@@ -56,6 +83,14 @@ module Aws
56
83
  end
57
84
  end
58
85
 
86
+ # Sets the clock correction for an endpoint
87
+ # @param endpoint [URI / String]
88
+ # @param correction [Number]
89
+ def set_clock_correction(endpoint, correction)
90
+ @mutex.synchronize do
91
+ @endpoint_clock_corrections[endpoint.to_s] = correction
92
+ end
93
+ end
59
94
  end
60
95
  end
61
96
  end
@@ -97,15 +97,19 @@ This option is only used in the `legacy` retry mode.
97
97
  doc_type: String,
98
98
  docstring: <<-DOCS) do |cfg|
99
99
  Specifies which retry algorithm to use. Values are:
100
- * `legacy` - The pre-existing retry behavior. This is default value if
101
- no retry mode is provided.
102
- * `standard` - A standardized set of retry rules across the AWS SDKs.
103
- This includes support for retry quotas, which limit the number of
104
- unsuccessful retries a client can make.
105
- * `adaptive` - An experimental retry mode that includes all the
106
- functionality of `standard` mode along with automatic client side
107
- throttling. This is a provisional mode that may change behavior
108
- in the future.
100
+
101
+ * `legacy` - The pre-existing retry behavior. This is default value if
102
+ no retry mode is provided.
103
+
104
+ * `standard` - A standardized set of retry rules across the AWS SDKs.
105
+ This includes support for retry quotas, which limit the number of
106
+ unsuccessful retries a client can make.
107
+
108
+ * `adaptive` - An experimental retry mode that includes all the
109
+ functionality of `standard` mode along with automatic client side
110
+ throttling. This is a provisional mode that may change behavior
111
+ in the future.
112
+
109
113
  DOCS
110
114
  resolve_retry_mode(cfg)
111
115
  end
@@ -223,6 +227,7 @@ a clock skew correction and retry requests with skewed client clocks.
223
227
  config = context.config
224
228
 
225
229
  get_send_token(config)
230
+ add_retry_headers(context)
226
231
  response = @handler.call(context)
227
232
  error_inspector = Retries::ErrorInspector.new(
228
233
  response.error, response.context.http_response.status_code
@@ -235,12 +240,16 @@ a clock skew correction and retry requests with skewed client clocks.
235
240
  config.endpoint_cache.delete(key)
236
241
  end
237
242
 
238
- # Clock skew needs to be updated from the response even when
239
- # the request is not retryable
243
+ # Clock correction needs to be updated from the response even when
244
+ # the request is not retryable but should only be updated
245
+ # in the case of clock skew errors
240
246
  if error_inspector.clock_skew?(context)
241
- config.clock_skew.update_clock_skew(context)
247
+ config.clock_skew.update_clock_correction(context)
242
248
  end
243
249
 
250
+ # Estimated skew needs to be updated on every request
251
+ config.clock_skew.update_estimated_skew(context)
252
+
244
253
  return response unless retryable?(context, response, error_inspector)
245
254
 
246
255
  return response if context.retries >= config.max_attempts - 1
@@ -304,6 +313,35 @@ a clock skew correction and retry requests with skewed client clocks.
304
313
  context.http_response.reset
305
314
  call(context)
306
315
  end
316
+
317
+ def add_retry_headers(context)
318
+ request_pairs = {
319
+ 'attempt' => context.retries,
320
+ 'max' => context.config.max_attempts
321
+ }
322
+ if (ttl = compute_request_ttl(context))
323
+ request_pairs['ttl'] = ttl
324
+ end
325
+
326
+ # create the request header
327
+ formatted_header = request_pairs.map { |k, v| "#{k}=#{v}" }.join('; ')
328
+ context.http_request.headers['amz-sdk-request'] = formatted_header
329
+ end
330
+
331
+ def compute_request_ttl(context)
332
+ return if context.operation.async
333
+
334
+ endpoint = context.http_request.endpoint
335
+ estimated_skew = context.config.clock_skew.estimated_skew(endpoint)
336
+ if context.config.respond_to?(:http_read_timeout)
337
+ read_timeout = context.config.http_read_timeout
338
+ end
339
+
340
+ if estimated_skew && read_timeout
341
+ (Time.now.utc + read_timeout + estimated_skew)
342
+ .strftime('%Y%m%dT%H%M%SZ')
343
+ end
344
+ end
307
345
  end
308
346
 
309
347
  class LegacyHandler < Seahorse::Client::Handler
@@ -43,6 +43,6 @@ require_relative 'aws-sdk-sts/customizations'
43
43
  # @service
44
44
  module Aws::STS
45
45
 
46
- GEM_VERSION = '3.91.0'
46
+ GEM_VERSION = '3.91.1'
47
47
 
48
48
  end
@@ -33,11 +33,11 @@ Aws::Plugins::GlobalConfiguration.add_identifier(:sts)
33
33
  module Aws::STS
34
34
  # An API client for STS. To construct a client, you need to configure a `:region` and `:credentials`.
35
35
  #
36
- # client = Aws::STS::Client.new(
37
- # region: region_name,
38
- # credentials: credentials,
39
- # # ...
40
- # )
36
+ # client = Aws::STS::Client.new(
37
+ # region: region_name,
38
+ # credentials: credentials,
39
+ # # ...
40
+ # )
41
41
  #
42
42
  # For details on configuring region and credentials see
43
43
  # the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html).
@@ -231,15 +231,19 @@ module Aws::STS
231
231
  #
232
232
  # @option options [String] :retry_mode ("legacy")
233
233
  # Specifies which retry algorithm to use. Values are:
234
- # * `legacy` - The pre-existing retry behavior. This is default value if
235
- # no retry mode is provided.
236
- # * `standard` - A standardized set of retry rules across the AWS SDKs.
237
- # This includes support for retry quotas, which limit the number of
238
- # unsuccessful retries a client can make.
239
- # * `adaptive` - An experimental retry mode that includes all the
240
- # functionality of `standard` mode along with automatic client side
241
- # throttling. This is a provisional mode that may change behavior
242
- # in the future.
234
+ #
235
+ # * `legacy` - The pre-existing retry behavior. This is default value if
236
+ # no retry mode is provided.
237
+ #
238
+ # * `standard` - A standardized set of retry rules across the AWS SDKs.
239
+ # This includes support for retry quotas, which limit the number of
240
+ # unsuccessful retries a client can make.
241
+ #
242
+ # * `adaptive` - An experimental retry mode that includes all the
243
+ # functionality of `standard` mode along with automatic client side
244
+ # throttling. This is a provisional mode that may change behavior
245
+ # in the future.
246
+ #
243
247
  #
244
248
  # @option options [String] :secret_access_key
245
249
  #
@@ -2182,7 +2186,7 @@ module Aws::STS
2182
2186
  params: params,
2183
2187
  config: config)
2184
2188
  context[:gem_name] = 'aws-sdk-core'
2185
- context[:gem_version] = '3.91.0'
2189
+ context[:gem_version] = '3.91.1'
2186
2190
  Seahorse::Client::Request.new(handlers, context)
2187
2191
  end
2188
2192
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.91.0
4
+ version: 3.91.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-09 00:00:00.000000000 Z
11
+ date: 2020-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath
@@ -293,8 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
293
293
  - !ruby/object:Gem::Version
294
294
  version: '0'
295
295
  requirements: []
296
- rubyforge_project:
297
- rubygems_version: 2.5.2.3
296
+ rubygems_version: 3.0.3
298
297
  signing_key:
299
298
  specification_version: 4
300
299
  summary: AWS SDK for Ruby - Core