aws-sdk-core 3.46.2 → 3.126.2
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 +5 -5
- data/CHANGELOG.md +1258 -0
- data/LICENSE.txt +202 -0
- data/VERSION +1 -1
- data/lib/aws-defaults/default_configuration.rb +153 -0
- data/lib/aws-defaults/defaults_mode_config_resolver.rb +107 -0
- data/lib/aws-defaults.rb +3 -0
- data/lib/aws-sdk-core/arn.rb +92 -0
- data/lib/aws-sdk-core/arn_parser.rb +40 -0
- data/lib/aws-sdk-core/assume_role_credentials.rb +20 -0
- data/lib/aws-sdk-core/assume_role_web_identity_credentials.rb +109 -0
- data/lib/aws-sdk-core/async_client_stubs.rb +82 -0
- data/lib/aws-sdk-core/binary/decode_handler.rb +11 -1
- data/lib/aws-sdk-core/binary/encode_handler.rb +34 -0
- data/lib/aws-sdk-core/binary/event_builder.rb +124 -0
- data/lib/aws-sdk-core/binary/event_parser.rb +50 -18
- data/lib/aws-sdk-core/binary/event_stream_decoder.rb +7 -2
- data/lib/aws-sdk-core/binary/event_stream_encoder.rb +55 -0
- data/lib/aws-sdk-core/binary.rb +5 -0
- data/lib/aws-sdk-core/client_side_monitoring/publisher.rb +11 -1
- data/lib/aws-sdk-core/client_side_monitoring/request_metrics.rb +2 -0
- data/lib/aws-sdk-core/client_stubs.rb +16 -13
- data/lib/aws-sdk-core/credential_provider.rb +1 -30
- data/lib/aws-sdk-core/credential_provider_chain.rb +102 -40
- data/lib/aws-sdk-core/credentials.rb +2 -0
- data/lib/aws-sdk-core/deprecations.rb +17 -11
- data/lib/aws-sdk-core/eager_loader.rb +2 -0
- data/lib/aws-sdk-core/ec2_metadata.rb +238 -0
- data/lib/aws-sdk-core/ecs_credentials.rb +18 -9
- data/lib/aws-sdk-core/endpoint_cache.rb +16 -11
- data/lib/aws-sdk-core/errors.rb +138 -15
- data/lib/aws-sdk-core/event_emitter.rb +44 -0
- data/lib/aws-sdk-core/ini_parser.rb +2 -0
- data/lib/aws-sdk-core/instance_profile_credentials.rb +179 -42
- data/lib/aws-sdk-core/json/builder.rb +2 -0
- data/lib/aws-sdk-core/json/error_handler.rb +21 -2
- data/lib/aws-sdk-core/json/handler.rb +21 -1
- data/lib/aws-sdk-core/json/json_engine.rb +12 -8
- data/lib/aws-sdk-core/json/oj_engine.rb +35 -6
- data/lib/aws-sdk-core/json/parser.rb +10 -0
- data/lib/aws-sdk-core/json.rb +11 -28
- data/lib/aws-sdk-core/log/formatter.rb +16 -4
- data/lib/aws-sdk-core/log/handler.rb +2 -0
- data/lib/aws-sdk-core/log/param_filter.rb +38 -13
- data/lib/aws-sdk-core/log/param_formatter.rb +2 -0
- data/lib/aws-sdk-core/pageable_response.rb +48 -24
- data/lib/aws-sdk-core/pager.rb +5 -0
- data/lib/aws-sdk-core/param_converter.rb +2 -0
- data/lib/aws-sdk-core/param_validator.rb +63 -7
- data/lib/aws-sdk-core/plugins/api_key.rb +5 -1
- data/lib/aws-sdk-core/plugins/apig_authorizer_token.rb +2 -0
- data/lib/aws-sdk-core/plugins/apig_credentials_configuration.rb +2 -0
- data/lib/aws-sdk-core/plugins/apig_user_agent.rb +2 -0
- data/lib/aws-sdk-core/plugins/client_metrics_plugin.rb +28 -1
- data/lib/aws-sdk-core/plugins/client_metrics_send_plugin.rb +2 -0
- data/lib/aws-sdk-core/plugins/credentials_configuration.rb +26 -7
- data/lib/aws-sdk-core/plugins/defaults_mode.rb +40 -0
- data/lib/aws-sdk-core/plugins/endpoint_discovery.rb +12 -4
- data/lib/aws-sdk-core/plugins/endpoint_pattern.rb +8 -6
- data/lib/aws-sdk-core/plugins/event_stream_configuration.rb +16 -0
- data/lib/aws-sdk-core/plugins/global_configuration.rb +2 -0
- data/lib/aws-sdk-core/plugins/helpful_socket_errors.rb +2 -0
- data/lib/aws-sdk-core/plugins/http_checksum.rb +57 -0
- data/lib/aws-sdk-core/plugins/idempotency_token.rb +2 -0
- data/lib/aws-sdk-core/plugins/invocation_id.rb +35 -0
- data/lib/aws-sdk-core/plugins/jsonvalue_converter.rb +2 -0
- data/lib/aws-sdk-core/plugins/logging.rb +2 -0
- data/lib/aws-sdk-core/plugins/param_converter.rb +2 -0
- data/lib/aws-sdk-core/plugins/param_validator.rb +2 -0
- data/lib/aws-sdk-core/plugins/protocols/api_gateway.rb +19 -0
- data/lib/aws-sdk-core/plugins/protocols/ec2.rb +2 -0
- data/lib/aws-sdk-core/plugins/protocols/json_rpc.rb +2 -0
- data/lib/aws-sdk-core/plugins/protocols/query.rb +2 -0
- data/lib/aws-sdk-core/plugins/protocols/rest_json.rb +18 -1
- data/lib/aws-sdk-core/plugins/protocols/rest_xml.rb +2 -0
- data/lib/aws-sdk-core/plugins/recursion_detection.rb +27 -0
- data/lib/aws-sdk-core/plugins/regional_endpoint.rb +74 -16
- data/lib/aws-sdk-core/plugins/response_paging.rb +2 -0
- data/lib/aws-sdk-core/plugins/retries/client_rate_limiter.rb +139 -0
- data/lib/aws-sdk-core/plugins/retries/clock_skew.rb +100 -0
- data/lib/aws-sdk-core/plugins/retries/error_inspector.rb +146 -0
- data/lib/aws-sdk-core/plugins/retries/retry_quota.rb +59 -0
- data/lib/aws-sdk-core/plugins/retry_errors.rb +295 -107
- data/lib/aws-sdk-core/plugins/signature_v2.rb +2 -0
- data/lib/aws-sdk-core/plugins/signature_v4.rb +28 -25
- data/lib/aws-sdk-core/plugins/stub_responses.rb +24 -7
- data/lib/aws-sdk-core/plugins/transfer_encoding.rb +53 -0
- data/lib/aws-sdk-core/plugins/user_agent.rb +6 -8
- data/lib/aws-sdk-core/process_credentials.rb +12 -5
- data/lib/aws-sdk-core/query/ec2_param_builder.rb +2 -0
- data/lib/aws-sdk-core/query/handler.rb +2 -0
- data/lib/aws-sdk-core/query/param.rb +2 -0
- data/lib/aws-sdk-core/query/param_builder.rb +2 -0
- data/lib/aws-sdk-core/query/param_list.rb +2 -0
- data/lib/aws-sdk-core/query.rb +2 -0
- data/lib/aws-sdk-core/refreshing_credentials.rb +15 -2
- data/lib/aws-sdk-core/resources/collection.rb +2 -0
- data/lib/aws-sdk-core/rest/handler.rb +2 -0
- data/lib/aws-sdk-core/rest/request/body.rb +21 -1
- data/lib/aws-sdk-core/rest/request/builder.rb +2 -0
- data/lib/aws-sdk-core/rest/request/endpoint.rb +10 -3
- data/lib/aws-sdk-core/rest/request/headers.rb +20 -6
- data/lib/aws-sdk-core/rest/request/querystring_builder.rb +4 -2
- data/lib/aws-sdk-core/rest/response/body.rb +2 -0
- data/lib/aws-sdk-core/rest/response/headers.rb +6 -3
- data/lib/aws-sdk-core/rest/response/parser.rb +2 -0
- data/lib/aws-sdk-core/rest/response/status_code.rb +2 -0
- data/lib/aws-sdk-core/rest.rb +2 -0
- data/lib/aws-sdk-core/shared_config.rb +153 -127
- data/lib/aws-sdk-core/shared_credentials.rb +9 -1
- data/lib/aws-sdk-core/sso_credentials.rb +136 -0
- data/lib/aws-sdk-core/structure.rb +14 -4
- data/lib/aws-sdk-core/stubbing/data_applicator.rb +2 -0
- data/lib/aws-sdk-core/stubbing/empty_stub.rb +2 -0
- data/lib/aws-sdk-core/stubbing/protocols/api_gateway.rb +2 -0
- data/lib/aws-sdk-core/stubbing/protocols/ec2.rb +2 -0
- data/lib/aws-sdk-core/stubbing/protocols/json.rb +3 -1
- data/lib/aws-sdk-core/stubbing/protocols/query.rb +4 -2
- data/lib/aws-sdk-core/stubbing/protocols/rest.rb +52 -7
- data/lib/aws-sdk-core/stubbing/protocols/rest_json.rb +3 -1
- data/lib/aws-sdk-core/stubbing/protocols/rest_xml.rb +2 -2
- data/lib/aws-sdk-core/stubbing/stub_data.rb +15 -4
- data/lib/aws-sdk-core/stubbing/xml_error.rb +2 -0
- data/lib/aws-sdk-core/type_builder.rb +2 -0
- data/lib/aws-sdk-core/util.rb +6 -0
- data/lib/aws-sdk-core/waiters/errors.rb +2 -0
- data/lib/aws-sdk-core/waiters/poller.rb +2 -0
- data/lib/aws-sdk-core/waiters/waiter.rb +4 -2
- data/lib/aws-sdk-core/waiters.rb +2 -0
- data/lib/aws-sdk-core/xml/builder.rb +5 -3
- data/lib/aws-sdk-core/xml/default_list.rb +2 -0
- data/lib/aws-sdk-core/xml/default_map.rb +2 -0
- data/lib/aws-sdk-core/xml/doc_builder.rb +15 -4
- data/lib/aws-sdk-core/xml/error_handler.rb +29 -4
- data/lib/aws-sdk-core/xml/parser/engines/libxml.rb +2 -0
- data/lib/aws-sdk-core/xml/parser/engines/nokogiri.rb +2 -0
- data/lib/aws-sdk-core/xml/parser/engines/oga.rb +2 -0
- data/lib/aws-sdk-core/xml/parser/engines/ox.rb +3 -1
- data/lib/aws-sdk-core/xml/parser/engines/rexml.rb +4 -1
- data/lib/aws-sdk-core/xml/parser/frame.rb +25 -0
- data/lib/aws-sdk-core/xml/parser/parsing_error.rb +2 -0
- data/lib/aws-sdk-core/xml/parser/stack.rb +2 -0
- data/lib/aws-sdk-core/xml/parser.rb +7 -0
- data/lib/aws-sdk-core/xml.rb +2 -0
- data/lib/aws-sdk-core.rb +23 -4
- data/lib/aws-sdk-sso/client.rb +568 -0
- data/lib/aws-sdk-sso/client_api.rb +190 -0
- data/lib/aws-sdk-sso/customizations.rb +1 -0
- data/lib/aws-sdk-sso/errors.rb +102 -0
- data/lib/aws-sdk-sso/resource.rb +26 -0
- data/lib/aws-sdk-sso/types.rb +352 -0
- data/lib/aws-sdk-sso.rb +55 -0
- data/lib/aws-sdk-sts/client.rb +1282 -531
- data/lib/aws-sdk-sts/client_api.rb +76 -1
- data/lib/aws-sdk-sts/customizations.rb +4 -0
- data/lib/aws-sdk-sts/errors.rb +153 -1
- data/lib/aws-sdk-sts/plugins/sts_regional_endpoints.rb +38 -0
- data/lib/aws-sdk-sts/presigner.rb +75 -0
- data/lib/aws-sdk-sts/resource.rb +4 -1
- data/lib/aws-sdk-sts/types.rb +958 -229
- data/lib/aws-sdk-sts.rb +16 -6
- data/lib/seahorse/client/async_base.rb +52 -0
- data/lib/seahorse/client/async_response.rb +64 -0
- data/lib/seahorse/client/base.rb +7 -2
- data/lib/seahorse/client/block_io.rb +6 -2
- data/lib/seahorse/client/configuration.rb +7 -1
- data/lib/seahorse/client/events.rb +3 -1
- data/lib/seahorse/client/h2/connection.rb +250 -0
- data/lib/seahorse/client/h2/handler.rb +152 -0
- data/lib/seahorse/client/handler.rb +2 -0
- data/lib/seahorse/client/handler_builder.rb +2 -0
- data/lib/seahorse/client/handler_list.rb +2 -0
- data/lib/seahorse/client/handler_list_entry.rb +6 -4
- data/lib/seahorse/client/http/async_response.rb +44 -0
- data/lib/seahorse/client/http/headers.rb +2 -0
- data/lib/seahorse/client/http/request.rb +5 -3
- data/lib/seahorse/client/http/response.rb +18 -11
- data/lib/seahorse/client/logging/formatter.rb +6 -2
- data/lib/seahorse/client/logging/handler.rb +2 -0
- data/lib/seahorse/client/managed_file.rb +2 -0
- data/lib/seahorse/client/net_http/connection_pool.rb +30 -23
- data/lib/seahorse/client/net_http/handler.rb +24 -7
- data/lib/seahorse/client/net_http/patches.rb +15 -84
- data/lib/seahorse/client/networking_error.rb +30 -0
- data/lib/seahorse/client/plugin.rb +10 -7
- data/lib/seahorse/client/plugin_list.rb +2 -0
- data/lib/seahorse/client/plugins/content_length.rb +14 -3
- data/lib/seahorse/client/plugins/endpoint.rb +4 -2
- data/lib/seahorse/client/plugins/h2.rb +69 -0
- data/lib/seahorse/client/plugins/logging.rb +2 -0
- data/lib/seahorse/client/plugins/net_http.rb +39 -3
- data/lib/seahorse/client/plugins/operation_methods.rb +2 -0
- data/lib/seahorse/client/plugins/raise_response_errors.rb +2 -0
- data/lib/seahorse/client/plugins/request_callback.rb +110 -0
- data/lib/seahorse/client/plugins/response_target.rb +23 -14
- data/lib/seahorse/client/request.rb +2 -0
- data/lib/seahorse/client/request_context.rb +2 -0
- data/lib/seahorse/client/response.rb +5 -5
- data/lib/seahorse/model/api.rb +10 -0
- data/lib/seahorse/model/authorizer.rb +2 -0
- data/lib/seahorse/model/operation.rb +9 -0
- data/lib/seahorse/model/shapes.rb +29 -2
- data/lib/seahorse/util.rb +8 -1
- data/lib/seahorse/version.rb +2 -0
- data/lib/seahorse.rb +12 -0
- metadata +64 -14
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'aws-eventstream'
|
|
2
4
|
|
|
3
5
|
module Aws
|
|
@@ -43,7 +45,7 @@ module Aws
|
|
|
43
45
|
def build_body(api, operation, data)
|
|
44
46
|
rules = operation.output
|
|
45
47
|
if head_operation(operation)
|
|
46
|
-
|
|
48
|
+
''
|
|
47
49
|
elsif streaming?(rules)
|
|
48
50
|
data[rules[:payload]]
|
|
49
51
|
elsif rules[:payload]
|
|
@@ -73,7 +75,7 @@ module Aws
|
|
|
73
75
|
end
|
|
74
76
|
|
|
75
77
|
def head_operation(operation)
|
|
76
|
-
operation.http_method ==
|
|
78
|
+
operation.http_method == 'HEAD'
|
|
77
79
|
end
|
|
78
80
|
|
|
79
81
|
def eventstream?(rules)
|
|
@@ -94,9 +96,9 @@ module Aws
|
|
|
94
96
|
# Pending
|
|
95
97
|
raise 'Stubbing :exception event is not supported'
|
|
96
98
|
end
|
|
97
|
-
stream
|
|
98
|
-
Aws::EventStream::Message.new(opts)
|
|
99
|
-
|
|
99
|
+
[stream, Aws::EventStream::Encoder.new.encode(
|
|
100
|
+
Aws::EventStream::Message.new(opts)
|
|
101
|
+
)].pack('a*a*')
|
|
100
102
|
end
|
|
101
103
|
end
|
|
102
104
|
|
|
@@ -116,8 +118,41 @@ module Aws
|
|
|
116
118
|
opts
|
|
117
119
|
end
|
|
118
120
|
|
|
119
|
-
def
|
|
120
|
-
|
|
121
|
+
def encode_unknown_event(opts, event_type, event_data)
|
|
122
|
+
# right now h2 events are only rest_json
|
|
123
|
+
opts[:payload] = StringIO.new(Aws::Json.dump(event_data))
|
|
124
|
+
opts[:headers][':event-type'] = Aws::EventStream::HeaderValue.new(
|
|
125
|
+
value: event_type.to_s,
|
|
126
|
+
type: 'string'
|
|
127
|
+
)
|
|
128
|
+
opts[:headers][':message-type'] = Aws::EventStream::HeaderValue.new(
|
|
129
|
+
value: 'event',
|
|
130
|
+
type: 'string'
|
|
131
|
+
)
|
|
132
|
+
opts
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def encode_modeled_event(opts, rules, event_type, event_data, builder)
|
|
136
|
+
event_ref = rules.shape.member(event_type)
|
|
137
|
+
explicit_payload = false
|
|
138
|
+
implicit_payload_members = {}
|
|
139
|
+
event_ref.shape.members.each do |name, ref|
|
|
140
|
+
if ref.eventpayload
|
|
141
|
+
explicit_payload = true
|
|
142
|
+
else
|
|
143
|
+
implicit_payload_members[name] = ref
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
if !explicit_payload && !implicit_payload_members.empty?
|
|
148
|
+
unless implicit_payload_members.size > 1
|
|
149
|
+
m_name, _ = implicit_payload_members.first
|
|
150
|
+
value = {}
|
|
151
|
+
value[m_name] = event_data[m_name]
|
|
152
|
+
opts[:payload] = StringIO.new(builder.new(event_ref).serialize(value))
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
121
156
|
event_data.each do |k, v|
|
|
122
157
|
member_ref = event_ref.shape.member(k)
|
|
123
158
|
if member_ref.eventheader
|
|
@@ -147,6 +182,16 @@ module Aws
|
|
|
147
182
|
opts
|
|
148
183
|
end
|
|
149
184
|
|
|
185
|
+
def encode_event(opts, rules, event_data, builder)
|
|
186
|
+
event_type = event_data.delete(:event_type)
|
|
187
|
+
|
|
188
|
+
if rules.shape.member?(event_type)
|
|
189
|
+
encode_modeled_event(opts, rules, event_type, event_data, builder)
|
|
190
|
+
else
|
|
191
|
+
encode_unknown_event(opts, event_type, event_data)
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
150
195
|
end
|
|
151
196
|
end
|
|
152
197
|
end
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Aws
|
|
2
4
|
module Stubbing
|
|
3
5
|
module Protocols
|
|
4
6
|
class RestJson < Rest
|
|
5
7
|
|
|
6
|
-
def body_for(
|
|
8
|
+
def body_for(_a, _b, rules, data)
|
|
7
9
|
if eventstream?(rules)
|
|
8
10
|
encode_eventstream_response(rules, data, Aws::Json::Builder)
|
|
9
11
|
else
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Aws
|
|
2
4
|
module Stubbing
|
|
3
5
|
module Protocols
|
|
4
6
|
class RestXml < Rest
|
|
5
7
|
|
|
6
|
-
include Seahorse::Model::Shapes
|
|
7
|
-
|
|
8
8
|
def body_for(api, operation, rules, data)
|
|
9
9
|
if eventstream?(rules)
|
|
10
10
|
encode_eventstream_response(rules, data, Xml::Builder)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Aws
|
|
2
4
|
# @api private
|
|
3
5
|
module Stubbing
|
|
@@ -20,17 +22,26 @@ module Aws
|
|
|
20
22
|
def remove_paging_tokens(stub)
|
|
21
23
|
if @pager
|
|
22
24
|
@pager.instance_variable_get("@tokens").keys.each do |path|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
if divide = (path[' || '] || path[' or '])
|
|
26
|
+
path = path.split(divide)[0]
|
|
27
|
+
end
|
|
28
|
+
parts = path.split(/\b/)
|
|
29
|
+
# if nested struct/expression, EmptyStub auto-pop "string"
|
|
30
|
+
# currently not support remove "string" for nested/expression
|
|
31
|
+
# as it requires reverse JMESPATH search
|
|
32
|
+
stub[parts[0]] = nil if parts.size == 1
|
|
25
33
|
end
|
|
26
34
|
if more_results = @pager.instance_variable_get('@more_results')
|
|
27
|
-
|
|
35
|
+
parts = more_results.split(/\b/)
|
|
36
|
+
# if nested struct/expression, EmptyStub auto-pop false value
|
|
37
|
+
# no further work needed
|
|
38
|
+
stub[parts[0]] = false if parts.size == 1
|
|
28
39
|
end
|
|
29
40
|
end
|
|
30
41
|
end
|
|
31
42
|
|
|
32
43
|
def apply_data(data, stub)
|
|
33
|
-
ParamValidator.new(@rules, validate_required:false).validate!(data)
|
|
44
|
+
ParamValidator.new(@rules, validate_required: false, input: false).validate!(data)
|
|
34
45
|
DataApplicator.new(@rules).apply_data(data, stub)
|
|
35
46
|
end
|
|
36
47
|
end
|
data/lib/aws-sdk-core/util.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Aws
|
|
2
4
|
module Waiters
|
|
3
5
|
# @api private
|
|
@@ -50,7 +52,7 @@ module Aws
|
|
|
50
52
|
#
|
|
51
53
|
# @yieldparam [Integer] attempts The number of attempts made.
|
|
52
54
|
def before_attempt(&block)
|
|
53
|
-
@before_attempt <<
|
|
55
|
+
@before_attempt << block if block_given?
|
|
54
56
|
end
|
|
55
57
|
|
|
56
58
|
# Register a callback that is invoked after an attempt but before
|
|
@@ -81,7 +83,7 @@ module Aws
|
|
|
81
83
|
# @yieldparam [Seahorse::Client::Response] response The response from
|
|
82
84
|
# the previous polling attempts.
|
|
83
85
|
def before_wait(&block)
|
|
84
|
-
@before_wait <<
|
|
86
|
+
@before_wait << block if block_given?
|
|
85
87
|
end
|
|
86
88
|
|
|
87
89
|
# @option options [Client] :client
|
data/lib/aws-sdk-core/waiters.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'base64'
|
|
2
4
|
|
|
3
5
|
module Aws
|
|
@@ -9,9 +11,9 @@ module Aws
|
|
|
9
11
|
def initialize(rules, options = {})
|
|
10
12
|
@rules = rules
|
|
11
13
|
@xml = options[:target] || []
|
|
12
|
-
indent = options[:indent] || '
|
|
14
|
+
indent = options[:indent] || ''
|
|
13
15
|
pad = options[:pad] || ''
|
|
14
|
-
@builder = DocBuilder.new(target
|
|
16
|
+
@builder = DocBuilder.new(target: @xml, indent: indent, pad: pad)
|
|
15
17
|
end
|
|
16
18
|
|
|
17
19
|
def to_xml(params)
|
|
@@ -46,7 +48,7 @@ module Aws
|
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
def list(name, ref, values)
|
|
49
|
-
if ref.shape.flattened
|
|
51
|
+
if ref[:flattened] || ref.shape.flattened
|
|
50
52
|
values.each do |value|
|
|
51
53
|
member(ref.shape.member.location_name || name, ref.shape.member, value)
|
|
52
54
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Aws
|
|
2
4
|
module Xml
|
|
3
5
|
class DocBuilder
|
|
@@ -6,7 +8,11 @@ module Aws
|
|
|
6
8
|
# @option options [String] :pad ('')
|
|
7
9
|
# @option options [String] :indent ('')
|
|
8
10
|
def initialize(options = {})
|
|
9
|
-
@target = options[:target] ||
|
|
11
|
+
@target = options[:target] || (
|
|
12
|
+
# The String has to be mutable
|
|
13
|
+
# because @target implements `<<` method.
|
|
14
|
+
String.new
|
|
15
|
+
)
|
|
10
16
|
@indent = options[:indent] || ''
|
|
11
17
|
@pad = options[:pad] || ''
|
|
12
18
|
@end_of_line = @indent == '' ? '' : "\n"
|
|
@@ -32,7 +38,7 @@ module Aws
|
|
|
32
38
|
if block_given?
|
|
33
39
|
@target << open_el(name, attrs)
|
|
34
40
|
@target << @end_of_line
|
|
35
|
-
increase_pad
|
|
41
|
+
increase_pad(&block)
|
|
36
42
|
@target << @pad
|
|
37
43
|
@target << close_el(name)
|
|
38
44
|
elsif args.empty?
|
|
@@ -61,7 +67,12 @@ module Aws
|
|
|
61
67
|
end
|
|
62
68
|
|
|
63
69
|
def escape(string, text_or_attr)
|
|
64
|
-
string.to_s
|
|
70
|
+
string.to_s
|
|
71
|
+
.encode(:xml => text_or_attr)
|
|
72
|
+
.gsub("\u{000D}", '
') # Carriage Return
|
|
73
|
+
.gsub("\u{000A}", '
') # Line Feed
|
|
74
|
+
.gsub("\u{0085}", '…') # Next Line
|
|
75
|
+
.gsub("\u{2028}", '
') # Line Separator
|
|
65
76
|
end
|
|
66
77
|
|
|
67
78
|
def attributes(attr)
|
|
@@ -77,7 +88,7 @@ module Aws
|
|
|
77
88
|
def increase_pad(&block)
|
|
78
89
|
pre_increase = @pad
|
|
79
90
|
@pad = @pad + @indent
|
|
80
|
-
|
|
91
|
+
block.call
|
|
81
92
|
@pad = pre_increase
|
|
82
93
|
end
|
|
83
94
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'cgi'
|
|
2
4
|
|
|
3
5
|
module Aws
|
|
@@ -6,7 +8,7 @@ module Aws
|
|
|
6
8
|
|
|
7
9
|
def call(context)
|
|
8
10
|
@handler.call(context).on(300..599) do |response|
|
|
9
|
-
response.error = error(context)
|
|
11
|
+
response.error = error(context) unless response.error
|
|
10
12
|
response.data = nil
|
|
11
13
|
end
|
|
12
14
|
end
|
|
@@ -18,20 +20,43 @@ module Aws
|
|
|
18
20
|
if body.empty?
|
|
19
21
|
code = http_status_error_code(context)
|
|
20
22
|
message = ''
|
|
23
|
+
data = EmptyStructure.new
|
|
21
24
|
else
|
|
22
|
-
code, message = extract_error(body, context)
|
|
25
|
+
code, message, data = extract_error(body, context)
|
|
23
26
|
end
|
|
24
27
|
errors_module = context.client.class.errors_module
|
|
25
|
-
errors_module.error_class(code).new(context, message)
|
|
28
|
+
error_class = errors_module.error_class(code).new(context, message, data)
|
|
29
|
+
error_class
|
|
26
30
|
end
|
|
27
31
|
|
|
28
32
|
def extract_error(body, context)
|
|
33
|
+
code = error_code(body, context)
|
|
29
34
|
[
|
|
30
|
-
|
|
35
|
+
code,
|
|
31
36
|
error_message(body),
|
|
37
|
+
error_data(context, code)
|
|
32
38
|
]
|
|
33
39
|
end
|
|
34
40
|
|
|
41
|
+
def error_data(context, code)
|
|
42
|
+
data = EmptyStructure.new
|
|
43
|
+
if error_rules = context.operation.errors
|
|
44
|
+
error_rules.each do |rule|
|
|
45
|
+
# for modeled shape with error trait
|
|
46
|
+
# match `code` in the error trait before
|
|
47
|
+
# match modeled shape name
|
|
48
|
+
error_shape_code = rule.shape['error']['code'] if rule.shape['error']
|
|
49
|
+
match = (code == error_shape_code || code == rule.shape.name)
|
|
50
|
+
if match && rule.shape.members.any?
|
|
51
|
+
data = Parser.new(rule).parse(context.http_response.body_contents)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
data
|
|
56
|
+
rescue Xml::Parser::ParsingError
|
|
57
|
+
EmptyStructure.new
|
|
58
|
+
end
|
|
59
|
+
|
|
35
60
|
def error_code(body, context)
|
|
36
61
|
if matches = body.match(/<Code>(.+?)<\/Code>/)
|
|
37
62
|
remove_prefix(unescape(matches[1]), context)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'rexml/document'
|
|
2
4
|
require 'rexml/streamlistener'
|
|
3
5
|
|
|
@@ -15,7 +17,8 @@ module Aws
|
|
|
15
17
|
|
|
16
18
|
def parse(xml)
|
|
17
19
|
begin
|
|
18
|
-
|
|
20
|
+
mutable_xml = xml.dup # REXML only accepts mutable string
|
|
21
|
+
source = REXML::Source.new(mutable_xml)
|
|
19
22
|
REXML::Parsers::StreamParser.new(source, self).parse
|
|
20
23
|
rescue REXML::ParseException => error
|
|
21
24
|
@stack.error(error.message)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'base64'
|
|
2
4
|
require 'time'
|
|
3
5
|
|
|
@@ -93,6 +95,8 @@ module Aws
|
|
|
93
95
|
def child_frame(xml_name)
|
|
94
96
|
if @member = @members[xml_name]
|
|
95
97
|
Frame.new(xml_name, self, @member[:ref])
|
|
98
|
+
elsif @ref.shape.union
|
|
99
|
+
UnknownMemberFrame.new(xml_name, self, nil, @result)
|
|
96
100
|
else
|
|
97
101
|
NullFrame.new(xml_name, self)
|
|
98
102
|
end
|
|
@@ -104,10 +108,24 @@ module Aws
|
|
|
104
108
|
@result[@member[:name]][child.key.result] = child.value.result
|
|
105
109
|
when FlatListFrame
|
|
106
110
|
@result[@member[:name]] << child.result
|
|
111
|
+
when UnknownMemberFrame
|
|
112
|
+
@result[:unknown] = { 'name' => child.path.last, 'value' => child.result }
|
|
107
113
|
when NullFrame
|
|
108
114
|
else
|
|
109
115
|
@result[@member[:name]] = child.result
|
|
110
116
|
end
|
|
117
|
+
|
|
118
|
+
if @ref.shape.union
|
|
119
|
+
# a union may only have one member set
|
|
120
|
+
# convert to the union subclass
|
|
121
|
+
# The default Struct created will have defaults set for all values
|
|
122
|
+
# This also sets only one of the values leaving everything else nil
|
|
123
|
+
# as required for unions
|
|
124
|
+
set_member_name = @member ? @member[:name] : :unknown
|
|
125
|
+
member_subclass = @ref.shape.member_subclass(set_member_name).new # shape.member_subclass(target.member).new
|
|
126
|
+
member_subclass[set_member_name] = @result[set_member_name]
|
|
127
|
+
@result = member_subclass
|
|
128
|
+
end
|
|
111
129
|
end
|
|
112
130
|
|
|
113
131
|
private
|
|
@@ -240,6 +258,12 @@ module Aws
|
|
|
240
258
|
end
|
|
241
259
|
end
|
|
242
260
|
|
|
261
|
+
class UnknownMemberFrame < Frame
|
|
262
|
+
def result
|
|
263
|
+
@text.join
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
|
|
243
267
|
class BlobFrame < Frame
|
|
244
268
|
def result
|
|
245
269
|
@text.empty? ? nil : Base64.decode64(@text.join)
|
|
@@ -300,6 +324,7 @@ module Aws
|
|
|
300
324
|
MapShape => MapFrame,
|
|
301
325
|
StringShape => StringFrame,
|
|
302
326
|
StructureShape => StructureFrame,
|
|
327
|
+
UnionShape => StructureFrame,
|
|
303
328
|
TimestampShape => TimestampFrame,
|
|
304
329
|
}
|
|
305
330
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Aws
|
|
2
4
|
# @api private
|
|
3
5
|
module Xml
|
|
@@ -68,6 +70,11 @@ module Aws
|
|
|
68
70
|
[:ox, :oga, :libxml, :nokogiri, :rexml].each do |name|
|
|
69
71
|
@engine ||= try_load_engine(name)
|
|
70
72
|
end
|
|
73
|
+
unless @engine
|
|
74
|
+
raise 'Unable to find a compatible xml library. ' \
|
|
75
|
+
'Ensure that you have installed or added to your Gemfile one of ' \
|
|
76
|
+
'ox, oga, libxml, nokogiri or rexml'
|
|
77
|
+
end
|
|
71
78
|
end
|
|
72
79
|
|
|
73
80
|
private
|
data/lib/aws-sdk-core/xml.rb
CHANGED
data/lib/aws-sdk-core.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'aws-partitions'
|
|
2
4
|
require 'seahorse'
|
|
3
5
|
require 'jmespath'
|
|
@@ -9,16 +11,19 @@ require_relative 'aws-sdk-core/deprecations'
|
|
|
9
11
|
require_relative 'aws-sdk-core/credential_provider'
|
|
10
12
|
require_relative 'aws-sdk-core/refreshing_credentials'
|
|
11
13
|
require_relative 'aws-sdk-core/assume_role_credentials'
|
|
14
|
+
require_relative 'aws-sdk-core/assume_role_web_identity_credentials'
|
|
12
15
|
require_relative 'aws-sdk-core/credentials'
|
|
13
16
|
require_relative 'aws-sdk-core/credential_provider_chain'
|
|
14
17
|
require_relative 'aws-sdk-core/ecs_credentials'
|
|
15
18
|
require_relative 'aws-sdk-core/instance_profile_credentials'
|
|
16
19
|
require_relative 'aws-sdk-core/shared_credentials'
|
|
17
20
|
require_relative 'aws-sdk-core/process_credentials'
|
|
21
|
+
require_relative 'aws-sdk-core/sso_credentials'
|
|
18
22
|
|
|
19
23
|
# client modules
|
|
20
24
|
|
|
21
25
|
require_relative 'aws-sdk-core/client_stubs'
|
|
26
|
+
require_relative 'aws-sdk-core/async_client_stubs'
|
|
22
27
|
require_relative 'aws-sdk-core/eager_loader'
|
|
23
28
|
require_relative 'aws-sdk-core/errors'
|
|
24
29
|
require_relative 'aws-sdk-core/pageable_response'
|
|
@@ -77,9 +82,23 @@ require_relative 'aws-sdk-core/endpoint_cache'
|
|
|
77
82
|
require_relative 'aws-sdk-core/client_side_monitoring/request_metrics'
|
|
78
83
|
require_relative 'aws-sdk-core/client_side_monitoring/publisher'
|
|
79
84
|
|
|
80
|
-
#
|
|
85
|
+
# utilities
|
|
86
|
+
|
|
87
|
+
require_relative 'aws-sdk-core/arn'
|
|
88
|
+
require_relative 'aws-sdk-core/arn_parser'
|
|
89
|
+
require_relative 'aws-sdk-core/ec2_metadata'
|
|
90
|
+
|
|
91
|
+
# defaults
|
|
92
|
+
require_relative 'aws-defaults'
|
|
93
|
+
|
|
94
|
+
# plugins
|
|
95
|
+
# loaded through building STS or SSO ..
|
|
96
|
+
|
|
97
|
+
# aws-sdk-sts is included to support Aws::AssumeRoleCredentials
|
|
98
|
+
require_relative 'aws-sdk-sts'
|
|
81
99
|
|
|
82
|
-
|
|
100
|
+
# aws-sdk-sso is included to support Aws::SSOCredentials
|
|
101
|
+
require_relative 'aws-sdk-sso'
|
|
83
102
|
|
|
84
103
|
module Aws
|
|
85
104
|
|
|
@@ -160,8 +179,8 @@ module Aws
|
|
|
160
179
|
|
|
161
180
|
# @api private
|
|
162
181
|
def eager_autoload!(*args)
|
|
163
|
-
msg = 'Aws.eager_autoload is no longer needed, usage of '
|
|
164
|
-
|
|
182
|
+
msg = 'Aws.eager_autoload is no longer needed, usage of '\
|
|
183
|
+
'autoload has been replaced with require statements'
|
|
165
184
|
warn(msg)
|
|
166
185
|
end
|
|
167
186
|
|