aws-sdk-core 3.196.1 → 3.197.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b77f2eeb94a52526e385b422b59703e582c75af70402ab009b66d542694259c8
4
- data.tar.gz: e97d33313f38d3b6dd565a02b3c1ccdc34d5960cd076ace3449fe50f7f75f2b6
3
+ metadata.gz: 2126c3d8e997ce7f62c9c4d66f5eeef1b3ca33dbe07963cee7ab64af41e3bea3
4
+ data.tar.gz: c8e520892d84cfe2afb40aae3c2064c2f9aed5c291b4346d3a45a2f61df6175d
5
5
  SHA512:
6
- metadata.gz: 2efdc811c495c91558cf5144599eff67f2e828a94d90d4fd31d49575a9bff4456e7f237aa79853cdb6f8fba016b9011cc8f6d8677596c85a9e6179f606431961
7
- data.tar.gz: e933ae0dc9b2d77e0455a1af5f5c635833b394ec2f70f90133af52993992134b56481952124d5a2448182a6c180c4cb1483114667ea5d2437891e22a739e3f44
6
+ metadata.gz: 33e18c7d668078ac612c1c77324c86fc4a102e6d4f752211ca1b6ca9cec91ae098e1261c3ae1ec03dfe2c57d16925608feef5f89cb76a32203d04cb9d790b135
7
+ data.tar.gz: 459028118688f266b87f788388ffbb5a7cc6e32931b8bc6ffdbad86dfc00818adc7d394ffee4aa672cb5a4003bfdf2046bfbda5e729582a7022c2d0c835df634
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.197.0 (2024-06-05)
5
+ ------------------
6
+
7
+ * Issue - Ensure no UTC offset when deserializing `iso8601` timestamp format values.
8
+
9
+ * Feature - Bump User Agent to version 2.1 to track business metrics. This changes the User Agent plugin order to be just before sending.
10
+
4
11
  3.196.1 (2024-05-14)
5
12
  ------------------
6
13
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.196.1
1
+ 3.197.0
@@ -201,7 +201,7 @@ module Aws
201
201
  def next_response(params)
202
202
  params = next_page_params(params)
203
203
  request = context.client.build_request(context.operation_name, params)
204
- Aws::Plugins::UserAgent.feature('paginator') do
204
+ Aws::Plugins::UserAgent.metric('PAGINATOR') do
205
205
  request.send_request
206
206
  end
207
207
  end
@@ -11,6 +11,8 @@ module Aws
11
11
  # AttemptHandler comes just before we would retry an error.
12
12
  # Or before we would follow redirects.
13
13
  handlers.add(AttemptHandler, step: :sign, priority: 39)
14
+ # ErrorHandler comes after we have parsed an error.
15
+ handlers.add(ErrorHandler, step: :sign, priority: 95)
14
16
  # LatencyHandler is as close to sending as possible.
15
17
  handlers.add(LatencyHandler, step: :sign, priority: 0)
16
18
  end
@@ -62,17 +64,27 @@ module Aws
62
64
  call_attempt.x_amzn_request_id = headers["x-amzn-request-id"]
63
65
  end
64
66
  call_attempt.http_status_code = context.http_response.status_code
65
- if e = resp.error
67
+ context.metadata[:current_call_attempt] = call_attempt
68
+ request_metrics.add_call_attempt(call_attempt)
69
+ resp
70
+ end
71
+ end
72
+
73
+ class ErrorHandler < Seahorse::Client::Handler
74
+ def call(context)
75
+ resp = @handler.call(context)
76
+ call_attempt = context.metadata[:current_call_attempt]
77
+ if (e = resp.error)
66
78
  e_name = _extract_error_name(e)
67
79
  e_msg = e.message
68
80
  call_attempt.aws_exception = "#{e_name}"
69
81
  call_attempt.aws_exception_msg = "#{e_msg}"
70
82
  end
71
- request_metrics.add_call_attempt(call_attempt)
72
83
  resp
73
84
  end
74
85
 
75
86
  private
87
+
76
88
  def _extract_error_name(error)
77
89
  if error.is_a?(Aws::Errors::ServiceError)
78
90
  error.class.code
@@ -91,11 +91,20 @@ and 10485780 bytes inclusive.
91
91
  end
92
92
  end
93
93
  end
94
- @handler.call(context)
94
+ with_metric(selected_encoding) { @handler.call(context) }
95
95
  end
96
96
 
97
97
  private
98
98
 
99
+ def with_metric(encoding, &block)
100
+ case encoding
101
+ when 'gzip'
102
+ Aws::Plugins::UserAgent.metric('GZIP_REQUEST_COMPRESSION', &block)
103
+ else
104
+ block.call
105
+ end
106
+ end
107
+
99
108
  def request_encoding_selection(context)
100
109
  encoding_list = context.operation.request_compression['encodings']
101
110
  encoding_list.find { |encoding| RequestCompression::SUPPORTED_ENCODINGS.include?(encoding) }
@@ -235,7 +235,7 @@ a clock skew correction and retry requests with skewed client clocks.
235
235
 
236
236
  get_send_token(config)
237
237
  add_retry_headers(context)
238
- response = @handler.call(context)
238
+ response = with_metric(config.retry_mode) { @handler.call(context) }
239
239
  error_inspector = Retries::ErrorInspector.new(
240
240
  response.error, response.context.http_response.status_code
241
241
  )
@@ -272,6 +272,10 @@ a clock skew correction and retry requests with skewed client clocks.
272
272
 
273
273
  private
274
274
 
275
+ def with_metric(retry_mode, &block)
276
+ Aws::Plugins::UserAgent.metric("RETRY_MODE_#{retry_mode.upcase}", &block)
277
+ end
278
+
275
279
  def get_send_token(config)
276
280
  # either fail fast or block until a token becomes available
277
281
  # must be configurable
@@ -359,7 +363,7 @@ a clock skew correction and retry requests with skewed client clocks.
359
363
  class LegacyHandler < Seahorse::Client::Handler
360
364
 
361
365
  def call(context)
362
- response = @handler.call(context)
366
+ response = with_metric { @handler.call(context) }
363
367
  if response.error
364
368
  error_inspector = Retries::ErrorInspector.new(
365
369
  response.error, response.context.http_response.status_code
@@ -378,6 +382,10 @@ a clock skew correction and retry requests with skewed client clocks.
378
382
 
379
383
  private
380
384
 
385
+ def with_metric(&block)
386
+ Aws::Plugins::UserAgent.metric('RETRY_MODE_LEGACY', &block)
387
+ end
388
+
381
389
  def retry_if_possible(response, error_inspector)
382
390
  context = response.context
383
391
  if should_retry?(context, error_inspector)
@@ -4,6 +4,23 @@ module Aws
4
4
  module Plugins
5
5
  # @api private
6
6
  class UserAgent < Seahorse::Client::Plugin
7
+ METRICS = Aws::Json.load(<<-METRICS)
8
+ {
9
+ "RESOURCE_MODEL": "A",
10
+ "WAITER": "B",
11
+ "PAGINATOR": "C",
12
+ "RETRY_MODE_LEGACY": "D",
13
+ "RETRY_MODE_STANDARD": "E",
14
+ "RETRY_MODE_ADAPTIVE": "F",
15
+ "S3_TRANSFER": "G",
16
+ "S3_CRYPTO_V1N": "H",
17
+ "S3_CRYPTO_V2": "I",
18
+ "S3_EXPRESS_BUCKET": "J",
19
+ "S3_ACCESS_GRANTS": "K",
20
+ "GZIP_REQUEST_COMPRESSION": "L"
21
+ }
22
+ METRICS
23
+
7
24
  # @api private
8
25
  option(:user_agent_suffix)
9
26
  # @api private
@@ -23,12 +40,20 @@ variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
23
40
  app_id
24
41
  end
25
42
 
26
- def self.feature(feature, &block)
27
- Thread.current[:aws_sdk_core_user_agent_feature] ||= []
28
- Thread.current[:aws_sdk_core_user_agent_feature] << "ft/#{feature}"
43
+ # Deprecated - must exist for old service gems
44
+ def self.feature(_feature, &block)
45
+ block.call
46
+ end
47
+
48
+ def self.metric(metric, &block)
49
+ Thread.current[:aws_sdk_core_user_agent_metric] ||= []
50
+ Thread.current[:aws_sdk_core_user_agent_metric] << METRICS[metric]
29
51
  block.call
30
52
  ensure
31
- Thread.current[:aws_sdk_core_user_agent_feature].pop
53
+ Thread.current[:aws_sdk_core_user_agent_metric].pop
54
+ if Thread.current[:aws_sdk_core_user_agent_metric].empty?
55
+ Thread.current[:aws_sdk_core_user_agent_metric] = nil
56
+ end
32
57
  end
33
58
 
34
59
  # @api private
@@ -49,15 +74,24 @@ variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
49
74
 
50
75
  def to_s
51
76
  ua = "aws-sdk-ruby3/#{CORE_GEM_VERSION}"
52
- ua += ' ua/2.0'
53
- ua += " #{api_metadata}" if api_metadata
77
+ ua += ' ua/2.1'
78
+ if (api_m = api_metadata)
79
+ ua += " #{api_m}"
80
+ end
54
81
  ua += " #{os_metadata}"
55
82
  ua += " #{language_metadata}"
56
- ua += " #{env_metadata}" if env_metadata
57
- ua += " #{config_metadata}" if config_metadata
58
- ua += " #{app_id}" if app_id
59
- ua += " #{feature_metadata}" if feature_metadata
60
- ua += " #{framework_metadata}" if framework_metadata
83
+ if (env_m = env_metadata)
84
+ ua += " #{env_m}"
85
+ end
86
+ if (app_id_m = app_id_metadata)
87
+ ua += " #{app_id_m}"
88
+ end
89
+ if (framework_m = framework_metadata)
90
+ ua += " #{framework_m}"
91
+ end
92
+ if (metric_m = metric_metadata)
93
+ ua += " #{metric_m}"
94
+ end
61
95
  if @context.config.user_agent_suffix
62
96
  ua += " #{@context.config.user_agent_suffix}"
63
97
  end
@@ -93,7 +127,6 @@ variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
93
127
  local_version = Gem::Platform.local.version
94
128
  metadata += "##{local_version}" if local_version
95
129
  metadata += " md/#{RbConfig::CONFIG['host_cpu']}"
96
- metadata
97
130
  end
98
131
 
99
132
  # Used to be RUBY_ENGINE/RUBY_VERSION
@@ -107,11 +140,7 @@ variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
107
140
  "exec-env/#{execution_env}"
108
141
  end
109
142
 
110
- def config_metadata
111
- "cfg/retry-mode##{@context.config.retry_mode}"
112
- end
113
-
114
- def app_id
143
+ def app_id_metadata
115
144
  return unless (app_id = @context.config.sdk_ua_app_id)
116
145
 
117
146
  # Sanitize and only allow these characters
@@ -119,12 +148,6 @@ variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
119
148
  "app/#{app_id}"
120
149
  end
121
150
 
122
- def feature_metadata
123
- return unless Thread.current[:aws_sdk_core_user_agent_feature]
124
-
125
- Thread.current[:aws_sdk_core_user_agent_feature].join(' ')
126
- end
127
-
128
151
  def framework_metadata
129
152
  if (frameworks_cfg = @context.config.user_agent_frameworks).empty?
130
153
  return
@@ -141,10 +164,21 @@ variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
141
164
  end
142
165
  frameworks.map { |n, v| "lib/#{n}##{v}" }.join(' ')
143
166
  end
167
+
168
+ def metric_metadata
169
+ return unless Thread.current[:aws_sdk_core_user_agent_metric]
170
+
171
+ metrics = Thread.current[:aws_sdk_core_user_agent_metric].join(',')
172
+ # Metric metadata is limited to 1024 bytes
173
+ return "m/#{metrics}" if metrics.bytesize <= 1024
174
+
175
+ # Removes the last unfinished metric
176
+ "m/#{metrics[0...metrics[0..1024].rindex(',')]}"
177
+ end
144
178
  end
145
179
  end
146
180
 
147
- handler(Handler, priority: 1)
181
+ handler(Handler, step: :sign, priority: 97)
148
182
  end
149
183
  end
150
184
  end
@@ -90,16 +90,16 @@ module Aws
90
90
  end
91
91
  end
92
92
 
93
- # @param [String, Integer] value
93
+ # @param [String] value
94
94
  # @return [Time]
95
95
  def deserialize_time(value)
96
96
  case value
97
97
  when nil then nil
98
- when /^\d+$/ then Time.at(value.to_i)
98
+ when /^[\d.]+$/ then Time.at(value.to_f).utc
99
99
  else
100
100
  begin
101
- fractional_time = Time.parse(value).utc.to_f
102
- Time.at(fractional_time)
101
+ fractional_time = Time.parse(value).to_f
102
+ Time.at(fractional_time).utc
103
103
  rescue ArgumentError
104
104
  raise "unhandled timestamp format `#{value}'"
105
105
  end
@@ -62,7 +62,7 @@ module Aws
62
62
  def send_request(options)
63
63
  req = options[:client].build_request(@operation_name, options[:params])
64
64
  req.handlers.remove(RAISE_HANDLER)
65
- Aws::Plugins::UserAgent.feature('waiter') do
65
+ Aws::Plugins::UserAgent.metric('WAITER') do
66
66
  req.send_request
67
67
  end
68
68
  end
@@ -630,7 +630,7 @@ module Aws::SSO
630
630
  params: params,
631
631
  config: config)
632
632
  context[:gem_name] = 'aws-sdk-core'
633
- context[:gem_version] = '3.196.1'
633
+ context[:gem_version] = '3.197.0'
634
634
  Seahorse::Client::Request.new(handlers, context)
635
635
  end
636
636
 
data/lib/aws-sdk-sso.rb CHANGED
@@ -54,6 +54,6 @@ require_relative 'aws-sdk-sso/customizations'
54
54
  # @!group service
55
55
  module Aws::SSO
56
56
 
57
- GEM_VERSION = '3.196.1'
57
+ GEM_VERSION = '3.197.0'
58
58
 
59
59
  end
@@ -983,7 +983,7 @@ module Aws::SSOOIDC
983
983
  params: params,
984
984
  config: config)
985
985
  context[:gem_name] = 'aws-sdk-core'
986
- context[:gem_version] = '3.196.1'
986
+ context[:gem_version] = '3.197.0'
987
987
  Seahorse::Client::Request.new(handlers, context)
988
988
  end
989
989
 
@@ -54,6 +54,6 @@ require_relative 'aws-sdk-ssooidc/customizations'
54
54
  # @!group service
55
55
  module Aws::SSOOIDC
56
56
 
57
- GEM_VERSION = '3.196.1'
57
+ GEM_VERSION = '3.197.0'
58
58
 
59
59
  end
@@ -2377,7 +2377,7 @@ module Aws::STS
2377
2377
  params: params,
2378
2378
  config: config)
2379
2379
  context[:gem_name] = 'aws-sdk-core'
2380
- context[:gem_version] = '3.196.1'
2380
+ context[:gem_version] = '3.197.0'
2381
2381
  Seahorse::Client::Request.new(handlers, context)
2382
2382
  end
2383
2383
 
data/lib/aws-sdk-sts.rb CHANGED
@@ -54,6 +54,6 @@ require_relative 'aws-sdk-sts/customizations'
54
54
  # @!group service
55
55
  module Aws::STS
56
56
 
57
- GEM_VERSION = '3.196.1'
57
+ GEM_VERSION = '3.197.0'
58
58
 
59
59
  end
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.196.1
4
+ version: 3.197.0
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: 2024-05-14 00:00:00.000000000 Z
11
+ date: 2024-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath