aws-sdk-core 3.209.1 → 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 (112) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +331 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-core/arn.rb +1 -3
  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/cbor/decoder.rb +0 -2
  8. data/lib/aws-sdk-core/cbor/encoder.rb +2 -2
  9. data/lib/aws-sdk-core/cbor.rb +3 -56
  10. data/lib/aws-sdk-core/client_stubs.rb +35 -55
  11. data/lib/aws-sdk-core/credential_provider.rb +4 -0
  12. data/lib/aws-sdk-core/credential_provider_chain.rb +91 -22
  13. data/lib/aws-sdk-core/credentials.rb +6 -0
  14. data/lib/aws-sdk-core/ecs_credentials.rb +14 -13
  15. data/lib/aws-sdk-core/endpoints/matchers.rb +3 -9
  16. data/lib/aws-sdk-core/endpoints.rb +37 -13
  17. data/lib/aws-sdk-core/error_handler.rb +5 -0
  18. data/lib/aws-sdk-core/errors.rb +5 -2
  19. data/lib/aws-sdk-core/event_emitter.rb +1 -1
  20. data/lib/aws-sdk-core/instance_profile_credentials.rb +147 -157
  21. data/lib/aws-sdk-core/json/error_handler.rb +14 -3
  22. data/lib/aws-sdk-core/json/handler.rb +1 -0
  23. data/lib/aws-sdk-core/log/param_formatter.rb +7 -3
  24. data/lib/aws-sdk-core/login_credentials.rb +229 -0
  25. data/lib/aws-sdk-core/plugins/checksum_algorithm.rb +347 -171
  26. data/lib/aws-sdk-core/plugins/client_metrics_plugin.rb +0 -1
  27. data/lib/aws-sdk-core/plugins/credentials_configuration.rb +75 -59
  28. data/lib/aws-sdk-core/plugins/endpoint_pattern.rb +40 -32
  29. data/lib/aws-sdk-core/plugins/http_checksum.rb +2 -8
  30. data/lib/aws-sdk-core/plugins/regional_endpoint.rb +44 -25
  31. data/lib/aws-sdk-core/plugins/sign.rb +30 -21
  32. data/lib/aws-sdk-core/plugins/stub_responses.rb +30 -8
  33. data/lib/aws-sdk-core/plugins/user_agent.rb +35 -2
  34. data/lib/aws-sdk-core/process_credentials.rb +1 -1
  35. data/lib/aws-sdk-core/refreshing_credentials.rb +8 -11
  36. data/lib/aws-sdk-core/rest/request/headers.rb +3 -3
  37. data/lib/aws-sdk-core/rpc_v2/builder.rb +1 -1
  38. data/lib/aws-sdk-core/{cbor → rpc_v2}/cbor_engine.rb +4 -5
  39. data/lib/aws-sdk-core/rpc_v2/content_type_handler.rb +3 -1
  40. data/lib/aws-sdk-core/rpc_v2/error_handler.rb +27 -16
  41. data/lib/aws-sdk-core/rpc_v2/handler.rb +2 -1
  42. data/lib/aws-sdk-core/rpc_v2/parser.rb +9 -1
  43. data/lib/aws-sdk-core/rpc_v2.rb +65 -2
  44. data/lib/aws-sdk-core/shared_config.rb +104 -21
  45. data/lib/aws-sdk-core/shared_credentials.rb +1 -0
  46. data/lib/aws-sdk-core/sso_credentials.rb +3 -1
  47. data/lib/aws-sdk-core/static_token_provider.rb +1 -2
  48. data/lib/aws-sdk-core/stubbing/protocols/ec2.rb +12 -11
  49. data/lib/aws-sdk-core/stubbing/protocols/json.rb +11 -10
  50. data/lib/aws-sdk-core/stubbing/protocols/query.rb +7 -6
  51. data/lib/aws-sdk-core/stubbing/protocols/rest.rb +2 -1
  52. data/lib/aws-sdk-core/stubbing/protocols/rest_json.rb +9 -8
  53. data/lib/aws-sdk-core/stubbing/protocols/rest_xml.rb +6 -5
  54. data/lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb +13 -15
  55. data/lib/aws-sdk-core/stubbing.rb +2 -2
  56. data/lib/aws-sdk-core/token.rb +3 -3
  57. data/lib/aws-sdk-core/token_provider.rb +4 -0
  58. data/lib/aws-sdk-core/token_provider_chain.rb +2 -6
  59. data/lib/aws-sdk-core/util.rb +2 -1
  60. data/lib/aws-sdk-core/xml/error_handler.rb +3 -1
  61. data/lib/aws-sdk-core.rb +4 -0
  62. data/lib/aws-sdk-signin/client.rb +604 -0
  63. data/lib/aws-sdk-signin/client_api.rb +119 -0
  64. data/lib/aws-sdk-signin/customizations.rb +1 -0
  65. data/lib/aws-sdk-signin/endpoint_parameters.rb +69 -0
  66. data/lib/aws-sdk-signin/endpoint_provider.rb +59 -0
  67. data/lib/aws-sdk-signin/endpoints.rb +20 -0
  68. data/lib/aws-sdk-signin/errors.rb +122 -0
  69. data/lib/aws-sdk-signin/plugins/endpoints.rb +77 -0
  70. data/lib/aws-sdk-signin/resource.rb +26 -0
  71. data/lib/aws-sdk-signin/types.rb +299 -0
  72. data/lib/aws-sdk-signin.rb +63 -0
  73. data/lib/aws-sdk-sso/client.rb +76 -47
  74. data/lib/aws-sdk-sso/endpoint_parameters.rb +13 -10
  75. data/lib/aws-sdk-sso/endpoint_provider.rb +16 -20
  76. data/lib/aws-sdk-sso/endpoints.rb +2 -42
  77. data/lib/aws-sdk-sso/plugins/endpoints.rb +1 -14
  78. data/lib/aws-sdk-sso.rb +1 -1
  79. data/lib/aws-sdk-ssooidc/client.rb +132 -73
  80. data/lib/aws-sdk-ssooidc/client_api.rb +11 -0
  81. data/lib/aws-sdk-ssooidc/endpoint_parameters.rb +13 -10
  82. data/lib/aws-sdk-ssooidc/endpoint_provider.rb +14 -18
  83. data/lib/aws-sdk-ssooidc/endpoints.rb +2 -42
  84. data/lib/aws-sdk-ssooidc/errors.rb +10 -0
  85. data/lib/aws-sdk-ssooidc/plugins/endpoints.rb +1 -14
  86. data/lib/aws-sdk-ssooidc/types.rb +65 -21
  87. data/lib/aws-sdk-ssooidc.rb +1 -1
  88. data/lib/aws-sdk-sts/client.rb +416 -107
  89. data/lib/aws-sdk-sts/client_api.rb +105 -8
  90. data/lib/aws-sdk-sts/customizations.rb +0 -1
  91. data/lib/aws-sdk-sts/endpoint_parameters.rb +15 -14
  92. data/lib/aws-sdk-sts/endpoint_provider.rb +50 -55
  93. data/lib/aws-sdk-sts/endpoints.rb +2 -94
  94. data/lib/aws-sdk-sts/errors.rb +79 -0
  95. data/lib/aws-sdk-sts/plugins/endpoints.rb +1 -22
  96. data/lib/aws-sdk-sts/presigner.rb +2 -6
  97. data/lib/aws-sdk-sts/types.rb +343 -32
  98. data/lib/aws-sdk-sts.rb +1 -1
  99. data/lib/seahorse/client/async_base.rb +4 -5
  100. data/lib/seahorse/client/base.rb +0 -14
  101. data/lib/seahorse/client/h2/connection.rb +18 -28
  102. data/lib/seahorse/client/h2/handler.rb +6 -1
  103. data/lib/seahorse/client/http/response.rb +1 -1
  104. data/lib/seahorse/client/net_http/connection_pool.rb +4 -1
  105. data/lib/seahorse/client/networking_error.rb +1 -1
  106. data/lib/seahorse/client/plugins/h2.rb +4 -4
  107. data/lib/seahorse/client/request_context.rb +2 -2
  108. data/lib/seahorse/client/response.rb +2 -0
  109. data/lib/seahorse/util.rb +2 -1
  110. data/sig/aws-sdk-core/async_client_stubs.rbs +21 -0
  111. data/sig/seahorse/client/async_base.rbs +18 -0
  112. metadata +69 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b21a55766ac3b065464e202f9e5e8eaa449fb1b186776cc439f9ef6859c51923
4
- data.tar.gz: d0602af7e12f340646722e0ca65ebbe1b9950d8b7ac7da1da2bfaf22a6723fbb
3
+ metadata.gz: bfea66796a6586854e469946701deeb09f2b344e82967f505262052efea4c972
4
+ data.tar.gz: 98d0d7a3da929b82b7b14098d0041532d94ec0f88bfa04e74c5bcf8286e090b3
5
5
  SHA512:
6
- metadata.gz: dce3b13eced2c29beecdbc6929836c9917cc0d7524033cb76e0ea7ae6cf6f01c87b9f0f07a88a17197cb2989c4addf3a9c303acbdb6cf5fb331ecb328d16feec
7
- data.tar.gz: ace0cb1e6d8e05083601c36607a3c8d6902a72a36cec481081939626ce8399fa43b603b42d6fb026cddce1ec51ab98f405a02e6fa4eb861aabe23aa658519457
6
+ metadata.gz: 65092f9f2795f01ee929393ccdbb06ca55d2e0ea420ac7004c0d24fe6bfd9e3b155cd2d4869b96a6deb64e65c8d4fd0e917e8834ea0cac3602a9289df6de4c4f
7
+ data.tar.gz: 806b5e412f3a25b956d607f948e957e71241b25fdea11306d43a9752570d5daa80e33740c543bc499d74412d63db8325c9c9bf39ae4738c971e318ac33503b47
data/CHANGELOG.md CHANGED
@@ -1,6 +1,337 @@
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
+
226
+ 3.219.0 (2025-02-18)
227
+ ------------------
228
+
229
+ * Feature - Updated Aws::STS::Client with the latest API changes.
230
+
231
+ * Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
232
+
233
+ * Feature - Updated Aws::SSO::Client with the latest API changes.
234
+
235
+ 3.218.1 (2025-02-07)
236
+ ------------------
237
+
238
+ * Issue - Add handling of block in ExtendedSession delegation (#3178).
239
+
240
+ 3.218.0 (2025-02-06)
241
+ ------------------
242
+
243
+ * Feature - Updated Aws::STS::Client with the latest API changes.
244
+
245
+ * Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
246
+
247
+ * Feature - Updated Aws::SSO::Client with the latest API changes.
248
+
249
+ 3.217.1 (2025-01-30)
250
+ ------------------
251
+
252
+ * Issue - Add `transfer-encoding` and `connection` to list of unsigned sigv4 headers.
253
+
254
+ 3.217.0 (2025-01-24)
255
+ ------------------
256
+
257
+ * Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
258
+
259
+ * Feature - Fixed typos in the descriptions.
260
+
261
+ 3.216.1 (2025-01-22)
262
+ ------------------
263
+
264
+ * Issue - Use epoch seconds instead of milliseconds in cbor encode/decode.
265
+
266
+ * Issue - Add handling of block in response delegation (#3169).
267
+
268
+ 3.216.0 (2025-01-15)
269
+ ------------------
270
+
271
+ * Feature - Updated Aws::STS::Client with the latest API changes.
272
+
273
+ * Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
274
+
275
+ * Feature - Updated Aws::SSO::Client with the latest API changes.
276
+
277
+ * Feature - Always calculate request checksums for operations that support or require it. Supported config options are `when_supported` and `when_required`. The default value is `when_supported`. This option is configured in code with `:request_checksum_calculation`, in the shared config file as `request_checksum_calculation`, and in the ENV as `ENV['AWS_REQUEST_CHECKSUM_CALCULATION']`.
278
+
279
+ * Feature - Always validate response checksums for operations that support or require it. Supported config options are `when_supported` and `when_required`. The default value is `when_supported`. This option is configured in code with `:response_checksum_validation`, in the shared config file as `response_checksum_validation`, and in the ENV as `ENV['AWS_RESPONSE_CHECKSUM_VALIDATION']`.
280
+
281
+ * Feature - Support CRC64NVME checksums through the `aws-crt` gem.
282
+
283
+ 3.215.1 (2025-01-14)
284
+ ------------------
285
+
286
+ * Issue - Fixed error when attempting to log an unlinked tempfile.
287
+
288
+ 3.215.0 (2025-01-10)
289
+ ------------------
290
+
291
+ * Feature - Updated Aws::STS::Client with the latest API changes.
292
+
293
+ * Feature - Fixed typos in the descriptions.
294
+
295
+ 3.214.1 (2024-12-28)
296
+ ------------------
297
+
298
+ * Issue - Fix documentation that references a non-existent method.
299
+
300
+ 3.214.0 (2024-11-25)
301
+ ------------------
302
+
303
+ * Feature - Updated configuration values for `defaults_mode`.
304
+
305
+ 3.213.0 (2024-11-14)
306
+ ------------------
307
+
308
+ * Feature - Updated Aws::STS::Client with the latest API changes.
309
+
310
+ * Feature - This release introduces the new API 'AssumeRoot', which returns short-term credentials that you can use to perform privileged tasks.
311
+
312
+ 3.212.0 (2024-11-06)
313
+ ------------------
314
+
315
+ * Feature - Updated Aws::STS::Client with the latest API changes.
316
+
317
+ 3.211.0 (2024-10-21)
318
+ ------------------
319
+
320
+ * Feature - Support functionality for services that migrate from AWS Query to AWS JSON or CBOR.
321
+
322
+ * Issue - Fix RPCv2 protocol to always send an Accept header for CBOR.
323
+
324
+ 3.210.0 (2024-10-18)
325
+ ------------------
326
+
327
+ * Feature - Updated Aws::STS::Client with the latest API changes.
328
+
329
+ * Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
330
+
331
+ * Feature - Updated Aws::SSO::Client with the latest API changes.
332
+
333
+ * Feature - reduce memory usage by not using legacy endpoint data unless required.
334
+
4
335
  3.209.1 (2024-09-25)
5
336
  ------------------
6
337
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.209.1
1
+ 3.240.0
@@ -24,9 +24,7 @@ module Aws
24
24
  # arn.resource
25
25
  # # => foo/bar
26
26
  #
27
- # # Note: parser available for parsing resource details
28
- # @see Aws::ARNParser#parse_resource
29
- #
27
+ # @see ARNParser
30
28
  # @see https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-arns
31
29
  class ARN
32
30
 
@@ -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
 
@@ -61,9 +61,7 @@ module Aws
61
61
  when :tag
62
62
  case (tag = read_tag)
63
63
  when TAG_TYPE_EPOCH
64
- type = peek_type
65
64
  item = decode_item
66
- item /= 1000.0 if type == :integer
67
65
  Time.at(item)
68
66
  when TAG_TYPE_BIGNUM, TAG_TYPE_NEG_BIGNUM
69
67
  read_bignum(tag)
@@ -226,8 +226,8 @@ module Aws
226
226
 
227
227
  def add_time(value)
228
228
  head(MAJOR_TYPE_TAG, TAG_TYPE_EPOCH)
229
- epoch_ms = (value.to_f * 1000).to_i
230
- add_integer(epoch_ms)
229
+ epoch = value.to_f
230
+ add_double(epoch)
231
231
  end
232
232
 
233
233
  def bignum_to_bytes(value)
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'cbor/encoder'
4
+ require_relative 'cbor/decoder'
5
+
3
6
  module Aws
4
7
  # @api private
5
8
  module Cbor
@@ -46,61 +49,5 @@ module Aws
46
49
  super("Unexpected additional information: #{add_info}")
47
50
  end
48
51
  end
49
-
50
- class << self
51
- # @param [Symbol,Class] engine
52
- # Must be one of the following values:
53
- #
54
- # * :cbor
55
- #
56
- def engine=(engine)
57
- @engine = Class === engine ? engine : load_engine(engine)
58
- end
59
-
60
- # @return [Class] Returns the default engine.
61
- # One of:
62
- #
63
- # * {CborEngine}
64
- #
65
- def engine
66
- set_default_engine unless @engine
67
- @engine
68
- end
69
-
70
- def encode(data)
71
- @engine.encode(data)
72
- end
73
-
74
- def decode(bytes)
75
- bytes.force_encoding(Encoding::BINARY)
76
- @engine.decode(bytes)
77
- end
78
-
79
- def set_default_engine
80
- [:cbor].each do |name|
81
- @engine ||= try_load_engine(name)
82
- end
83
-
84
- unless @engine
85
- raise 'Unable to find a compatible cbor library.'
86
- end
87
- end
88
-
89
- private
90
-
91
- def load_engine(name)
92
- require "aws-sdk-core/cbor/#{name}_engine"
93
- const_name = name[0].upcase + name[1..-1] + 'Engine'
94
- const_get(const_name)
95
- end
96
-
97
- def try_load_engine(name)
98
- load_engine(name)
99
- rescue LoadError
100
- false
101
- end
102
- end
103
-
104
- set_default_engine
105
52
  end
106
53
  end
@@ -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,22 +273,28 @@ 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']
310
- when 'json' then Stubbing::Protocols::Json
311
- when 'rest-json' then Stubbing::Protocols::RestJson
312
- when 'rest-xml' then Stubbing::Protocols::RestXml
313
- when 'query' then Stubbing::Protocols::Query
314
- when 'ec2' then Stubbing::Protocols::EC2
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']
290
+ when 'json' then Stubbing::Protocols::Json
291
+ when 'rest-json' then Stubbing::Protocols::RestJson
292
+ when 'rest-xml' then Stubbing::Protocols::RestXml
293
+ when 'query' then Stubbing::Protocols::Query
294
+ when 'ec2' then Stubbing::Protocols::EC2
315
295
  when 'smithy-rpc-v2-cbor' then Stubbing::Protocols::RpcV2
316
- when 'api-gateway' then Stubbing::Protocols::ApiGateway
317
- else raise "unsupported protocol"
296
+ when 'api-gateway' then Stubbing::Protocols::ApiGateway
297
+ else raise 'unsupported protocol'
318
298
  end.new
319
299
  end
320
300
  end
@@ -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?