aws-sdk-core 3.125.4 → 3.126.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-core/ec2_metadata.rb +3 -2
- data/lib/aws-sdk-core/errors.rb +1 -1
- data/lib/aws-sdk-core/instance_profile_credentials.rb +23 -8
- data/lib/aws-sdk-core/plugins/recursion_detection.rb +27 -0
- data/lib/aws-sdk-core/rest/request/headers.rb +8 -8
- data/lib/aws-sdk-sso/client.rb +3 -1
- data/lib/aws-sdk-sso.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +3 -1
- data/lib/aws-sdk-sts.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46193e52f3ea24b17d0d2ff28e7abf1ef462586db550c10f0540810da7a45fed
|
4
|
+
data.tar.gz: 3dc8f9629d7d7057632bd639c097747792dd40d6c6c81ca5f91e4366ca9dd6bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f72443886e4e7077c1dc7d1f816b1774ceeae361f13e6f13a5ce532bc77a669e297e5fb3f3582eb772563e315dd0afcef9c5d9acd45d672fea79706537b8868
|
7
|
+
data.tar.gz: 3ed264c5a2ed5cb2dcd3c050224785e62618ded48137d8dd217a75107865f58679a26e5ded1e8498971e8de862e8f91e684eb1a5c64fa9e3db3f53d186d8b351
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,28 @@
|
|
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
|
+
|
9
|
+
3.126.0 (2022-02-03)
|
10
|
+
------------------
|
11
|
+
|
12
|
+
* Feature - Updated Aws::SSO::Client with the latest API changes.
|
13
|
+
|
14
|
+
* Feature - Add support for recursion detection.
|
15
|
+
|
16
|
+
3.125.6 (2022-02-02)
|
17
|
+
------------------
|
18
|
+
|
19
|
+
* Issue - Ensure default message for ServiceError is a string (#2643).
|
20
|
+
|
21
|
+
3.125.5 (2022-01-19)
|
22
|
+
------------------
|
23
|
+
|
24
|
+
* Issue - Correctly serialize empty header lists.
|
25
|
+
|
4
26
|
3.125.4 (2022-01-18)
|
5
27
|
------------------
|
6
28
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
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.
|
data/lib/aws-sdk-core/errors.rb
CHANGED
@@ -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
|
-
|
170
|
-
|
171
|
-
|
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.
|
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 =
|
265
|
+
@created_time = created_time
|
251
266
|
end
|
252
267
|
|
253
268
|
# [String] token value
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module Plugins
|
5
|
+
# @api private
|
6
|
+
class RecursionDetection < Seahorse::Client::Plugin
|
7
|
+
|
8
|
+
# @api private
|
9
|
+
class Handler < Seahorse::Client::Handler
|
10
|
+
def call(context)
|
11
|
+
|
12
|
+
unless context.http_request.headers.key?('x-amz-trace-id')
|
13
|
+
if ENV['AWS_LAMBDA_FUNCTION_NAME'] &&
|
14
|
+
(trace_id = ENV['_X_AMZ_TRACE_ID'])
|
15
|
+
context.http_request.headers['x-amz-trace-id'] = trace_id
|
16
|
+
end
|
17
|
+
end
|
18
|
+
@handler.call(context)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# should be at the end of build so that
|
23
|
+
# modeled traits / service customizations apply first
|
24
|
+
handler(Handler, step: :build, order: 99)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -32,12 +32,11 @@ module Aws
|
|
32
32
|
|
33
33
|
def apply_header_value(headers, ref, value)
|
34
34
|
value = apply_json_trait(value) if ref['jsonvalue']
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
35
|
+
case ref.shape
|
36
|
+
when TimestampShape then headers[ref.location_name] = timestamp(ref, value)
|
37
|
+
when ListShape then list(headers, ref, value)
|
38
|
+
else headers[ref.location_name] = value.to_s
|
39
|
+
end
|
41
40
|
end
|
42
41
|
|
43
42
|
def timestamp(ref, value)
|
@@ -50,8 +49,9 @@ module Aws
|
|
50
49
|
end
|
51
50
|
end
|
52
51
|
|
53
|
-
def list(
|
54
|
-
value
|
52
|
+
def list(headers, ref, value)
|
53
|
+
return if !value || value.empty?
|
54
|
+
headers[ref.location_name] = value
|
55
55
|
.compact
|
56
56
|
.map { |s| escape_header_list_string(s.to_s) }
|
57
57
|
.join(",")
|
data/lib/aws-sdk-sso/client.rb
CHANGED
@@ -28,6 +28,7 @@ require 'aws-sdk-core/plugins/client_metrics_send_plugin.rb'
|
|
28
28
|
require 'aws-sdk-core/plugins/transfer_encoding.rb'
|
29
29
|
require 'aws-sdk-core/plugins/http_checksum.rb'
|
30
30
|
require 'aws-sdk-core/plugins/defaults_mode.rb'
|
31
|
+
require 'aws-sdk-core/plugins/recursion_detection.rb'
|
31
32
|
require 'aws-sdk-core/plugins/signature_v4.rb'
|
32
33
|
require 'aws-sdk-core/plugins/protocols/rest_json.rb'
|
33
34
|
|
@@ -75,6 +76,7 @@ module Aws::SSO
|
|
75
76
|
add_plugin(Aws::Plugins::TransferEncoding)
|
76
77
|
add_plugin(Aws::Plugins::HttpChecksum)
|
77
78
|
add_plugin(Aws::Plugins::DefaultsMode)
|
79
|
+
add_plugin(Aws::Plugins::RecursionDetection)
|
78
80
|
add_plugin(Aws::Plugins::SignatureV4)
|
79
81
|
add_plugin(Aws::Plugins::Protocols::RestJson)
|
80
82
|
|
@@ -541,7 +543,7 @@ module Aws::SSO
|
|
541
543
|
params: params,
|
542
544
|
config: config)
|
543
545
|
context[:gem_name] = 'aws-sdk-core'
|
544
|
-
context[:gem_version] = '3.
|
546
|
+
context[:gem_version] = '3.126.1'
|
545
547
|
Seahorse::Client::Request.new(handlers, context)
|
546
548
|
end
|
547
549
|
|
data/lib/aws-sdk-sso.rb
CHANGED
data/lib/aws-sdk-sts/client.rb
CHANGED
@@ -28,6 +28,7 @@ require 'aws-sdk-core/plugins/client_metrics_send_plugin.rb'
|
|
28
28
|
require 'aws-sdk-core/plugins/transfer_encoding.rb'
|
29
29
|
require 'aws-sdk-core/plugins/http_checksum.rb'
|
30
30
|
require 'aws-sdk-core/plugins/defaults_mode.rb'
|
31
|
+
require 'aws-sdk-core/plugins/recursion_detection.rb'
|
31
32
|
require 'aws-sdk-core/plugins/signature_v4.rb'
|
32
33
|
require 'aws-sdk-core/plugins/protocols/query.rb'
|
33
34
|
require 'aws-sdk-sts/plugins/sts_regional_endpoints.rb'
|
@@ -76,6 +77,7 @@ module Aws::STS
|
|
76
77
|
add_plugin(Aws::Plugins::TransferEncoding)
|
77
78
|
add_plugin(Aws::Plugins::HttpChecksum)
|
78
79
|
add_plugin(Aws::Plugins::DefaultsMode)
|
80
|
+
add_plugin(Aws::Plugins::RecursionDetection)
|
79
81
|
add_plugin(Aws::Plugins::SignatureV4)
|
80
82
|
add_plugin(Aws::Plugins::Protocols::Query)
|
81
83
|
add_plugin(Aws::STS::Plugins::STSRegionalEndpoints)
|
@@ -2284,7 +2286,7 @@ module Aws::STS
|
|
2284
2286
|
params: params,
|
2285
2287
|
config: config)
|
2286
2288
|
context[:gem_name] = 'aws-sdk-core'
|
2287
|
-
context[:gem_version] = '3.
|
2289
|
+
context[:gem_version] = '3.126.1'
|
2288
2290
|
Seahorse::Client::Request.new(handlers, context)
|
2289
2291
|
end
|
2290
2292
|
|
data/lib/aws-sdk-sts.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2022-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jmespath
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- lib/aws-sdk-core/plugins/protocols/query.rb
|
162
162
|
- lib/aws-sdk-core/plugins/protocols/rest_json.rb
|
163
163
|
- lib/aws-sdk-core/plugins/protocols/rest_xml.rb
|
164
|
+
- lib/aws-sdk-core/plugins/recursion_detection.rb
|
164
165
|
- lib/aws-sdk-core/plugins/regional_endpoint.rb
|
165
166
|
- lib/aws-sdk-core/plugins/response_paging.rb
|
166
167
|
- lib/aws-sdk-core/plugins/retries/client_rate_limiter.rb
|