aws-sdk-core 3.219.0 → 3.240.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.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +222 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-defaults/default_configuration.rb +2 -1
  5. data/lib/aws-sdk-core/assume_role_credentials.rb +9 -8
  6. data/lib/aws-sdk-core/assume_role_web_identity_credentials.rb +3 -2
  7. data/lib/aws-sdk-core/client_stubs.rb +28 -48
  8. data/lib/aws-sdk-core/credential_provider.rb +4 -0
  9. data/lib/aws-sdk-core/credential_provider_chain.rb +91 -22
  10. data/lib/aws-sdk-core/credentials.rb +6 -0
  11. data/lib/aws-sdk-core/ecs_credentials.rb +14 -13
  12. data/lib/aws-sdk-core/endpoints/matchers.rb +2 -1
  13. data/lib/aws-sdk-core/endpoints.rb +37 -13
  14. data/lib/aws-sdk-core/error_handler.rb +5 -0
  15. data/lib/aws-sdk-core/errors.rb +5 -2
  16. data/lib/aws-sdk-core/event_emitter.rb +1 -1
  17. data/lib/aws-sdk-core/instance_profile_credentials.rb +147 -157
  18. data/lib/aws-sdk-core/json/error_handler.rb +14 -4
  19. data/lib/aws-sdk-core/login_credentials.rb +229 -0
  20. data/lib/aws-sdk-core/plugins/checksum_algorithm.rb +28 -14
  21. data/lib/aws-sdk-core/plugins/client_metrics_plugin.rb +0 -1
  22. data/lib/aws-sdk-core/plugins/credentials_configuration.rb +75 -59
  23. data/lib/aws-sdk-core/plugins/endpoint_pattern.rb +40 -32
  24. data/lib/aws-sdk-core/plugins/sign.rb +29 -20
  25. data/lib/aws-sdk-core/plugins/stub_responses.rb +30 -8
  26. data/lib/aws-sdk-core/plugins/user_agent.rb +26 -2
  27. data/lib/aws-sdk-core/process_credentials.rb +1 -1
  28. data/lib/aws-sdk-core/refreshing_credentials.rb +8 -11
  29. data/lib/aws-sdk-core/rest/request/headers.rb +1 -1
  30. data/lib/aws-sdk-core/rpc_v2/error_handler.rb +26 -16
  31. data/lib/aws-sdk-core/rpc_v2/parser.rb +8 -0
  32. data/lib/aws-sdk-core/shared_config.rb +102 -21
  33. data/lib/aws-sdk-core/shared_credentials.rb +1 -0
  34. data/lib/aws-sdk-core/sso_credentials.rb +3 -1
  35. data/lib/aws-sdk-core/static_token_provider.rb +1 -2
  36. data/lib/aws-sdk-core/token.rb +3 -3
  37. data/lib/aws-sdk-core/token_provider.rb +4 -0
  38. data/lib/aws-sdk-core/token_provider_chain.rb +2 -6
  39. data/lib/aws-sdk-core/util.rb +2 -1
  40. data/lib/aws-sdk-core/xml/error_handler.rb +3 -1
  41. data/lib/aws-sdk-core.rb +4 -0
  42. data/lib/aws-sdk-signin/client.rb +604 -0
  43. data/lib/aws-sdk-signin/client_api.rb +119 -0
  44. data/lib/aws-sdk-signin/customizations.rb +1 -0
  45. data/lib/aws-sdk-signin/endpoint_parameters.rb +69 -0
  46. data/lib/aws-sdk-signin/endpoint_provider.rb +59 -0
  47. data/lib/aws-sdk-signin/endpoints.rb +20 -0
  48. data/lib/aws-sdk-signin/errors.rb +122 -0
  49. data/lib/aws-sdk-signin/plugins/endpoints.rb +77 -0
  50. data/lib/aws-sdk-signin/resource.rb +26 -0
  51. data/lib/aws-sdk-signin/types.rb +299 -0
  52. data/lib/aws-sdk-signin.rb +63 -0
  53. data/lib/aws-sdk-sso/client.rb +25 -19
  54. data/lib/aws-sdk-sso/endpoint_parameters.rb +4 -4
  55. data/lib/aws-sdk-sso/endpoint_provider.rb +2 -2
  56. data/lib/aws-sdk-sso.rb +1 -1
  57. data/lib/aws-sdk-ssooidc/client.rb +57 -27
  58. data/lib/aws-sdk-ssooidc/client_api.rb +11 -0
  59. data/lib/aws-sdk-ssooidc/endpoint_parameters.rb +4 -4
  60. data/lib/aws-sdk-ssooidc/errors.rb +10 -0
  61. data/lib/aws-sdk-ssooidc/types.rb +45 -6
  62. data/lib/aws-sdk-ssooidc.rb +1 -1
  63. data/lib/aws-sdk-sts/client.rb +160 -30
  64. data/lib/aws-sdk-sts/client_api.rb +82 -8
  65. data/lib/aws-sdk-sts/customizations.rb +0 -1
  66. data/lib/aws-sdk-sts/endpoint_parameters.rb +5 -5
  67. data/lib/aws-sdk-sts/endpoint_provider.rb +18 -18
  68. data/lib/aws-sdk-sts/errors.rb +79 -0
  69. data/lib/aws-sdk-sts/presigner.rb +2 -6
  70. data/lib/aws-sdk-sts/types.rb +175 -6
  71. data/lib/aws-sdk-sts.rb +1 -1
  72. data/lib/seahorse/client/async_base.rb +4 -5
  73. data/lib/seahorse/client/base.rb +0 -14
  74. data/lib/seahorse/client/h2/connection.rb +18 -28
  75. data/lib/seahorse/client/h2/handler.rb +6 -1
  76. data/lib/seahorse/client/http/response.rb +1 -1
  77. data/lib/seahorse/client/net_http/connection_pool.rb +2 -1
  78. data/lib/seahorse/client/networking_error.rb +1 -1
  79. data/lib/seahorse/client/plugins/h2.rb +4 -4
  80. data/lib/seahorse/client/request_context.rb +2 -2
  81. data/lib/seahorse/util.rb +2 -1
  82. data/sig/aws-sdk-core/async_client_stubs.rbs +21 -0
  83. data/sig/seahorse/client/async_base.rbs +18 -0
  84. metadata +46 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: daacffffa5a66ef5ba66b2abdd92d47fc186f5bf55f9d2e0daf32f1769cd3976
4
- data.tar.gz: 98e54a35f69070132a9cbc14aab6d1e53b324e649bed80b5775c09b1c299de82
3
+ metadata.gz: bfea66796a6586854e469946701deeb09f2b344e82967f505262052efea4c972
4
+ data.tar.gz: 98d0d7a3da929b82b7b14098d0041532d94ec0f88bfa04e74c5bcf8286e090b3
5
5
  SHA512:
6
- metadata.gz: 8357279c87cb3d8becf3a903242eb3c1d8dd2398a4ba2672265fbc77534e79abe32c080fe1481ae6211b564159d0a0afca6b45894a1bcc1975d13c76f1c3adf4
7
- data.tar.gz: 6d1c7706d7828fc2d0c977c8e33f0ae92a32995b9b7878fa9801f3cdc7265d4c2977a4399f2d9c7022d8b9d7ff909b46da8b7f1713e5301c4e4d769e6a015a43
6
+ metadata.gz: 65092f9f2795f01ee929393ccdbb06ca55d2e0ea420ac7004c0d24fe6bfd9e3b155cd2d4869b96a6deb64e65c8d4fd0e917e8834ea0cac3602a9289df6de4c4f
7
+ data.tar.gz: 806b5e412f3a25b956d607f948e957e71241b25fdea11306d43a9752570d5daa80e33740c543bc499d74412d63db8325c9c9bf39ae4738c971e318ac33503b47
data/CHANGELOG.md CHANGED
@@ -1,6 +1,228 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.240.0 (2025-12-16)
5
+ ------------------
6
+
7
+ * Feature - Updated configuration values for `defaults_mode`.
8
+
9
+ * Issue - Prioritizes JSON over CBOR when both are supported for stubbed clients.
10
+
11
+ 3.239.2 (2025-11-25)
12
+ ------------------
13
+
14
+ * Issue - Fix `login_credentials` in credentials chain when config is enabled.
15
+
16
+ 3.239.1 (2025-11-21)
17
+ ------------------
18
+
19
+ * Issue - Fixed HTTP/2 connection issues when using custom ports.
20
+
21
+ 3.239.0 (2025-11-20)
22
+ ------------------
23
+
24
+ * Feature - Updated Aws::Signin::Client with the latest API changes.
25
+
26
+ * Issue - Fix region configuration for LoginCredential's Signin client.
27
+
28
+ 3.238.0 (2025-11-19)
29
+ ------------------
30
+
31
+ * Feature - Updated Aws::Signin::Client with the latest API changes.
32
+
33
+ * Feature - Updated Aws::STS::Client with the latest API changes.
34
+
35
+ * Feature - IAM now supports outbound identity federation via the STS GetWebIdentityToken API, enabling AWS workloads to securely authenticate with external services using short-lived JSON Web Tokens.
36
+
37
+ * Feature - Add `LoginCredentials` which retrieves credentials from AWS Sign-In. Support `aws-sdk-signin` alias gem.
38
+
39
+ 3.237.0 (2025-11-10)
40
+ ------------------
41
+
42
+ * Feature - Updated Aws::STS::Client with the latest API changes.
43
+
44
+ * Feature - Added GetDelegatedAccessToken API, which is not available for general use at this time.
45
+
46
+ 3.236.0 (2025-10-30)
47
+ ------------------
48
+
49
+ * Feature - Updated Aws::STS::Client with the latest API changes.
50
+
51
+ * Feature - Updated Aws::SSO::Client with the latest API changes.
52
+
53
+ * Feature - Update endpoint ruleset parameters casing
54
+
55
+ 3.235.0 (2025-10-24)
56
+ ------------------
57
+
58
+ * Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
59
+
60
+ * Feature - Update endpoint ruleset parameters casing
61
+
62
+ 3.234.0 (2025-10-21)
63
+ ------------------
64
+
65
+ * Issue - Fix `request_checksum_calculation` `when_required` mode to only calculate checksums when explicitly provided by user.
66
+
67
+ * Feature - Add `CREDENTIALS_CODE` metric for `static_profile_` prefixed methods in default credential chain.
68
+
69
+ 3.233.0 (2025-09-23)
70
+ ------------------
71
+
72
+ * Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
73
+
74
+ * Feature - This release includes exception definition and documentation updates.
75
+
76
+ 3.232.0 (2025-08-28)
77
+ ------------------
78
+
79
+ * Feature - Updated Aws::SSO::Client with the latest API changes.
80
+
81
+ * Feature - Remove incorrect endpoint tests
82
+
83
+ 3.231.0 (2025-08-26)
84
+ ------------------
85
+
86
+ * Feature - Remove incorrect endpoint tests
87
+
88
+ * Feature - Add support for ENV as credential source for `AssumeRoleCredentials`.
89
+
90
+ 3.230.0 (2025-08-21)
91
+ ------------------
92
+
93
+ * Feature - Remove incorrect endpoint tests
94
+
95
+ 3.229.0 (2025-08-04)
96
+ ------------------
97
+
98
+ * Feature - Updated Aws::STS::Client with the latest API changes.
99
+
100
+ * Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
101
+
102
+ * Feature - Updated Aws::SSO::Client with the latest API changes.
103
+
104
+ 3.228.0 (2025-07-31)
105
+ ------------------
106
+
107
+ * Feature - Add `bigdecimal` as a dependency. For systems that are not able to build native extension gems, prefer the locally installed `bigdecimal` with `bundle install --prefer-local`.
108
+
109
+ 3.227.0 (2025-07-21)
110
+ ------------------
111
+
112
+ * Feature - Updated Aws::STS::Client with the latest API changes.
113
+
114
+ * Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
115
+
116
+ * Feature - Updated Aws::SSO::Client with the latest API changes.
117
+
118
+ * Feature - Support an auth scheme signing preference list using `ENV['AWS_AUTH_SCHEME_PREFERENCE']` or `auth_scheme_preference` in shared configuration.
119
+
120
+ * Feature - Support metric tracking for Bedrock Bearer tokens.
121
+
122
+ 3.226.3 (2025-07-17)
123
+ ------------------
124
+
125
+ * Issue - Skip `Aws::InstanceProfileCredentials` instantiation when `ENV['AWS_EC2_METADATA_DISABLED']` is set to `true` in the credential resolution chain.
126
+
127
+ * Issue - Refactor `InstanceProfileCredentials` to improve code clarity and documentation.
128
+
129
+ 3.226.2 (2025-07-01)
130
+ ------------------
131
+
132
+ * Issue - Document incorrect behavior in protocol error parsing (specifically around query and query compatible services).
133
+
134
+ 3.226.1 (2025-06-24)
135
+ ------------------
136
+
137
+ * Issue - Fixed spelling in the `Aws::Errors::SignalEventError` error message.
138
+
139
+ 3.226.0 (2025-06-17)
140
+ ------------------
141
+
142
+ * Feature - Updated Aws::STS::Client with the latest API changes.
143
+
144
+ * Feature - The AWS Security Token Service APIs AssumeRoleWithSAML and AssumeRoleWithWebIdentity can now be invoked without pre-configured AWS credentials in the SDK configuration.
145
+
146
+ 3.225.2 (2025-06-10)
147
+ ------------------
148
+
149
+ * Issue - Only load required `cgi` modules for Ruby 3.5.
150
+
151
+ 3.225.1 (2025-06-05)
152
+ ------------------
153
+
154
+ * Issue - Fix RPCv2 parser to handle flattened list and flattened map members correctly for `AwsQueryCompatible` services.
155
+
156
+ 3.225.0 (2025-06-02)
157
+ ------------------
158
+
159
+ * Feature - AWS SDK for Ruby no longer supports Ruby runtime versions 2.5 and 2.6.
160
+
161
+ 3.224.1 (2025-05-28)
162
+ ------------------
163
+
164
+ * Issue - Signal data in http response listeners prior to writing, so that data can be inspected or verified before potential mutation.
165
+
166
+ 3.224.0 (2025-05-12)
167
+ ------------------
168
+
169
+ * Feature - Updated Aws::STS::Client with the latest API changes.
170
+
171
+ * Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
172
+
173
+ * Feature - Updated Aws::SSO::Client with the latest API changes.
174
+
175
+ * Feature - Support `ENV['AWS_DISABLE_HOST_PREFIX_INJECTION']` and `disable_host_prefix_injection` shared config to disable host prefix injection for all services.
176
+
177
+ 3.223.0 (2025-05-01)
178
+ ------------------
179
+
180
+ * Feature - Updated Aws::STS::Client with the latest API changes.
181
+
182
+ 3.222.3 (2025-04-28)
183
+ ------------------
184
+
185
+ * Issue - Do not dynamically create operation methods from the API. (#3234)
186
+
187
+ 3.222.2 (2025-04-16)
188
+ ------------------
189
+
190
+ * Issue - Additional metrics collection for credentials in the User-Agent plugin.
191
+
192
+ 3.222.1 (2025-03-28)
193
+ ------------------
194
+
195
+ * Issue - Allow explicit modeled headers to override prefixed headers for `rest` protocols.
196
+
197
+ 3.222.0 (2025-03-27)
198
+ ------------------
199
+
200
+ * Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
201
+
202
+ * Feature - This release adds AwsAdditionalDetails in the CreateTokenWithIAM API response.
203
+
204
+ 3.221.0 (2025-03-24)
205
+ ------------------
206
+
207
+ * Feature - Add `logger` as an explicit dependency for Ruby 3.5.
208
+ * Issue - Enable ALPN over TLS for H2 Connection by default.
209
+ * Issue - Fix HTTP-2 connections to properly use config values configured on the client.
210
+
211
+ 3.220.2 (2025-03-20)
212
+ ------------------
213
+
214
+ * Issue - Enable ALPN over TLS for H2 by default.
215
+
216
+ 3.220.1 (2025-03-06)
217
+ ------------------
218
+
219
+ * Issue - Convert stubs at request time.
220
+
221
+ 3.220.0 (2025-03-04)
222
+ ------------------
223
+
224
+ * Feature - Updated Aws::STS::Client with the latest API changes.
225
+
4
226
  3.219.0 (2025-02-18)
5
227
  ------------------
6
228
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.219.0
1
+ 3.240.0
@@ -128,7 +128,8 @@ module Aws
128
128
  "override" => 3100
129
129
  }
130
130
  },
131
- "in-region" => {},
131
+ "in-region" => {
132
+ },
132
133
  "cross-region" => {
133
134
  "connectTimeoutInMillis" => {
134
135
  "override" => 3100
@@ -7,7 +7,7 @@ module Aws
7
7
  # {Aws::STS::Client#assume_role}.
8
8
  #
9
9
  # role_credentials = Aws::AssumeRoleCredentials.new(
10
- # client: Aws::STS::Client.new(...),
10
+ # client: Aws::STS::Client.new(sts_options),
11
11
  # role_arn: "linked::account::arn",
12
12
  # role_session_name: "session-name"
13
13
  # )
@@ -28,15 +28,15 @@ module Aws
28
28
  # @option options [Integer] :duration_seconds
29
29
  # @option options [String] :external_id
30
30
  # @option options [STS::Client] :client
31
- # @option options [Callable] before_refresh Proc called before
31
+ # @option options [Proc] :before_refresh A Proc called before
32
32
  # credentials are refreshed. Useful for updating tokens.
33
- # `before_refresh` is called when AWS credentials are
34
- # required and need to be refreshed. Tokens can be refreshed using
35
- # the following example:
33
+ # `:before_refresh` is called when AWS credentials are
34
+ # required and need to be refreshed. See the example in this doc.
36
35
  #
37
- # before_refresh = Proc.new do |assume_role_credentials| do
38
- # assume_role_credentials.assume_role_params['token_code'] = update_token
39
- # end
36
+ # @example Tokens can be refreshed using a Proc.
37
+ # before_refresh = Proc.new do |assume_role_credentials|
38
+ # assume_role_credentials.assume_role_params['token_code'] = update_token
39
+ # end
40
40
  #
41
41
  def initialize(options = {})
42
42
  client_opts = {}
@@ -50,6 +50,7 @@ module Aws
50
50
  end
51
51
  @client = client_opts[:client] || STS::Client.new(client_opts)
52
52
  @async_refresh = true
53
+ @metrics = ['CREDENTIALS_STS_ASSUME_ROLE']
53
54
  super
54
55
  end
55
56
 
@@ -9,11 +9,11 @@ module Aws
9
9
  # {Aws::STS::Client#assume_role_with_web_identity}.
10
10
  #
11
11
  # role_credentials = Aws::AssumeRoleWebIdentityCredentials.new(
12
- # client: Aws::STS::Client.new(...),
12
+ # client: Aws::STS::Client.new(sts_options),
13
13
  # role_arn: "linked::account::arn",
14
14
  # web_identity_token_file: "/path/to/token/file",
15
15
  # role_session_name: "session-name"
16
- # ...
16
+ # # ...
17
17
  # )
18
18
  # ec2 = Aws::EC2::Client.new(credentials: role_credentials)
19
19
  #
@@ -61,6 +61,7 @@ module Aws
61
61
  @assume_role_web_identity_params[:role_session_name] = _session_name
62
62
  end
63
63
  @client = client_opts[:client] || STS::Client.new(client_opts.merge(credentials: nil))
64
+ @metrics = ['CREDENTIALS_STS_ASSUME_ROLE_WEB_ID']
64
65
  super
65
66
  end
66
67
 
@@ -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,20 @@ 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
+ # Prioritize JSON over CBOR when CBOR is the configured protocol but both are supported. This is to match similar
284
+ # prioritization in service.rb code generation.
285
+ if @config.api.metadata['protocol'] == 'smithy-rpc-v2-cbor' && @config.api.metadata['protocols']&.include?('json')
286
+ return Stubbing::Protocols::Json.new
287
+ end
288
+
289
+ case @config.api.metadata['protocol']
310
290
  when 'json' then Stubbing::Protocols::Json
311
291
  when 'rest-json' then Stubbing::Protocols::RestJson
312
292
  when 'rest-xml' then Stubbing::Protocols::RestXml
@@ -9,6 +9,10 @@ module Aws
9
9
  # @return [Time]
10
10
  attr_reader :expiration
11
11
 
12
+ # @api private
13
+ # Returns UserAgent metrics for credentials.
14
+ attr_accessor :metrics
15
+
12
16
  # @return [Boolean]
13
17
  def set?
14
18
  !!@credentials && @credentials.set?