aws-sdk-core 3.170.0 → 3.175.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +52 -0
- data/VERSION +1 -1
- data/lib/aws-defaults/default_configuration.rb +4 -4
- data/lib/aws-sdk-core/credential_provider_chain.rb +2 -1
- data/lib/aws-sdk-core/ecs_credentials.rb +111 -53
- data/lib/aws-sdk-core/json/error_handler.rb +15 -5
- data/lib/aws-sdk-core/log/formatter.rb +6 -0
- data/lib/aws-sdk-core/pageable_response.rb +3 -1
- data/lib/aws-sdk-core/plugins/checksum_algorithm.rb +1 -1
- data/lib/aws-sdk-core/plugins/user_agent.rb +117 -14
- data/lib/aws-sdk-core/shared_config.rb +2 -1
- data/lib/aws-sdk-core/waiters/poller.rb +3 -1
- data/lib/aws-sdk-sso/client.rb +6 -1
- data/lib/aws-sdk-sso/endpoints.rb +1 -0
- data/lib/aws-sdk-sso.rb +1 -1
- data/lib/aws-sdk-ssooidc/client.rb +6 -1
- data/lib/aws-sdk-ssooidc/endpoints.rb +1 -0
- data/lib/aws-sdk-ssooidc.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +111 -110
- data/lib/aws-sdk-sts/endpoint_provider.rb +81 -78
- data/lib/aws-sdk-sts/endpoints.rb +1 -0
- data/lib/aws-sdk-sts/types.rb +8 -9
- data/lib/aws-sdk-sts.rb +1 -1
- data/lib/seahorse/client/h2/connection.rb +10 -6
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 00b5dd5634edc052e3a3b44da5f1d06a96c5897585de71fe994130a991bf7cee
|
|
4
|
+
data.tar.gz: 4aab11d507d492ed8b2eec6123bb9170c5271c40b42afb026dd844dbb082786f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e85525d950b0e7dbe029a0b8c45661edf1ed398d32f4e63b2f0641d6febbdfee370701309719146e5da98415233d2a978fc88905e4fc1073cd95dca42cd13eff
|
|
7
|
+
data.tar.gz: 3a9c20834b4b0f8faf9fdbc3963156cf996719f1f1051ae4b8e251f5f32ec45a7f072b9c0f007cbbeabcc6496aa6f473f840ee338d97e3f227b72217d53f2cba
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
Unreleased Changes
|
|
2
2
|
------------------
|
|
3
3
|
|
|
4
|
+
3.175.0 (2023-06-15)
|
|
5
|
+
------------------
|
|
6
|
+
|
|
7
|
+
* Feature - Updated Aws::STS::Client with the latest API changes.
|
|
8
|
+
|
|
9
|
+
* Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
|
|
10
|
+
|
|
11
|
+
* Feature - Updated Aws::SSO::Client with the latest API changes.
|
|
12
|
+
|
|
13
|
+
3.174.0 (2023-05-31)
|
|
14
|
+
------------------
|
|
15
|
+
|
|
16
|
+
* Feature - Updated Aws::STS::Client with the latest API changes.
|
|
17
|
+
|
|
18
|
+
* Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
|
|
19
|
+
|
|
20
|
+
* Feature - Updated Aws::SSO::Client with the latest API changes.
|
|
21
|
+
|
|
22
|
+
* Feature - Improve User-Agent metrics tracking.
|
|
23
|
+
|
|
24
|
+
3.173.1 (2023-05-24)
|
|
25
|
+
------------------
|
|
26
|
+
|
|
27
|
+
* Issue - Updated `checksum_algorithm` plugin to use IO.copy_stream for JRuby.
|
|
28
|
+
|
|
29
|
+
3.173.0 (2023-05-18)
|
|
30
|
+
------------------
|
|
31
|
+
|
|
32
|
+
* Feature - Updated Aws::STS::Client with the latest API changes.
|
|
33
|
+
|
|
34
|
+
3.172.0 (2023-05-08)
|
|
35
|
+
------------------
|
|
36
|
+
|
|
37
|
+
* Feature - Updated Aws::STS::Client with the latest API changes.
|
|
38
|
+
|
|
39
|
+
* Feature - Add :region option to `Aws::Log::Formatter`.
|
|
40
|
+
|
|
41
|
+
3.171.1 (2023-05-04)
|
|
42
|
+
------------------
|
|
43
|
+
|
|
44
|
+
* Issue - Fix error code parsing in AWS query compatible JSON services.
|
|
45
|
+
|
|
46
|
+
3.171.0 (2023-03-22)
|
|
47
|
+
------------------
|
|
48
|
+
|
|
49
|
+
* Feature - Add support for `AWS_CONTAINER_CREDENTIALS_FULL_URI` and `AWS_CONTAINER_AUTHORIZATION_TOKEN` environment variables to `ECSCredentials`.
|
|
50
|
+
|
|
51
|
+
3.170.1 (2023-03-17)
|
|
52
|
+
------------------
|
|
53
|
+
|
|
54
|
+
* Issue - Reduce memory usage in H2::Connection when `http_wire_log` is not set.
|
|
55
|
+
|
|
4
56
|
3.170.0 (2023-01-25)
|
|
5
57
|
------------------
|
|
6
58
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.175.0
|
|
@@ -20,7 +20,7 @@ module Aws
|
|
|
20
20
|
# * Globally via the "AWS_DEFAULTS_MODE" environment variable.
|
|
21
21
|
#
|
|
22
22
|
#
|
|
23
|
-
#
|
|
23
|
+
# #defaults START - documentation
|
|
24
24
|
# The following `:default_mode` values are supported:
|
|
25
25
|
#
|
|
26
26
|
# * `'standard'` -
|
|
@@ -105,10 +105,10 @@ module Aws
|
|
|
105
105
|
# [2]: https://docs.aws.amazon.com/sdkref/latest/guide/setting-global-retry_mode.html
|
|
106
106
|
# [3]: https://docs.aws.amazon.com/sdkref/latest/guide/setting-global-sts_regional_endpoints.html
|
|
107
107
|
#
|
|
108
|
-
#
|
|
108
|
+
# #defaults END - documentation
|
|
109
109
|
module DefaultsModeConfiguration
|
|
110
110
|
# @api private
|
|
111
|
-
#
|
|
111
|
+
# #defaults START - configuration
|
|
112
112
|
SDK_DEFAULT_CONFIGURATION =
|
|
113
113
|
{
|
|
114
114
|
"version" => 1,
|
|
@@ -148,6 +148,6 @@ module Aws
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
#
|
|
151
|
+
# #defaults END - configuration
|
|
152
152
|
end
|
|
153
153
|
end
|
|
@@ -161,7 +161,8 @@ module Aws
|
|
|
161
161
|
|
|
162
162
|
def instance_profile_credentials(options)
|
|
163
163
|
profile_name = determine_profile_name(options)
|
|
164
|
-
if ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI']
|
|
164
|
+
if ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI'] ||
|
|
165
|
+
ENV['AWS_CONTAINER_CREDENTIALS_FULL_URI']
|
|
165
166
|
ECSCredentials.new(options)
|
|
166
167
|
else
|
|
167
168
|
InstanceProfileCredentials.new(options.merge(profile: profile_name))
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'time'
|
|
4
4
|
require 'net/http'
|
|
5
|
+
require 'resolv'
|
|
5
6
|
|
|
6
7
|
module Aws
|
|
7
8
|
# An auto-refreshing credential provider that loads credentials from
|
|
@@ -10,7 +11,6 @@ module Aws
|
|
|
10
11
|
# ecs_credentials = Aws::ECSCredentials.new(retries: 3)
|
|
11
12
|
# ec2 = Aws::EC2::Client.new(credentials: ecs_credentials)
|
|
12
13
|
class ECSCredentials
|
|
13
|
-
|
|
14
14
|
include CredentialProvider
|
|
15
15
|
include RefreshingCredentials
|
|
16
16
|
|
|
@@ -29,16 +29,22 @@ module Aws
|
|
|
29
29
|
Errno::ENETUNREACH,
|
|
30
30
|
SocketError,
|
|
31
31
|
Timeout::Error,
|
|
32
|
-
Non200Response
|
|
33
|
-
]
|
|
32
|
+
Non200Response
|
|
33
|
+
].freeze
|
|
34
34
|
|
|
35
35
|
# @param [Hash] options
|
|
36
36
|
# @option options [Integer] :retries (5) Number of times to retry
|
|
37
37
|
# when retrieving credentials.
|
|
38
|
-
# @option options [String] :ip_address ('169.254.170.2')
|
|
39
|
-
#
|
|
38
|
+
# @option options [String] :ip_address ('169.254.170.2') This value is
|
|
39
|
+
# ignored if `endpoint` is set and `credential_path` is not set.
|
|
40
|
+
# @option options [Integer] :port (80) This value is ignored if `endpoint`
|
|
41
|
+
# is set and `credential_path` is not set.
|
|
40
42
|
# @option options [String] :credential_path By default, the value of the
|
|
41
43
|
# AWS_CONTAINER_CREDENTIALS_RELATIVE_URI environment variable.
|
|
44
|
+
# @option options [String] :endpoint The ECS credential endpoint.
|
|
45
|
+
# By default, this is the value of the AWS_CONTAINER_CREDENTIALS_FULL_URI
|
|
46
|
+
# environment variable. This value is ignored if `credential_path` or
|
|
47
|
+
# ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI'] is set.
|
|
42
48
|
# @option options [Float] :http_open_timeout (5)
|
|
43
49
|
# @option options [Float] :http_read_timeout (5)
|
|
44
50
|
# @option options [Numeric, Proc] :delay By default, failures are retried
|
|
@@ -52,17 +58,15 @@ module Aws
|
|
|
52
58
|
# credentials are refreshed. `before_refresh` is called
|
|
53
59
|
# with an instance of this object when
|
|
54
60
|
# AWS credentials are required and need to be refreshed.
|
|
55
|
-
def initialize
|
|
61
|
+
def initialize(options = {})
|
|
62
|
+
credential_path = options[:credential_path] ||
|
|
63
|
+
ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI']
|
|
64
|
+
endpoint = options[:endpoint] ||
|
|
65
|
+
ENV['AWS_CONTAINER_CREDENTIALS_FULL_URI']
|
|
66
|
+
initialize_uri(options, credential_path, endpoint)
|
|
67
|
+
@authorization_token = ENV['AWS_CONTAINER_AUTHORIZATION_TOKEN']
|
|
68
|
+
|
|
56
69
|
@retries = options[:retries] || 5
|
|
57
|
-
@ip_address = options[:ip_address] || '169.254.170.2'
|
|
58
|
-
@port = options[:port] || 80
|
|
59
|
-
@credential_path = options[:credential_path]
|
|
60
|
-
@credential_path ||= ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI']
|
|
61
|
-
unless @credential_path
|
|
62
|
-
raise ArgumentError.new(
|
|
63
|
-
"Cannot instantiate an ECS Credential Provider without a credential path."
|
|
64
|
-
)
|
|
65
|
-
end
|
|
66
70
|
@http_open_timeout = options[:http_open_timeout] || 5
|
|
67
71
|
@http_read_timeout = options[:http_read_timeout] || 5
|
|
68
72
|
@http_debug_output = options[:http_debug_output]
|
|
@@ -77,11 +81,69 @@ module Aws
|
|
|
77
81
|
|
|
78
82
|
private
|
|
79
83
|
|
|
84
|
+
def initialize_uri(options, credential_path, endpoint)
|
|
85
|
+
if credential_path
|
|
86
|
+
initialize_relative_uri(options, credential_path)
|
|
87
|
+
# Use FULL_URI/endpoint only if RELATIVE_URI/path is not set
|
|
88
|
+
elsif endpoint
|
|
89
|
+
initialize_full_uri(endpoint)
|
|
90
|
+
else
|
|
91
|
+
raise ArgumentError,
|
|
92
|
+
'Cannot instantiate an ECS Credential Provider '\
|
|
93
|
+
'without a credential path or endpoint.'
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def initialize_relative_uri(options, path)
|
|
98
|
+
@host = options[:ip_address] || '169.254.170.2'
|
|
99
|
+
@port = options[:port] || 80
|
|
100
|
+
@scheme = 'http'
|
|
101
|
+
@credential_path = path
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def initialize_full_uri(endpoint)
|
|
105
|
+
uri = URI.parse(endpoint)
|
|
106
|
+
validate_full_uri!(uri)
|
|
107
|
+
@host = uri.host
|
|
108
|
+
@port = uri.port
|
|
109
|
+
@scheme = uri.scheme
|
|
110
|
+
@credential_path = uri.path
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Validate that the full URI is using a loopback address if scheme is http.
|
|
114
|
+
def validate_full_uri!(full_uri)
|
|
115
|
+
return unless full_uri.scheme == 'http'
|
|
116
|
+
|
|
117
|
+
begin
|
|
118
|
+
return if ip_loopback?(IPAddr.new(full_uri.host))
|
|
119
|
+
rescue IPAddr::InvalidAddressError
|
|
120
|
+
addresses = Resolv.getaddresses(full_uri.host)
|
|
121
|
+
return if addresses.all? { |addr| ip_loopback?(IPAddr.new(addr)) }
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
raise ArgumentError,
|
|
125
|
+
'AWS_CONTAINER_CREDENTIALS_FULL_URI must use a loopback '\
|
|
126
|
+
'address when using the http scheme.'
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# loopback? method is available in Ruby 2.5+
|
|
130
|
+
# Replicate the logic here.
|
|
131
|
+
def ip_loopback?(ip_address)
|
|
132
|
+
case ip_address.family
|
|
133
|
+
when Socket::AF_INET
|
|
134
|
+
ip_address & 0xff000000 == 0x7f000000
|
|
135
|
+
when Socket::AF_INET6
|
|
136
|
+
ip_address == 1
|
|
137
|
+
else
|
|
138
|
+
false
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
80
142
|
def backoff(backoff)
|
|
81
143
|
case backoff
|
|
82
144
|
when Proc then backoff
|
|
83
|
-
when Numeric then
|
|
84
|
-
else
|
|
145
|
+
when Numeric then ->(_) { sleep(backoff) }
|
|
146
|
+
else ->(num_failures) { Kernel.sleep(1.2**num_failures) }
|
|
85
147
|
end
|
|
86
148
|
end
|
|
87
149
|
|
|
@@ -89,68 +151,64 @@ module Aws
|
|
|
89
151
|
# Retry loading credentials up to 3 times is the instance metadata
|
|
90
152
|
# service is responding but is returning invalid JSON documents
|
|
91
153
|
# in response to the GET profile credentials call.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
end
|
|
102
|
-
rescue Aws::Json::ParseError
|
|
103
|
-
raise Aws::Errors::MetadataParserError.new
|
|
154
|
+
|
|
155
|
+
retry_errors([Aws::Json::ParseError, StandardError], max_retries: 3) do
|
|
156
|
+
c = Aws::Json.load(get_credentials.to_s)
|
|
157
|
+
@credentials = Credentials.new(
|
|
158
|
+
c['AccessKeyId'],
|
|
159
|
+
c['SecretAccessKey'],
|
|
160
|
+
c['Token']
|
|
161
|
+
)
|
|
162
|
+
@expiration = c['Expiration'] ? Time.iso8601(c['Expiration']) : nil
|
|
104
163
|
end
|
|
164
|
+
rescue Aws::Json::ParseError
|
|
165
|
+
raise Aws::Errors::MetadataParserError
|
|
105
166
|
end
|
|
106
167
|
|
|
107
168
|
def get_credentials
|
|
108
169
|
# Retry loading credentials a configurable number of times if
|
|
109
170
|
# the instance metadata service is not responding.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
end
|
|
171
|
+
|
|
172
|
+
retry_errors(NETWORK_ERRORS, max_retries: @retries) do
|
|
173
|
+
open_connection do |conn|
|
|
174
|
+
http_get(conn, @credential_path)
|
|
115
175
|
end
|
|
116
|
-
rescue
|
|
117
|
-
'{}'
|
|
118
176
|
end
|
|
177
|
+
rescue StandardError
|
|
178
|
+
'{}'
|
|
119
179
|
end
|
|
120
180
|
|
|
121
181
|
def open_connection
|
|
122
|
-
http = Net::HTTP.new(@
|
|
182
|
+
http = Net::HTTP.new(@host, @port, nil)
|
|
123
183
|
http.open_timeout = @http_open_timeout
|
|
124
184
|
http.read_timeout = @http_read_timeout
|
|
125
185
|
http.set_debug_output(@http_debug_output) if @http_debug_output
|
|
186
|
+
http.use_ssl = @scheme == 'https'
|
|
126
187
|
http.start
|
|
127
188
|
yield(http).tap { http.finish }
|
|
128
189
|
end
|
|
129
190
|
|
|
130
191
|
def http_get(connection, path)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
192
|
+
request = Net::HTTP::Get.new(path)
|
|
193
|
+
request['Authorization'] = @authorization_token if @authorization_token
|
|
194
|
+
response = connection.request(request)
|
|
195
|
+
raise Non200Response unless response.code.to_i == 200
|
|
196
|
+
|
|
197
|
+
response.body
|
|
137
198
|
end
|
|
138
199
|
|
|
139
|
-
def retry_errors(error_classes, options = {}
|
|
200
|
+
def retry_errors(error_classes, options = {})
|
|
140
201
|
max_retries = options[:max_retries]
|
|
141
202
|
retries = 0
|
|
142
203
|
begin
|
|
143
204
|
yield
|
|
144
|
-
rescue *error_classes =>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
raise
|
|
151
|
-
end
|
|
205
|
+
rescue *error_classes => _e
|
|
206
|
+
raise unless retries < max_retries
|
|
207
|
+
|
|
208
|
+
@backoff.call(retries)
|
|
209
|
+
retries += 1
|
|
210
|
+
retry
|
|
152
211
|
end
|
|
153
212
|
end
|
|
154
|
-
|
|
155
213
|
end
|
|
156
214
|
end
|
|
@@ -26,11 +26,13 @@ module Aws
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def error_code(json, context)
|
|
29
|
-
code =
|
|
30
|
-
context
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
code =
|
|
30
|
+
if aws_query_error?(context)
|
|
31
|
+
error = context.http_response.headers['x-amzn-query-error'].split(';')[0]
|
|
32
|
+
remove_prefix(error, context)
|
|
33
|
+
else
|
|
34
|
+
json['__type']
|
|
35
|
+
end
|
|
34
36
|
code ||= json['code']
|
|
35
37
|
code ||= context.http_response.headers['x-amzn-errortype']
|
|
36
38
|
if code
|
|
@@ -45,6 +47,14 @@ module Aws
|
|
|
45
47
|
context.http_response.headers['x-amzn-query-error']
|
|
46
48
|
end
|
|
47
49
|
|
|
50
|
+
def remove_prefix(error_code, context)
|
|
51
|
+
if prefix = context.config.api.metadata['errorPrefix']
|
|
52
|
+
error_code.sub(/^#{prefix}/, '')
|
|
53
|
+
else
|
|
54
|
+
error_code
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
48
58
|
def error_message(code, json)
|
|
49
59
|
if code == 'RequestEntityTooLarge'
|
|
50
60
|
'Request body must be less than 1 MB'
|
|
@@ -26,6 +26,8 @@ module Aws
|
|
|
26
26
|
#
|
|
27
27
|
# You can put any of these placeholders into you pattern.
|
|
28
28
|
#
|
|
29
|
+
# * `:region` - The region configured for the client.
|
|
30
|
+
#
|
|
29
31
|
# * `:client_class` - The name of the client class.
|
|
30
32
|
#
|
|
31
33
|
# * `:operation` - The name of the client request method.
|
|
@@ -116,6 +118,10 @@ module Aws
|
|
|
116
118
|
|
|
117
119
|
private
|
|
118
120
|
|
|
121
|
+
def _region(response)
|
|
122
|
+
response.context.config.region
|
|
123
|
+
end
|
|
124
|
+
|
|
119
125
|
def _client_class(response)
|
|
120
126
|
response.context.client.class.name
|
|
121
127
|
end
|
|
@@ -201,7 +201,9 @@ 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
|
-
|
|
204
|
+
Aws::Plugins::UserAgent.feature('paginator') do
|
|
205
|
+
request.send_request
|
|
206
|
+
end
|
|
205
207
|
end
|
|
206
208
|
|
|
207
209
|
def next_page_params(params)
|
|
@@ -4,7 +4,31 @@ module Aws
|
|
|
4
4
|
module Plugins
|
|
5
5
|
# @api private
|
|
6
6
|
class UserAgent < Seahorse::Client::Plugin
|
|
7
|
+
# @api private
|
|
7
8
|
option(:user_agent_suffix)
|
|
9
|
+
# @api private
|
|
10
|
+
option(:user_agent_frameworks, default: [])
|
|
11
|
+
|
|
12
|
+
option(
|
|
13
|
+
:sdk_ua_app_id,
|
|
14
|
+
doc_type: 'String',
|
|
15
|
+
docstring: <<-DOCS) do |cfg|
|
|
16
|
+
A unique and opaque application ID that is appended to the
|
|
17
|
+
User-Agent header as app/<sdk_ua_app_id>. It should have a
|
|
18
|
+
maximum length of 50.
|
|
19
|
+
DOCS
|
|
20
|
+
app_id = ENV['AWS_SDK_UA_APP_ID']
|
|
21
|
+
app_id ||= Aws.shared_config.sdk_ua_app_id(profile: cfg.profile)
|
|
22
|
+
app_id
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.feature(feature, &block)
|
|
26
|
+
Thread.current[:aws_sdk_core_user_agent_feature] ||= []
|
|
27
|
+
Thread.current[:aws_sdk_core_user_agent_feature] << "ft/#{feature}"
|
|
28
|
+
block.call
|
|
29
|
+
ensure
|
|
30
|
+
Thread.current[:aws_sdk_core_user_agent_feature].pop
|
|
31
|
+
end
|
|
8
32
|
|
|
9
33
|
# @api private
|
|
10
34
|
class Handler < Seahorse::Client::Handler
|
|
@@ -14,33 +38,112 @@ module Aws
|
|
|
14
38
|
end
|
|
15
39
|
|
|
16
40
|
def set_user_agent(context)
|
|
17
|
-
|
|
41
|
+
context.http_request.headers['User-Agent'] = UserAgent.new(context).to_s
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class UserAgent
|
|
45
|
+
def initialize(context)
|
|
46
|
+
@context = context
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def to_s
|
|
50
|
+
ua = "aws-sdk-ruby3/#{CORE_GEM_VERSION}"
|
|
51
|
+
ua += ' ua/2.0'
|
|
52
|
+
ua += " #{api_metadata}" if api_metadata
|
|
53
|
+
ua += " #{os_metadata}"
|
|
54
|
+
ua += " #{language_metadata}"
|
|
55
|
+
ua += " #{env_metadata}" if env_metadata
|
|
56
|
+
ua += " #{config_metadata}" if config_metadata
|
|
57
|
+
ua += " #{app_id}" if app_id
|
|
58
|
+
ua += " #{feature_metadata}" if feature_metadata
|
|
59
|
+
ua += " #{framework_metadata}" if framework_metadata
|
|
60
|
+
if @context.config.user_agent_suffix
|
|
61
|
+
ua += " #{@context.config.user_agent_suffix}"
|
|
62
|
+
end
|
|
63
|
+
ua.strip
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
private
|
|
18
67
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
68
|
+
# Used to be gem_name/gem_version
|
|
69
|
+
def api_metadata
|
|
70
|
+
service_id = @context.config.api.metadata['serviceId']
|
|
71
|
+
return unless service_id
|
|
72
|
+
|
|
73
|
+
service_id = service_id.gsub(' ', '_').downcase
|
|
74
|
+
gem_version = @context[:gem_version]
|
|
75
|
+
"api/#{service_id}##{gem_version}"
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Used to be RUBY_PLATFORM
|
|
79
|
+
def os_metadata
|
|
80
|
+
os =
|
|
81
|
+
case RbConfig::CONFIG['host_os']
|
|
82
|
+
when /mac|darwin/
|
|
83
|
+
'macos'
|
|
84
|
+
when /linux|cygwin/
|
|
85
|
+
'linux'
|
|
86
|
+
when /mingw|mswin/
|
|
87
|
+
'windows'
|
|
88
|
+
else
|
|
89
|
+
'other'
|
|
90
|
+
end
|
|
91
|
+
metadata = "os/#{os}"
|
|
92
|
+
local_version = Gem::Platform.local.version
|
|
93
|
+
metadata += "##{local_version}" if local_version
|
|
94
|
+
metadata += " md/#{RbConfig::CONFIG['host_cpu']}"
|
|
95
|
+
metadata
|
|
23
96
|
end
|
|
24
97
|
|
|
25
|
-
|
|
98
|
+
# Used to be RUBY_ENGINE/RUBY_VERSION
|
|
99
|
+
def language_metadata
|
|
100
|
+
"lang/#{RUBY_ENGINE}##{RUBY_ENGINE_VERSION} md/#{RUBY_VERSION}"
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def env_metadata
|
|
104
|
+
return unless (execution_env = ENV['AWS_EXECUTION_ENV'])
|
|
105
|
+
|
|
106
|
+
"exec-env/#{execution_env}"
|
|
107
|
+
end
|
|
26
108
|
|
|
27
|
-
|
|
28
|
-
|
|
109
|
+
def config_metadata
|
|
110
|
+
"cfg/retry-mode##{@context.config.retry_mode}"
|
|
29
111
|
end
|
|
30
112
|
|
|
31
|
-
|
|
32
|
-
|
|
113
|
+
def app_id
|
|
114
|
+
return unless (app_id = @context.config.sdk_ua_app_id)
|
|
115
|
+
|
|
116
|
+
# Sanitize and only allow these characters
|
|
117
|
+
app_id = app_id.gsub(/[^!#$%&'*+\-.^_`|~0-9A-Za-z]/, '-')
|
|
118
|
+
"app/#{app_id}"
|
|
33
119
|
end
|
|
34
120
|
|
|
35
|
-
|
|
36
|
-
|
|
121
|
+
def feature_metadata
|
|
122
|
+
return unless Thread.current[:aws_sdk_core_user_agent_feature]
|
|
123
|
+
|
|
124
|
+
Thread.current[:aws_sdk_core_user_agent_feature].join(' ')
|
|
37
125
|
end
|
|
38
126
|
|
|
39
|
-
|
|
127
|
+
def framework_metadata
|
|
128
|
+
if (frameworks_cfg = @context.config.user_agent_frameworks).empty?
|
|
129
|
+
return
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Frameworks may be aws-record, aws-sdk-rails, etc.
|
|
133
|
+
regex = /gems\/(?<name>#{frameworks_cfg.join('|')})-(?<version>\d+\.\d+\.\d+)/.freeze
|
|
134
|
+
frameworks = {}
|
|
135
|
+
Kernel.caller.each do |line|
|
|
136
|
+
match = line.match(regex)
|
|
137
|
+
next unless match
|
|
138
|
+
|
|
139
|
+
frameworks[match[:name]] = match[:version]
|
|
140
|
+
end
|
|
141
|
+
frameworks.map { |n, v| "lib/#{n}##{v}" }.join(' ')
|
|
142
|
+
end
|
|
40
143
|
end
|
|
41
144
|
end
|
|
42
145
|
|
|
43
|
-
handler(Handler)
|
|
146
|
+
handler(Handler, priority: 1)
|
|
44
147
|
end
|
|
45
148
|
end
|
|
46
149
|
end
|
|
@@ -62,7 +62,9 @@ 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
|
-
|
|
65
|
+
Aws::Plugins::UserAgent.feature('waiter') do
|
|
66
|
+
req.send_request
|
|
67
|
+
end
|
|
66
68
|
end
|
|
67
69
|
|
|
68
70
|
def acceptor_matches?(acceptor, response)
|
data/lib/aws-sdk-sso/client.rb
CHANGED
|
@@ -275,6 +275,11 @@ module Aws::SSO
|
|
|
275
275
|
# in the future.
|
|
276
276
|
#
|
|
277
277
|
#
|
|
278
|
+
# @option options [String] :sdk_ua_app_id
|
|
279
|
+
# A unique and opaque application ID that is appended to the
|
|
280
|
+
# User-Agent header as app/<sdk_ua_app_id>. It should have a
|
|
281
|
+
# maximum length of 50.
|
|
282
|
+
#
|
|
278
283
|
# @option options [String] :secret_access_key
|
|
279
284
|
#
|
|
280
285
|
# @option options [String] :session_token
|
|
@@ -585,7 +590,7 @@ module Aws::SSO
|
|
|
585
590
|
params: params,
|
|
586
591
|
config: config)
|
|
587
592
|
context[:gem_name] = 'aws-sdk-core'
|
|
588
|
-
context[:gem_version] = '3.
|
|
593
|
+
context[:gem_version] = '3.175.0'
|
|
589
594
|
Seahorse::Client::Request.new(handlers, context)
|
|
590
595
|
end
|
|
591
596
|
|
data/lib/aws-sdk-sso.rb
CHANGED
|
@@ -275,6 +275,11 @@ module Aws::SSOOIDC
|
|
|
275
275
|
# in the future.
|
|
276
276
|
#
|
|
277
277
|
#
|
|
278
|
+
# @option options [String] :sdk_ua_app_id
|
|
279
|
+
# A unique and opaque application ID that is appended to the
|
|
280
|
+
# User-Agent header as app/<sdk_ua_app_id>. It should have a
|
|
281
|
+
# maximum length of 50.
|
|
282
|
+
#
|
|
278
283
|
# @option options [String] :secret_access_key
|
|
279
284
|
#
|
|
280
285
|
# @option options [String] :session_token
|
|
@@ -581,7 +586,7 @@ module Aws::SSOOIDC
|
|
|
581
586
|
params: params,
|
|
582
587
|
config: config)
|
|
583
588
|
context[:gem_name] = 'aws-sdk-core'
|
|
584
|
-
context[:gem_version] = '3.
|
|
589
|
+
context[:gem_version] = '3.175.0'
|
|
585
590
|
Seahorse::Client::Request.new(handlers, context)
|
|
586
591
|
end
|
|
587
592
|
|