aws-sdk-core 3.128.1 → 3.129.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53aab290e862816944f62b219f9f5ed4695a3eaf875e80c734e4903e6fd7c667
4
- data.tar.gz: 87ccab0dd866022fd07c8b142649b3ffbe63a62823b8730753552f07b470aa72
3
+ metadata.gz: ed3d2d582fb74767dc5f0d2211e65c95f0c6513ea3b251ac91fe9e4911ca10cb
4
+ data.tar.gz: c8b4261e45c2ec02e5c38ccc3f37cf7cce3de1ad47f5fe6a31b8e6cfe773d5f4
5
5
  SHA512:
6
- metadata.gz: e38def3a74f0b22945249d2780e6f11a5b358189dcdcfab4f3e089054cf90accbdedf1f5987023524edba94e63dbabf4c601a9b49c577994935925cce95335e6
7
- data.tar.gz: 62287dbd4a357de5216564b351938a1e266d0559f87746c288d36ade8715e01678040d47f24c680e1e9009997133201fb0af74e047b20fbf207fe054417cf6e8
6
+ metadata.gz: da350fda9592e059be2b4fd2d355e580f8e2cfa7c638bdf2524564073441b96543d0e00444a69209e6950a902ba98828aceee1740ccbb7a58d755638883fdc27
7
+ data.tar.gz: 4ec8d06a538e401bd9864564daa04cbad71c546872fe98b4b43c5796f69f00fa492f5be203f456e5db13231b7dfe3a2df26661cafc0a0d787c545cfcfccc7792
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.129.0 (2022-03-08)
5
+ ------------------
6
+
7
+ * Feature - Add support for cases when `InstanceProfileCredentials` (IMDS) is unable to refresh credentials.
8
+
4
9
  3.128.1 (2022-03-07)
5
10
  ------------------
6
11
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.128.1
1
+ 3.129.0
@@ -78,6 +78,7 @@ module Aws
78
78
  @backoff = backoff(options[:backoff])
79
79
  @token_ttl = options[:token_ttl] || 21_600
80
80
  @token = nil
81
+ @no_refresh_until = nil
81
82
  super
82
83
  end
83
84
 
@@ -125,18 +126,48 @@ module Aws
125
126
  end
126
127
 
127
128
  def refresh
129
+ if @no_refresh_until && @no_refresh_until > Time.now
130
+ warn_expired_credentials
131
+ return
132
+ end
133
+
128
134
  # Retry loading credentials up to 3 times is the instance metadata
129
135
  # service is responding but is returning invalid JSON documents
130
136
  # in response to the GET profile credentials call.
131
137
  begin
132
138
  retry_errors([Aws::Json::ParseError, StandardError], max_retries: 3) do
133
139
  c = Aws::Json.load(get_credentials.to_s)
134
- @credentials = Credentials.new(
135
- c['AccessKeyId'],
136
- c['SecretAccessKey'],
137
- c['Token']
138
- )
139
- @expiration = c['Expiration'] ? Time.iso8601(c['Expiration']) : nil
140
+ if empty_credentials?(@credentials)
141
+ @credentials = Credentials.new(
142
+ c['AccessKeyId'],
143
+ c['SecretAccessKey'],
144
+ c['Token']
145
+ )
146
+ @expiration = c['Expiration'] ? Time.iso8601(c['Expiration']) : nil
147
+ if @expiration && @expiration < Time.now
148
+ @no_refresh_until = Time.now + refresh_offset
149
+ warn_expired_credentials
150
+ end
151
+ else
152
+ # credentials are already set, update them only if the new ones are not empty
153
+ if !c['AccessKeyId'] || c['AccessKeyId'].empty?
154
+ # error getting new credentials
155
+ @no_refresh_until = Time.now + refresh_offset
156
+ warn_expired_credentials
157
+ else
158
+ @credentials = Credentials.new(
159
+ c['AccessKeyId'],
160
+ c['SecretAccessKey'],
161
+ c['Token']
162
+ )
163
+ @expiration = c['Expiration'] ? Time.iso8601(c['Expiration']) : nil
164
+ if @expiration && @expiration < Time.now
165
+ @no_refresh_until = Time.now + refresh_offset
166
+ warn_expired_credentials
167
+ end
168
+ end
169
+ end
170
+
140
171
  end
141
172
  rescue Aws::Json::ParseError
142
173
  raise Aws::Errors::MetadataParserError
@@ -260,6 +291,21 @@ module Aws
260
291
  end
261
292
  end
262
293
 
294
+ def warn_expired_credentials
295
+ warn("Attempting credential expiration extension due to a credential "\
296
+ "service availability issue. A refresh of these credentials "\
297
+ "will be attempted again in 5 minutes.")
298
+ end
299
+
300
+ def empty_credentials?(creds)
301
+ !creds || !creds.access_key_id || creds.access_key_id.empty?
302
+ end
303
+
304
+ # Compute an offset for refresh with jitter
305
+ def refresh_offset
306
+ 300 + rand(0..60)
307
+ end
308
+
263
309
  # @api private
264
310
  # Token used to fetch IMDS profile and credentials
265
311
  class Token
@@ -545,7 +545,7 @@ module Aws::SSO
545
545
  params: params,
546
546
  config: config)
547
547
  context[:gem_name] = 'aws-sdk-core'
548
- context[:gem_version] = '3.128.1'
548
+ context[:gem_version] = '3.129.0'
549
549
  Seahorse::Client::Request.new(handlers, context)
550
550
  end
551
551
 
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.128.1'
53
+ GEM_VERSION = '3.129.0'
54
54
 
55
55
  end
@@ -2290,7 +2290,7 @@ module Aws::STS
2290
2290
  params: params,
2291
2291
  config: config)
2292
2292
  context[:gem_name] = 'aws-sdk-core'
2293
- context[:gem_version] = '3.128.1'
2293
+ context[:gem_version] = '3.129.0'
2294
2294
  Seahorse::Client::Request.new(handlers, context)
2295
2295
  end
2296
2296
 
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.128.1'
53
+ GEM_VERSION = '3.129.0'
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.128.1
4
+ version: 3.129.0
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-03-07 00:00:00.000000000 Z
11
+ date: 2022-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath