aws-sdk-core 3.224.1 → 3.240.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 +157 -0
- data/VERSION +1 -1
- data/lib/aws-defaults/default_configuration.rb +2 -1
- data/lib/aws-sdk-core/assume_role_credentials.rb +8 -8
- data/lib/aws-sdk-core/assume_role_web_identity_credentials.rb +2 -2
- data/lib/aws-sdk-core/client_stubs.rb +6 -0
- data/lib/aws-sdk-core/credential_provider_chain.rb +72 -23
- data/lib/aws-sdk-core/ecs_credentials.rb +13 -13
- data/lib/aws-sdk-core/endpoints/matchers.rb +2 -1
- data/lib/aws-sdk-core/endpoints.rb +37 -13
- data/lib/aws-sdk-core/error_handler.rb +5 -0
- data/lib/aws-sdk-core/errors.rb +3 -0
- data/lib/aws-sdk-core/event_emitter.rb +1 -1
- data/lib/aws-sdk-core/instance_profile_credentials.rb +146 -157
- data/lib/aws-sdk-core/json/error_handler.rb +14 -4
- data/lib/aws-sdk-core/login_credentials.rb +229 -0
- data/lib/aws-sdk-core/plugins/checksum_algorithm.rb +28 -14
- data/lib/aws-sdk-core/plugins/credentials_configuration.rb +75 -59
- data/lib/aws-sdk-core/plugins/sign.rb +23 -28
- data/lib/aws-sdk-core/plugins/stub_responses.rb +6 -0
- data/lib/aws-sdk-core/plugins/user_agent.rb +4 -1
- data/lib/aws-sdk-core/refreshing_credentials.rb +8 -11
- data/lib/aws-sdk-core/rpc_v2/error_handler.rb +26 -16
- data/lib/aws-sdk-core/rpc_v2/parser.rb +8 -0
- data/lib/aws-sdk-core/shared_config.rb +30 -0
- data/lib/aws-sdk-core/sso_credentials.rb +1 -1
- data/lib/aws-sdk-core/static_token_provider.rb +1 -2
- data/lib/aws-sdk-core/token.rb +3 -3
- data/lib/aws-sdk-core/token_provider.rb +4 -0
- data/lib/aws-sdk-core/token_provider_chain.rb +2 -6
- data/lib/aws-sdk-core/util.rb +2 -1
- data/lib/aws-sdk-core/xml/error_handler.rb +3 -1
- data/lib/aws-sdk-core.rb +4 -0
- data/lib/aws-sdk-signin/client.rb +604 -0
- data/lib/aws-sdk-signin/client_api.rb +119 -0
- data/lib/aws-sdk-signin/customizations.rb +1 -0
- data/lib/aws-sdk-signin/endpoint_parameters.rb +69 -0
- data/lib/aws-sdk-signin/endpoint_provider.rb +59 -0
- data/lib/aws-sdk-signin/endpoints.rb +20 -0
- data/lib/aws-sdk-signin/errors.rb +122 -0
- data/lib/aws-sdk-signin/plugins/endpoints.rb +77 -0
- data/lib/aws-sdk-signin/resource.rb +26 -0
- data/lib/aws-sdk-signin/types.rb +299 -0
- data/lib/aws-sdk-signin.rb +63 -0
- data/lib/aws-sdk-sso/client.rb +24 -17
- data/lib/aws-sdk-sso/endpoint_parameters.rb +4 -4
- data/lib/aws-sdk-sso/endpoint_provider.rb +2 -2
- data/lib/aws-sdk-sso.rb +1 -1
- data/lib/aws-sdk-ssooidc/client.rb +43 -23
- data/lib/aws-sdk-ssooidc/client_api.rb +5 -0
- data/lib/aws-sdk-ssooidc/endpoint_parameters.rb +4 -4
- data/lib/aws-sdk-ssooidc/errors.rb +10 -0
- data/lib/aws-sdk-ssooidc/types.rb +27 -15
- data/lib/aws-sdk-ssooidc.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +159 -28
- data/lib/aws-sdk-sts/client_api.rb +74 -0
- data/lib/aws-sdk-sts/customizations.rb +0 -1
- data/lib/aws-sdk-sts/endpoint_parameters.rb +5 -5
- data/lib/aws-sdk-sts/errors.rb +64 -1
- data/lib/aws-sdk-sts/presigner.rb +2 -6
- data/lib/aws-sdk-sts/types.rb +175 -6
- data/lib/aws-sdk-sts.rb +1 -1
- data/lib/seahorse/client/h2/handler.rb +6 -1
- data/lib/seahorse/client/net_http/connection_pool.rb +2 -1
- data/lib/seahorse/client/request_context.rb +2 -2
- data/lib/seahorse/util.rb +2 -1
- metadata +28 -2
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Aws
|
|
4
4
|
module RpcV2
|
|
5
|
+
# @api private
|
|
5
6
|
class ErrorHandler < Aws::ErrorHandler
|
|
6
7
|
|
|
7
8
|
def call(context)
|
|
@@ -37,11 +38,14 @@ module Aws
|
|
|
37
38
|
end
|
|
38
39
|
|
|
39
40
|
def error_code(data, context)
|
|
41
|
+
# This is not correct per protocol tests. awsQueryError is intended to populate the
|
|
42
|
+
# error code of the error class. The error class should come from __type. Query and
|
|
43
|
+
# query compatible services currently have dynamic errors raised from error codes instead
|
|
44
|
+
# of the modeled error class. However, changing this in this major version would break
|
|
45
|
+
# existing usage.
|
|
40
46
|
code =
|
|
41
47
|
if aws_query_error?(context)
|
|
42
|
-
|
|
43
|
-
error, _type = query_header.split(';') # type not supported
|
|
44
|
-
remove_prefix(error, context)
|
|
48
|
+
aws_query_error_code(context)
|
|
45
49
|
else
|
|
46
50
|
data['__type']
|
|
47
51
|
end
|
|
@@ -52,6 +56,25 @@ module Aws
|
|
|
52
56
|
end
|
|
53
57
|
end
|
|
54
58
|
|
|
59
|
+
def aws_query_error?(context)
|
|
60
|
+
context.config.api.metadata['awsQueryCompatible'] &&
|
|
61
|
+
context.http_response.headers['x-amzn-query-error']
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def aws_query_error_code(context)
|
|
65
|
+
query_header = context.http_response.headers['x-amzn-query-error']
|
|
66
|
+
error, _type = query_header.split(';') # type not supported
|
|
67
|
+
remove_prefix(error, context)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def remove_prefix(error_code, context)
|
|
71
|
+
if (prefix = context.config.api.metadata['errorPrefix'])
|
|
72
|
+
error_code.sub(/^#{prefix}/, '')
|
|
73
|
+
else
|
|
74
|
+
error_code
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
55
78
|
def parse_error_data(context, body, code)
|
|
56
79
|
data = EmptyStructure.new
|
|
57
80
|
if (error_rules = context.operation.errors)
|
|
@@ -67,19 +90,6 @@ module Aws
|
|
|
67
90
|
end
|
|
68
91
|
data
|
|
69
92
|
end
|
|
70
|
-
|
|
71
|
-
def aws_query_error?(context)
|
|
72
|
-
context.config.api.metadata['awsQueryCompatible'] &&
|
|
73
|
-
context.http_response.headers['x-amzn-query-error']
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def remove_prefix(error_code, context)
|
|
77
|
-
if (prefix = context.config.api.metadata['errorPrefix'])
|
|
78
|
-
error_code.sub(/^#{prefix}/, '')
|
|
79
|
-
else
|
|
80
|
-
error_code
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
93
|
end
|
|
84
94
|
end
|
|
85
95
|
end
|
|
@@ -171,6 +171,16 @@ module Aws
|
|
|
171
171
|
token
|
|
172
172
|
end
|
|
173
173
|
|
|
174
|
+
# Attempts to load from shared config or shared credentials file.
|
|
175
|
+
# Will always attempt first to load from the shared credentials
|
|
176
|
+
# file, if present.
|
|
177
|
+
def login_credentials_from_config(opts = {})
|
|
178
|
+
p = opts[:profile] || @profile_name
|
|
179
|
+
credentials = login_credentials_from_profile(@parsed_credentials, p, opts[:region])
|
|
180
|
+
credentials ||= login_credentials_from_profile(@parsed_config, p, opts[:region]) if @parsed_config
|
|
181
|
+
credentials
|
|
182
|
+
end
|
|
183
|
+
|
|
174
184
|
# Source a custom configured endpoint from the shared configuration file
|
|
175
185
|
#
|
|
176
186
|
# @param [Hash] opts
|
|
@@ -203,6 +213,7 @@ module Aws
|
|
|
203
213
|
config_reader(
|
|
204
214
|
:region,
|
|
205
215
|
:account_id_endpoint_mode,
|
|
216
|
+
:auth_scheme_preference,
|
|
206
217
|
:sigv4a_signing_region_set,
|
|
207
218
|
:ca_bundle,
|
|
208
219
|
:credential_process,
|
|
@@ -368,6 +379,15 @@ module Aws
|
|
|
368
379
|
)
|
|
369
380
|
when 'EcsContainer'
|
|
370
381
|
ECSCredentials.new
|
|
382
|
+
when 'Environment'
|
|
383
|
+
creds = Credentials.new(
|
|
384
|
+
ENV['AWS_ACCESS_KEY_ID'],
|
|
385
|
+
ENV['AWS_SECRET_ACCESS_KEY'],
|
|
386
|
+
ENV['AWS_SESSION_TOKEN'],
|
|
387
|
+
account_id: ENV['AWS_ACCOUNT_ID']
|
|
388
|
+
)
|
|
389
|
+
creds.metrics = ['CREDENTIALS_ENV_VARS']
|
|
390
|
+
creds
|
|
371
391
|
else
|
|
372
392
|
raise Errors::InvalidCredentialSourceError, "Unsupported credential_source: #{credential_source}"
|
|
373
393
|
end
|
|
@@ -459,6 +479,16 @@ module Aws
|
|
|
459
479
|
end
|
|
460
480
|
end
|
|
461
481
|
|
|
482
|
+
def login_credentials_from_profile(cfg, profile, region)
|
|
483
|
+
return unless @parsed_config && (prof_config = cfg[profile]) && prof_config['login_session']
|
|
484
|
+
|
|
485
|
+
cfg = { login_session: prof_config['login_session'] }
|
|
486
|
+
cfg[:region] = region if region
|
|
487
|
+
creds = LoginCredentials.new(cfg)
|
|
488
|
+
creds.metrics << 'CREDENTIALS_PROFILE_LOGIN'
|
|
489
|
+
creds
|
|
490
|
+
end
|
|
491
|
+
|
|
462
492
|
def credentials_from_profile(prof_config)
|
|
463
493
|
creds = Credentials.new(
|
|
464
494
|
prof_config['aws_access_key_id'],
|
|
@@ -7,7 +7,7 @@ module Aws
|
|
|
7
7
|
# {Aws::SSOTokenProvider} will be used to refresh the token if possible.
|
|
8
8
|
# This class does NOT implement the SSO login token flow - tokens
|
|
9
9
|
# must generated separately by running `aws login` from the
|
|
10
|
-
# AWS CLI with the correct profile. The
|
|
10
|
+
# AWS CLI with the correct profile. The {SSOCredentials} will
|
|
11
11
|
# auto-refresh the AWS credentials from SSO.
|
|
12
12
|
#
|
|
13
13
|
# # You must first run aws sso login --profile your-sso-profile
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module Aws
|
|
4
4
|
class StaticTokenProvider
|
|
5
|
-
|
|
6
5
|
include TokenProvider
|
|
7
6
|
|
|
8
7
|
# @param [String] token
|
|
9
8
|
# @param [Time] expiration
|
|
10
|
-
def initialize(token, expiration=nil)
|
|
9
|
+
def initialize(token, expiration = nil)
|
|
11
10
|
@token = Token.new(token, expiration)
|
|
12
11
|
end
|
|
13
12
|
end
|
data/lib/aws-sdk-core/token.rb
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
module Aws
|
|
4
4
|
class Token
|
|
5
5
|
|
|
6
|
-
# @param [String] token
|
|
7
|
-
# @param [Time] expiration
|
|
8
|
-
def initialize(token, expiration=nil)
|
|
6
|
+
# @param [String, nil] token
|
|
7
|
+
# @param [Time, nil] expiration
|
|
8
|
+
def initialize(token, expiration = nil)
|
|
9
9
|
@token = token
|
|
10
10
|
@expiration = expiration
|
|
11
11
|
end
|
|
@@ -27,17 +27,13 @@ module Aws
|
|
|
27
27
|
|
|
28
28
|
def static_profile_sso_token(options)
|
|
29
29
|
if Aws.shared_config.config_enabled? && options[:config] && options[:config].profile
|
|
30
|
-
Aws.shared_config.sso_token_from_config(
|
|
31
|
-
profile: options[:config].profile
|
|
32
|
-
)
|
|
30
|
+
Aws.shared_config.sso_token_from_config(profile: options[:config].profile)
|
|
33
31
|
end
|
|
34
32
|
end
|
|
35
33
|
|
|
36
|
-
|
|
37
34
|
def sso_token(options)
|
|
38
|
-
profile_name = determine_profile_name(options)
|
|
39
35
|
if Aws.shared_config.config_enabled?
|
|
40
|
-
Aws.shared_config.sso_token_from_config(profile:
|
|
36
|
+
Aws.shared_config.sso_token_from_config(profile: determine_profile_name(options))
|
|
41
37
|
end
|
|
42
38
|
rescue Errors::NoSuchProfileError
|
|
43
39
|
nil
|
data/lib/aws-sdk-core/util.rb
CHANGED
data/lib/aws-sdk-core.rb
CHANGED
|
@@ -25,6 +25,7 @@ module Aws
|
|
|
25
25
|
autoload :SharedCredentials, 'aws-sdk-core/shared_credentials'
|
|
26
26
|
autoload :ProcessCredentials, 'aws-sdk-core/process_credentials'
|
|
27
27
|
autoload :SSOCredentials, 'aws-sdk-core/sso_credentials'
|
|
28
|
+
autoload :LoginCredentials, 'aws-sdk-core/login_credentials'
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
# tokens and token providers
|
|
@@ -175,3 +176,6 @@ require_relative 'aws-sdk-sts'
|
|
|
175
176
|
# aws-sdk-sso is included to support Aws::SSOCredentials
|
|
176
177
|
require_relative 'aws-sdk-sso'
|
|
177
178
|
require_relative 'aws-sdk-ssooidc'
|
|
179
|
+
|
|
180
|
+
# aws-sdk-signin is included to support Aws::SignInCredentials
|
|
181
|
+
require_relative 'aws-sdk-signin'
|