aws-sdk-core 3.168.4 → 3.224.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 +4 -4
- data/CHANGELOG.md +719 -0
- data/VERSION +1 -1
- data/lib/aws-defaults/default_configuration.rb +5 -6
- data/lib/aws-defaults.rb +4 -1
- data/lib/aws-sdk-core/arn.rb +1 -3
- data/lib/aws-sdk-core/assume_role_credentials.rb +13 -5
- data/lib/aws-sdk-core/assume_role_web_identity_credentials.rb +14 -7
- data/lib/aws-sdk-core/binary/decode_handler.rb +3 -9
- data/lib/aws-sdk-core/binary/encode_handler.rb +1 -1
- data/lib/aws-sdk-core/binary/event_builder.rb +34 -37
- data/lib/aws-sdk-core/binary/event_stream_decoder.rb +1 -0
- data/lib/aws-sdk-core/binary/event_stream_encoder.rb +4 -3
- data/lib/aws-sdk-core/cbor/decoder.rb +308 -0
- data/lib/aws-sdk-core/cbor/encoder.rb +243 -0
- data/lib/aws-sdk-core/cbor.rb +53 -0
- data/lib/aws-sdk-core/client_side_monitoring.rb +9 -0
- data/lib/aws-sdk-core/client_stubs.rb +33 -55
- data/lib/aws-sdk-core/credential_provider.rb +8 -1
- data/lib/aws-sdk-core/credential_provider_chain.rb +39 -11
- data/lib/aws-sdk-core/credentials.rb +19 -6
- data/lib/aws-sdk-core/ec2_metadata.rb +1 -1
- data/lib/aws-sdk-core/ecs_credentials.rb +179 -53
- data/lib/aws-sdk-core/endpoints/condition.rb +5 -0
- data/lib/aws-sdk-core/endpoints/endpoint.rb +3 -1
- data/lib/aws-sdk-core/endpoints/endpoint_rule.rb +5 -1
- data/lib/aws-sdk-core/endpoints/error_rule.rb +5 -0
- data/lib/aws-sdk-core/endpoints/function.rb +5 -0
- data/lib/aws-sdk-core/endpoints/matchers.rb +19 -18
- data/lib/aws-sdk-core/endpoints/reference.rb +5 -0
- data/lib/aws-sdk-core/endpoints/rule.rb +5 -0
- data/lib/aws-sdk-core/endpoints/rule_set.rb +5 -0
- data/lib/aws-sdk-core/endpoints/rules_provider.rb +5 -0
- data/lib/aws-sdk-core/endpoints/templater.rb +6 -0
- data/lib/aws-sdk-core/endpoints/tree_rule.rb +5 -0
- data/lib/aws-sdk-core/endpoints/url.rb +1 -0
- data/lib/aws-sdk-core/endpoints.rb +79 -19
- data/lib/aws-sdk-core/error_handler.rb +41 -0
- data/lib/aws-sdk-core/errors.rb +14 -5
- data/lib/aws-sdk-core/event_emitter.rb +0 -16
- data/lib/aws-sdk-core/ini_parser.rb +7 -0
- data/lib/aws-sdk-core/instance_profile_credentials.rb +56 -32
- data/lib/aws-sdk-core/json/builder.rb +8 -1
- data/lib/aws-sdk-core/json/error_handler.rb +30 -14
- data/lib/aws-sdk-core/json/handler.rb +13 -6
- data/lib/aws-sdk-core/json/json_engine.rb +3 -1
- data/lib/aws-sdk-core/json/oj_engine.rb +7 -1
- data/lib/aws-sdk-core/json/parser.rb +33 -3
- data/lib/aws-sdk-core/json.rb +43 -14
- data/lib/aws-sdk-core/log/formatter.rb +6 -0
- data/lib/aws-sdk-core/log/param_filter.rb +2 -2
- data/lib/aws-sdk-core/log/param_formatter.rb +7 -3
- data/lib/aws-sdk-core/log.rb +10 -0
- data/lib/aws-sdk-core/lru_cache.rb +75 -0
- data/lib/aws-sdk-core/pageable_response.rb +3 -1
- data/lib/aws-sdk-core/param_validator.rb +9 -4
- data/lib/aws-sdk-core/plugins/bearer_authorization.rb +2 -0
- data/lib/aws-sdk-core/plugins/checksum_algorithm.rb +333 -168
- data/lib/aws-sdk-core/plugins/client_metrics_plugin.rb +1 -1
- data/lib/aws-sdk-core/plugins/client_metrics_send_plugin.rb +14 -2
- data/lib/aws-sdk-core/plugins/credentials_configuration.rb +9 -3
- data/lib/aws-sdk-core/plugins/endpoint_pattern.rb +40 -32
- data/lib/aws-sdk-core/plugins/global_configuration.rb +8 -9
- data/lib/aws-sdk-core/plugins/http_checksum.rb +3 -8
- data/lib/aws-sdk-core/plugins/invocation_id.rb +1 -11
- data/lib/aws-sdk-core/plugins/logging.rb +2 -0
- data/lib/aws-sdk-core/plugins/protocols/api_gateway.rb +3 -1
- data/lib/aws-sdk-core/plugins/protocols/ec2.rb +2 -24
- data/lib/aws-sdk-core/plugins/protocols/json_rpc.rb +6 -8
- data/lib/aws-sdk-core/plugins/protocols/query.rb +4 -2
- data/lib/aws-sdk-core/plugins/protocols/rest_json.rb +3 -15
- data/lib/aws-sdk-core/plugins/protocols/rest_xml.rb +3 -0
- data/lib/aws-sdk-core/plugins/protocols/rpc_v2.rb +17 -0
- data/lib/aws-sdk-core/plugins/regional_endpoint.rb +162 -37
- data/lib/aws-sdk-core/plugins/request_compression.rb +226 -0
- data/lib/aws-sdk-core/plugins/retry_errors.rb +12 -3
- data/lib/aws-sdk-core/plugins/sign.rb +44 -17
- data/lib/aws-sdk-core/plugins/signature_v2.rb +2 -1
- data/lib/aws-sdk-core/plugins/signature_v4.rb +2 -1
- data/lib/aws-sdk-core/plugins/stub_responses.rb +53 -9
- data/lib/aws-sdk-core/plugins/telemetry.rb +75 -0
- data/lib/aws-sdk-core/plugins/transfer_encoding.rb +16 -9
- data/lib/aws-sdk-core/plugins/user_agent.rb +191 -14
- data/lib/aws-sdk-core/plugins.rb +39 -0
- data/lib/aws-sdk-core/process_credentials.rb +48 -29
- data/lib/aws-sdk-core/query/ec2_handler.rb +27 -0
- data/lib/aws-sdk-core/query/ec2_param_builder.rb +5 -7
- data/lib/aws-sdk-core/query/handler.rb +4 -4
- data/lib/aws-sdk-core/query/param_builder.rb +2 -2
- data/lib/aws-sdk-core/query.rb +2 -1
- data/lib/aws-sdk-core/refreshing_credentials.rb +12 -12
- data/lib/aws-sdk-core/resources.rb +8 -0
- data/lib/aws-sdk-core/rest/content_type_handler.rb +60 -0
- data/lib/aws-sdk-core/rest/handler.rb +3 -4
- data/lib/aws-sdk-core/rest/request/body.rb +32 -5
- data/lib/aws-sdk-core/rest/request/endpoint.rb +24 -4
- data/lib/aws-sdk-core/rest/request/headers.rb +15 -7
- data/lib/aws-sdk-core/rest/request/querystring_builder.rb +62 -36
- data/lib/aws-sdk-core/rest/response/body.rb +15 -1
- data/lib/aws-sdk-core/rest/response/header_list_parser.rb +79 -0
- data/lib/aws-sdk-core/rest/response/headers.rb +8 -3
- data/lib/aws-sdk-core/rest.rb +1 -0
- data/lib/aws-sdk-core/rpc_v2/builder.rb +62 -0
- data/lib/aws-sdk-core/rpc_v2/cbor_engine.rb +18 -0
- data/lib/aws-sdk-core/rpc_v2/content_type_handler.rb +47 -0
- data/lib/aws-sdk-core/rpc_v2/error_handler.rb +85 -0
- data/lib/aws-sdk-core/rpc_v2/handler.rb +79 -0
- data/lib/aws-sdk-core/rpc_v2/parser.rb +90 -0
- data/lib/aws-sdk-core/rpc_v2.rb +69 -0
- data/lib/aws-sdk-core/shared_config.rb +125 -39
- data/lib/aws-sdk-core/shared_credentials.rb +1 -7
- data/lib/aws-sdk-core/sso_credentials.rb +5 -2
- data/lib/aws-sdk-core/stubbing/protocols/ec2.rb +12 -11
- data/lib/aws-sdk-core/stubbing/protocols/json.rb +11 -10
- data/lib/aws-sdk-core/stubbing/protocols/query.rb +7 -6
- data/lib/aws-sdk-core/stubbing/protocols/rest.rb +2 -1
- data/lib/aws-sdk-core/stubbing/protocols/rest_json.rb +9 -8
- data/lib/aws-sdk-core/stubbing/protocols/rest_xml.rb +6 -5
- data/lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb +39 -0
- data/lib/aws-sdk-core/stubbing/stub_data.rb +11 -0
- 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/util.rb +39 -0
- data/lib/aws-sdk-core/waiters/poller.rb +12 -5
- data/lib/aws-sdk-core/xml/builder.rb +17 -9
- data/lib/aws-sdk-core/xml/error_handler.rb +32 -42
- data/lib/aws-sdk-core/xml/parser/frame.rb +4 -20
- data/lib/aws-sdk-core/xml/parser/{engines/oga.rb → oga_engine.rb} +2 -0
- data/lib/aws-sdk-core/xml/parser/stack.rb +2 -0
- data/lib/aws-sdk-core/xml/parser.rb +2 -6
- data/lib/aws-sdk-core.rb +82 -107
- data/lib/aws-sdk-sso/client.rb +185 -79
- data/lib/aws-sdk-sso/client_api.rb +7 -0
- data/lib/aws-sdk-sso/endpoint_parameters.rb +9 -6
- data/lib/aws-sdk-sso/endpoint_provider.rb +37 -96
- data/lib/aws-sdk-sso/endpoints.rb +3 -54
- data/lib/aws-sdk-sso/plugins/endpoints.rb +23 -22
- data/lib/aws-sdk-sso/types.rb +1 -0
- data/lib/aws-sdk-sso.rb +15 -11
- data/lib/aws-sdk-ssooidc/client.rb +592 -112
- data/lib/aws-sdk-ssooidc/client_api.rb +89 -1
- data/lib/aws-sdk-ssooidc/endpoint_parameters.rb +9 -6
- data/lib/aws-sdk-ssooidc/endpoint_provider.rb +37 -95
- data/lib/aws-sdk-ssooidc/endpoints.rb +3 -40
- data/lib/aws-sdk-ssooidc/errors.rb +52 -0
- data/lib/aws-sdk-ssooidc/plugins/endpoints.rb +23 -20
- data/lib/aws-sdk-ssooidc/types.rb +407 -53
- data/lib/aws-sdk-ssooidc.rb +15 -11
- data/lib/aws-sdk-sts/client.rb +516 -238
- data/lib/aws-sdk-sts/client_api.rb +48 -11
- data/lib/aws-sdk-sts/customizations.rb +5 -1
- data/lib/aws-sdk-sts/endpoint_parameters.rb +10 -9
- data/lib/aws-sdk-sts/endpoint_provider.rb +91 -213
- data/lib/aws-sdk-sts/endpoints.rb +3 -118
- data/lib/aws-sdk-sts/errors.rb +16 -0
- data/lib/aws-sdk-sts/plugins/endpoints.rb +23 -30
- data/lib/aws-sdk-sts/presigner.rb +1 -1
- data/lib/aws-sdk-sts/types.rb +217 -36
- data/lib/aws-sdk-sts.rb +15 -11
- data/lib/seahorse/client/async_base.rb +4 -5
- data/lib/seahorse/client/async_response.rb +19 -0
- data/lib/seahorse/client/base.rb +18 -21
- data/lib/seahorse/client/configuration.rb +0 -4
- data/lib/seahorse/client/h2/connection.rb +25 -31
- data/lib/seahorse/client/h2/handler.rb +14 -3
- data/lib/seahorse/client/handler.rb +1 -1
- data/lib/seahorse/client/http/response.rb +1 -1
- data/lib/seahorse/client/net_http/connection_pool.rb +13 -11
- data/lib/seahorse/client/net_http/handler.rb +21 -9
- data/lib/seahorse/client/net_http/patches.rb +1 -4
- data/lib/seahorse/client/networking_error.rb +1 -1
- data/lib/seahorse/client/plugin.rb +9 -0
- data/lib/seahorse/client/plugins/endpoint.rb +0 -1
- data/lib/seahorse/client/plugins/h2.rb +4 -4
- data/lib/seahorse/client/plugins/net_http.rb +57 -16
- data/lib/seahorse/client/plugins/request_callback.rb +31 -0
- data/lib/seahorse/client/request_context.rb +8 -1
- data/lib/seahorse/client/response.rb +8 -0
- data/lib/seahorse/model/operation.rb +3 -0
- data/lib/seahorse/model/shapes.rb +2 -2
- data/sig/aws-sdk-core/async_client_stubs.rbs +21 -0
- data/sig/aws-sdk-core/client_stubs.rbs +10 -0
- data/sig/aws-sdk-core/errors.rbs +22 -0
- data/sig/aws-sdk-core/resources/collection.rbs +21 -0
- data/sig/aws-sdk-core/structure.rbs +4 -0
- 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
- data/sig/aws-sdk-core/waiters/errors.rbs +20 -0
- data/sig/aws-sdk-core.rbs +7 -0
- data/sig/seahorse/client/async_base.rbs +18 -0
- data/sig/seahorse/client/base.rbs +25 -0
- data/sig/seahorse/client/handler_builder.rbs +16 -0
- data/sig/seahorse/client/response.rbs +61 -0
- metadata +92 -23
- /data/lib/aws-sdk-core/xml/parser/{engines/libxml.rb → libxml_engine.rb} +0 -0
- /data/lib/aws-sdk-core/xml/parser/{engines/nokogiri.rb → nokogiri_engine.rb} +0 -0
- /data/lib/aws-sdk-core/xml/parser/{engines/ox.rb → ox_engine.rb} +0 -0
- /data/lib/aws-sdk-core/xml/parser/{engines/rexml.rb → rexml_engine.rb} +0 -0
|
@@ -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,
|
|
@@ -23,6 +25,7 @@ at HOME/.aws/credentials. When not specified, 'default' is used.
|
|
|
23
25
|
option(:credentials,
|
|
24
26
|
required: true,
|
|
25
27
|
doc_type: 'Aws::CredentialProvider',
|
|
28
|
+
rbs_type: 'untyped',
|
|
26
29
|
docstring: <<-DOCS
|
|
27
30
|
Your AWS credentials. This can be an instance of any one of the
|
|
28
31
|
following classes:
|
|
@@ -57,13 +60,15 @@ When `:credentials` are not configured directly, the following
|
|
|
57
60
|
locations will be searched for credentials:
|
|
58
61
|
|
|
59
62
|
* `Aws.config[:credentials]`
|
|
60
|
-
* The `:access_key_id`, `:secret_access_key`,
|
|
61
|
-
|
|
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']
|
|
62
67
|
* `~/.aws/credentials`
|
|
63
68
|
* `~/.aws/config`
|
|
64
69
|
* EC2/ECS IMDS instance profile - When used by default, the timeouts
|
|
65
70
|
are very aggressive. Construct and pass an instance of
|
|
66
|
-
`Aws::
|
|
71
|
+
`Aws::InstanceProfileCredentials` or `Aws::ECSCredentials` to
|
|
67
72
|
enable retries and extended timeouts. Instance profile credential
|
|
68
73
|
fetching can be disabled by setting ENV['AWS_EC2_METADATA_DISABLED']
|
|
69
74
|
to true.
|
|
@@ -79,6 +84,7 @@ locations will be searched for credentials:
|
|
|
79
84
|
option(:token_provider,
|
|
80
85
|
required: false,
|
|
81
86
|
doc_type: 'Aws::TokenProvider',
|
|
87
|
+
rbs_type: 'untyped',
|
|
82
88
|
docstring: <<-DOCS
|
|
83
89
|
A Bearer Token Provider. This can be an instance of any one of the
|
|
84
90
|
following classes:
|
|
@@ -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
|
|
@@ -43,7 +43,7 @@ module Aws
|
|
|
43
43
|
# @api private
|
|
44
44
|
class GlobalConfiguration < Seahorse::Client::Plugin
|
|
45
45
|
|
|
46
|
-
@identifiers = Set.new
|
|
46
|
+
@identifiers = Set.new
|
|
47
47
|
|
|
48
48
|
# @api private
|
|
49
49
|
def before_initialize(client_class, options)
|
|
@@ -55,17 +55,18 @@ module Aws
|
|
|
55
55
|
private
|
|
56
56
|
|
|
57
57
|
def apply_service_defaults(client_class, options)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
return unless (defaults = Aws.config[client_class.identifier])
|
|
59
|
+
|
|
60
|
+
defaults.each do |option_name, default|
|
|
61
|
+
options[option_name] = default unless options.key?(option_name)
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
def apply_aws_defaults(
|
|
65
|
+
def apply_aws_defaults(_client_class, options)
|
|
66
66
|
Aws.config.each do |option_name, default|
|
|
67
67
|
next if self.class.identifiers.include?(option_name)
|
|
68
68
|
next if options.key?(option_name)
|
|
69
|
+
|
|
69
70
|
options[option_name] = default
|
|
70
71
|
end
|
|
71
72
|
end
|
|
@@ -80,9 +81,7 @@ module Aws
|
|
|
80
81
|
|
|
81
82
|
# @return [Set<String>]
|
|
82
83
|
# @api private
|
|
83
|
-
|
|
84
|
-
@identifiers
|
|
85
|
-
end
|
|
84
|
+
attr_reader :identifiers
|
|
86
85
|
|
|
87
86
|
end
|
|
88
87
|
end
|
|
@@ -11,8 +11,9 @@ 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
|
+
!context[:s3_express_endpoint] # s3 express endpoints do not support md5
|
|
16
17
|
body = context.http_request.body
|
|
17
18
|
context.http_request.headers['Content-Md5'] ||= md5(body)
|
|
18
19
|
end
|
|
@@ -21,12 +22,6 @@ module Aws
|
|
|
21
22
|
|
|
22
23
|
private
|
|
23
24
|
|
|
24
|
-
def checksum_required?(context)
|
|
25
|
-
context.operation.http_checksum_required ||
|
|
26
|
-
(context.operation.http_checksum &&
|
|
27
|
-
context.operation.http_checksum['requestChecksumRequired'])
|
|
28
|
-
end
|
|
29
|
-
|
|
30
25
|
# @param [File, Tempfile, IO#read, String] value
|
|
31
26
|
# @return [String<MD5>]
|
|
32
27
|
def md5(value)
|
|
@@ -12,18 +12,8 @@ module Aws
|
|
|
12
12
|
class Handler < Seahorse::Client::Handler
|
|
13
13
|
|
|
14
14
|
def call(context)
|
|
15
|
-
apply_invocation_id(context)
|
|
16
|
-
@handler.call(context)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
private
|
|
20
|
-
|
|
21
|
-
def apply_invocation_id(context)
|
|
22
15
|
context.http_request.headers['amz-sdk-invocation-id'] = SecureRandom.uuid
|
|
23
|
-
|
|
24
|
-
# only used for eventstreaming at input
|
|
25
|
-
context.http_request.headers['x-amz-content-sha256'] = 'STREAMING-AWS4-HMAC-SHA256-EVENTS'
|
|
26
|
-
end
|
|
16
|
+
@handler.call(context)
|
|
27
17
|
end
|
|
28
18
|
|
|
29
19
|
end
|
|
@@ -8,6 +8,7 @@ module Aws
|
|
|
8
8
|
|
|
9
9
|
option(:logger,
|
|
10
10
|
doc_type: 'Logger',
|
|
11
|
+
rbs_type: 'untyped',
|
|
11
12
|
docstring: <<-DOCS
|
|
12
13
|
The Logger instance to send log messages to. If this option
|
|
13
14
|
is not set, logging will be disabled.
|
|
@@ -22,6 +23,7 @@ is not set, logging will be disabled.
|
|
|
22
23
|
|
|
23
24
|
option(:log_formatter,
|
|
24
25
|
doc_type: 'Aws::Log::Formatter',
|
|
26
|
+
rbs_type: 'untyped',
|
|
25
27
|
doc_default: literal('Aws::Log::Formatter.default'),
|
|
26
28
|
docstring: 'The log formatter.'
|
|
27
29
|
) do |config|
|
|
@@ -5,6 +5,8 @@ module Aws
|
|
|
5
5
|
module Protocols
|
|
6
6
|
class ApiGateway < Seahorse::Client::Plugin
|
|
7
7
|
|
|
8
|
+
option(:protocol, 'api-gateway')
|
|
9
|
+
|
|
8
10
|
class ContentTypeHandler < Seahorse::Client::Handler
|
|
9
11
|
def call(context)
|
|
10
12
|
body = context.http_request.body
|
|
@@ -22,8 +24,8 @@ module Aws
|
|
|
22
24
|
handler(Rest::Handler)
|
|
23
25
|
handler(ContentTypeHandler, priority: 30)
|
|
24
26
|
handler(Json::ErrorHandler, step: :sign)
|
|
25
|
-
end
|
|
26
27
|
|
|
28
|
+
end
|
|
27
29
|
end
|
|
28
30
|
end
|
|
29
31
|
end
|
|
@@ -1,35 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative '../../query'
|
|
4
|
-
|
|
5
3
|
module Aws
|
|
6
4
|
module Plugins
|
|
7
5
|
module Protocols
|
|
8
6
|
class EC2 < Seahorse::Client::Plugin
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def apply_params(param_list, params, rules)
|
|
13
|
-
Aws::Query::EC2ParamBuilder.new(param_list).apply(rules, params)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def parse_xml(context)
|
|
17
|
-
if rules = context.operation.output
|
|
18
|
-
parser = Xml::Parser.new(rules)
|
|
19
|
-
data = parser.parse(xml(context)) do |path, value|
|
|
20
|
-
if path.size == 2 && path.last == 'requestId'
|
|
21
|
-
context.metadata[:request_id] = value
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
data
|
|
25
|
-
else
|
|
26
|
-
EmptyStructure.new
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
end
|
|
8
|
+
option(:protocol, 'ec2')
|
|
31
9
|
|
|
32
|
-
handler(
|
|
10
|
+
handler(Aws::Query::EC2Handler)
|
|
33
11
|
handler(Xml::ErrorHandler, step: :sign)
|
|
34
12
|
|
|
35
13
|
end
|
|
@@ -5,18 +5,17 @@ module Aws
|
|
|
5
5
|
module Protocols
|
|
6
6
|
class JsonRpc < Seahorse::Client::Plugin
|
|
7
7
|
|
|
8
|
+
option(:protocol, 'json')
|
|
9
|
+
|
|
8
10
|
option(:simple_json,
|
|
9
11
|
default: false,
|
|
10
12
|
doc_type: 'Boolean',
|
|
11
13
|
docstring: <<-DOCS)
|
|
12
14
|
Disables request parameter conversion, validation, and formatting.
|
|
13
|
-
Also
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
structures.
|
|
17
|
-
|
|
18
|
-
When `:simple_json` is enabled, the request parameters hash must
|
|
19
|
-
be formatted exactly as the DynamoDB API expects.
|
|
15
|
+
Also disables response data type conversions. The request parameters
|
|
16
|
+
hash must be formatted exactly as the API expects.This option is useful
|
|
17
|
+
when you want to ensure the highest level of performance by avoiding
|
|
18
|
+
overhead of walking request parameters and response data structures.
|
|
20
19
|
DOCS
|
|
21
20
|
|
|
22
21
|
option(:validate_params) { |config| !config.simple_json }
|
|
@@ -24,7 +23,6 @@ be formatted exactly as the DynamoDB API expects.
|
|
|
24
23
|
option(:convert_params) { |config| !config.simple_json }
|
|
25
24
|
|
|
26
25
|
handler(Json::Handler)
|
|
27
|
-
|
|
28
26
|
handler(Json::ErrorHandler, step: :sign)
|
|
29
27
|
|
|
30
28
|
end
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative '../../query'
|
|
4
|
-
|
|
5
3
|
module Aws
|
|
6
4
|
module Plugins
|
|
7
5
|
module Protocols
|
|
8
6
|
class Query < Seahorse::Client::Plugin
|
|
7
|
+
|
|
8
|
+
option(:protocol, 'query')
|
|
9
|
+
|
|
9
10
|
handler(Aws::Query::Handler)
|
|
10
11
|
handler(Xml::ErrorHandler, step: :sign)
|
|
12
|
+
|
|
11
13
|
end
|
|
12
14
|
end
|
|
13
15
|
end
|
|
@@ -5,25 +5,13 @@ module Aws
|
|
|
5
5
|
module Protocols
|
|
6
6
|
class RestJson < Seahorse::Client::Plugin
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
def call(context)
|
|
10
|
-
body = context.http_request.body
|
|
11
|
-
# Rest::Handler will set a default JSON body, so size can be checked
|
|
12
|
-
# if this handler is run after serialization.
|
|
13
|
-
if !body.respond_to?(:size) ||
|
|
14
|
-
(body.respond_to?(:size) && body.size > 0)
|
|
15
|
-
context.http_request.headers['Content-Type'] ||=
|
|
16
|
-
'application/json'
|
|
17
|
-
end
|
|
18
|
-
@handler.call(context)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
8
|
+
option(:protocol, 'rest-json')
|
|
21
9
|
|
|
22
10
|
handler(Rest::Handler)
|
|
23
|
-
handler(ContentTypeHandler, priority: 30)
|
|
11
|
+
handler(Rest::ContentTypeHandler, priority: 30)
|
|
24
12
|
handler(Json::ErrorHandler, step: :sign)
|
|
25
|
-
end
|
|
26
13
|
|
|
14
|
+
end
|
|
27
15
|
end
|
|
28
16
|
end
|
|
29
17
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Plugins
|
|
5
|
+
module Protocols
|
|
6
|
+
class RpcV2 < Seahorse::Client::Plugin
|
|
7
|
+
|
|
8
|
+
option(:protocol, 'smithy-rpc-v2-cbor')
|
|
9
|
+
|
|
10
|
+
handler(Aws::RpcV2::Handler)
|
|
11
|
+
handler(Aws::RpcV2::ContentTypeHandler, priority: 30)
|
|
12
|
+
handler(Aws::RpcV2::ErrorHandler, step: :sign)
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -20,16 +20,31 @@ a default `:region` is searched for in the following locations:
|
|
|
20
20
|
* `ENV['AWS_DEFAULT_REGION']`
|
|
21
21
|
* `~/.aws/credentials`
|
|
22
22
|
* `~/.aws/config`
|
|
23
|
-
|
|
23
|
+
DOCS
|
|
24
24
|
resolve_region(cfg)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
option(:sigv4a_signing_region_set,
|
|
28
|
+
doc_type: Array,
|
|
29
|
+
rbs_type: 'Array[String]',
|
|
30
|
+
docstring: <<-DOCS) do |cfg|
|
|
31
|
+
A list of regions that should be signed with SigV4a signing. When
|
|
32
|
+
not passed, a default `:sigv4a_signing_region_set` is searched for
|
|
33
|
+
in the following locations:
|
|
34
|
+
|
|
35
|
+
* `Aws.config[:sigv4a_signing_region_set]`
|
|
36
|
+
* `ENV['AWS_SIGV4A_SIGNING_REGION_SET']`
|
|
37
|
+
* `~/.aws/config`
|
|
38
|
+
DOCS
|
|
39
|
+
resolve_sigv4a_signing_region_set(cfg)
|
|
40
|
+
end
|
|
41
|
+
|
|
27
42
|
option(:use_dualstack_endpoint,
|
|
28
43
|
doc_type: 'Boolean',
|
|
29
44
|
docstring: <<-DOCS) do |cfg|
|
|
30
45
|
When set to `true`, dualstack enabled endpoints (with `.aws` TLD)
|
|
31
46
|
will be used if available.
|
|
32
|
-
|
|
47
|
+
DOCS
|
|
33
48
|
resolve_use_dualstack_endpoint(cfg)
|
|
34
49
|
end
|
|
35
50
|
|
|
@@ -39,7 +54,7 @@ will be used if available.
|
|
|
39
54
|
When set to `true`, fips compatible endpoints will be used if available.
|
|
40
55
|
When a `fips` region is used, the region is normalized and this config
|
|
41
56
|
is set to `true`.
|
|
42
|
-
|
|
57
|
+
DOCS
|
|
43
58
|
resolve_use_fips_endpoint(cfg)
|
|
44
59
|
end
|
|
45
60
|
|
|
@@ -47,50 +62,71 @@ is set to `true`.
|
|
|
47
62
|
# Legacy endpoints must continue to be generated at client time.
|
|
48
63
|
option(:regional_endpoint, false)
|
|
49
64
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
65
|
+
option(:ignore_configured_endpoint_urls,
|
|
66
|
+
doc_type: 'Boolean',
|
|
67
|
+
docstring: <<-DOCS) do |cfg|
|
|
68
|
+
Setting to true disables use of endpoint URLs provided via environment
|
|
69
|
+
variables and the shared configuration file.
|
|
70
|
+
DOCS
|
|
71
|
+
resolve_ignore_configured_endpoint_urls(cfg)
|
|
72
|
+
end
|
|
73
|
+
|
|
53
74
|
option(:endpoint, doc_type: String, docstring: <<-DOCS) do |cfg|
|
|
54
75
|
The client endpoint is normally constructed from the `:region`
|
|
55
76
|
option. You should only configure an `:endpoint` when connecting
|
|
56
77
|
to test or custom endpoints. This should be a valid HTTP(S) URI.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if cfg.respond_to?(:sts_regional_endpoints)
|
|
61
|
-
sts_regional = cfg.sts_regional_endpoints
|
|
62
|
-
end
|
|
78
|
+
DOCS
|
|
79
|
+
resolve_endpoint(cfg)
|
|
80
|
+
end
|
|
63
81
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
end
|
|
82
|
+
def after_initialize(client)
|
|
83
|
+
region = client.config.region
|
|
84
|
+
raise Errors::MissingRegionError if region.nil? || region == ''
|
|
68
85
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if region != new_region
|
|
72
|
-
warn("Legacy region #{region} was transformed to #{new_region}."\
|
|
73
|
-
'`use_fips_endpoint` config was set to true.')
|
|
74
|
-
cfg.override_config(:use_fips_endpoint, true)
|
|
75
|
-
cfg.override_config(:region, new_region)
|
|
76
|
-
end
|
|
86
|
+
# resolve a default endpoint to preserve legacy behavior
|
|
87
|
+
initialize_default_endpoint(client) if client.config.endpoint.nil?
|
|
77
88
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
)
|
|
87
|
-
end
|
|
89
|
+
region_set = client.config.sigv4a_signing_region_set
|
|
90
|
+
return if region_set.nil?
|
|
91
|
+
raise Errors::InvalidRegionSetError unless region_set.is_a?(Array)
|
|
92
|
+
|
|
93
|
+
region_set = region_set.compact.reject(&:empty?)
|
|
94
|
+
raise Errors::InvalidRegionSetError if region_set.empty?
|
|
95
|
+
|
|
96
|
+
client.config.sigv4a_signing_region_set = region_set
|
|
88
97
|
end
|
|
89
98
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
99
|
+
private
|
|
100
|
+
|
|
101
|
+
def initialize_default_endpoint(client)
|
|
102
|
+
client_module = Object.const_get(client.class.name.rpartition('::').first)
|
|
103
|
+
param_class = client_module.const_get(:EndpointParameters)
|
|
104
|
+
endpoint_provider = client.config.endpoint_provider
|
|
105
|
+
params = param_class.create(client.config)
|
|
106
|
+
endpoint = endpoint_provider.resolve_endpoint(params)
|
|
107
|
+
client.config.endpoint = endpoint.url
|
|
108
|
+
rescue ArgumentError, NameError
|
|
109
|
+
# fallback to legacy
|
|
110
|
+
client.config.endpoint = resolve_legacy_endpoint(client.config)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# set a default endpoint in config using legacy (endpoints.json) resolver
|
|
114
|
+
def resolve_legacy_endpoint(cfg)
|
|
115
|
+
endpoint_prefix = cfg.api.metadata['endpointPrefix']
|
|
116
|
+
if cfg.respond_to?(:sts_regional_endpoints)
|
|
117
|
+
sts_regional = cfg.sts_regional_endpoints
|
|
93
118
|
end
|
|
119
|
+
|
|
120
|
+
endpoint = Aws::Partitions::EndpointProvider.resolve(
|
|
121
|
+
cfg.region,
|
|
122
|
+
endpoint_prefix,
|
|
123
|
+
sts_regional,
|
|
124
|
+
{
|
|
125
|
+
dualstack: cfg.use_dualstack_endpoint,
|
|
126
|
+
fips: cfg.use_fips_endpoint
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
URI(endpoint)
|
|
94
130
|
end
|
|
95
131
|
|
|
96
132
|
class << self
|
|
@@ -104,6 +140,12 @@ to test or custom endpoints. This should be a valid HTTP(S) URI.
|
|
|
104
140
|
env_region || cfg_region
|
|
105
141
|
end
|
|
106
142
|
|
|
143
|
+
def resolve_sigv4a_signing_region_set(cfg)
|
|
144
|
+
value = ENV['AWS_SIGV4A_SIGNING_REGION_SET']
|
|
145
|
+
value ||= Aws.shared_config.sigv4a_signing_region_set(profile: cfg.profile)
|
|
146
|
+
value.split(',') if value
|
|
147
|
+
end
|
|
148
|
+
|
|
107
149
|
def resolve_use_dualstack_endpoint(cfg)
|
|
108
150
|
value = ENV['AWS_USE_DUALSTACK_ENDPOINT']
|
|
109
151
|
value ||= Aws.shared_config.use_dualstack_endpoint(
|
|
@@ -117,6 +159,89 @@ to test or custom endpoints. This should be a valid HTTP(S) URI.
|
|
|
117
159
|
value ||= Aws.shared_config.use_fips_endpoint(profile: cfg.profile)
|
|
118
160
|
Aws::Util.str_2_bool(value) || false
|
|
119
161
|
end
|
|
162
|
+
|
|
163
|
+
def resolve_ignore_configured_endpoint_urls(cfg)
|
|
164
|
+
value = ENV['AWS_IGNORE_CONFIGURED_ENDPOINT_URLS']
|
|
165
|
+
value ||= Aws.shared_config.ignore_configured_endpoint_urls(profile: cfg.profile)
|
|
166
|
+
Aws::Util.str_2_bool(value&.downcase) || false
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# NOTE: with Endpoints 2.0, some of this logic is deprecated
|
|
170
|
+
# but because new old service gems may depend on new core versions
|
|
171
|
+
# we must preserve that behavior.
|
|
172
|
+
# Additional behavior controls the setting of the custom SDK::Endpoint
|
|
173
|
+
# parameter.
|
|
174
|
+
# When the `regional_endpoint` config is set to true - this indicates to
|
|
175
|
+
# Endpoints2.0 that a custom endpoint has NOT been configured by the user.
|
|
176
|
+
def resolve_endpoint(cfg)
|
|
177
|
+
endpoint = resolve_custom_config_endpoint(cfg)
|
|
178
|
+
endpoint_prefix = cfg.api.metadata['endpointPrefix']
|
|
179
|
+
|
|
180
|
+
return endpoint unless endpoint.nil? && cfg.region && endpoint_prefix
|
|
181
|
+
|
|
182
|
+
validate_region!(cfg.region)
|
|
183
|
+
handle_legacy_pseudo_regions(cfg)
|
|
184
|
+
|
|
185
|
+
# set regional_endpoint flag - this indicates to Endpoints 2.0
|
|
186
|
+
# that a custom endpoint has NOT been configured by the user
|
|
187
|
+
cfg.override_config(:regional_endpoint, true)
|
|
188
|
+
|
|
189
|
+
# a default endpoint is resolved in after_initialize
|
|
190
|
+
nil
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# get a custom configured endpoint from ENV or configuration
|
|
194
|
+
def resolve_custom_config_endpoint(cfg)
|
|
195
|
+
return if cfg.ignore_configured_endpoint_urls
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
env_service_endpoint(cfg) || env_global_endpoint(cfg) || shared_config_endpoint(cfg)
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def env_service_endpoint(cfg)
|
|
202
|
+
service_id = cfg.api.metadata['serviceId'] || cfg.api.metadata['endpointPrefix']
|
|
203
|
+
env_service_id = service_id.gsub(" ", "_").upcase
|
|
204
|
+
return unless endpoint = ENV["AWS_ENDPOINT_URL_#{env_service_id}"]
|
|
205
|
+
|
|
206
|
+
cfg.logger&.debug(
|
|
207
|
+
"Endpoint configured from ENV['AWS_ENDPOINT_URL_#{env_service_id}']: #{endpoint}\n")
|
|
208
|
+
endpoint
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def env_global_endpoint(cfg)
|
|
212
|
+
return unless endpoint = ENV['AWS_ENDPOINT_URL']
|
|
213
|
+
|
|
214
|
+
cfg.logger&.debug(
|
|
215
|
+
"Endpoint configured from ENV['AWS_ENDPOINT_URL']: #{endpoint}\n")
|
|
216
|
+
endpoint
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
def shared_config_endpoint(cfg)
|
|
220
|
+
service_id = cfg.api.metadata['serviceId'] || cfg.api.metadata['endpointPrefix']
|
|
221
|
+
return unless endpoint = Aws.shared_config.configured_endpoint(profile: cfg.profile, service_id: service_id)
|
|
222
|
+
|
|
223
|
+
cfg.logger&.debug(
|
|
224
|
+
"Endpoint configured from shared config(profile: #{cfg.profile}): #{endpoint}\n")
|
|
225
|
+
endpoint
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# check region is a valid RFC host label
|
|
229
|
+
def validate_region!(region)
|
|
230
|
+
unless Seahorse::Util.host_label?(region)
|
|
231
|
+
raise Errors::InvalidRegionError
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
def handle_legacy_pseudo_regions(cfg)
|
|
236
|
+
region = cfg.region
|
|
237
|
+
new_region = region.gsub('fips-', '').gsub('-fips', '')
|
|
238
|
+
if region != new_region
|
|
239
|
+
warn("Legacy region #{region} was transformed to #{new_region}."\
|
|
240
|
+
'`use_fips_endpoint` config was set to true.')
|
|
241
|
+
cfg.override_config(:use_fips_endpoint, true)
|
|
242
|
+
cfg.override_config(:region, new_region)
|
|
243
|
+
end
|
|
244
|
+
end
|
|
120
245
|
end
|
|
121
246
|
end
|
|
122
247
|
end
|