aws-sdk-core 3.220.0 → 3.220.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
2
  SHA256:
3
- metadata.gz: 1f27ca30a27b9facf199f41e7e80e5b89582f87581d5e9d1f0c771e7a8a184fb
4
- data.tar.gz: 80780457231b474d80999129e719103f0a7292f66154741861076234704a9e47
3
+ metadata.gz: 3240fa70bcc8af09bd2cf7dfaaa5801cb7786c7fd253beff8d859e6a65a4b135
4
+ data.tar.gz: cf8950c3f0291a93298b3723eb697d6930f55d6fcc6ddd4ed197db3d2225b8bf
5
5
  SHA512:
6
- metadata.gz: c53631e0e54859cee1281b03b355c9ae2c447836aa6a32f9f7756fc923e0f2d10149ed95e20877641baf60fdde8329734689ddfee7324d35517e414e2979130f
7
- data.tar.gz: f1e1c011480a498d256410cf99294ad6f8b52061517c3785760cc741033948580c2a93e57c5be461133b23cdfaa11336ccb92fb85fbd6a62cd67a4c62ab7ee99
6
+ metadata.gz: d2cbfdcdb577a82a691c172f3f69785e0d0ab980fdf2cbb9387ef60c8b32531a0804f7cee8c799e7be17f8c6c2a43956fec8ad6425147516c1aaec75a3e6cb42
7
+ data.tar.gz: 0de986f5a38fc00014c90010e259c30c1c30714f8191aa1858af4a2bc6cf075ffd52d8caf1da4eacaaab0b987bc5cf245061d951b8fe86be0cba0b0f793a38fa
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.220.1 (2025-03-06)
5
+ ------------------
6
+
7
+ * Issue - Convert stubs at request time.
8
+
4
9
  3.220.0 (2025-03-04)
5
10
  ------------------
6
11
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.220.0
1
+ 3.220.1
@@ -15,27 +15,11 @@ module Aws
15
15
 
16
16
  # @api private
17
17
  def setup_stubbing
18
- @stubs = {}
19
- @stub_mutex = Mutex.new
20
18
  if Hash === @config.stub_responses
21
19
  @config.stub_responses.each do |operation_name, stubs|
22
20
  apply_stubs(operation_name, Array === stubs ? stubs : [stubs])
23
21
  end
24
22
  end
25
-
26
- # When a client is stubbed allow the user to access the requests made
27
- requests = @api_requests = []
28
- requests_mutex = @requests_mutex = Mutex.new
29
- self.handle do |context|
30
- requests_mutex.synchronize do
31
- requests << {
32
- operation_name: context.operation_name,
33
- params: context.params,
34
- context: context
35
- }
36
- end
37
- @handler.call(context)
38
- end
39
23
  end
40
24
 
41
25
  # Configures what data / errors should be returned from the named operation
@@ -175,7 +159,7 @@ module Aws
175
159
  # on a client that has not enabled response stubbing via
176
160
  # `:stub_responses => true`.
177
161
  def stub_responses(operation_name, *stubs)
178
- if config.stub_responses
162
+ if @config.stub_responses
179
163
  apply_stubs(operation_name, stubs.flatten)
180
164
  else
181
165
  msg = 'stubbing is not enabled; enable stubbing in the constructor '\
@@ -194,12 +178,12 @@ module Aws
194
178
  # @raise [NotImplementedError] Raises `NotImplementedError` when the client
195
179
  # is not stubbed.
196
180
  def api_requests(options = {})
197
- if config.stub_responses
198
- @requests_mutex.synchronize do
181
+ if @config.stub_responses
182
+ @config.api_requests_mutex.synchronize do
199
183
  if options[:exclude_presign]
200
- @api_requests.reject {|req| req[:context][:presigned_url] }
184
+ @config.api_requests.reject {|req| req[:context][:presigned_url] }
201
185
  else
202
- @api_requests
186
+ @config.api_requests
203
187
  end
204
188
  end
205
189
  else
@@ -228,54 +212,44 @@ module Aws
228
212
  # @return [Structure] Returns a stubbed response data structure. The
229
213
  # actual class returned will depend on the given `operation_name`.
230
214
  def stub_data(operation_name, data = {})
231
- Stubbing::StubData.new(config.api.operation(operation_name)).stub(data)
215
+ Stubbing::StubData.new(@config.api.operation(operation_name)).stub(data)
232
216
  end
233
217
 
234
218
  # @api private
235
219
  def next_stub(context)
236
220
  operation_name = context.operation_name.to_sym
237
- stub = @stub_mutex.synchronize do
238
- stubs = @stubs[operation_name] || []
221
+ stub = @config.stubs_mutex.synchronize do
222
+ stubs = @config.stubs[operation_name] || []
239
223
  case stubs.length
240
- when 0 then default_stub(operation_name)
224
+ when 0 then stub_data(operation_name)
241
225
  when 1 then stubs.first
242
226
  else stubs.shift
243
227
  end
244
228
  end
245
- Proc === stub ? convert_stub(operation_name, stub.call(context)) : stub
229
+ stub = convert_stub(operation_name, stub, context)
230
+ stub[:mutex] = Mutex.new
231
+ stub
246
232
  end
247
233
 
248
234
  private
249
235
 
250
- def default_stub(operation_name)
251
- stub = stub_data(operation_name)
252
- http_response_stub(operation_name, stub)
236
+ def apply_stubs(operation_name, stubs)
237
+ @config.stubs_mutex.synchronize do
238
+ @config.stubs[operation_name.to_sym] = stubs
239
+ end
253
240
  end
254
241
 
255
242
  # This method converts the given stub data and converts it to a
256
243
  # HTTP response (when possible). This enables the response stubbing
257
244
  # plugin to provide a HTTP response that triggers all normal events
258
245
  # during response handling.
259
- def apply_stubs(operation_name, stubs)
260
- @stub_mutex.synchronize do
261
- @stubs[operation_name.to_sym] = stubs.map do |stub|
262
- convert_stub(operation_name, stub)
263
- end
264
- end
265
- end
266
-
267
- def convert_stub(operation_name, stub)
268
- stub = case stub
269
- when Proc then stub
246
+ def convert_stub(operation_name, stub, context)
247
+ case stub
248
+ when Proc then convert_stub(operation_name, stub.call(context), context)
270
249
  when Exception, Class then { error: stub }
271
250
  when String then service_error_stub(stub)
272
- when Hash then http_response_stub(operation_name, stub)
273
- else { data: stub }
274
- end
275
- if Hash === stub
276
- stub[:mutex] = Mutex.new
251
+ else http_response_stub(operation_name, stub)
277
252
  end
278
- stub
279
253
  end
280
254
 
281
255
  def service_error_stub(error_code)
@@ -299,14 +273,14 @@ module Aws
299
273
  end
300
274
 
301
275
  def data_to_http_resp(operation_name, data)
302
- api = config.api
276
+ api = @config.api
303
277
  operation = api.operation(operation_name)
304
278
  ParamValidator.new(operation.output, input: false).validate!(data)
305
279
  protocol_helper.stub_data(api, operation, data)
306
280
  end
307
281
 
308
282
  def protocol_helper
309
- case config.api.metadata['protocol']
283
+ case @config.api.metadata['protocol']
310
284
  when 'json' then Stubbing::Protocols::Json
311
285
  when 'rest-json' then Stubbing::Protocols::RestJson
312
286
  when 'rest-xml' then Stubbing::Protocols::RestXml
@@ -29,8 +29,16 @@ requests are made, and retries are disabled.
29
29
  end
30
30
  end
31
31
 
32
+ option(:stubs) { {} }
33
+ option(:stubs_mutex) { Mutex.new }
34
+ option(:api_requests) { [] }
35
+ option(:api_requests_mutex) { Mutex.new }
36
+
32
37
  def add_handlers(handlers, config)
33
- handlers.add(Handler, step: :send) if config.stub_responses
38
+ return unless config.stub_responses
39
+
40
+ handlers.add(ApiRequestsHandler)
41
+ handlers.add(StubbingHandler, step: :send)
34
42
  end
35
43
 
36
44
  def after_initialize(client)
@@ -46,8 +54,20 @@ requests are made, and retries are disabled.
46
54
  end
47
55
  end
48
56
 
49
- class Handler < Seahorse::Client::Handler
57
+ class ApiRequestsHandler < Seahorse::Client::Handler
58
+ def call(context)
59
+ context.config.api_requests_mutex.synchronize do
60
+ context.config.api_requests << {
61
+ operation_name: context.operation_name,
62
+ params: context.params,
63
+ context: context
64
+ }
65
+ end
66
+ @handler.call(context)
67
+ end
68
+ end
50
69
 
70
+ class StubbingHandler < Seahorse::Client::Handler
51
71
  def call(context)
52
72
  span_wrapper(context) do
53
73
  stub_responses(context)
@@ -57,14 +77,10 @@ requests are made, and retries are disabled.
57
77
  private
58
78
 
59
79
  def stub_responses(context)
60
- stub = context.client.next_stub(context)
61
80
  resp = Seahorse::Client::Response.new(context: context)
62
81
  async_mode = context.client.is_a? Seahorse::Client::AsyncBase
63
- if Hash === stub && stub[:mutex]
64
- stub[:mutex].synchronize { apply_stub(stub, resp, async_mode) }
65
- else
66
- apply_stub(stub, resp, async_mode)
67
- end
82
+ stub = context.client.next_stub(context)
83
+ stub[:mutex].synchronize { apply_stub(stub, resp, async_mode) }
68
84
 
69
85
  if async_mode
70
86
  Seahorse::Client::AsyncResponse.new(
@@ -692,7 +692,7 @@ module Aws::SSO
692
692
  tracer: tracer
693
693
  )
694
694
  context[:gem_name] = 'aws-sdk-core'
695
- context[:gem_version] = '3.220.0'
695
+ context[:gem_version] = '3.220.1'
696
696
  Seahorse::Client::Request.new(handlers, context)
697
697
  end
698
698
 
data/lib/aws-sdk-sso.rb CHANGED
@@ -56,7 +56,7 @@ module Aws::SSO
56
56
  autoload :EndpointProvider, 'aws-sdk-sso/endpoint_provider'
57
57
  autoload :Endpoints, 'aws-sdk-sso/endpoints'
58
58
 
59
- GEM_VERSION = '3.220.0'
59
+ GEM_VERSION = '3.220.1'
60
60
 
61
61
  end
62
62
 
@@ -1051,7 +1051,7 @@ module Aws::SSOOIDC
1051
1051
  tracer: tracer
1052
1052
  )
1053
1053
  context[:gem_name] = 'aws-sdk-core'
1054
- context[:gem_version] = '3.220.0'
1054
+ context[:gem_version] = '3.220.1'
1055
1055
  Seahorse::Client::Request.new(handlers, context)
1056
1056
  end
1057
1057
 
@@ -56,7 +56,7 @@ module Aws::SSOOIDC
56
56
  autoload :EndpointProvider, 'aws-sdk-ssooidc/endpoint_provider'
57
57
  autoload :Endpoints, 'aws-sdk-ssooidc/endpoints'
58
58
 
59
- GEM_VERSION = '3.220.0'
59
+ GEM_VERSION = '3.220.1'
60
60
 
61
61
  end
62
62
 
@@ -2595,7 +2595,7 @@ module Aws::STS
2595
2595
  tracer: tracer
2596
2596
  )
2597
2597
  context[:gem_name] = 'aws-sdk-core'
2598
- context[:gem_version] = '3.220.0'
2598
+ context[:gem_version] = '3.220.1'
2599
2599
  Seahorse::Client::Request.new(handlers, context)
2600
2600
  end
2601
2601
 
data/lib/aws-sdk-sts.rb CHANGED
@@ -56,7 +56,7 @@ module Aws::STS
56
56
  autoload :EndpointProvider, 'aws-sdk-sts/endpoint_provider'
57
57
  autoload :Endpoints, 'aws-sdk-sts/endpoints'
58
58
 
59
- GEM_VERSION = '3.220.0'
59
+ GEM_VERSION = '3.220.1'
60
60
 
61
61
  end
62
62
 
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.220.0
4
+ version: 3.220.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: 2025-03-04 00:00:00.000000000 Z
11
+ date: 2025-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-eventstream