aws-sdk-core 3.211.0 → 3.225.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 +161 -0
- data/VERSION +1 -1
- data/lib/aws-defaults/default_configuration.rb +1 -2
- data/lib/aws-sdk-core/arn.rb +1 -3
- data/lib/aws-sdk-core/assume_role_credentials.rb +1 -0
- data/lib/aws-sdk-core/assume_role_web_identity_credentials.rb +1 -0
- data/lib/aws-sdk-core/cbor/decoder.rb +0 -2
- data/lib/aws-sdk-core/cbor/encoder.rb +2 -2
- data/lib/aws-sdk-core/client_stubs.rb +22 -48
- data/lib/aws-sdk-core/credential_provider.rb +4 -0
- data/lib/aws-sdk-core/credential_provider_chain.rb +27 -7
- data/lib/aws-sdk-core/credentials.rb +6 -0
- data/lib/aws-sdk-core/ecs_credentials.rb +1 -0
- data/lib/aws-sdk-core/errors.rb +2 -2
- data/lib/aws-sdk-core/instance_profile_credentials.rb +1 -0
- data/lib/aws-sdk-core/log/param_formatter.rb +7 -3
- data/lib/aws-sdk-core/plugins/checksum_algorithm.rb +332 -170
- data/lib/aws-sdk-core/plugins/client_metrics_plugin.rb +0 -1
- data/lib/aws-sdk-core/plugins/endpoint_pattern.rb +40 -32
- data/lib/aws-sdk-core/plugins/http_checksum.rb +2 -8
- data/lib/aws-sdk-core/plugins/sign.rb +16 -2
- data/lib/aws-sdk-core/plugins/stub_responses.rb +24 -8
- data/lib/aws-sdk-core/plugins/user_agent.rb +32 -2
- data/lib/aws-sdk-core/process_credentials.rb +1 -1
- data/lib/aws-sdk-core/rest/request/headers.rb +1 -1
- data/lib/aws-sdk-core/shared_config.rb +74 -21
- data/lib/aws-sdk-core/shared_credentials.rb +1 -0
- data/lib/aws-sdk-core/sso_credentials.rb +2 -0
- data/lib/aws-sdk-sso/client.rb +53 -31
- data/lib/aws-sdk-sso/endpoint_provider.rb +14 -18
- data/lib/aws-sdk-sso.rb +1 -1
- data/lib/aws-sdk-ssooidc/client.rb +90 -51
- data/lib/aws-sdk-ssooidc/client_api.rb +6 -0
- data/lib/aws-sdk-ssooidc/endpoint_provider.rb +14 -18
- data/lib/aws-sdk-ssooidc/types.rb +48 -16
- data/lib/aws-sdk-ssooidc.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +261 -83
- data/lib/aws-sdk-sts/client_api.rb +31 -8
- data/lib/aws-sdk-sts/endpoint_provider.rb +50 -55
- data/lib/aws-sdk-sts/errors.rb +16 -0
- data/lib/aws-sdk-sts/types.rb +170 -28
- data/lib/aws-sdk-sts.rb +1 -1
- data/lib/seahorse/client/async_base.rb +4 -5
- data/lib/seahorse/client/base.rb +0 -14
- data/lib/seahorse/client/h2/connection.rb +18 -28
- data/lib/seahorse/client/http/response.rb +1 -1
- data/lib/seahorse/client/net_http/connection_pool.rb +2 -0
- data/lib/seahorse/client/networking_error.rb +1 -1
- data/lib/seahorse/client/plugins/h2.rb +4 -4
- data/lib/seahorse/client/response.rb +2 -0
- data/sig/aws-sdk-core/async_client_stubs.rbs +21 -0
- data/sig/seahorse/client/async_base.rbs +18 -0
- metadata +40 -14
@@ -4,62 +4,70 @@ module Aws
|
|
4
4
|
module Plugins
|
5
5
|
# @api private
|
6
6
|
class EndpointPattern < Seahorse::Client::Plugin
|
7
|
-
|
8
|
-
|
7
|
+
option(
|
8
|
+
:disable_host_prefix_injection,
|
9
9
|
default: false,
|
10
10
|
doc_type: 'Boolean',
|
11
|
-
docstring:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
)
|
11
|
+
docstring: 'When `true`, the SDK will not prepend the modeled host prefix to the endpoint.'
|
12
|
+
) do |cfg|
|
13
|
+
resolve_disable_host_prefix_injection(cfg)
|
14
|
+
end
|
16
15
|
|
17
|
-
def add_handlers(handlers,
|
16
|
+
def add_handlers(handlers, _config)
|
18
17
|
handlers.add(Handler, priority: 10)
|
19
18
|
end
|
20
19
|
|
21
|
-
class
|
20
|
+
class << self
|
21
|
+
private
|
22
|
+
|
23
|
+
def resolve_disable_host_prefix_injection(cfg)
|
24
|
+
value = ENV['AWS_DISABLE_HOST_PREFIX_INJECTION'] ||
|
25
|
+
Aws.shared_config.disable_host_prefix_injection(profile: cfg.profile) ||
|
26
|
+
'false'
|
27
|
+
value = Aws::Util.str_2_bool(value)
|
28
|
+
unless [true, false].include?(value)
|
29
|
+
raise ArgumentError,
|
30
|
+
'Must provide either `true` or `false` for '\
|
31
|
+
'disable_host_prefix_injection profile option or for '\
|
32
|
+
'ENV[\'AWS_DISABLE_HOST_PREFIX_INJECTION\']'
|
33
|
+
end
|
34
|
+
value
|
35
|
+
end
|
36
|
+
end
|
22
37
|
|
38
|
+
# @api private
|
39
|
+
class Handler < Seahorse::Client::Handler
|
23
40
|
def call(context)
|
24
|
-
|
41
|
+
unless context.config.disable_host_prefix_injection
|
25
42
|
endpoint_trait = context.operation.endpoint_pattern
|
26
|
-
if endpoint_trait && !endpoint_trait.empty?
|
27
|
-
_apply_endpoint_trait(context, endpoint_trait)
|
28
|
-
end
|
43
|
+
apply_endpoint_trait(context, endpoint_trait) if endpoint_trait && !endpoint_trait.empty?
|
29
44
|
end
|
30
45
|
@handler.call(context)
|
31
46
|
end
|
32
47
|
|
33
48
|
private
|
34
49
|
|
35
|
-
def
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
ori_host, label, context.operation.input, context.params)
|
43
|
-
end
|
44
|
-
context.http_request.endpoint.host = host_prefix + context.http_request.endpoint.host
|
50
|
+
def apply_endpoint_trait(context, trait)
|
51
|
+
pattern = trait['hostPrefix']
|
52
|
+
return unless pattern
|
53
|
+
|
54
|
+
host_prefix = pattern.gsub(/\{.+?}/) do |label|
|
55
|
+
label = label.delete('{}')
|
56
|
+
replace_label_value(label, context.operation.input, context.params)
|
45
57
|
end
|
58
|
+
context.http_request.endpoint.host = host_prefix + context.http_request.endpoint.host
|
46
59
|
end
|
47
60
|
|
48
|
-
def
|
61
|
+
def replace_label_value(label, input_ref, params)
|
49
62
|
name = nil
|
50
63
|
input_ref.shape.members.each do |m_name, ref|
|
51
|
-
if ref['hostLabel'] && ref['hostLabelName'] == label
|
52
|
-
name = m_name
|
53
|
-
end
|
54
|
-
end
|
55
|
-
if name.nil? || params[name].nil?
|
56
|
-
raise Errors::MissingEndpointHostLabelValue.new(name)
|
64
|
+
name = m_name if ref['hostLabel'] && ref['hostLabelName'] == label
|
57
65
|
end
|
66
|
+
raise Errors::MissingEndpointHostLabelValue, name if name.nil? || params[name].nil?
|
67
|
+
|
58
68
|
params[name]
|
59
69
|
end
|
60
|
-
|
61
70
|
end
|
62
|
-
|
63
71
|
end
|
64
72
|
end
|
65
73
|
end
|
@@ -11,8 +11,8 @@ module Aws
|
|
11
11
|
CHUNK_SIZE = 1 * 1024 * 1024 # one MB
|
12
12
|
|
13
13
|
def call(context)
|
14
|
-
if
|
15
|
-
!context[:
|
14
|
+
if context.operation.http_checksum_required &&
|
15
|
+
!context[:http_checksum][:request_algorithm] && # skip in favor of flexible checksum
|
16
16
|
!context[:s3_express_endpoint] # s3 express endpoints do not support md5
|
17
17
|
body = context.http_request.body
|
18
18
|
context.http_request.headers['Content-Md5'] ||= md5(body)
|
@@ -22,12 +22,6 @@ module Aws
|
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
|
-
def checksum_required?(context)
|
26
|
-
context.operation.http_checksum_required ||
|
27
|
-
(context.operation.http_checksum &&
|
28
|
-
context.operation.http_checksum['requestChecksumRequired'])
|
29
|
-
end
|
30
|
-
|
31
25
|
# @param [File, Tempfile, IO#read, String] value
|
32
26
|
# @return [String<MD5>]
|
33
27
|
def md5(value)
|
@@ -41,6 +41,7 @@ module Aws
|
|
41
41
|
class Handler < Seahorse::Client::Handler
|
42
42
|
def call(context)
|
43
43
|
# Skip signing if using sigv2 signing from s3_signer in S3
|
44
|
+
credentials = nil
|
44
45
|
unless v2_signing?(context.config)
|
45
46
|
signer = Sign.signer_for(
|
46
47
|
context[:auth_scheme],
|
@@ -48,13 +49,20 @@ module Aws
|
|
48
49
|
context[:sigv4_region],
|
49
50
|
context[:sigv4_credentials]
|
50
51
|
)
|
52
|
+
credentials = signer.credentials if signer.is_a?(SignatureV4)
|
51
53
|
signer.sign(context)
|
52
54
|
end
|
53
|
-
@handler.call(context)
|
55
|
+
with_metrics(credentials) { @handler.call(context) }
|
54
56
|
end
|
55
57
|
|
56
58
|
private
|
57
59
|
|
60
|
+
def with_metrics(credentials, &block)
|
61
|
+
return block.call unless credentials&.respond_to?(:metrics)
|
62
|
+
|
63
|
+
Aws::Plugins::UserAgent.metric(*credentials.metrics, &block)
|
64
|
+
end
|
65
|
+
|
58
66
|
def v2_signing?(config)
|
59
67
|
# 's3' is legacy signing, 'v4' is default
|
60
68
|
config.respond_to?(:signature_version) &&
|
@@ -92,6 +100,8 @@ module Aws
|
|
92
100
|
|
93
101
|
# @api private
|
94
102
|
class SignatureV4
|
103
|
+
attr_reader :signer
|
104
|
+
|
95
105
|
def initialize(auth_scheme, config, sigv4_overrides = {})
|
96
106
|
scheme_name = auth_scheme['name']
|
97
107
|
|
@@ -113,7 +123,7 @@ module Aws
|
|
113
123
|
signing_algorithm: scheme_name.to_sym,
|
114
124
|
uri_escape_path: !!!auth_scheme['disableDoubleEncoding'],
|
115
125
|
normalize_path: !!!auth_scheme['disableNormalizePath'],
|
116
|
-
unsigned_headers: %w[content-length user-agent x-amzn-trace-id]
|
126
|
+
unsigned_headers: %w[content-length user-agent x-amzn-trace-id expect transfer-encoding connection]
|
117
127
|
)
|
118
128
|
rescue Aws::Sigv4::Errors::MissingCredentialsError
|
119
129
|
raise Aws::Errors::MissingCredentialsError
|
@@ -155,6 +165,10 @@ module Aws
|
|
155
165
|
@signer.sign_event(*args)
|
156
166
|
end
|
157
167
|
|
168
|
+
def credentials
|
169
|
+
@signer.credentials_provider
|
170
|
+
end
|
171
|
+
|
158
172
|
private
|
159
173
|
|
160
174
|
def apply_authtype(context, req)
|
@@ -29,8 +29,16 @@ requests are made, and retries are disabled.
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
option(:stubs) { {} }
|
33
|
+
option(:stubs_mutex) { Mutex.new }
|
34
|
+
option(:api_requests) { [] }
|
35
|
+
option(:api_requests_mutex) { Mutex.new }
|
36
|
+
|
32
37
|
def add_handlers(handlers, config)
|
33
|
-
|
38
|
+
return unless config.stub_responses
|
39
|
+
|
40
|
+
handlers.add(ApiRequestsHandler)
|
41
|
+
handlers.add(StubbingHandler, step: :send)
|
34
42
|
end
|
35
43
|
|
36
44
|
def after_initialize(client)
|
@@ -46,8 +54,20 @@ requests are made, and retries are disabled.
|
|
46
54
|
end
|
47
55
|
end
|
48
56
|
|
49
|
-
class
|
57
|
+
class ApiRequestsHandler < Seahorse::Client::Handler
|
58
|
+
def call(context)
|
59
|
+
context.config.api_requests_mutex.synchronize do
|
60
|
+
context.config.api_requests << {
|
61
|
+
operation_name: context.operation_name,
|
62
|
+
params: context.params,
|
63
|
+
context: context
|
64
|
+
}
|
65
|
+
end
|
66
|
+
@handler.call(context)
|
67
|
+
end
|
68
|
+
end
|
50
69
|
|
70
|
+
class StubbingHandler < Seahorse::Client::Handler
|
51
71
|
def call(context)
|
52
72
|
span_wrapper(context) do
|
53
73
|
stub_responses(context)
|
@@ -57,14 +77,10 @@ requests are made, and retries are disabled.
|
|
57
77
|
private
|
58
78
|
|
59
79
|
def stub_responses(context)
|
60
|
-
stub = context.client.next_stub(context)
|
61
80
|
resp = Seahorse::Client::Response.new(context: context)
|
62
81
|
async_mode = context.client.is_a? Seahorse::Client::AsyncBase
|
63
|
-
|
64
|
-
|
65
|
-
else
|
66
|
-
apply_stub(stub, resp, async_mode)
|
67
|
-
end
|
82
|
+
stub = context.client.next_stub(context)
|
83
|
+
stub[:mutex].synchronize { apply_stub(stub, resp, async_mode) }
|
68
84
|
|
69
85
|
if async_mode
|
70
86
|
Seahorse::Client::AsyncResponse.new(
|
@@ -25,7 +25,36 @@ module Aws
|
|
25
25
|
"ACCOUNT_ID_MODE_DISABLED": "Q",
|
26
26
|
"ACCOUNT_ID_MODE_REQUIRED": "R",
|
27
27
|
"SIGV4A_SIGNING": "S",
|
28
|
-
"RESOLVED_ACCOUNT_ID": "T"
|
28
|
+
"RESOLVED_ACCOUNT_ID": "T",
|
29
|
+
"FLEXIBLE_CHECKSUMS_REQ_CRC32" : "U",
|
30
|
+
"FLEXIBLE_CHECKSUMS_REQ_CRC32C" : "V",
|
31
|
+
"FLEXIBLE_CHECKSUMS_REQ_CRC64" : "W",
|
32
|
+
"FLEXIBLE_CHECKSUMS_REQ_SHA1" : "X",
|
33
|
+
"FLEXIBLE_CHECKSUMS_REQ_SHA256" : "Y",
|
34
|
+
"FLEXIBLE_CHECKSUMS_REQ_WHEN_SUPPORTED" : "Z",
|
35
|
+
"FLEXIBLE_CHECKSUMS_REQ_WHEN_REQUIRED" : "a",
|
36
|
+
"FLEXIBLE_CHECKSUMS_RES_WHEN_SUPPORTED" : "b",
|
37
|
+
"FLEXIBLE_CHECKSUMS_RES_WHEN_REQUIRED" : "c",
|
38
|
+
"DDB_MAPPER": "d",
|
39
|
+
"CREDENTIALS_CODE" : "e",
|
40
|
+
"CREDENTIALS_ENV_VARS" : "g",
|
41
|
+
"CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN" : "h",
|
42
|
+
"CREDENTIALS_STS_ASSUME_ROLE" : "i",
|
43
|
+
"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID" : "k",
|
44
|
+
"CREDENTIALS_PROFILE" : "n",
|
45
|
+
"CREDENTIALS_PROFILE_SOURCE_PROFILE" : "o",
|
46
|
+
"CREDENTIALS_PROFILE_NAMED_PROVIDER" : "p",
|
47
|
+
"CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN" : "q",
|
48
|
+
"CREDENTIALS_PROFILE_SSO" : "r",
|
49
|
+
"CREDENTIALS_SSO" : "s",
|
50
|
+
"CREDENTIALS_PROFILE_SSO_LEGACY" : "t",
|
51
|
+
"CREDENTIALS_SSO_LEGACY" : "u",
|
52
|
+
"CREDENTIALS_PROFILE_PROCESS" : "v",
|
53
|
+
"CREDENTIALS_PROCESS" : "w",
|
54
|
+
"CREDENTIALS_HTTP" : "z",
|
55
|
+
"CREDENTIALS_IMDS" : "0",
|
56
|
+
"SSO_LOGIN_DEVICE" : "1",
|
57
|
+
"SSO_LOGIN_AUTH" : "2"
|
29
58
|
}
|
30
59
|
METRICS
|
31
60
|
|
@@ -187,7 +216,8 @@ variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
|
|
187
216
|
end
|
188
217
|
end
|
189
218
|
|
190
|
-
|
219
|
+
# Priority set to 5 in order to add user agent as late as possible after signing
|
220
|
+
handler(Handler, step: :sign, priority: 5)
|
191
221
|
end
|
192
222
|
end
|
193
223
|
end
|
@@ -138,7 +138,11 @@ module Aws
|
|
138
138
|
role_session_name: entry['role_session_name']
|
139
139
|
}
|
140
140
|
cfg[:region] = opts[:region] if opts[:region]
|
141
|
-
|
141
|
+
with_metrics('CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN') do
|
142
|
+
creds = AssumeRoleWebIdentityCredentials.new(cfg)
|
143
|
+
creds.metrics << 'CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN'
|
144
|
+
creds
|
145
|
+
end
|
142
146
|
end
|
143
147
|
end
|
144
148
|
end
|
@@ -208,10 +212,13 @@ module Aws
|
|
208
212
|
:ec2_metadata_service_endpoint,
|
209
213
|
:ec2_metadata_service_endpoint_mode,
|
210
214
|
:ec2_metadata_v1_disabled,
|
215
|
+
:disable_host_prefix_injection,
|
211
216
|
:max_attempts,
|
212
217
|
:retry_mode,
|
213
218
|
:adaptive_retry_wait_to_fill,
|
214
219
|
:correct_clock_skew,
|
220
|
+
:request_checksum_calculation,
|
221
|
+
:response_checksum_validation,
|
215
222
|
:csm_client_id,
|
216
223
|
:csm_enabled,
|
217
224
|
:csm_host,
|
@@ -253,8 +260,8 @@ module Aws
|
|
253
260
|
'provide only source_profile or credential_source, not both.'
|
254
261
|
elsif opts[:source_profile]
|
255
262
|
opts[:visited_profiles] ||= Set.new
|
256
|
-
|
257
|
-
if opts[:credentials]
|
263
|
+
provider = resolve_source_profile(opts[:source_profile], opts)
|
264
|
+
if provider && (opts[:credentials] = provider.credentials)
|
258
265
|
opts[:role_session_name] ||= prof_cfg['role_session_name']
|
259
266
|
opts[:role_session_name] ||= 'default_session'
|
260
267
|
opts[:role_arn] ||= prof_cfg['role_arn']
|
@@ -263,17 +270,28 @@ module Aws
|
|
263
270
|
opts[:serial_number] ||= prof_cfg['mfa_serial']
|
264
271
|
opts[:profile] = opts.delete(:source_profile)
|
265
272
|
opts.delete(:visited_profiles)
|
266
|
-
|
273
|
+
|
274
|
+
metrics = provider.metrics
|
275
|
+
if provider.is_a?(AssumeRoleCredentials)
|
276
|
+
opts[:credentials] = provider
|
277
|
+
metrics.delete('CREDENTIALS_STS_ASSUME_ROLE')
|
278
|
+
else
|
279
|
+
metrics << 'CREDENTIALS_PROFILE_SOURCE_PROFILE'
|
280
|
+
end
|
281
|
+
# Set the original credentials metrics to [] to prevent duplicate metrics during sign plugin
|
282
|
+
opts[:credentials].metrics = []
|
283
|
+
with_metrics(metrics) do
|
284
|
+
creds = AssumeRoleCredentials.new(opts)
|
285
|
+
creds.metrics.push(*metrics)
|
286
|
+
creds
|
287
|
+
end
|
267
288
|
else
|
268
289
|
raise Errors::NoSourceProfileError,
|
269
290
|
"Profile #{profile} has a role_arn, and source_profile, but the"\
|
270
291
|
' source_profile does not have credentials.'
|
271
292
|
end
|
272
293
|
elsif credential_source
|
273
|
-
opts[:credentials] = credentials_from_source(
|
274
|
-
credential_source,
|
275
|
-
chain_config
|
276
|
-
)
|
294
|
+
opts[:credentials] = credentials_from_source(credential_source, chain_config)
|
277
295
|
if opts[:credentials]
|
278
296
|
opts[:role_session_name] ||= prof_cfg['role_session_name']
|
279
297
|
opts[:role_session_name] ||= 'default_session'
|
@@ -282,7 +300,16 @@ module Aws
|
|
282
300
|
opts[:external_id] ||= prof_cfg['external_id']
|
283
301
|
opts[:serial_number] ||= prof_cfg['mfa_serial']
|
284
302
|
opts.delete(:source_profile) # Cleanup
|
285
|
-
|
303
|
+
|
304
|
+
metrics = opts[:credentials].metrics
|
305
|
+
metrics << 'CREDENTIALS_PROFILE_NAMED_PROVIDER'
|
306
|
+
# Set the original credentials metrics to [] to prevent duplicate metrics during sign plugin
|
307
|
+
opts[:credentials].metrics = []
|
308
|
+
with_metrics(metrics) do
|
309
|
+
creds = AssumeRoleCredentials.new(opts)
|
310
|
+
creds.metrics.push(*metrics)
|
311
|
+
creds
|
312
|
+
end
|
286
313
|
else
|
287
314
|
raise Errors::NoSourceCredentials,
|
288
315
|
"Profile #{profile} could not get source credentials from"\
|
@@ -310,12 +337,24 @@ module Aws
|
|
310
337
|
elsif profile_config && profile_config['source_profile']
|
311
338
|
opts.delete(:source_profile)
|
312
339
|
assume_role_credentials_from_config(opts.merge(profile: profile))
|
313
|
-
elsif (provider =
|
314
|
-
provider
|
340
|
+
elsif (provider = assume_role_web_identity_credentials_from_config_with_metrics(opts.merge(profile: profile)))
|
341
|
+
provider if provider.credentials.set?
|
315
342
|
elsif (provider = assume_role_process_credentials_from_config(profile))
|
316
|
-
provider
|
317
|
-
elsif (provider =
|
318
|
-
provider
|
343
|
+
provider if provider.credentials.set?
|
344
|
+
elsif (provider = sso_credentials_from_config_with_metrics(profile))
|
345
|
+
provider if provider.credentials.set?
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
349
|
+
def assume_role_web_identity_credentials_from_config_with_metrics(opts)
|
350
|
+
with_metrics('CREDENTIALS_PROFILE_SOURCE_PROFILE') do
|
351
|
+
assume_role_web_identity_credentials_from_config(opts)
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
def sso_credentials_from_config_with_metrics(profile)
|
356
|
+
with_metrics('CREDENTIALS_PROFILE_SOURCE_PROFILE') do
|
357
|
+
sso_credentials_from_config(profile: profile)
|
319
358
|
end
|
320
359
|
end
|
321
360
|
|
@@ -340,7 +379,11 @@ module Aws
|
|
340
379
|
if @parsed_config
|
341
380
|
credential_process ||= @parsed_config.fetch(profile, {})['credential_process']
|
342
381
|
end
|
343
|
-
|
382
|
+
if credential_process
|
383
|
+
creds = ProcessCredentials.new([credential_process])
|
384
|
+
creds.metrics << 'CREDENTIALS_PROFILE_PROCESS'
|
385
|
+
creds
|
386
|
+
end
|
344
387
|
end
|
345
388
|
|
346
389
|
def credentials_from_shared(profile, _opts)
|
@@ -384,13 +427,18 @@ module Aws
|
|
384
427
|
sso_start_url = prof_config['sso_start_url']
|
385
428
|
end
|
386
429
|
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
430
|
+
metric = prof_config['sso_session'] ? 'CREDENTIALS_PROFILE_SSO' : 'CREDENTIALS_PROFILE_SSO_LEGACY'
|
431
|
+
with_metrics(metric) do
|
432
|
+
creds = SSOCredentials.new(
|
433
|
+
sso_account_id: prof_config['sso_account_id'],
|
434
|
+
sso_role_name: prof_config['sso_role_name'],
|
435
|
+
sso_session: prof_config['sso_session'],
|
436
|
+
sso_region: sso_region,
|
437
|
+
sso_start_url: sso_start_url
|
393
438
|
)
|
439
|
+
creds.metrics << metric
|
440
|
+
creds
|
441
|
+
end
|
394
442
|
end
|
395
443
|
end
|
396
444
|
|
@@ -418,6 +466,7 @@ module Aws
|
|
418
466
|
prof_config['aws_session_token'],
|
419
467
|
account_id: prof_config['aws_account_id']
|
420
468
|
)
|
469
|
+
creds.metrics = ['CREDENTIALS_PROFILE']
|
421
470
|
creds if creds.set?
|
422
471
|
end
|
423
472
|
|
@@ -478,5 +527,9 @@ module Aws
|
|
478
527
|
|
479
528
|
sso_session
|
480
529
|
end
|
530
|
+
|
531
|
+
def with_metrics(metrics, &block)
|
532
|
+
Aws::Plugins::UserAgent.metric(*metrics, &block)
|
533
|
+
end
|
481
534
|
end
|
482
535
|
end
|
@@ -91,6 +91,7 @@ module Aws
|
|
91
91
|
client_opts[:credentials] = nil
|
92
92
|
@client = Aws::SSO::Client.new(client_opts)
|
93
93
|
end
|
94
|
+
@metrics = ['CREDENTIALS_SSO']
|
94
95
|
else # legacy behavior
|
95
96
|
missing_keys = LEGACY_REQUIRED_OPTS.select { |k| options[k].nil? }
|
96
97
|
unless missing_keys.empty?
|
@@ -111,6 +112,7 @@ module Aws
|
|
111
112
|
client_opts[:credentials] = nil
|
112
113
|
|
113
114
|
@client = options[:client] || Aws::SSO::Client.new(client_opts)
|
115
|
+
@metrics = ['CREDENTIALS_SSO_LEGACY']
|
114
116
|
end
|
115
117
|
|
116
118
|
@async_refresh = true
|
data/lib/aws-sdk-sso/client.rb
CHANGED
@@ -7,34 +7,34 @@
|
|
7
7
|
#
|
8
8
|
# WARNING ABOUT GENERATED CODE
|
9
9
|
|
10
|
-
require 'seahorse/client/plugins/content_length
|
11
|
-
require 'aws-sdk-core/plugins/credentials_configuration
|
12
|
-
require 'aws-sdk-core/plugins/logging
|
13
|
-
require 'aws-sdk-core/plugins/param_converter
|
14
|
-
require 'aws-sdk-core/plugins/param_validator
|
15
|
-
require 'aws-sdk-core/plugins/user_agent
|
16
|
-
require 'aws-sdk-core/plugins/helpful_socket_errors
|
17
|
-
require 'aws-sdk-core/plugins/retry_errors
|
18
|
-
require 'aws-sdk-core/plugins/global_configuration
|
19
|
-
require 'aws-sdk-core/plugins/regional_endpoint
|
20
|
-
require 'aws-sdk-core/plugins/endpoint_discovery
|
21
|
-
require 'aws-sdk-core/plugins/endpoint_pattern
|
22
|
-
require 'aws-sdk-core/plugins/response_paging
|
23
|
-
require 'aws-sdk-core/plugins/stub_responses
|
24
|
-
require 'aws-sdk-core/plugins/idempotency_token
|
25
|
-
require 'aws-sdk-core/plugins/invocation_id
|
26
|
-
require 'aws-sdk-core/plugins/jsonvalue_converter
|
27
|
-
require 'aws-sdk-core/plugins/client_metrics_plugin
|
28
|
-
require 'aws-sdk-core/plugins/client_metrics_send_plugin
|
29
|
-
require 'aws-sdk-core/plugins/transfer_encoding
|
30
|
-
require 'aws-sdk-core/plugins/http_checksum
|
31
|
-
require 'aws-sdk-core/plugins/checksum_algorithm
|
32
|
-
require 'aws-sdk-core/plugins/request_compression
|
33
|
-
require 'aws-sdk-core/plugins/defaults_mode
|
34
|
-
require 'aws-sdk-core/plugins/recursion_detection
|
35
|
-
require 'aws-sdk-core/plugins/telemetry
|
36
|
-
require 'aws-sdk-core/plugins/sign
|
37
|
-
require 'aws-sdk-core/plugins/protocols/rest_json
|
10
|
+
require 'seahorse/client/plugins/content_length'
|
11
|
+
require 'aws-sdk-core/plugins/credentials_configuration'
|
12
|
+
require 'aws-sdk-core/plugins/logging'
|
13
|
+
require 'aws-sdk-core/plugins/param_converter'
|
14
|
+
require 'aws-sdk-core/plugins/param_validator'
|
15
|
+
require 'aws-sdk-core/plugins/user_agent'
|
16
|
+
require 'aws-sdk-core/plugins/helpful_socket_errors'
|
17
|
+
require 'aws-sdk-core/plugins/retry_errors'
|
18
|
+
require 'aws-sdk-core/plugins/global_configuration'
|
19
|
+
require 'aws-sdk-core/plugins/regional_endpoint'
|
20
|
+
require 'aws-sdk-core/plugins/endpoint_discovery'
|
21
|
+
require 'aws-sdk-core/plugins/endpoint_pattern'
|
22
|
+
require 'aws-sdk-core/plugins/response_paging'
|
23
|
+
require 'aws-sdk-core/plugins/stub_responses'
|
24
|
+
require 'aws-sdk-core/plugins/idempotency_token'
|
25
|
+
require 'aws-sdk-core/plugins/invocation_id'
|
26
|
+
require 'aws-sdk-core/plugins/jsonvalue_converter'
|
27
|
+
require 'aws-sdk-core/plugins/client_metrics_plugin'
|
28
|
+
require 'aws-sdk-core/plugins/client_metrics_send_plugin'
|
29
|
+
require 'aws-sdk-core/plugins/transfer_encoding'
|
30
|
+
require 'aws-sdk-core/plugins/http_checksum'
|
31
|
+
require 'aws-sdk-core/plugins/checksum_algorithm'
|
32
|
+
require 'aws-sdk-core/plugins/request_compression'
|
33
|
+
require 'aws-sdk-core/plugins/defaults_mode'
|
34
|
+
require 'aws-sdk-core/plugins/recursion_detection'
|
35
|
+
require 'aws-sdk-core/plugins/telemetry'
|
36
|
+
require 'aws-sdk-core/plugins/sign'
|
37
|
+
require 'aws-sdk-core/plugins/protocols/rest_json'
|
38
38
|
|
39
39
|
module Aws::SSO
|
40
40
|
# An API client for SSO. To construct a client, you need to configure a `:region` and `:credentials`.
|
@@ -200,8 +200,7 @@ module Aws::SSO
|
|
200
200
|
# accepted modes and the configuration defaults that are included.
|
201
201
|
#
|
202
202
|
# @option options [Boolean] :disable_host_prefix_injection (false)
|
203
|
-
#
|
204
|
-
# to default service endpoint when available.
|
203
|
+
# When `true`, the SDK will not prepend the modeled host prefix to the endpoint.
|
205
204
|
#
|
206
205
|
# @option options [Boolean] :disable_request_compression (false)
|
207
206
|
# When set to 'true' the request body will not be compressed
|
@@ -257,11 +256,34 @@ module Aws::SSO
|
|
257
256
|
# Used when loading credentials from the shared credentials file
|
258
257
|
# at HOME/.aws/credentials. When not specified, 'default' is used.
|
259
258
|
#
|
259
|
+
# @option options [String] :request_checksum_calculation ("when_supported")
|
260
|
+
# Determines when a checksum will be calculated for request payloads. Values are:
|
261
|
+
#
|
262
|
+
# * `when_supported` - (default) When set, a checksum will be
|
263
|
+
# calculated for all request payloads of operations modeled with the
|
264
|
+
# `httpChecksum` trait where `requestChecksumRequired` is `true` and/or a
|
265
|
+
# `requestAlgorithmMember` is modeled.
|
266
|
+
# * `when_required` - When set, a checksum will only be calculated for
|
267
|
+
# request payloads of operations modeled with the `httpChecksum` trait where
|
268
|
+
# `requestChecksumRequired` is `true` or where a `requestAlgorithmMember`
|
269
|
+
# is modeled and supplied.
|
270
|
+
#
|
260
271
|
# @option options [Integer] :request_min_compression_size_bytes (10240)
|
261
272
|
# The minimum size in bytes that triggers compression for request
|
262
273
|
# bodies. The value must be non-negative integer value between 0
|
263
274
|
# and 10485780 bytes inclusive.
|
264
275
|
#
|
276
|
+
# @option options [String] :response_checksum_validation ("when_supported")
|
277
|
+
# Determines when checksum validation will be performed on response payloads. Values are:
|
278
|
+
#
|
279
|
+
# * `when_supported` - (default) When set, checksum validation is performed on all
|
280
|
+
# response payloads of operations modeled with the `httpChecksum` trait where
|
281
|
+
# `responseAlgorithms` is modeled, except when no modeled checksum algorithms
|
282
|
+
# are supported.
|
283
|
+
# * `when_required` - When set, checksum validation is not performed on
|
284
|
+
# response payloads of operations unless the checksum algorithm is supported and
|
285
|
+
# the `requestValidationModeMember` member is set to `ENABLED`.
|
286
|
+
#
|
265
287
|
# @option options [Proc] :retry_backoff
|
266
288
|
# A proc or lambda used for backoff. Defaults to 2**retries * retry_base_delay.
|
267
289
|
# This option is only used in the `legacy` retry mode.
|
@@ -669,7 +691,7 @@ module Aws::SSO
|
|
669
691
|
tracer: tracer
|
670
692
|
)
|
671
693
|
context[:gem_name] = 'aws-sdk-core'
|
672
|
-
context[:gem_version] = '3.
|
694
|
+
context[:gem_version] = '3.225.0'
|
673
695
|
Seahorse::Client::Request.new(handlers, context)
|
674
696
|
end
|
675
697
|
|