aws-sdk-core 3.201.2 → 3.226.2

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 (116) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +324 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-defaults/default_configuration.rb +1 -2
  5. data/lib/aws-defaults.rb +4 -1
  6. data/lib/aws-sdk-core/arn.rb +1 -3
  7. data/lib/aws-sdk-core/assume_role_credentials.rb +13 -5
  8. data/lib/aws-sdk-core/assume_role_web_identity_credentials.rb +14 -7
  9. data/lib/aws-sdk-core/cbor/decoder.rb +0 -2
  10. data/lib/aws-sdk-core/cbor/encoder.rb +2 -2
  11. data/lib/aws-sdk-core/cbor.rb +3 -56
  12. data/lib/aws-sdk-core/client_side_monitoring.rb +9 -0
  13. data/lib/aws-sdk-core/client_stubs.rb +29 -55
  14. data/lib/aws-sdk-core/credential_provider.rb +4 -0
  15. data/lib/aws-sdk-core/credential_provider_chain.rb +35 -8
  16. data/lib/aws-sdk-core/credentials.rb +19 -6
  17. data/lib/aws-sdk-core/ecs_credentials.rb +1 -0
  18. data/lib/aws-sdk-core/endpoints/endpoint.rb +3 -1
  19. data/lib/aws-sdk-core/endpoints/matchers.rb +3 -9
  20. data/lib/aws-sdk-core/endpoints.rb +13 -3
  21. data/lib/aws-sdk-core/error_handler.rb +5 -0
  22. data/lib/aws-sdk-core/errors.rb +2 -2
  23. data/lib/aws-sdk-core/event_emitter.rb +1 -1
  24. data/lib/aws-sdk-core/instance_profile_credentials.rb +1 -0
  25. data/lib/aws-sdk-core/json/error_handler.rb +14 -3
  26. data/lib/aws-sdk-core/json/handler.rb +1 -0
  27. data/lib/aws-sdk-core/log/param_formatter.rb +7 -3
  28. data/lib/aws-sdk-core/log.rb +10 -0
  29. data/lib/aws-sdk-core/plugins/checksum_algorithm.rb +332 -170
  30. data/lib/aws-sdk-core/plugins/client_metrics_plugin.rb +0 -1
  31. data/lib/aws-sdk-core/plugins/credentials_configuration.rb +7 -3
  32. data/lib/aws-sdk-core/plugins/endpoint_pattern.rb +40 -32
  33. data/lib/aws-sdk-core/plugins/http_checksum.rb +2 -8
  34. data/lib/aws-sdk-core/plugins/regional_endpoint.rb +44 -24
  35. data/lib/aws-sdk-core/plugins/sign.rb +18 -5
  36. data/lib/aws-sdk-core/plugins/stub_responses.rb +52 -9
  37. data/lib/aws-sdk-core/plugins/telemetry.rb +75 -0
  38. data/lib/aws-sdk-core/plugins/user_agent.rb +48 -9
  39. data/lib/aws-sdk-core/plugins.rb +39 -0
  40. data/lib/aws-sdk-core/process_credentials.rb +3 -2
  41. data/lib/aws-sdk-core/resources.rb +8 -0
  42. data/lib/aws-sdk-core/rest/request/headers.rb +3 -3
  43. data/lib/aws-sdk-core/rpc_v2/builder.rb +1 -1
  44. data/lib/aws-sdk-core/{cbor → rpc_v2}/cbor_engine.rb +4 -5
  45. data/lib/aws-sdk-core/rpc_v2/content_type_handler.rb +3 -1
  46. data/lib/aws-sdk-core/rpc_v2/error_handler.rb +27 -16
  47. data/lib/aws-sdk-core/rpc_v2/handler.rb +7 -2
  48. data/lib/aws-sdk-core/rpc_v2/parser.rb +9 -1
  49. data/lib/aws-sdk-core/rpc_v2.rb +65 -2
  50. data/lib/aws-sdk-core/shared_config.rb +77 -22
  51. data/lib/aws-sdk-core/shared_credentials.rb +1 -7
  52. data/lib/aws-sdk-core/sso_credentials.rb +4 -1
  53. data/lib/aws-sdk-core/stubbing/protocols/ec2.rb +12 -11
  54. data/lib/aws-sdk-core/stubbing/protocols/json.rb +11 -10
  55. data/lib/aws-sdk-core/stubbing/protocols/query.rb +7 -6
  56. data/lib/aws-sdk-core/stubbing/protocols/rest.rb +2 -1
  57. data/lib/aws-sdk-core/stubbing/protocols/rest_json.rb +9 -8
  58. data/lib/aws-sdk-core/stubbing/protocols/rest_xml.rb +6 -5
  59. data/lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb +13 -15
  60. data/lib/aws-sdk-core/stubbing.rb +22 -0
  61. data/lib/aws-sdk-core/telemetry/base.rb +177 -0
  62. data/lib/aws-sdk-core/telemetry/no_op.rb +70 -0
  63. data/lib/aws-sdk-core/telemetry/otel.rb +235 -0
  64. data/lib/aws-sdk-core/telemetry/span_kind.rb +22 -0
  65. data/lib/aws-sdk-core/telemetry/span_status.rb +59 -0
  66. data/lib/aws-sdk-core/telemetry.rb +78 -0
  67. data/lib/aws-sdk-core/util.rb +2 -1
  68. data/lib/aws-sdk-core/waiters/poller.rb +9 -4
  69. data/lib/aws-sdk-core/xml/error_handler.rb +3 -1
  70. data/lib/aws-sdk-core.rb +82 -112
  71. data/lib/aws-sdk-sso/client.rb +86 -37
  72. data/lib/aws-sdk-sso/client_api.rb +1 -0
  73. data/lib/aws-sdk-sso/endpoint_parameters.rb +9 -6
  74. data/lib/aws-sdk-sso/endpoint_provider.rb +14 -18
  75. data/lib/aws-sdk-sso/endpoints.rb +2 -54
  76. data/lib/aws-sdk-sso/plugins/endpoints.rb +19 -20
  77. data/lib/aws-sdk-sso/types.rb +1 -0
  78. data/lib/aws-sdk-sso.rb +15 -11
  79. data/lib/aws-sdk-ssooidc/client.rb +123 -57
  80. data/lib/aws-sdk-ssooidc/client_api.rb +7 -0
  81. data/lib/aws-sdk-ssooidc/endpoint_parameters.rb +9 -6
  82. data/lib/aws-sdk-ssooidc/endpoint_provider.rb +14 -18
  83. data/lib/aws-sdk-ssooidc/endpoints.rb +2 -54
  84. data/lib/aws-sdk-ssooidc/plugins/endpoints.rb +19 -20
  85. data/lib/aws-sdk-ssooidc/types.rb +49 -16
  86. data/lib/aws-sdk-ssooidc.rb +15 -11
  87. data/lib/aws-sdk-sts/client.rb +294 -89
  88. data/lib/aws-sdk-sts/client_api.rb +34 -8
  89. data/lib/aws-sdk-sts/customizations.rb +5 -1
  90. data/lib/aws-sdk-sts/endpoint_parameters.rb +10 -9
  91. data/lib/aws-sdk-sts/endpoint_provider.rb +50 -55
  92. data/lib/aws-sdk-sts/endpoints.rb +2 -118
  93. data/lib/aws-sdk-sts/errors.rb +15 -0
  94. data/lib/aws-sdk-sts/plugins/endpoints.rb +19 -28
  95. data/lib/aws-sdk-sts/types.rb +171 -28
  96. data/lib/aws-sdk-sts.rb +15 -11
  97. data/lib/seahorse/client/async_base.rb +4 -5
  98. data/lib/seahorse/client/base.rb +0 -14
  99. data/lib/seahorse/client/h2/connection.rb +18 -28
  100. data/lib/seahorse/client/h2/handler.rb +13 -3
  101. data/lib/seahorse/client/http/response.rb +1 -1
  102. data/lib/seahorse/client/net_http/connection_pool.rb +12 -3
  103. data/lib/seahorse/client/net_http/handler.rb +21 -9
  104. data/lib/seahorse/client/networking_error.rb +1 -1
  105. data/lib/seahorse/client/plugins/h2.rb +4 -4
  106. data/lib/seahorse/client/plugins/net_http.rb +9 -0
  107. data/lib/seahorse/client/request_context.rb +8 -1
  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/aws-sdk-core/telemetry/base.rbs +46 -0
  112. data/sig/aws-sdk-core/telemetry/otel.rbs +22 -0
  113. data/sig/aws-sdk-core/telemetry/span_kind.rbs +15 -0
  114. data/sig/aws-sdk-core/telemetry/span_status.rbs +24 -0
  115. data/sig/seahorse/client/async_base.rbs +18 -0
  116. metadata +61 -19
@@ -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,22 @@ 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
+ case @config.api.metadata['protocol']
284
+ when 'json' then Stubbing::Protocols::Json
285
+ when 'rest-json' then Stubbing::Protocols::RestJson
286
+ when 'rest-xml' then Stubbing::Protocols::RestXml
287
+ when 'query' then Stubbing::Protocols::Query
288
+ when 'ec2' then Stubbing::Protocols::EC2
315
289
  when 'smithy-rpc-v2-cbor' then Stubbing::Protocols::RpcV2
316
- when 'api-gateway' then Stubbing::Protocols::ApiGateway
317
- else raise "unsupported protocol"
290
+ when 'api-gateway' then Stubbing::Protocols::ApiGateway
291
+ else raise 'unsupported protocol'
318
292
  end.new
319
293
  end
320
294
  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?
@@ -42,11 +42,14 @@ module Aws
42
42
 
43
43
  def static_credentials(options)
44
44
  if options[:config]
45
- Credentials.new(
45
+ creds = Credentials.new(
46
46
  options[:config].access_key_id,
47
47
  options[:config].secret_access_key,
48
- options[:config].session_token
48
+ options[:config].session_token,
49
+ account_id: options[:config].account_id
49
50
  )
51
+ creds.metrics = ['CREDENTIALS_PROFILE']
52
+ creds
50
53
  end
51
54
  end
52
55
 
@@ -75,7 +78,9 @@ module Aws
75
78
 
76
79
  def static_profile_credentials(options)
77
80
  if options[:config] && options[:config].profile
78
- SharedCredentials.new(profile_name: options[:config].profile)
81
+ creds = SharedCredentials.new(profile_name: options[:config].profile)
82
+ creds.metrics = ['CREDENTIALS_PROFILE']
83
+ creds
79
84
  end
80
85
  rescue Errors::NoSuchProfileError
81
86
  nil
@@ -84,7 +89,11 @@ module Aws
84
89
  def static_profile_process_credentials(options)
85
90
  if Aws.shared_config.config_enabled? && options[:config] && options[:config].profile
86
91
  process_provider = Aws.shared_config.credential_process(profile: options[:config].profile)
87
- ProcessCredentials.new([process_provider]) if process_provider
92
+ if process_provider
93
+ creds = ProcessCredentials.new([process_provider])
94
+ creds.metrics << 'CREDENTIALS_PROFILE_PROCESS'
95
+ creds
96
+ end
88
97
  end
89
98
  rescue Errors::NoSuchProfileError
90
99
  nil
@@ -94,7 +103,15 @@ module Aws
94
103
  key = %w[AWS_ACCESS_KEY_ID AMAZON_ACCESS_KEY_ID AWS_ACCESS_KEY]
95
104
  secret = %w[AWS_SECRET_ACCESS_KEY AMAZON_SECRET_ACCESS_KEY AWS_SECRET_KEY]
96
105
  token = %w[AWS_SESSION_TOKEN AMAZON_SESSION_TOKEN]
97
- Credentials.new(envar(key), envar(secret), envar(token))
106
+ account_id = %w[AWS_ACCOUNT_ID]
107
+ creds = Credentials.new(
108
+ envar(key),
109
+ envar(secret),
110
+ envar(token),
111
+ account_id: envar(account_id)
112
+ )
113
+ creds.metrics = ['CREDENTIALS_ENV_VARS']
114
+ creds
98
115
  end
99
116
 
100
117
  def envar(keys)
@@ -110,7 +127,9 @@ module Aws
110
127
 
111
128
  def shared_credentials(options)
112
129
  profile_name = determine_profile_name(options)
113
- SharedCredentials.new(profile_name: profile_name)
130
+ creds = SharedCredentials.new(profile_name: profile_name)
131
+ creds.metrics = ['CREDENTIALS_PROFILE']
132
+ creds
114
133
  rescue Errors::NoSuchProfileError
115
134
  nil
116
135
  end
@@ -119,7 +138,11 @@ module Aws
119
138
  profile_name = determine_profile_name(options)
120
139
  if Aws.shared_config.config_enabled?
121
140
  process_provider = Aws.shared_config.credential_process(profile: profile_name)
122
- ProcessCredentials.new([process_provider]) if process_provider
141
+ if process_provider
142
+ creds = ProcessCredentials.new([process_provider])
143
+ creds.metrics << 'CREDENTIALS_PROFILE_PROCESS'
144
+ creds
145
+ end
123
146
  end
124
147
  rescue Errors::NoSuchProfileError
125
148
  nil
@@ -149,7 +172,11 @@ module Aws
149
172
  role_session_name: ENV['AWS_ROLE_SESSION_NAME']
150
173
  }
151
174
  cfg[:region] = region if region
152
- AssumeRoleWebIdentityCredentials.new(cfg)
175
+ Aws::Plugins::UserAgent.metric('CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN') do
176
+ creds = AssumeRoleWebIdentityCredentials.new(cfg)
177
+ creds.metrics << 'CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN'
178
+ creds
179
+ end
153
180
  elsif Aws.shared_config.config_enabled?
154
181
  profile = options[:config].profile if options[:config]
155
182
  Aws.shared_config.assume_role_web_identity_credentials_from_config(
@@ -6,21 +6,34 @@ module Aws
6
6
  # @param [String] access_key_id
7
7
  # @param [String] secret_access_key
8
8
  # @param [String] session_token (nil)
9
- def initialize(access_key_id, secret_access_key, session_token = nil)
9
+ # @param [Hash] kwargs
10
+ # @option kwargs [String] :credential_scope (nil)
11
+ def initialize(access_key_id, secret_access_key, session_token = nil,
12
+ **kwargs)
10
13
  @access_key_id = access_key_id
11
14
  @secret_access_key = secret_access_key
12
15
  @session_token = session_token
16
+ @account_id = kwargs[:account_id]
17
+ @metrics = ['CREDENTIALS_CODE']
13
18
  end
14
19
 
15
- # @return [String, nil]
20
+ # @return [String]
16
21
  attr_reader :access_key_id
17
22
 
18
- # @return [String, nil]
23
+ # @return [String]
19
24
  attr_reader :secret_access_key
20
25
 
21
26
  # @return [String, nil]
22
27
  attr_reader :session_token
23
28
 
29
+ # @return [String, nil]
30
+ attr_reader :account_id
31
+
32
+ # @api private
33
+ # Returns the credentials source. Used for tracking credentials
34
+ # related UserAgent metrics.
35
+ attr_accessor :metrics
36
+
24
37
  # @return [Credentials]
25
38
  def credentials
26
39
  self
@@ -30,9 +43,9 @@ module Aws
30
43
  # access key are both set.
31
44
  def set?
32
45
  !access_key_id.nil? &&
33
- !access_key_id.empty? &&
34
- !secret_access_key.nil? &&
35
- !secret_access_key.empty?
46
+ !access_key_id.empty? &&
47
+ !secret_access_key.nil? &&
48
+ !secret_access_key.empty?
36
49
  end
37
50
 
38
51
  # Removing the secret access key from the default inspect string.
@@ -77,6 +77,7 @@ module Aws
77
77
  @http_debug_output = options[:http_debug_output]
78
78
  @backoff = backoff(options[:backoff])
79
79
  @async_refresh = false
80
+ @metrics = ['CREDENTIALS_HTTP']
80
81
  super
81
82
  end
82
83
 
@@ -3,15 +3,17 @@
3
3
  module Aws
4
4
  module Endpoints
5
5
  class Endpoint
6
- def initialize(url:, properties: {}, headers: {})
6
+ def initialize(url:, properties: {}, headers: {}, metadata: {})
7
7
  @url = url
8
8
  @properties = properties
9
9
  @headers = headers
10
+ @metadata = metadata
10
11
  end
11
12
 
12
13
  attr_reader :url
13
14
  attr_reader :properties
14
15
  attr_reader :headers
16
+ attr_reader :metadata
15
17
  end
16
18
  end
17
19
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'cgi'
3
+ require "cgi/escape"
4
+ require "cgi/util" if RUBY_VERSION < "3.5"
4
5
 
5
6
  module Aws
6
7
  module Endpoints
@@ -94,14 +95,7 @@ module Aws
94
95
 
95
96
  # aws.partition(value: string) Option<Partition>
96
97
  def self.aws_partition(value)
97
- partition =
98
- Aws::Partitions.find { |p| p.region?(value) } ||
99
- Aws::Partitions.find { |p| value.match(p.region_regex) } ||
100
- Aws::Partitions.find { |p| p.name == 'aws' }
101
-
102
- return nil unless partition
103
-
104
- partition.metadata
98
+ Aws::Partitions::Metadata.partition(value)
105
99
  end
106
100
 
107
101
  # aws.parseArn(value: string) Option<ARN>
@@ -19,9 +19,12 @@ require 'aws-sigv4'
19
19
  module Aws
20
20
  # @api private
21
21
  module Endpoints
22
- supported_auth_traits = %w[aws.auth#sigv4 smithy.api#httpBearerAuth smithy.api#noAuth]
23
- supported_auth_traits += ['aws.auth#sigv4a'] if Aws::Sigv4::Signer.use_crt?
24
- SUPPORTED_AUTH_TRAITS = supported_auth_traits.freeze
22
+ SUPPORTED_AUTH_TRAITS = %w[
23
+ aws.auth#sigv4
24
+ aws.auth#sigv4a
25
+ smithy.api#httpBearerAuth
26
+ smithy.api#noAuth
27
+ ].freeze
25
28
 
26
29
  class << self
27
30
  def resolve_auth_scheme(context, endpoint)
@@ -42,6 +45,13 @@ module Aws
42
45
  def merge_signing_defaults(auth_scheme, config)
43
46
  if %w[sigv4 sigv4a sigv4-s3express].include?(auth_scheme['name'])
44
47
  auth_scheme['signingName'] ||= sigv4_name(config)
48
+
49
+ # back fill disableNormalizePath for S3 until it gets correctly set in the rules
50
+ if auth_scheme['signingName'] == 's3' &&
51
+ !auth_scheme.include?('disableNormalizePath') &&
52
+ auth_scheme.include?('disableDoubleEncoding')
53
+ auth_scheme['disableNormalizePath'] = auth_scheme['disableDoubleEncoding']
54
+ end
45
55
  if auth_scheme['name'] == 'sigv4a'
46
56
  # config option supersedes endpoint properties
47
57
  auth_scheme['signingRegionSet'] =
@@ -1,12 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Aws
4
+ # @api private
4
5
  class ErrorHandler < Seahorse::Client::Handler
5
6
 
6
7
  private
7
8
 
8
9
  def error(context)
9
10
  body = context.http_response.body_contents
11
+ # This is not correct per protocol tests. Some headers will determine the error code.
12
+ # If the body is empty, there is still potentially an error code from the header, but
13
+ # we are making a generic http status error instead. In a new major version, we should
14
+ # always try to extract header, and during extraction, check headers and body.
10
15
  if body.empty?
11
16
  code, message, data = http_status_error(context)
12
17
  else
@@ -68,7 +68,7 @@ module Aws
68
68
  end
69
69
  end
70
70
 
71
- # Rasied when endpoint discovery failed for operations
71
+ # Raised when endpoint discovery failed for operations
72
72
  # that requires endpoints from endpoint discovery
73
73
  class EndpointDiscoveryError < RuntimeError
74
74
  def initialize(*args)
@@ -78,7 +78,7 @@ module Aws
78
78
  end
79
79
  end
80
80
 
81
- # raised when hostLabel member is not provided
81
+ # Raised when hostLabel member is not provided
82
82
  # at operation input when endpoint trait is available
83
83
  # with 'hostPrefix' requirement
84
84
  class MissingEndpointHostLabelValue < RuntimeError
@@ -31,7 +31,7 @@ module Aws
31
31
  def emit(type, params)
32
32
  unless @stream
33
33
  raise Aws::Errors::SignalEventError.new(
34
- "Singaling events before making async request"\
34
+ "Signaling events before making async request"\
35
35
  " is not allowed."
36
36
  )
37
37
  end
@@ -90,6 +90,7 @@ module Aws
90
90
  @token = nil
91
91
  @no_refresh_until = nil
92
92
  @async_refresh = false
93
+ @metrics = ['CREDENTIALS_IMDS']
93
94
  super
94
95
  end
95
96
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  module Aws
4
4
  module Json
5
+ # @api private
5
6
  class ErrorHandler < Aws::ErrorHandler
6
7
 
7
8
  def call(context)
@@ -24,17 +25,21 @@ module Aws
24
25
  end
25
26
 
26
27
  def error_code(json, context)
28
+ # This is not correct per protocol tests. awsQueryError is intended to populate the
29
+ # error code of the error class. The error class should come from __type. Query and
30
+ # query compatible services currently have dynamic errors raised from error codes instead
31
+ # of the modeled error class. However, changing this in this major version would break
32
+ # existing usage.
27
33
  code =
28
34
  if aws_query_error?(context)
29
- error = context.http_response.headers['x-amzn-query-error'].split(';')[0]
30
- remove_prefix(error, context)
35
+ aws_query_error_code(context)
31
36
  else
32
37
  json['__type']
33
38
  end
34
39
  code ||= json['code']
35
40
  code ||= context.http_response.headers['x-amzn-errortype']
36
41
  if code
37
- code.split('#').last
42
+ code.split('#').last.split(':').first
38
43
  else
39
44
  http_status_error_code(context)
40
45
  end
@@ -45,6 +50,12 @@ module Aws
45
50
  context.http_response.headers['x-amzn-query-error']
46
51
  end
47
52
 
53
+ def aws_query_error_code(context)
54
+ query_header = context.http_response.headers['x-amzn-query-error']
55
+ error, _type = query_header.split(';') # type not supported
56
+ remove_prefix(error, context)
57
+ end
58
+
48
59
  def remove_prefix(error_code, context)
49
60
  if (prefix = context.config.api.metadata['errorPrefix'])
50
61
  error_code.sub(/^#{prefix}/, '')
@@ -21,6 +21,7 @@ module Aws
21
21
  context.http_request.http_method = 'POST'
22
22
  context.http_request.headers['Content-Type'] = content_type(context)
23
23
  context.http_request.headers['X-Amz-Target'] = target(context)
24
+ context.http_request.headers['X-Amzn-Query-Mode'] = 'true' if query_compatible?(context)
24
25
  context.http_request.body = build_body(context)
25
26
  end
26
27
 
@@ -51,13 +51,17 @@ module Aws
51
51
  when String then summarize_string(value)
52
52
  when Hash then '{' + summarize_hash(value) + '}'
53
53
  when Array then summarize_array(value)
54
- when File then summarize_file(value.path)
55
- when Pathname then summarize_file(value)
54
+ when File then summarize_file(value)
55
+ when Pathname then summarize_filepath(value)
56
56
  else value.inspect
57
57
  end
58
58
  end
59
59
 
60
- def summarize_file(path)
60
+ def summarize_file(file)
61
+ "#<File:#{file.path} (#{file.size} bytes)>"
62
+ end
63
+
64
+ def summarize_filepath(path)
61
65
  "#<File:#{path} (#{File.size(path)} bytes)>"
62
66
  end
63
67
 
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aws
4
+ # setup autoloading for Log module
5
+ module Log
6
+ autoload :Formatter, 'aws-sdk-core/log/formatter'
7
+ autoload :ParamFilter, 'aws-sdk-core/log/param_filter'
8
+ autoload :ParamFormatter, 'aws-sdk-core/log/param_formatter'
9
+ end
10
+ end