aws-sdk-core 3.196.1 → 3.199.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 +39 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-core/binary/decode_handler.rb +3 -4
- data/lib/aws-sdk-core/binary/encode_handler.rb +1 -1
- 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/cbor_engine.rb +19 -0
- data/lib/aws-sdk-core/cbor/decoder.rb +310 -0
- data/lib/aws-sdk-core/cbor/encoder.rb +243 -0
- data/lib/aws-sdk-core/cbor.rb +106 -0
- data/lib/aws-sdk-core/client_stubs.rb +3 -2
- data/lib/aws-sdk-core/endpoints/matchers.rb +5 -1
- data/lib/aws-sdk-core/error_handler.rb +41 -0
- data/lib/aws-sdk-core/json/error_handler.rb +6 -8
- data/lib/aws-sdk-core/json/handler.rb +5 -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 +2 -0
- data/lib/aws-sdk-core/json.rb +43 -14
- data/lib/aws-sdk-core/pageable_response.rb +1 -1
- data/lib/aws-sdk-core/plugins/client_metrics_send_plugin.rb +14 -2
- data/lib/aws-sdk-core/plugins/global_configuration.rb +8 -9
- 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 +4 -3
- data/lib/aws-sdk-core/plugins/protocols/rest_xml.rb +5 -1
- data/lib/aws-sdk-core/plugins/protocols/rpc_v2.rb +17 -0
- data/lib/aws-sdk-core/plugins/request_compression.rb +10 -1
- data/lib/aws-sdk-core/plugins/retry_errors.rb +10 -3
- data/lib/aws-sdk-core/plugins/user_agent.rb +58 -24
- data/lib/aws-sdk-core/process_credentials.rb +45 -27
- data/lib/aws-sdk-core/query/ec2_handler.rb +27 -0
- data/lib/aws-sdk-core/query/handler.rb +4 -4
- data/lib/aws-sdk-core/query.rb +2 -1
- data/lib/aws-sdk-core/rest/{request/content_type.rb → content_type_handler.rb} +1 -1
- data/lib/aws-sdk-core/rest/handler.rb +3 -4
- data/lib/aws-sdk-core/rest/request/endpoint.rb +3 -1
- data/lib/aws-sdk-core/rest.rb +1 -1
- data/lib/aws-sdk-core/rpc_v2/builder.rb +62 -0
- data/lib/aws-sdk-core/rpc_v2/content_type_handler.rb +45 -0
- data/lib/aws-sdk-core/rpc_v2/error_handler.rb +84 -0
- data/lib/aws-sdk-core/rpc_v2/handler.rb +74 -0
- data/lib/aws-sdk-core/rpc_v2/parser.rb +90 -0
- data/lib/aws-sdk-core/rpc_v2.rb +6 -0
- data/lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb +41 -0
- data/lib/aws-sdk-core/util.rb +4 -4
- data/lib/aws-sdk-core/waiters/poller.rb +1 -1
- data/lib/aws-sdk-core/xml/error_handler.rb +11 -37
- data/lib/aws-sdk-core/xml/parser.rb +2 -6
- data/lib/aws-sdk-core.rb +6 -2
- data/lib/aws-sdk-sso/client.rb +6 -3
- data/lib/aws-sdk-sso.rb +1 -1
- data/lib/aws-sdk-ssooidc/client.rb +6 -3
- data/lib/aws-sdk-ssooidc.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +6 -3
- data/lib/aws-sdk-sts.rb +1 -1
- data/lib/seahorse/client/base.rb +17 -7
- data/lib/seahorse/client/handler.rb +1 -1
- data/lib/seahorse/client/plugins/endpoint.rb +0 -1
- metadata +22 -8
- /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/oga.rb → oga_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
@@ -0,0 +1,106 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
# @api private
|
5
|
+
module Cbor
|
6
|
+
|
7
|
+
# CBOR Tagged data (Major type 6).
|
8
|
+
# A Tag consists of a tag number and a value.
|
9
|
+
# In the extended generic data model, a tag number's definition
|
10
|
+
# describes the additional semantics conveyed with the tag number.
|
11
|
+
# # @!method initialize(*args)
|
12
|
+
# @option args [Integer] :tag The tag number.
|
13
|
+
# @option args [Object] :value The tag's content.
|
14
|
+
# @!attribute tag
|
15
|
+
# The tag number.
|
16
|
+
# @return [Integer]
|
17
|
+
# @!attribute value
|
18
|
+
# The tag's content.
|
19
|
+
# @return [Object]
|
20
|
+
Tagged = Struct.new(:tag, :value)
|
21
|
+
|
22
|
+
class Error < StandardError; end
|
23
|
+
|
24
|
+
class OutOfBytesError < Error
|
25
|
+
def initialize(n, left)
|
26
|
+
super("Out of bytes. Trying to read #{n} bytes but buffer contains only #{left}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class UnknownTypeError < Error
|
31
|
+
def initialize(type)
|
32
|
+
super("Unable to encode #{type}")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class ExtraBytesError < Error
|
37
|
+
def initialize(pos, size)
|
38
|
+
super("Extra bytes follow after decoding item. Read #{pos} / #{size} bytes")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class UnexpectedBreakCodeError < Error; end
|
43
|
+
|
44
|
+
class UnexpectedAdditionalInformationError < Error
|
45
|
+
def initialize(add_info)
|
46
|
+
super("Unexpected additional information: #{add_info}")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class << self
|
51
|
+
# @param [Symbol,Class] engine
|
52
|
+
# Must be one of the following values:
|
53
|
+
#
|
54
|
+
# * :cbor
|
55
|
+
#
|
56
|
+
def engine=(engine)
|
57
|
+
@engine = Class === engine ? engine : load_engine(engine)
|
58
|
+
end
|
59
|
+
|
60
|
+
# @return [Class] Returns the default engine.
|
61
|
+
# One of:
|
62
|
+
#
|
63
|
+
# * {CborEngine}
|
64
|
+
#
|
65
|
+
def engine
|
66
|
+
set_default_engine unless @engine
|
67
|
+
@engine
|
68
|
+
end
|
69
|
+
|
70
|
+
def encode(data)
|
71
|
+
@engine.encode(data)
|
72
|
+
end
|
73
|
+
|
74
|
+
def decode(bytes)
|
75
|
+
bytes.force_encoding(Encoding::BINARY)
|
76
|
+
@engine.decode(bytes)
|
77
|
+
end
|
78
|
+
|
79
|
+
def set_default_engine
|
80
|
+
[:cbor].each do |name|
|
81
|
+
@engine ||= try_load_engine(name)
|
82
|
+
end
|
83
|
+
|
84
|
+
unless @engine
|
85
|
+
raise 'Unable to find a compatible cbor library.'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
def load_engine(name)
|
92
|
+
require "aws-sdk-core/cbor/#{name}_engine"
|
93
|
+
const_name = name[0].upcase + name[1..-1] + 'Engine'
|
94
|
+
const_get(const_name)
|
95
|
+
end
|
96
|
+
|
97
|
+
def try_load_engine(name)
|
98
|
+
load_engine(name)
|
99
|
+
rescue LoadError
|
100
|
+
false
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
set_default_engine
|
105
|
+
end
|
106
|
+
end
|
@@ -308,10 +308,11 @@ module Aws
|
|
308
308
|
def protocol_helper
|
309
309
|
case config.api.metadata['protocol']
|
310
310
|
when 'json' then Stubbing::Protocols::Json
|
311
|
-
when 'query' then Stubbing::Protocols::Query
|
312
|
-
when 'ec2' then Stubbing::Protocols::EC2
|
313
311
|
when 'rest-json' then Stubbing::Protocols::RestJson
|
314
312
|
when 'rest-xml' then Stubbing::Protocols::RestXml
|
313
|
+
when 'query' then Stubbing::Protocols::Query
|
314
|
+
when 'ec2' then Stubbing::Protocols::EC2
|
315
|
+
when 'smithy-rpc-v2-cbor' then Stubbing::Protocols::RpcV2
|
315
316
|
when 'api-gateway' then Stubbing::Protocols::ApiGateway
|
316
317
|
else raise "unsupported protocol"
|
317
318
|
end.new
|
@@ -28,7 +28,11 @@ module Aws
|
|
28
28
|
|
29
29
|
val = if (index = parts.first[BRACKET_REGEX, 1])
|
30
30
|
# remove brackets and index from part before indexing
|
31
|
-
|
31
|
+
if (base = parts.first.gsub(BRACKET_REGEX, '')) && !base.empty?
|
32
|
+
value[base][index.to_i]
|
33
|
+
else
|
34
|
+
value[index.to_i]
|
35
|
+
end
|
32
36
|
else
|
33
37
|
value[parts.first]
|
34
38
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
class ErrorHandler < Seahorse::Client::Handler
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
def error(context)
|
9
|
+
body = context.http_response.body_contents
|
10
|
+
if body.empty?
|
11
|
+
code, message, data = http_status_error(context)
|
12
|
+
else
|
13
|
+
code, message, data = extract_error(body, context)
|
14
|
+
end
|
15
|
+
build_error(context, code, message, data)
|
16
|
+
end
|
17
|
+
|
18
|
+
def build_error(context, code, message, data)
|
19
|
+
errors_module = context.client.class.errors_module
|
20
|
+
errors_module.error_class(code).new(context, message, data)
|
21
|
+
end
|
22
|
+
|
23
|
+
def http_status_error(context)
|
24
|
+
[http_status_error_code(context), '', EmptyStructure.new]
|
25
|
+
end
|
26
|
+
|
27
|
+
def http_status_error_code(context)
|
28
|
+
status_code = context.http_response.status_code
|
29
|
+
{
|
30
|
+
302 => 'MovedTemporarily',
|
31
|
+
304 => 'NotModified',
|
32
|
+
400 => 'BadRequest',
|
33
|
+
403 => 'Forbidden',
|
34
|
+
404 => 'NotFound',
|
35
|
+
412 => 'PreconditionFailed',
|
36
|
+
413 => 'RequestEntityTooLarge',
|
37
|
+
}[status_code] || "Http#{status_code}Error"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -2,10 +2,8 @@
|
|
2
2
|
|
3
3
|
module Aws
|
4
4
|
module Json
|
5
|
-
class ErrorHandler <
|
5
|
+
class ErrorHandler < Aws::ErrorHandler
|
6
6
|
|
7
|
-
# @param [Seahorse::Client::RequestContext] context
|
8
|
-
# @return [Seahorse::Client::Response]
|
9
7
|
def call(context)
|
10
8
|
@handler.call(context).on(300..599) do |response|
|
11
9
|
response.error = error(context)
|
@@ -19,7 +17,7 @@ module Aws
|
|
19
17
|
json = Json.load(body)
|
20
18
|
code = error_code(json, context)
|
21
19
|
message = error_message(code, json)
|
22
|
-
data = parse_error_data(context, code)
|
20
|
+
data = parse_error_data(context, body, code)
|
23
21
|
[code, message, data]
|
24
22
|
rescue Json::ParseError
|
25
23
|
[http_status_error_code(context), '', EmptyStructure.new]
|
@@ -48,7 +46,7 @@ module Aws
|
|
48
46
|
end
|
49
47
|
|
50
48
|
def remove_prefix(error_code, context)
|
51
|
-
if prefix = context.config.api.metadata['errorPrefix']
|
49
|
+
if (prefix = context.config.api.metadata['errorPrefix'])
|
52
50
|
error_code.sub(/^#{prefix}/, '')
|
53
51
|
else
|
54
52
|
error_code
|
@@ -63,9 +61,9 @@ module Aws
|
|
63
61
|
end
|
64
62
|
end
|
65
63
|
|
66
|
-
def parse_error_data(context, code)
|
64
|
+
def parse_error_data(context, body, code)
|
67
65
|
data = EmptyStructure.new
|
68
|
-
if error_rules = context.operation.errors
|
66
|
+
if (error_rules = context.operation.errors)
|
69
67
|
error_rules.each do |rule|
|
70
68
|
# match modeled shape name with the type(code) only
|
71
69
|
# some type(code) might contains invalid characters
|
@@ -73,7 +71,7 @@ module Aws
|
|
73
71
|
match = rule.shape.name == code.gsub(/[^^a-zA-Z0-9]/, '')
|
74
72
|
next unless match && rule.shape.members.any?
|
75
73
|
|
76
|
-
data = Parser.new(rule).parse(
|
74
|
+
data = Parser.new(rule).parse(body)
|
77
75
|
# errors support HTTP bindings
|
78
76
|
apply_error_headers(rule, context, data)
|
79
77
|
end
|
@@ -12,8 +12,7 @@ module Aws
|
|
12
12
|
build_request(context)
|
13
13
|
response = @handler.call(context)
|
14
14
|
response.on(200..299) { |resp| parse_response(resp) }
|
15
|
-
response.on(200..599) { |
|
16
|
-
response
|
15
|
+
response.on(200..599) { |_resp| apply_request_id(context) }
|
17
16
|
end
|
18
17
|
|
19
18
|
private
|
@@ -38,10 +37,10 @@ module Aws
|
|
38
37
|
end
|
39
38
|
|
40
39
|
def parse_body(context)
|
40
|
+
json = context.http_response.body_contents
|
41
41
|
if simple_json?(context)
|
42
|
-
Json.load(
|
43
|
-
elsif rules = context.operation.output
|
44
|
-
json = context.http_response.body_contents
|
42
|
+
Json.load(json)
|
43
|
+
elsif (rules = context.operation.output)
|
45
44
|
if json.is_a?(Array)
|
46
45
|
# an array of emitted events
|
47
46
|
if json[0].respond_to?(:response)
|
@@ -62,7 +61,7 @@ module Aws
|
|
62
61
|
Parser.new(
|
63
62
|
rules,
|
64
63
|
query_compatible: query_compatible?(context)
|
65
|
-
).parse(json
|
64
|
+
).parse(json)
|
66
65
|
end
|
67
66
|
else
|
68
67
|
EmptyStructure.new
|
@@ -1,10 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'oj'
|
4
|
+
|
3
5
|
module Aws
|
4
6
|
module Json
|
5
7
|
module OjEngine
|
6
8
|
# @api private
|
7
|
-
LOAD_OPTIONS = {
|
9
|
+
LOAD_OPTIONS = {
|
10
|
+
mode: :compat,
|
11
|
+
symbol_keys: false,
|
12
|
+
empty_string: false
|
13
|
+
}.freeze
|
8
14
|
|
9
15
|
# @api private
|
10
16
|
DUMP_OPTIONS = { mode: :compat }.freeze
|
data/lib/aws-sdk-core/json.rb
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'json'
|
4
3
|
require_relative 'json/builder'
|
5
4
|
require_relative 'json/error_handler'
|
6
5
|
require_relative 'json/handler'
|
7
6
|
require_relative 'json/parser'
|
8
|
-
require_relative 'json/json_engine'
|
9
|
-
require_relative 'json/oj_engine'
|
10
7
|
|
11
8
|
module Aws
|
12
9
|
# @api private
|
@@ -21,29 +18,61 @@ module Aws
|
|
21
18
|
end
|
22
19
|
|
23
20
|
class << self
|
24
|
-
|
25
|
-
|
21
|
+
# @param [Symbol,Class] engine
|
22
|
+
# Must be one of the following values:
|
23
|
+
#
|
24
|
+
# * :oj
|
25
|
+
# * :json
|
26
|
+
#
|
27
|
+
def engine=(engine)
|
28
|
+
@engine = Class === engine ? engine : load_engine(engine)
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Class] Returns the default engine.
|
32
|
+
# One of:
|
33
|
+
#
|
34
|
+
# * {OjEngine}
|
35
|
+
# * {JsonEngine}
|
36
|
+
#
|
37
|
+
def engine
|
38
|
+
set_default_engine unless @engine
|
39
|
+
@engine
|
26
40
|
end
|
27
41
|
|
28
|
-
def
|
29
|
-
load(
|
42
|
+
def load(json)
|
43
|
+
@engine.load(json)
|
30
44
|
end
|
31
45
|
|
32
46
|
def dump(value)
|
33
|
-
|
47
|
+
@engine.dump(value)
|
48
|
+
end
|
49
|
+
|
50
|
+
def set_default_engine
|
51
|
+
[:oj, :json].each do |name|
|
52
|
+
@engine ||= try_load_engine(name)
|
53
|
+
end
|
54
|
+
unless @engine
|
55
|
+
raise 'Unable to find a compatible json library. ' \
|
56
|
+
'Ensure that you have installed or added to your Gemfile one of ' \
|
57
|
+
'oj or json'
|
58
|
+
end
|
34
59
|
end
|
35
60
|
|
36
61
|
private
|
37
62
|
|
38
|
-
def
|
39
|
-
require
|
40
|
-
|
63
|
+
def load_engine(name)
|
64
|
+
require "aws-sdk-core/json/#{name}_engine"
|
65
|
+
const_name = name[0].upcase + name[1..-1] + 'Engine'
|
66
|
+
const_get(const_name)
|
67
|
+
end
|
68
|
+
|
69
|
+
def try_load_engine(name)
|
70
|
+
load_engine(name)
|
41
71
|
rescue LoadError
|
42
|
-
|
72
|
+
false
|
43
73
|
end
|
44
74
|
end
|
45
75
|
|
46
|
-
|
47
|
-
ENGINE = select_engine
|
76
|
+
set_default_engine
|
48
77
|
end
|
49
78
|
end
|
@@ -201,7 +201,7 @@ module Aws
|
|
201
201
|
def next_response(params)
|
202
202
|
params = next_page_params(params)
|
203
203
|
request = context.client.build_request(context.operation_name, params)
|
204
|
-
Aws::Plugins::UserAgent.
|
204
|
+
Aws::Plugins::UserAgent.metric('PAGINATOR') do
|
205
205
|
request.send_request
|
206
206
|
end
|
207
207
|
end
|
@@ -11,6 +11,8 @@ module Aws
|
|
11
11
|
# AttemptHandler comes just before we would retry an error.
|
12
12
|
# Or before we would follow redirects.
|
13
13
|
handlers.add(AttemptHandler, step: :sign, priority: 39)
|
14
|
+
# ErrorHandler comes after we have parsed an error.
|
15
|
+
handlers.add(ErrorHandler, step: :sign, priority: 95)
|
14
16
|
# LatencyHandler is as close to sending as possible.
|
15
17
|
handlers.add(LatencyHandler, step: :sign, priority: 0)
|
16
18
|
end
|
@@ -62,17 +64,27 @@ module Aws
|
|
62
64
|
call_attempt.x_amzn_request_id = headers["x-amzn-request-id"]
|
63
65
|
end
|
64
66
|
call_attempt.http_status_code = context.http_response.status_code
|
65
|
-
|
67
|
+
context.metadata[:current_call_attempt] = call_attempt
|
68
|
+
request_metrics.add_call_attempt(call_attempt)
|
69
|
+
resp
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
class ErrorHandler < Seahorse::Client::Handler
|
74
|
+
def call(context)
|
75
|
+
resp = @handler.call(context)
|
76
|
+
call_attempt = context.metadata[:current_call_attempt]
|
77
|
+
if (e = resp.error)
|
66
78
|
e_name = _extract_error_name(e)
|
67
79
|
e_msg = e.message
|
68
80
|
call_attempt.aws_exception = "#{e_name}"
|
69
81
|
call_attempt.aws_exception_msg = "#{e_msg}"
|
70
82
|
end
|
71
|
-
request_metrics.add_call_attempt(call_attempt)
|
72
83
|
resp
|
73
84
|
end
|
74
85
|
|
75
86
|
private
|
87
|
+
|
76
88
|
def _extract_error_name(error)
|
77
89
|
if error.is_a?(Aws::Errors::ServiceError)
|
78
90
|
error.class.code
|
@@ -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
|
@@ -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
|
@@ -4,13 +4,14 @@ module Aws
|
|
4
4
|
module Plugins
|
5
5
|
module Protocols
|
6
6
|
class RestJson < Seahorse::Client::Plugin
|
7
|
+
|
8
|
+
option(:protocol, 'rest-json')
|
9
|
+
|
7
10
|
handler(Rest::Handler)
|
8
|
-
# Rest::Handler will set a default JSON body, so size can be checked
|
9
|
-
# if this handler is run after serialization.
|
10
11
|
handler(Rest::ContentTypeHandler, priority: 30)
|
11
12
|
handler(Json::ErrorHandler, step: :sign)
|
12
|
-
end
|
13
13
|
|
14
|
+
end
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
@@ -4,9 +4,13 @@ module Aws
|
|
4
4
|
module Plugins
|
5
5
|
module Protocols
|
6
6
|
class RestXml < Seahorse::Client::Plugin
|
7
|
+
|
8
|
+
option(:protocol, 'rest-xml')
|
9
|
+
|
7
10
|
handler(Rest::Handler)
|
8
|
-
handler(Rest::ContentTypeHandler)
|
11
|
+
handler(Rest::ContentTypeHandler, priority: 30)
|
9
12
|
handler(Xml::ErrorHandler, step: :sign)
|
13
|
+
|
10
14
|
end
|
11
15
|
end
|
12
16
|
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
|
@@ -91,11 +91,20 @@ and 10485780 bytes inclusive.
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
94
|
-
@handler.call(context)
|
94
|
+
with_metric(selected_encoding) { @handler.call(context) }
|
95
95
|
end
|
96
96
|
|
97
97
|
private
|
98
98
|
|
99
|
+
def with_metric(encoding, &block)
|
100
|
+
case encoding
|
101
|
+
when 'gzip'
|
102
|
+
Aws::Plugins::UserAgent.metric('GZIP_REQUEST_COMPRESSION', &block)
|
103
|
+
else
|
104
|
+
block.call
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
99
108
|
def request_encoding_selection(context)
|
100
109
|
encoding_list = context.operation.request_compression['encodings']
|
101
110
|
encoding_list.find { |encoding| RequestCompression::SUPPORTED_ENCODINGS.include?(encoding) }
|