aws-sdk-core 3.126.0 → 3.126.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e3ff54f89f443c065f82814db9e9594f0ebe726aeee0fefcc8d69ba96e07c08
4
- data.tar.gz: 7d943334fda11d8d24667b9edd746faee35de1c8814c6f843f03f36b24af8a81
3
+ metadata.gz: 46193e52f3ea24b17d0d2ff28e7abf1ef462586db550c10f0540810da7a45fed
4
+ data.tar.gz: 3dc8f9629d7d7057632bd639c097747792dd40d6c6c81ca5f91e4366ca9dd6bb
5
5
  SHA512:
6
- metadata.gz: 2b232fea85c3efd584c156f05604dd0bf38aa255c43f2ea17fc27575deab1ed182d85196ccb396f51e21c856e02544287be50a79d80efc43ffda67d02a411b27
7
- data.tar.gz: d31b0414fd7a575fe30b17037705dd115ef9bcdc0957d7d3641b6c1fccb1e964794d0652e2c5b7df38e75250619623b7b49cca9ccb540308469b3586bdbe298e
6
+ metadata.gz: 6f72443886e4e7077c1dc7d1f816b1774ceeae361f13e6f13a5ce532bc77a669e297e5fb3f3582eb772563e315dd0afcef9c5d9acd45d672fea79706537b8868
7
+ data.tar.gz: 3ed264c5a2ed5cb2dcd3c050224785e62618ded48137d8dd217a75107865f58679a26e5ded1e8498971e8de862e8f91e684eb1a5c64fa9e3db3f53d186d8b351
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.126.1 (2022-02-14)
5
+ ------------------
6
+
7
+ * Issue - Set `create_time` on IMDS tokens before fetch to reduce chance of using expired tokens and retry failures due to using expired tokens.
8
+
4
9
  3.126.0 (2022-02-03)
5
10
  ------------------
6
11
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.126.0
1
+ 3.126.1
@@ -136,8 +136,9 @@ module Aws
136
136
 
137
137
  def fetch_token
138
138
  open_connection do |conn|
139
+ created_time = Time.now
139
140
  token_value, token_ttl = http_put(conn, @token_ttl)
140
- @token = Token.new(value: token_value, ttl: token_ttl)
141
+ @token = Token.new(value: token_value, ttl: token_ttl, created_time: created_time)
141
142
  end
142
143
  end
143
144
 
@@ -222,7 +223,7 @@ module Aws
222
223
  def initialize(options = {})
223
224
  @ttl = options[:ttl]
224
225
  @value = options[:value]
225
- @created_time = Time.now
226
+ @created_time = options[:created_time] || Time.now
226
227
  end
227
228
 
228
229
  # [String] Returns the token value.
@@ -153,10 +153,11 @@ module Aws
153
153
  begin
154
154
  retry_errors(NETWORK_ERRORS, max_retries: @retries) do
155
155
  unless token_set?
156
+ created_time = Time.now
156
157
  token_value, ttl = http_put(
157
158
  conn, METADATA_TOKEN_PATH, @token_ttl
158
159
  )
159
- @token = Token.new(token_value, ttl) if token_value && ttl
160
+ @token = Token.new(token_value, ttl, created_time) if token_value && ttl
160
161
  end
161
162
  end
162
163
  rescue *NETWORK_ERRORS
@@ -166,9 +167,17 @@ module Aws
166
167
  end
167
168
 
168
169
  token = @token.value if token_set?
169
- metadata = http_get(conn, METADATA_PATH_BASE, token)
170
- profile_name = metadata.lines.first.strip
171
- http_get(conn, METADATA_PATH_BASE + profile_name, token)
170
+
171
+ begin
172
+ metadata = http_get(conn, METADATA_PATH_BASE, token)
173
+ profile_name = metadata.lines.first.strip
174
+ http_get(conn, METADATA_PATH_BASE + profile_name, token)
175
+ rescue TokenExpiredError
176
+ # Token has expired, reset it
177
+ # The next retry should fetch it
178
+ @token = nil
179
+ raise Non200Response
180
+ end
172
181
  end
173
182
  end
174
183
  rescue
@@ -200,9 +209,15 @@ module Aws
200
209
  headers = { 'User-Agent' => "aws-sdk-ruby3/#{CORE_GEM_VERSION}" }
201
210
  headers['x-aws-ec2-metadata-token'] = token if token
202
211
  response = connection.request(Net::HTTP::Get.new(path, headers))
203
- raise Non200Response unless response.code.to_i == 200
204
212
 
205
- response.body
213
+ case response.code.to_i
214
+ when 200
215
+ response.body
216
+ when 401
217
+ raise TokenExpiredError
218
+ else
219
+ raise Non200Response
220
+ end
206
221
  end
207
222
 
208
223
  # PUT request fetch token with ttl
@@ -244,10 +259,10 @@ module Aws
244
259
  # @api private
245
260
  # Token used to fetch IMDS profile and credentials
246
261
  class Token
247
- def initialize(value, ttl)
262
+ def initialize(value, ttl, created_time = Time.now)
248
263
  @ttl = ttl
249
264
  @value = value
250
- @created_time = Time.now
265
+ @created_time = created_time
251
266
  end
252
267
 
253
268
  # [String] token value
@@ -543,7 +543,7 @@ module Aws::SSO
543
543
  params: params,
544
544
  config: config)
545
545
  context[:gem_name] = 'aws-sdk-core'
546
- context[:gem_version] = '3.126.0'
546
+ context[:gem_version] = '3.126.1'
547
547
  Seahorse::Client::Request.new(handlers, context)
548
548
  end
549
549
 
data/lib/aws-sdk-sso.rb CHANGED
@@ -50,6 +50,6 @@ require_relative 'aws-sdk-sso/customizations'
50
50
  # @!group service
51
51
  module Aws::SSO
52
52
 
53
- GEM_VERSION = '3.126.0'
53
+ GEM_VERSION = '3.126.1'
54
54
 
55
55
  end
@@ -2286,7 +2286,7 @@ module Aws::STS
2286
2286
  params: params,
2287
2287
  config: config)
2288
2288
  context[:gem_name] = 'aws-sdk-core'
2289
- context[:gem_version] = '3.126.0'
2289
+ context[:gem_version] = '3.126.1'
2290
2290
  Seahorse::Client::Request.new(handlers, context)
2291
2291
  end
2292
2292
 
data/lib/aws-sdk-sts.rb CHANGED
@@ -50,6 +50,6 @@ require_relative 'aws-sdk-sts/customizations'
50
50
  # @!group service
51
51
  module Aws::STS
52
52
 
53
- GEM_VERSION = '3.126.0'
53
+ GEM_VERSION = '3.126.1'
54
54
 
55
55
  end
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.126.0
4
+ version: 3.126.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: 2022-02-03 00:00:00.000000000 Z
11
+ date: 2022-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath