aws-sdk-core 3.198.0 → 3.199.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -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/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/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/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.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/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 +1 -1
- data/lib/aws-sdk-sso.rb +1 -1
- data/lib/aws-sdk-ssooidc/client.rb +1 -1
- data/lib/aws-sdk-ssooidc.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +1 -1
- data/lib/aws-sdk-sts.rb +1 -1
- data/lib/seahorse/client/handler.rb +1 -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
|
@@ -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
|
@@ -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
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
# @api private
|
5
|
+
module Query
|
6
|
+
class EC2Handler < Aws::Query::Handler
|
7
|
+
|
8
|
+
def apply_params(param_list, params, rules)
|
9
|
+
Aws::Query::EC2ParamBuilder.new(param_list).apply(rules, params)
|
10
|
+
end
|
11
|
+
|
12
|
+
def parse_xml(context)
|
13
|
+
if (rules = context.operation.output)
|
14
|
+
parser = Xml::Parser.new(rules)
|
15
|
+
parser.parse(xml(context)) do |path, value|
|
16
|
+
if path.size == 2 && path.last == 'requestId'
|
17
|
+
context.metadata[:request_id] = value
|
18
|
+
end
|
19
|
+
end
|
20
|
+
else
|
21
|
+
EmptyStructure.new
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -27,13 +27,13 @@ module Aws
|
|
27
27
|
# @return [Seahorse::Client::Response]
|
28
28
|
def call(context)
|
29
29
|
build_request(context)
|
30
|
-
@handler.call(context).on_success do |
|
31
|
-
|
30
|
+
@handler.call(context).on_success do |resp|
|
31
|
+
resp.error = nil
|
32
32
|
parsed = parse_xml(context)
|
33
33
|
if parsed.nil? || parsed == EmptyStructure
|
34
|
-
|
34
|
+
resp.data = EmptyStructure.new
|
35
35
|
else
|
36
|
-
|
36
|
+
resp.data = parsed
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/lib/aws-sdk-core/query.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative 'query/ec2_param_builder'
|
4
3
|
require_relative 'query/handler'
|
4
|
+
require_relative 'query/ec2_handler'
|
5
5
|
require_relative 'query/param'
|
6
6
|
require_relative 'query/param_builder'
|
7
|
+
require_relative 'query/ec2_param_builder'
|
7
8
|
require_relative 'query/param_list'
|
@@ -7,10 +7,9 @@ module Aws
|
|
7
7
|
|
8
8
|
def call(context)
|
9
9
|
Rest::Request::Builder.new.apply(context)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
resp
|
10
|
+
response = @handler.call(context)
|
11
|
+
response.on(200..299) { |resp| Response::Parser.new.apply(resp) }
|
12
|
+
response.on(200..599) { |_resp| apply_request_id(context) }
|
14
13
|
end
|
15
14
|
|
16
15
|
private
|
data/lib/aws-sdk-core/rest.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'rest/handler'
|
4
|
+
require_relative 'rest/content_type_handler'
|
4
5
|
require_relative 'rest/request/body'
|
5
6
|
require_relative 'rest/request/builder'
|
6
7
|
require_relative 'rest/request/endpoint'
|
7
8
|
require_relative 'rest/request/headers'
|
8
9
|
require_relative 'rest/request/querystring_builder'
|
9
|
-
require_relative 'rest/request/content_type'
|
10
10
|
require_relative 'rest/response/body'
|
11
11
|
require_relative 'rest/response/headers'
|
12
12
|
require_relative 'rest/response/parser'
|