aws-sdk-core 3.202.2 → 3.209.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +81 -0
- data/VERSION +1 -1
- data/lib/aws-defaults.rb +4 -1
- data/lib/aws-sdk-core/assume_role_credentials.rb +12 -5
- data/lib/aws-sdk-core/assume_role_web_identity_credentials.rb +13 -7
- data/lib/aws-sdk-core/client_side_monitoring.rb +9 -0
- data/lib/aws-sdk-core/credential_provider_chain.rb +9 -2
- data/lib/aws-sdk-core/credentials.rb +13 -6
- data/lib/aws-sdk-core/endpoints/endpoint.rb +3 -1
- data/lib/aws-sdk-core/endpoints.rb +6 -3
- data/lib/aws-sdk-core/log.rb +10 -0
- data/lib/aws-sdk-core/plugins/credentials_configuration.rb +7 -3
- data/lib/aws-sdk-core/plugins/regional_endpoint.rb +1 -0
- data/lib/aws-sdk-core/plugins/stub_responses.rb +29 -2
- data/lib/aws-sdk-core/plugins/telemetry.rb +75 -0
- data/lib/aws-sdk-core/plugins/user_agent.rb +17 -8
- data/lib/aws-sdk-core/plugins.rb +39 -0
- data/lib/aws-sdk-core/process_credentials.rb +2 -1
- data/lib/aws-sdk-core/resources.rb +8 -0
- data/lib/aws-sdk-core/rpc_v2/handler.rb +5 -1
- data/lib/aws-sdk-core/shared_config.rb +3 -1
- data/lib/aws-sdk-core/shared_credentials.rb +0 -7
- data/lib/aws-sdk-core/sso_credentials.rb +2 -1
- data/lib/aws-sdk-core/stubbing.rb +22 -0
- data/lib/aws-sdk-core/telemetry/base.rb +177 -0
- data/lib/aws-sdk-core/telemetry/no_op.rb +70 -0
- data/lib/aws-sdk-core/telemetry/otel.rb +235 -0
- data/lib/aws-sdk-core/telemetry/span_kind.rb +22 -0
- data/lib/aws-sdk-core/telemetry/span_status.rb +59 -0
- data/lib/aws-sdk-core/telemetry.rb +78 -0
- data/lib/aws-sdk-core.rb +82 -112
- data/lib/aws-sdk-sso/client.rb +35 -8
- data/lib/aws-sdk-sso/client_api.rb +1 -0
- data/lib/aws-sdk-sso/endpoints.rb +4 -16
- data/lib/aws-sdk-sso/plugins/endpoints.rb +18 -6
- data/lib/aws-sdk-sso/types.rb +1 -0
- data/lib/aws-sdk-sso.rb +15 -11
- data/lib/aws-sdk-ssooidc/client.rb +35 -8
- data/lib/aws-sdk-ssooidc/client_api.rb +1 -0
- data/lib/aws-sdk-ssooidc/endpoints.rb +4 -16
- data/lib/aws-sdk-ssooidc/plugins/endpoints.rb +18 -6
- data/lib/aws-sdk-ssooidc/types.rb +1 -0
- data/lib/aws-sdk-ssooidc.rb +15 -11
- data/lib/aws-sdk-sts/client.rb +35 -8
- data/lib/aws-sdk-sts/client_api.rb +1 -0
- data/lib/aws-sdk-sts/customizations.rb +5 -1
- data/lib/aws-sdk-sts/endpoints.rb +8 -32
- data/lib/aws-sdk-sts/plugins/endpoints.rb +18 -6
- data/lib/aws-sdk-sts/types.rb +1 -0
- data/lib/aws-sdk-sts.rb +15 -11
- data/lib/seahorse/client/h2/handler.rb +13 -3
- data/lib/seahorse/client/net_http/connection_pool.rb +8 -2
- data/lib/seahorse/client/net_http/handler.rb +18 -1
- data/lib/seahorse/client/plugins/net_http.rb +9 -0
- data/lib/seahorse/client/request_context.rb +8 -1
- data/sig/aws-sdk-core/telemetry/base.rbs +46 -0
- data/sig/aws-sdk-core/telemetry/otel.rbs +22 -0
- data/sig/aws-sdk-core/telemetry/span_kind.rbs +15 -0
- data/sig/aws-sdk-core/telemetry/span_status.rbs +24 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b21a55766ac3b065464e202f9e5e8eaa449fb1b186776cc439f9ef6859c51923
|
4
|
+
data.tar.gz: d0602af7e12f340646722e0ca65ebbe1b9950d8b7ac7da1da2bfaf22a6723fbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dce3b13eced2c29beecdbc6929836c9917cc0d7524033cb76e0ea7ae6cf6f01c87b9f0f07a88a17197cb2989c4addf3a9c303acbdb6cf5fb331ecb328d16feec
|
7
|
+
data.tar.gz: ace0cb1e6d8e05083601c36607a3c8d6902a72a36cec481081939626ce8399fa43b603b42d6fb026cddce1ec51ab98f405a02e6fa4eb861aabe23aa658519457
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,86 @@
|
|
1
1
|
Unreleased Changes
|
2
2
|
------------------
|
3
3
|
|
4
|
+
3.209.1 (2024-09-25)
|
5
|
+
------------------
|
6
|
+
|
7
|
+
* Issue - Add all core plugins to autoloads.
|
8
|
+
|
9
|
+
3.209.0 (2024-09-24)
|
10
|
+
------------------
|
11
|
+
|
12
|
+
* Feature - Updated Aws::STS::Client with the latest API changes.
|
13
|
+
|
14
|
+
* Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
|
15
|
+
|
16
|
+
* Feature - Updated Aws::SSO::Client with the latest API changes.
|
17
|
+
|
18
|
+
* Issue - Add service identifiers to GlobalConfig's list of identifiers outside of autoload (#3113).
|
19
|
+
|
20
|
+
* Issue - Ignore invalid ARNs when trying to parse accountId in assume role credentials.
|
21
|
+
|
22
|
+
3.208.0 (2024-09-23)
|
23
|
+
------------------
|
24
|
+
|
25
|
+
* Feature - Updated Aws::STS::Client with the latest API changes.
|
26
|
+
|
27
|
+
* Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
|
28
|
+
|
29
|
+
* Feature - Updated Aws::SSO::Client with the latest API changes.
|
30
|
+
|
31
|
+
* Feature - Use autoloading at the service level to load service clients and resources.
|
32
|
+
|
33
|
+
3.207.0 (2024-09-20)
|
34
|
+
------------------
|
35
|
+
|
36
|
+
* Feature - Updated Aws::STS::Client with the latest API changes.
|
37
|
+
|
38
|
+
* Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
|
39
|
+
|
40
|
+
* Feature - Updated Aws::SSO::Client with the latest API changes.
|
41
|
+
|
42
|
+
* Feature - Support Account ID credentials using `ENV['AWS_ACCOUNT_ID']`, `aws_account_id` shared config, or the `account_id` Client configuration option.
|
43
|
+
|
44
|
+
* Feature - Support Account ID endpoint mode using `ENV['AWS_ACCOUNT_ID_ENDPOINT_MODE']`, `aws_account_id_endpoint_mode` shared config, or the `account_id_endpoint_mode` Client configuration option. Defaults to `preferred`, which will use the account id endpoint if available. Set to `disabled` to disable account id endpoints. Set to `required` to require account id endpoint usage; an error is raised if credentials do not have an account id.
|
45
|
+
|
46
|
+
3.206.0 (2024-09-17)
|
47
|
+
------------------
|
48
|
+
|
49
|
+
* Feature - Support `sigv4a` endpoint auth without CRT.
|
50
|
+
|
51
|
+
3.205.0 (2024-09-11)
|
52
|
+
------------------
|
53
|
+
|
54
|
+
* Feature - Updated Aws::STS::Client with the latest API changes.
|
55
|
+
|
56
|
+
* Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
|
57
|
+
|
58
|
+
* Feature - Updated Aws::SSO::Client with the latest API changes.
|
59
|
+
|
60
|
+
* Issue - Additional metrics collection in the User-Agent plugin.
|
61
|
+
|
62
|
+
3.204.0 (2024-09-10)
|
63
|
+
------------------
|
64
|
+
|
65
|
+
* Feature - Updated Aws::STS::Client with the latest API changes.
|
66
|
+
|
67
|
+
* Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
|
68
|
+
|
69
|
+
* Feature - Updated Aws::SSO::Client with the latest API changes.
|
70
|
+
|
71
|
+
* Issue - Add support for `ssl_cert` and `ssl_key` configuration options to support mTLS.
|
72
|
+
|
73
|
+
3.203.0 (2024-09-03)
|
74
|
+
------------------
|
75
|
+
|
76
|
+
* Feature - Updated Aws::STS::Client with the latest API changes.
|
77
|
+
|
78
|
+
* Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
|
79
|
+
|
80
|
+
* Feature - Updated Aws::SSO::Client with the latest API changes.
|
81
|
+
|
82
|
+
* Feature - Add support for Observability which includes a configuration, `telemetry_provider` and an OpenTelemetry-based telemetry provider.
|
83
|
+
|
4
84
|
3.202.2 (2024-08-30)
|
5
85
|
------------------
|
6
86
|
|
@@ -26,6 +106,7 @@ Unreleased Changes
|
|
26
106
|
------------------
|
27
107
|
|
28
108
|
* Issue - Allow legacy/undocumented `sigv4_signer` configuration to override resolved signer.
|
109
|
+
|
29
110
|
* Issue - Consider sigv4a supported without crt check.
|
30
111
|
|
31
112
|
3.201.4 (2024-08-08)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.209.1
|
data/lib/aws-defaults.rb
CHANGED
@@ -62,13 +62,20 @@ module Aws
|
|
62
62
|
private
|
63
63
|
|
64
64
|
def refresh
|
65
|
-
|
65
|
+
resp = @client.assume_role(@assume_role_params)
|
66
|
+
creds = resp.credentials
|
66
67
|
@credentials = Credentials.new(
|
67
|
-
|
68
|
-
|
69
|
-
|
68
|
+
creds.access_key_id,
|
69
|
+
creds.secret_access_key,
|
70
|
+
creds.session_token,
|
71
|
+
account_id: parse_account_id(resp)
|
70
72
|
)
|
71
|
-
@expiration =
|
73
|
+
@expiration = creds.expiration
|
74
|
+
end
|
75
|
+
|
76
|
+
def parse_account_id(resp)
|
77
|
+
arn = resp.assumed_role_user&.arn
|
78
|
+
ARNParser.parse(arn).account_id if ARNParser.arn?(arn)
|
72
79
|
end
|
73
80
|
|
74
81
|
class << self
|
@@ -60,7 +60,7 @@ module Aws
|
|
60
60
|
# not provided, generate encoded UUID as session name
|
61
61
|
@assume_role_web_identity_params[:role_session_name] = _session_name
|
62
62
|
end
|
63
|
-
@client = client_opts[:client] || STS::Client.new(client_opts.merge(credentials:
|
63
|
+
@client = client_opts[:client] || STS::Client.new(client_opts.merge(credentials: nil))
|
64
64
|
super
|
65
65
|
end
|
66
66
|
|
@@ -73,14 +73,15 @@ module Aws
|
|
73
73
|
# read from token file everytime it refreshes
|
74
74
|
@assume_role_web_identity_params[:web_identity_token] = _token_from_file(@token_file)
|
75
75
|
|
76
|
-
|
77
|
-
|
76
|
+
resp = @client.assume_role_with_web_identity(@assume_role_web_identity_params)
|
77
|
+
creds = resp.credentials
|
78
78
|
@credentials = Credentials.new(
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
creds.access_key_id,
|
80
|
+
creds.secret_access_key,
|
81
|
+
creds.session_token,
|
82
|
+
account_id: parse_account_id(resp)
|
82
83
|
)
|
83
|
-
@expiration =
|
84
|
+
@expiration = creds.expiration
|
84
85
|
end
|
85
86
|
|
86
87
|
def _token_from_file(path)
|
@@ -94,6 +95,11 @@ module Aws
|
|
94
95
|
Base64.strict_encode64(SecureRandom.uuid)
|
95
96
|
end
|
96
97
|
|
98
|
+
def parse_account_id(resp)
|
99
|
+
arn = resp.assumed_role_user&.arn
|
100
|
+
ARNParser.parse(arn).account_id if ARNParser.arn?(arn)
|
101
|
+
end
|
102
|
+
|
97
103
|
class << self
|
98
104
|
|
99
105
|
# @api private
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
# setup autoloading for ClientSideMonitoring module
|
5
|
+
module ClientSideMonitoring
|
6
|
+
autoload :RequestMetrics, 'aws-sdk-core/client_side_monitoring/request_metrics'
|
7
|
+
autoload :Publisher, 'aws-sdk-core/client_side_monitoring/publisher'
|
8
|
+
end
|
9
|
+
end
|
@@ -45,7 +45,8 @@ module Aws
|
|
45
45
|
Credentials.new(
|
46
46
|
options[:config].access_key_id,
|
47
47
|
options[:config].secret_access_key,
|
48
|
-
options[:config].session_token
|
48
|
+
options[:config].session_token,
|
49
|
+
account_id: options[:config].account_id
|
49
50
|
)
|
50
51
|
end
|
51
52
|
end
|
@@ -94,7 +95,13 @@ module Aws
|
|
94
95
|
key = %w[AWS_ACCESS_KEY_ID AMAZON_ACCESS_KEY_ID AWS_ACCESS_KEY]
|
95
96
|
secret = %w[AWS_SECRET_ACCESS_KEY AMAZON_SECRET_ACCESS_KEY AWS_SECRET_KEY]
|
96
97
|
token = %w[AWS_SESSION_TOKEN AMAZON_SESSION_TOKEN]
|
97
|
-
|
98
|
+
account_id = %w[AWS_ACCOUNT_ID]
|
99
|
+
Credentials.new(
|
100
|
+
envar(key),
|
101
|
+
envar(secret),
|
102
|
+
envar(token),
|
103
|
+
account_id: envar(account_id)
|
104
|
+
)
|
98
105
|
end
|
99
106
|
|
100
107
|
def envar(keys)
|
@@ -6,21 +6,28 @@ module Aws
|
|
6
6
|
# @param [String] access_key_id
|
7
7
|
# @param [String] secret_access_key
|
8
8
|
# @param [String] session_token (nil)
|
9
|
-
|
9
|
+
# @param [Hash] kwargs
|
10
|
+
# @option kwargs [String] :credential_scope (nil)
|
11
|
+
def initialize(access_key_id, secret_access_key, session_token = nil,
|
12
|
+
**kwargs)
|
10
13
|
@access_key_id = access_key_id
|
11
14
|
@secret_access_key = secret_access_key
|
12
15
|
@session_token = session_token
|
16
|
+
@account_id = kwargs[:account_id]
|
13
17
|
end
|
14
18
|
|
15
|
-
# @return [String
|
19
|
+
# @return [String]
|
16
20
|
attr_reader :access_key_id
|
17
21
|
|
18
|
-
# @return [String
|
22
|
+
# @return [String]
|
19
23
|
attr_reader :secret_access_key
|
20
24
|
|
21
25
|
# @return [String, nil]
|
22
26
|
attr_reader :session_token
|
23
27
|
|
28
|
+
# @return [String, nil]
|
29
|
+
attr_reader :account_id
|
30
|
+
|
24
31
|
# @return [Credentials]
|
25
32
|
def credentials
|
26
33
|
self
|
@@ -30,9 +37,9 @@ module Aws
|
|
30
37
|
# access key are both set.
|
31
38
|
def set?
|
32
39
|
!access_key_id.nil? &&
|
33
|
-
|
34
|
-
|
35
|
-
|
40
|
+
!access_key_id.empty? &&
|
41
|
+
!secret_access_key.nil? &&
|
42
|
+
!secret_access_key.empty?
|
36
43
|
end
|
37
44
|
|
38
45
|
# Removing the secret access key from the default inspect string.
|
@@ -3,15 +3,17 @@
|
|
3
3
|
module Aws
|
4
4
|
module Endpoints
|
5
5
|
class Endpoint
|
6
|
-
def initialize(url:, properties: {}, headers: {})
|
6
|
+
def initialize(url:, properties: {}, headers: {}, metadata: {})
|
7
7
|
@url = url
|
8
8
|
@properties = properties
|
9
9
|
@headers = headers
|
10
|
+
@metadata = metadata
|
10
11
|
end
|
11
12
|
|
12
13
|
attr_reader :url
|
13
14
|
attr_reader :properties
|
14
15
|
attr_reader :headers
|
16
|
+
attr_reader :metadata
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
@@ -19,9 +19,12 @@ require 'aws-sigv4'
|
|
19
19
|
module Aws
|
20
20
|
# @api private
|
21
21
|
module Endpoints
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
SUPPORTED_AUTH_TRAITS = %w[
|
23
|
+
aws.auth#sigv4
|
24
|
+
aws.auth#sigv4a
|
25
|
+
smithy.api#httpBearerAuth
|
26
|
+
smithy.api#noAuth
|
27
|
+
].freeze
|
25
28
|
|
26
29
|
class << self
|
27
30
|
def resolve_auth_scheme(context, endpoint)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
# setup autoloading for Log module
|
5
|
+
module Log
|
6
|
+
autoload :Formatter, 'aws-sdk-core/log/formatter'
|
7
|
+
autoload :ParamFilter, 'aws-sdk-core/log/param_filter'
|
8
|
+
autoload :ParamFormatter, 'aws-sdk-core/log/param_formatter'
|
9
|
+
end
|
10
|
+
end
|
@@ -12,6 +12,8 @@ module Aws
|
|
12
12
|
|
13
13
|
option(:session_token, doc_type: String, docstring: '')
|
14
14
|
|
15
|
+
option(:account_id, doc_type: String, docstring: '')
|
16
|
+
|
15
17
|
option(:profile,
|
16
18
|
doc_default: 'default',
|
17
19
|
doc_type: String,
|
@@ -58,13 +60,15 @@ When `:credentials` are not configured directly, the following
|
|
58
60
|
locations will be searched for credentials:
|
59
61
|
|
60
62
|
* `Aws.config[:credentials]`
|
61
|
-
* The `:access_key_id`, `:secret_access_key`,
|
62
|
-
|
63
|
+
* The `:access_key_id`, `:secret_access_key`, `:session_token`, and
|
64
|
+
`:account_id` options.
|
65
|
+
* ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'],
|
66
|
+
ENV['AWS_SESSION_TOKEN'], and ENV['AWS_ACCOUNT_ID']
|
63
67
|
* `~/.aws/credentials`
|
64
68
|
* `~/.aws/config`
|
65
69
|
* EC2/ECS IMDS instance profile - When used by default, the timeouts
|
66
70
|
are very aggressive. Construct and pass an instance of
|
67
|
-
`Aws::
|
71
|
+
`Aws::InstanceProfileCredentials` or `Aws::ECSCredentials` to
|
68
72
|
enable retries and extended timeouts. Instance profile credential
|
69
73
|
fetching can be disabled by setting ENV['AWS_EC2_METADATA_DISABLED']
|
70
74
|
to true.
|
@@ -205,6 +205,7 @@ to test or custom endpoints. This should be a valid HTTP(S) URI.
|
|
205
205
|
cfg.override_config(:region, new_region)
|
206
206
|
end
|
207
207
|
end
|
208
|
+
|
208
209
|
# set a default endpoint in config using legacy (endpoints.json) resolver
|
209
210
|
def resolve_legacy_endpoint(cfg)
|
210
211
|
endpoint_prefix = cfg.api.metadata['endpointPrefix']
|
@@ -49,6 +49,14 @@ requests are made, and retries are disabled.
|
|
49
49
|
class Handler < Seahorse::Client::Handler
|
50
50
|
|
51
51
|
def call(context)
|
52
|
+
span_wrapper(context) do
|
53
|
+
stub_responses(context)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def stub_responses(context)
|
52
60
|
stub = context.client.next_stub(context)
|
53
61
|
resp = Seahorse::Client::Response.new(context: context)
|
54
62
|
async_mode = context.client.is_a? Seahorse::Client::AsyncBase
|
@@ -58,8 +66,15 @@ requests are made, and retries are disabled.
|
|
58
66
|
apply_stub(stub, resp, async_mode)
|
59
67
|
end
|
60
68
|
|
61
|
-
async_mode
|
62
|
-
|
69
|
+
if async_mode
|
70
|
+
Seahorse::Client::AsyncResponse.new(
|
71
|
+
context: context,
|
72
|
+
stream: context[:input_event_stream_handler].event_emitter.stream,
|
73
|
+
sync_queue: Queue.new
|
74
|
+
)
|
75
|
+
else
|
76
|
+
resp
|
77
|
+
end
|
63
78
|
end
|
64
79
|
|
65
80
|
def apply_stub(stub, response, async_mode = false)
|
@@ -99,6 +114,18 @@ requests are made, and retries are disabled.
|
|
99
114
|
http_resp.signal_done
|
100
115
|
end
|
101
116
|
|
117
|
+
def span_wrapper(context, &block)
|
118
|
+
context.tracer.in_span(
|
119
|
+
'Handler.StubResponses',
|
120
|
+
attributes: Aws::Telemetry.http_request_attrs(context)
|
121
|
+
) do |span|
|
122
|
+
block.call.tap do
|
123
|
+
span.add_attributes(
|
124
|
+
Aws::Telemetry.http_response_attrs(context)
|
125
|
+
)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
102
129
|
end
|
103
130
|
end
|
104
131
|
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module Plugins
|
5
|
+
# @api private
|
6
|
+
class Telemetry < Seahorse::Client::Plugin
|
7
|
+
option(
|
8
|
+
:telemetry_provider,
|
9
|
+
default: Aws::Telemetry::NoOpTelemetryProvider,
|
10
|
+
doc_type: Aws::Telemetry::TelemetryProviderBase,
|
11
|
+
rbs_type: Aws::Telemetry::TelemetryProviderBase,
|
12
|
+
docstring: <<-DOCS) do |_cfg|
|
13
|
+
Allows you to provide a telemetry provider, which is used to
|
14
|
+
emit telemetry data. By default, uses `NoOpTelemetryProvider` which
|
15
|
+
will not record or emit any telemetry data. The SDK supports the
|
16
|
+
following telemetry providers:
|
17
|
+
|
18
|
+
* OpenTelemetry (OTel) - To use the OTel provider, install and require the
|
19
|
+
`opentelemetry-sdk` gem and then, pass in an instance of a
|
20
|
+
`Aws::Telemetry::OTelProvider` for telemetry provider.
|
21
|
+
DOCS
|
22
|
+
Aws::Telemetry::NoOpTelemetryProvider.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def after_initialize(client)
|
26
|
+
validate_telemetry_provider(client.config)
|
27
|
+
end
|
28
|
+
|
29
|
+
def validate_telemetry_provider(config)
|
30
|
+
unless config.telemetry_provider.is_a?(Aws::Telemetry::TelemetryProviderBase)
|
31
|
+
raise ArgumentError,
|
32
|
+
'Must provide a telemetry provider for the '\
|
33
|
+
'`telemetry_provider` configuration option.'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Handler < Seahorse::Client::Handler
|
38
|
+
def call(context)
|
39
|
+
span_wrapper(context) { @handler.call(context) }
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def span_wrapper(context, &block)
|
45
|
+
service_id = service_id(context)
|
46
|
+
attributes = {
|
47
|
+
'rpc.system' => 'aws-api',
|
48
|
+
'rpc.service' => service_id,
|
49
|
+
'rpc.method' => context.operation.name,
|
50
|
+
'code.function' => context.operation_name.to_s,
|
51
|
+
'code.namespace' => 'Aws::Plugins::Telemetry'
|
52
|
+
}
|
53
|
+
context.tracer.in_span(
|
54
|
+
parent_span_name(context, service_id),
|
55
|
+
attributes: attributes,
|
56
|
+
kind: Aws::Telemetry::SpanKind::CLIENT,
|
57
|
+
&block
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
def service_id(context)
|
62
|
+
context.config.api.metadata['serviceId'] ||
|
63
|
+
context.config.api.metadata['serviceAbbreviation'] ||
|
64
|
+
context.config.api.metadata['serviceFullName']
|
65
|
+
end
|
66
|
+
|
67
|
+
def parent_span_name(context, service_id)
|
68
|
+
"#{service_id}.#{context.operation.name}".delete(' ')
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
handler(Handler, step: :initialize, priority: 99)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -17,7 +17,15 @@ module Aws
|
|
17
17
|
"S3_CRYPTO_V2": "I",
|
18
18
|
"S3_EXPRESS_BUCKET": "J",
|
19
19
|
"S3_ACCESS_GRANTS": "K",
|
20
|
-
"GZIP_REQUEST_COMPRESSION": "L"
|
20
|
+
"GZIP_REQUEST_COMPRESSION": "L",
|
21
|
+
"PROTOCOL_RPC_V2_CBOR": "M",
|
22
|
+
"ENDPOINT_OVERRIDE": "N",
|
23
|
+
"ACCOUNT_ID_ENDPOINT": "O",
|
24
|
+
"ACCOUNT_ID_MODE_PREFERRED": "P",
|
25
|
+
"ACCOUNT_ID_MODE_DISABLED": "Q",
|
26
|
+
"ACCOUNT_ID_MODE_REQUIRED": "R",
|
27
|
+
"SIGV4A_SIGNING": "S",
|
28
|
+
"RESOLVED_ACCOUNT_ID": "T"
|
21
29
|
}
|
22
30
|
METRICS
|
23
31
|
|
@@ -45,15 +53,13 @@ variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
|
|
45
53
|
block.call
|
46
54
|
end
|
47
55
|
|
48
|
-
def self.metric(
|
56
|
+
def self.metric(*metrics, &block)
|
49
57
|
Thread.current[:aws_sdk_core_user_agent_metric] ||= []
|
50
|
-
|
58
|
+
metrics = metrics.map { |metric| METRICS[metric] }.compact
|
59
|
+
Thread.current[:aws_sdk_core_user_agent_metric].concat(metrics)
|
51
60
|
block.call
|
52
61
|
ensure
|
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
|
62
|
+
Thread.current[:aws_sdk_core_user_agent_metric].pop(metrics.size)
|
57
63
|
end
|
58
64
|
|
59
65
|
# @api private
|
@@ -166,7 +172,10 @@ variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
|
|
166
172
|
end
|
167
173
|
|
168
174
|
def metric_metadata
|
169
|
-
|
175
|
+
if Thread.current[:aws_sdk_core_user_agent_metric].nil? ||
|
176
|
+
Thread.current[:aws_sdk_core_user_agent_metric].empty?
|
177
|
+
return
|
178
|
+
end
|
170
179
|
|
171
180
|
metrics = Thread.current[:aws_sdk_core_user_agent_metric].join(',')
|
172
181
|
# Metric metadata is limited to 1024 bytes
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
# setup autoloading for Plugins
|
5
|
+
# Most plugins are required explicitly from service clients
|
6
|
+
# but users may reference them outside of client usage.
|
7
|
+
module Plugins
|
8
|
+
autoload :ApiKey, 'aws-sdk-core/plugins/api_key'
|
9
|
+
autoload :BearerAuthorization, 'aws-sdk-core/plugins/bearer_authorization'
|
10
|
+
autoload :ChecksumAlgorithm, 'aws-sdk-core/plugins/checksum_algorithm'
|
11
|
+
autoload :ClientMetricsPlugin, 'aws-sdk-core/plugins/client_metrics_plugin'
|
12
|
+
autoload :ClientMetricsSendPlugin, 'aws-sdk-core/plugins/client_metrics_send_plugin'
|
13
|
+
autoload :CredentialsConfiguration, 'aws-sdk-core/plugins/credentials_configuration'
|
14
|
+
autoload :DefaultsMode, 'aws-sdk-core/plugins/defaults_mode'
|
15
|
+
autoload :EndpointDiscovery, 'aws-sdk-core/plugins/endpoint_discovery'
|
16
|
+
autoload :EndpointPattern, 'aws-sdk-core/plugins/endpoint_pattern'
|
17
|
+
autoload :EventStreamConfiguration, 'aws-sdk-core/plugins/event_stream_configuration'
|
18
|
+
autoload :GlobalConfiguration, 'aws-sdk-core/plugins/global_configuration'
|
19
|
+
autoload :HelpfulSocketErrors, 'aws-sdk-core/plugins/helpful_socket_errors'
|
20
|
+
autoload :HttpChecksum, 'aws-sdk-core/plugins/http_checksum'
|
21
|
+
autoload :IdempotencyToken, 'aws-sdk-core/plugins/idempotency_token'
|
22
|
+
autoload :InvocationId, 'aws-sdk-core/plugins/invocation_id'
|
23
|
+
autoload :JsonvalueConverter, 'aws-sdk-core/plugins/jsonvalue_converter'
|
24
|
+
autoload :Logging, 'aws-sdk-core/plugins/logging'
|
25
|
+
autoload :ParamConverter, 'aws-sdk-core/plugins/param_converter'
|
26
|
+
autoload :ParamValidator, 'aws-sdk-core/plugins/param_validator'
|
27
|
+
autoload :RecursionDetection, 'aws-sdk-core/plugins/recursion_detection'
|
28
|
+
autoload :RegionalEndpoint, 'aws-sdk-core/plugins/regional_endpoint'
|
29
|
+
autoload :RequestCompression, 'aws-sdk-core/plugins/request_compression'
|
30
|
+
autoload :ResponsePaging, 'aws-sdk-core/plugins/response_paging'
|
31
|
+
autoload :RetryErrors, 'aws-sdk-core/plugins/retry_errors'
|
32
|
+
autoload :Sign, 'aws-sdk-core/plugins/sign'
|
33
|
+
autoload :SignatureV4, 'aws-sdk-core/plugins/signature_v4'
|
34
|
+
autoload :StubResponses, 'aws-sdk-core/plugins/stub_responses'
|
35
|
+
autoload :Telemetry, 'aws-sdk-core/plugins/telemetry'
|
36
|
+
autoload :TransferEncoding, 'aws-sdk-core/plugins/transfer_encoding'
|
37
|
+
autoload :UserAgent, 'aws-sdk-core/plugins/user_agent'
|
38
|
+
end
|
39
|
+
end
|
@@ -74,7 +74,8 @@ module Aws
|
|
74
74
|
creds = Credentials.new(
|
75
75
|
creds_json['AccessKeyId'],
|
76
76
|
creds_json['SecretAccessKey'],
|
77
|
-
creds_json['SessionToken']
|
77
|
+
creds_json['SessionToken'],
|
78
|
+
account_id: creds_json['AccountId']
|
78
79
|
)
|
79
80
|
|
80
81
|
@expiration = creds_json['Expiration'] ? Time.iso8601(creds_json['Expiration']) : nil
|
@@ -7,7 +7,7 @@ module Aws
|
|
7
7
|
# @return [Seahorse::Client::Response]
|
8
8
|
def call(context)
|
9
9
|
build_request(context)
|
10
|
-
response = @handler.call(context)
|
10
|
+
response = with_metric { @handler.call(context) }
|
11
11
|
response.on(200..299) { |resp| resp.data = parse_body(context) }
|
12
12
|
response.on(200..599) { |_resp| apply_request_id(context) }
|
13
13
|
response
|
@@ -15,6 +15,10 @@ module Aws
|
|
15
15
|
|
16
16
|
private
|
17
17
|
|
18
|
+
def with_metric(&block)
|
19
|
+
Aws::Plugins::UserAgent.metric('PROTOCOL_RPC_V2_CBOR', &block)
|
20
|
+
end
|
21
|
+
|
18
22
|
def build_request(context)
|
19
23
|
context.http_request.headers['smithy-protocol'] = 'rpc-v2-cbor'
|
20
24
|
context.http_request.http_method = 'POST'
|
@@ -198,6 +198,7 @@ module Aws
|
|
198
198
|
|
199
199
|
config_reader(
|
200
200
|
:region,
|
201
|
+
:account_id_endpoint_mode,
|
201
202
|
:sigv4a_signing_region_set,
|
202
203
|
:ca_bundle,
|
203
204
|
:credential_process,
|
@@ -414,7 +415,8 @@ module Aws
|
|
414
415
|
creds = Credentials.new(
|
415
416
|
prof_config['aws_access_key_id'],
|
416
417
|
prof_config['aws_secret_access_key'],
|
417
|
-
prof_config['aws_session_token']
|
418
|
+
prof_config['aws_session_token'],
|
419
|
+
account_id: prof_config['aws_account_id']
|
418
420
|
)
|
419
421
|
creds if creds.set?
|
420
422
|
end
|
@@ -7,13 +7,6 @@ module Aws
|
|
7
7
|
|
8
8
|
include CredentialProvider
|
9
9
|
|
10
|
-
# @api private
|
11
|
-
KEY_MAP = {
|
12
|
-
'aws_access_key_id' => 'access_key_id',
|
13
|
-
'aws_secret_access_key' => 'secret_access_key',
|
14
|
-
'aws_session_token' => 'session_token',
|
15
|
-
}
|
16
|
-
|
17
10
|
# Constructs a new SharedCredentials object. This will load static
|
18
11
|
# (access_key_id, secret_access_key and session_token) AWS access
|
19
12
|
# credentials from an ini file, which supports profiles. The default
|