aws-sdk-core 3.128.0 → 3.129.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 +15 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-core/client_stubs.rb +5 -1
- data/lib/aws-sdk-core/instance_profile_credentials.rb +52 -6
- data/lib/aws-sdk-core/pageable_response.rb +72 -32
- data/lib/aws-sdk-core/plugins/response_paging.rb +1 -1
- data/lib/aws-sdk-core/plugins/stub_responses.rb +5 -1
- data/lib/aws-sdk-sso/client.rb +1 -1
- data/lib/aws-sdk-sso.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +1 -1
- data/lib/aws-sdk-sts.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49ca96451c7816e538a74ba800cbc2ade4fcfb7a9d712fea2cc6da12deca1172
|
4
|
+
data.tar.gz: 12431a75db151e6c918707c1e592a1810849eebdc437cc41564cb06d536227fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f59af7600dc1f0e76566543cadf66b65f838c195d0a24c962043cf38cbbb190ee5be73daa968acbe332dd9490d9fadd89882e3a6d87f60c2f6f8ef1150f382d
|
7
|
+
data.tar.gz: 56baca1bd31275d8aa749890f0fe02d0e02b6d01df8c9596573efc3c269e6145bfaedbb813ae0aa03982dbc7ea2d35f9a84e58a9b3323304d78e70aab18b0947
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
Unreleased Changes
|
2
2
|
------------------
|
3
3
|
|
4
|
+
3.129.1 (2022-03-10)
|
5
|
+
------------------
|
6
|
+
|
7
|
+
* Issue - Make stubs thread safe by creating new responses for each operation call (#2675).
|
8
|
+
|
9
|
+
3.129.0 (2022-03-08)
|
10
|
+
------------------
|
11
|
+
|
12
|
+
* Feature - Add support for cases when `InstanceProfileCredentials` (IMDS) is unable to refresh credentials.
|
13
|
+
|
14
|
+
3.128.1 (2022-03-07)
|
15
|
+
------------------
|
16
|
+
|
17
|
+
* Issue - Fixed `Aws::PageableResponse` invalidating Ruby's global constant cache.
|
18
|
+
|
4
19
|
3.128.0 (2022-03-04)
|
5
20
|
------------------
|
6
21
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.129.1
|
@@ -262,13 +262,17 @@ module Aws
|
|
262
262
|
end
|
263
263
|
|
264
264
|
def convert_stub(operation_name, stub)
|
265
|
-
case stub
|
265
|
+
stub = case stub
|
266
266
|
when Proc then stub
|
267
267
|
when Exception, Class then { error: stub }
|
268
268
|
when String then service_error_stub(stub)
|
269
269
|
when Hash then http_response_stub(operation_name, stub)
|
270
270
|
else { data: stub }
|
271
271
|
end
|
272
|
+
if Hash === stub
|
273
|
+
stub[:mutex] = Mutex.new
|
274
|
+
end
|
275
|
+
stub
|
272
276
|
end
|
273
277
|
|
274
278
|
def service_error_stub(error_code)
|
@@ -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
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
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
|
@@ -48,11 +48,11 @@ module Aws
|
|
48
48
|
#
|
49
49
|
module PageableResponse
|
50
50
|
|
51
|
-
def self.
|
52
|
-
base.extend
|
53
|
-
base.
|
54
|
-
base.instance_variable_set(
|
55
|
-
base
|
51
|
+
def self.apply(base)
|
52
|
+
base.extend Extension
|
53
|
+
base.instance_variable_set(:@last_page, nil)
|
54
|
+
base.instance_variable_set(:@more_results, nil)
|
55
|
+
base
|
56
56
|
end
|
57
57
|
|
58
58
|
# @return [Paging::Pager]
|
@@ -62,39 +62,26 @@ module Aws
|
|
62
62
|
# when this method returns `false` will raise an error.
|
63
63
|
# @return [Boolean]
|
64
64
|
def last_page?
|
65
|
-
|
66
|
-
@last_page = !@pager.truncated?(self)
|
67
|
-
end
|
68
|
-
@last_page
|
65
|
+
# Actual implementation is in PageableResponse::Extension
|
69
66
|
end
|
70
67
|
|
71
68
|
# Returns `true` if there are more results. Calling {#next_page} will
|
72
69
|
# return the next response.
|
73
70
|
# @return [Boolean]
|
74
71
|
def next_page?
|
75
|
-
|
72
|
+
# Actual implementation is in PageableResponse::Extension
|
76
73
|
end
|
77
74
|
|
78
75
|
# @return [Seahorse::Client::Response]
|
79
76
|
def next_page(params = {})
|
80
|
-
|
81
|
-
raise LastPageError.new(self)
|
82
|
-
else
|
83
|
-
next_response(params)
|
84
|
-
end
|
77
|
+
# Actual implementation is in PageableResponse::Extension
|
85
78
|
end
|
86
79
|
|
87
80
|
# Yields the current and each following response to the given block.
|
88
81
|
# @yieldparam [Response] response
|
89
82
|
# @return [Enumerable,nil] Returns a new Enumerable if no block is given.
|
90
83
|
def each(&block)
|
91
|
-
|
92
|
-
response = self
|
93
|
-
yield(response)
|
94
|
-
until response.last_page?
|
95
|
-
response = response.next_page
|
96
|
-
yield(response)
|
97
|
-
end
|
84
|
+
# Actual implementation is in PageableResponse::Extension
|
98
85
|
end
|
99
86
|
alias each_page each
|
100
87
|
|
@@ -105,9 +92,7 @@ module Aws
|
|
105
92
|
# @return [Seahorse::Client::Response] Returns the next page of
|
106
93
|
# results.
|
107
94
|
def next_response(params)
|
108
|
-
|
109
|
-
request = context.client.build_request(context.operation_name, params)
|
110
|
-
request.send_request
|
95
|
+
# Actual implementation is in PageableResponse::Extension
|
111
96
|
end
|
112
97
|
|
113
98
|
# @param [Hash] params A hash of additional request params to
|
@@ -115,13 +100,7 @@ module Aws
|
|
115
100
|
# @return [Hash] Returns the hash of request parameters for the
|
116
101
|
# next page, merging any given params.
|
117
102
|
def next_page_params(params)
|
118
|
-
#
|
119
|
-
# Sometimes a token can be nil and merge would not include it.
|
120
|
-
tokens = @pager.tokens.values.map(&:to_sym)
|
121
|
-
|
122
|
-
params_without_tokens = context[:original_params].reject { |k, _v| tokens.include?(k) }
|
123
|
-
params_without_tokens.merge!(@pager.next_tokens(self).merge(params))
|
124
|
-
params_without_tokens
|
103
|
+
# Actual implementation is in PageableResponse::Extension
|
125
104
|
end
|
126
105
|
|
127
106
|
# Raised when calling {PageableResponse#next_page} on a pager that
|
@@ -168,5 +147,66 @@ module Aws
|
|
168
147
|
end
|
169
148
|
|
170
149
|
end
|
150
|
+
|
151
|
+
# The actual decorator module implementation. It is in a distinct module
|
152
|
+
# so that it can be used to extend objects without busting Ruby's constant cache.
|
153
|
+
# object.extend(mod) bust the constant cache only if `mod` contains constants of its own.
|
154
|
+
# @api private
|
155
|
+
module Extension
|
156
|
+
|
157
|
+
include Enumerable
|
158
|
+
include UnsafeEnumerableMethods
|
159
|
+
|
160
|
+
attr_accessor :pager
|
161
|
+
|
162
|
+
def last_page?
|
163
|
+
if @last_page.nil?
|
164
|
+
@last_page = !@pager.truncated?(self)
|
165
|
+
end
|
166
|
+
@last_page
|
167
|
+
end
|
168
|
+
|
169
|
+
def next_page?
|
170
|
+
!last_page?
|
171
|
+
end
|
172
|
+
|
173
|
+
def next_page(params = {})
|
174
|
+
if last_page?
|
175
|
+
raise LastPageError.new(self)
|
176
|
+
else
|
177
|
+
next_response(params)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
def each(&block)
|
182
|
+
return enum_for(:each_page) unless block_given?
|
183
|
+
response = self
|
184
|
+
yield(response)
|
185
|
+
until response.last_page?
|
186
|
+
response = response.next_page
|
187
|
+
yield(response)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
alias each_page each
|
191
|
+
|
192
|
+
private
|
193
|
+
|
194
|
+
def next_response(params)
|
195
|
+
params = next_page_params(params)
|
196
|
+
request = context.client.build_request(context.operation_name, params)
|
197
|
+
request.send_request
|
198
|
+
end
|
199
|
+
|
200
|
+
def next_page_params(params)
|
201
|
+
# Remove all previous tokens from original params
|
202
|
+
# Sometimes a token can be nil and merge would not include it.
|
203
|
+
tokens = @pager.tokens.values.map(&:to_sym)
|
204
|
+
|
205
|
+
params_without_tokens = context[:original_params].reject { |k, _v| tokens.include?(k) }
|
206
|
+
params_without_tokens.merge!(@pager.next_tokens(self).merge(params))
|
207
|
+
params_without_tokens
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|
171
211
|
end
|
172
212
|
end
|
@@ -10,7 +10,7 @@ module Aws
|
|
10
10
|
def call(context)
|
11
11
|
context[:original_params] = context.params
|
12
12
|
resp = @handler.call(context)
|
13
|
-
|
13
|
+
PageableResponse.apply(resp)
|
14
14
|
resp.pager = context.operation[:pager] || Aws::Pager::NullPager.new
|
15
15
|
resp
|
16
16
|
end
|
@@ -51,7 +51,11 @@ requests are made, and retries are disabled.
|
|
51
51
|
stub = context.client.next_stub(context)
|
52
52
|
resp = Seahorse::Client::Response.new(context: context)
|
53
53
|
async_mode = context.client.is_a? Seahorse::Client::AsyncBase
|
54
|
-
|
54
|
+
if Hash === stub && stub[:mutex]
|
55
|
+
stub[:mutex].synchronize { apply_stub(stub, resp, async_mode) }
|
56
|
+
else
|
57
|
+
apply_stub(stub, resp, async_mode)
|
58
|
+
end
|
55
59
|
|
56
60
|
async_mode ? Seahorse::Client::AsyncResponse.new(
|
57
61
|
context: context, stream: context[:input_event_stream_handler].event_emitter.stream, sync_queue: Queue.new) : resp
|
data/lib/aws-sdk-sso/client.rb
CHANGED
data/lib/aws-sdk-sso.rb
CHANGED
data/lib/aws-sdk-sts/client.rb
CHANGED
@@ -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.
|
2293
|
+
context[:gem_version] = '3.129.1'
|
2294
2294
|
Seahorse::Client::Request.new(handlers, context)
|
2295
2295
|
end
|
2296
2296
|
|
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.129.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-03-
|
11
|
+
date: 2022-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jmespath
|