aws-sdk-core 3.196.1 → 3.197.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: b77f2eeb94a52526e385b422b59703e582c75af70402ab009b66d542694259c8
4
- data.tar.gz: e97d33313f38d3b6dd565a02b3c1ccdc34d5960cd076ace3449fe50f7f75f2b6
3
+ metadata.gz: f11249692fa65ae987ba92fad403281cc16a877ccfe8381afb6ae7806c3a50ae
4
+ data.tar.gz: 0f8b8f4a441fb62dc3b5c7f296e8e3c5fff877262414796b98fc20dbd4eb680c
5
5
  SHA512:
6
- metadata.gz: 2efdc811c495c91558cf5144599eff67f2e828a94d90d4fd31d49575a9bff4456e7f237aa79853cdb6f8fba016b9011cc8f6d8677596c85a9e6179f606431961
7
- data.tar.gz: e933ae0dc9b2d77e0455a1af5f5c635833b394ec2f70f90133af52993992134b56481952124d5a2448182a6c180c4cb1483114667ea5d2437891e22a739e3f44
6
+ metadata.gz: e7b0fbfd6d0062f19f0c9ec4f70b909123e98b570a83b156fcbb4bae0e58a685745f1bffdb55c2999d4fd0e8ad0a2927b685bd59373d9008c5f2a3e12a5878e2
7
+ data.tar.gz: 356fab036a80251e70ad0ecd0232db0df377a2bfffef5b2631f12fa3d3dd048166f10013105818dfd59ff4e66deef16dfaf2c03ceb889009b8b9d5beb89907f5
data/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.197.1 (2024-06-19)
5
+ ------------------
6
+
7
+ * Issue - Support an array of string arguments for `Aws::ProcessCredentials` to be executed by `system`.
8
+
9
+ 3.197.0 (2024-06-05)
10
+ ------------------
11
+
12
+ * Issue - Ensure no UTC offset when deserializing `iso8601` timestamp format values.
13
+
14
+ * Feature - Bump User Agent to version 2.1 to track business metrics. This changes the User Agent plugin order to be just before sending.
15
+
4
16
  3.196.1 (2024-05-14)
5
17
  ------------------
6
18
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.196.1
1
+ 3.197.1
@@ -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
@@ -2,9 +2,15 @@
2
2
 
3
3
  module Aws
4
4
  # A credential provider that executes a given process and attempts
5
- # to read its stdout to recieve a JSON payload containing the credentials.
5
+ # to read its stdout to receive a JSON payload containing the credentials.
6
6
  #
7
- # credentials = Aws::ProcessCredentials.new('/usr/bin/credential_proc')
7
+ # credentials = Aws::ProcessCredentials.new(['/usr/bin/credential_proc'])
8
+ # ec2 = Aws::EC2::Client.new(credentials: credentials)
9
+ #
10
+ # Arguments should be provided as strings in the array, for example:
11
+ #
12
+ # process = ['/usr/bin/credential_proc', 'arg1', 'arg2']
13
+ # credentials = Aws::ProcessCredentials.new(process)
8
14
  # ec2 = Aws::EC2::Client.new(credentials: credentials)
9
15
  #
10
16
  # Automatically handles refreshing credentials if an Expiration time is
@@ -19,40 +25,49 @@ module Aws
19
25
  # Creates a new ProcessCredentials object, which allows an
20
26
  # external process to be used as a credential provider.
21
27
  #
22
- # @param [String] process Invocation string for process
23
- # credentials provider.
28
+ # @param [Array<String>, String] process An array of strings including
29
+ # the process name and its arguments to execute, or a single string to be
30
+ # executed by the shell (deprecated and insecure).
24
31
  def initialize(process)
32
+ if process.is_a?(String)
33
+ warn('Passing a single string to Aws::ProcessCredentials.new '\
34
+ 'is insecure, please use use an array of system arguments instead')
35
+ end
25
36
  @process = process
26
- @credentials = credentials_from_process(@process)
37
+ @credentials = credentials_from_process
27
38
  @async_refresh = false
28
39
 
29
40
  super
30
41
  end
31
42
 
32
43
  private
33
- def credentials_from_process(proc_invocation)
34
- begin
35
- raw_out = `#{proc_invocation}`
36
- process_status = $?
37
- rescue Errno::ENOENT
38
- raise Errors::InvalidProcessCredentialsPayload.new("Could not find process #{proc_invocation}")
44
+
45
+ def credentials_from_process
46
+ r, w = IO.pipe
47
+ success = system(*@process, out: w)
48
+ w.close
49
+ raw_out = r.read
50
+ r.close
51
+
52
+ unless success
53
+ raise Errors::InvalidProcessCredentialsPayload.new(
54
+ 'credential_process provider failure, the credential process had '\
55
+ 'non zero exit status and failed to provide credentials'
56
+ )
39
57
  end
40
58
 
41
- if process_status.success?
42
- begin
43
- creds_json = Aws::Json.load(raw_out)
44
- rescue Aws::Json::ParseError
45
- raise Errors::InvalidProcessCredentialsPayload.new("Invalid JSON response")
46
- end
47
- payload_version = creds_json['Version']
48
- if payload_version == 1
49
- _parse_payload_format_v1(creds_json)
50
- else
51
- raise Errors::InvalidProcessCredentialsPayload.new("Invalid version #{payload_version} for credentials payload")
52
- end
53
- else
54
- raise Errors::InvalidProcessCredentialsPayload.new('credential_process provider failure, the credential process had non zero exit status and failed to provide credentials')
59
+ begin
60
+ creds_json = Aws::Json.load(raw_out)
61
+ rescue Aws::Json::ParseError
62
+ raise Errors::InvalidProcessCredentialsPayload.new('Invalid JSON response')
55
63
  end
64
+
65
+ payload_version = creds_json['Version']
66
+ return _parse_payload_format_v1(creds_json) if payload_version == 1
67
+
68
+ raise Errors::InvalidProcessCredentialsPayload.new(
69
+ "Invalid version #{payload_version} for credentials payload"
70
+ )
56
71
  end
57
72
 
58
73
  def _parse_payload_format_v1(creds_json)
@@ -64,11 +79,14 @@ module Aws
64
79
 
65
80
  @expiration = creds_json['Expiration'] ? Time.iso8601(creds_json['Expiration']) : nil
66
81
  return creds if creds.set?
67
- raise Errors::InvalidProcessCredentialsPayload.new("Invalid payload for JSON credentials version 1")
82
+
83
+ raise Errors::InvalidProcessCredentialsPayload.new(
84
+ 'Invalid payload for JSON credentials version 1'
85
+ )
68
86
  end
69
87
 
70
88
  def refresh
71
- @credentials = credentials_from_process(@process)
89
+ @credentials = credentials_from_process
72
90
  end
73
91
 
74
92
  def near_expiration?(expiration_length)
@@ -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.1'
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.1'
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.1'
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.1'
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.1'
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.1'
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.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: 2024-05-14 00:00:00.000000000 Z
11
+ date: 2024-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath