aws-sdk-core 3.191.0 → 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 +153 -1
- data/VERSION +1 -1
- 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/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/credential_provider.rb +1 -1
- data/lib/aws-sdk-core/ec2_metadata.rb +1 -1
- data/lib/aws-sdk-core/ecs_credentials.rb +2 -1
- 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/event_emitter.rb +0 -16
- data/lib/aws-sdk-core/instance_profile_credentials.rb +3 -2
- data/lib/aws-sdk-core/json/builder.rb +8 -1
- data/lib/aws-sdk-core/json/error_handler.rb +15 -10
- 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 +6 -1
- data/lib/aws-sdk-core/json.rb +43 -14
- data/lib/aws-sdk-core/lru_cache.rb +75 -0
- data/lib/aws-sdk-core/pageable_response.rb +1 -1
- data/lib/aws-sdk-core/param_validator.rb +7 -2
- 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/invocation_id.rb +1 -11
- 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/request_compression.rb +11 -2
- data/lib/aws-sdk-core/plugins/retry_errors.rb +10 -3
- data/lib/aws-sdk-core/plugins/sign.rb +8 -3
- data/lib/aws-sdk-core/plugins/user_agent.rb +61 -26
- 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/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/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 +23 -11
- 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/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 +39 -0
- data/lib/aws-sdk-core/waiters/poller.rb +1 -1
- 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/stack.rb +2 -0
- data/lib/aws-sdk-core/xml/parser.rb +2 -6
- data/lib/aws-sdk-core.rb +7 -2
- data/lib/aws-sdk-sso/client.rb +77 -49
- data/lib/aws-sdk-sso.rb +1 -1
- data/lib/aws-sdk-ssooidc/client.rb +127 -51
- data/lib/aws-sdk-ssooidc/client_api.rb +22 -0
- data/lib/aws-sdk-ssooidc/errors.rb +21 -0
- data/lib/aws-sdk-ssooidc/types.rb +77 -9
- data/lib/aws-sdk-ssooidc.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +77 -49
- data/lib/aws-sdk-sts/client_api.rb +8 -8
- data/lib/aws-sdk-sts.rb +1 -1
- data/lib/seahorse/client/async_base.rb +1 -1
- data/lib/seahorse/client/async_response.rb +19 -0
- data/lib/seahorse/client/base.rb +18 -7
- data/lib/seahorse/client/h2/handler.rb +1 -0
- data/lib/seahorse/client/handler.rb +1 -1
- data/lib/seahorse/client/net_http/connection_pool.rb +3 -9
- data/lib/seahorse/client/plugin.rb +8 -0
- data/lib/seahorse/client/plugins/endpoint.rb +0 -1
- data/lib/seahorse/client/plugins/net_http.rb +48 -16
- data/lib/seahorse/model/shapes.rb +2 -2
- metadata +24 -7
- /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
|
@@ -17,6 +17,8 @@ module Aws
|
|
|
17
17
|
|
|
18
18
|
# @param [String<JSON>] json
|
|
19
19
|
def parse(json, target = nil)
|
|
20
|
+
json = '{}' if json.empty?
|
|
21
|
+
|
|
20
22
|
parse_ref(@rules, Json.load(json), target)
|
|
21
23
|
end
|
|
22
24
|
|
|
@@ -69,6 +71,8 @@ module Aws
|
|
|
69
71
|
def map(ref, values, target = nil)
|
|
70
72
|
target = {} if target.nil?
|
|
71
73
|
values.each do |key, value|
|
|
74
|
+
next if value.nil?
|
|
75
|
+
|
|
72
76
|
target[key] = parse_ref(ref.shape.value, value)
|
|
73
77
|
end
|
|
74
78
|
target
|
|
@@ -85,6 +89,7 @@ module Aws
|
|
|
85
89
|
when TimestampShape then time(value)
|
|
86
90
|
when BlobShape then Base64.decode64(value)
|
|
87
91
|
when BooleanShape then value.to_s == 'true'
|
|
92
|
+
when FloatShape then Util.deserialize_number(value)
|
|
88
93
|
else value
|
|
89
94
|
end
|
|
90
95
|
end
|
|
@@ -93,7 +98,7 @@ module Aws
|
|
|
93
98
|
# @param [String, Integer] value
|
|
94
99
|
# @return [Time]
|
|
95
100
|
def time(value)
|
|
96
|
-
value.is_a?(Numeric) ? Time.at(value) :
|
|
101
|
+
value.is_a?(Numeric) ? Time.at(value) : Aws::Util.deserialize_time(value)
|
|
97
102
|
end
|
|
98
103
|
|
|
99
104
|
def flattened_list?(shape)
|
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
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
# @api private
|
|
5
|
+
# A simple thread safe LRU cache
|
|
6
|
+
class LRUCache
|
|
7
|
+
# @param [Hash] options
|
|
8
|
+
# @option options [Integer] :max_entries (100) Maximum number of entries
|
|
9
|
+
# @option options [Integer] :expiration (nil) Expiration time in seconds
|
|
10
|
+
def initialize(options = {})
|
|
11
|
+
@max_entries = options[:max_entries] || 100
|
|
12
|
+
@expiration = options[:expiration]
|
|
13
|
+
@entries = {}
|
|
14
|
+
@mutex = Mutex.new
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# @param [String] key
|
|
18
|
+
# @return [Object]
|
|
19
|
+
def [](key)
|
|
20
|
+
@mutex.synchronize do
|
|
21
|
+
value = @entries[key]
|
|
22
|
+
if value
|
|
23
|
+
@entries.delete(key)
|
|
24
|
+
@entries[key] = value unless value.expired?
|
|
25
|
+
end
|
|
26
|
+
@entries[key]&.value
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# @param [String] key
|
|
31
|
+
# @param [Object] value
|
|
32
|
+
def []=(key, value)
|
|
33
|
+
@mutex.synchronize do
|
|
34
|
+
@entries.shift unless @entries.size < @max_entries
|
|
35
|
+
# delete old value if exists
|
|
36
|
+
@entries.delete(key)
|
|
37
|
+
@entries[key] = Entry.new(value: value, expiration: @expiration)
|
|
38
|
+
@entries[key].value
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# @param [String] key
|
|
43
|
+
# @return [Boolean]
|
|
44
|
+
def key?(key)
|
|
45
|
+
@mutex.synchronize do
|
|
46
|
+
@entries.delete(key) if @entries.key?(key) && @entries[key].expired?
|
|
47
|
+
@entries.key?(key)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def clear
|
|
52
|
+
@mutex.synchronize do
|
|
53
|
+
@entries.clear
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# @api private
|
|
58
|
+
class Entry
|
|
59
|
+
def initialize(options = {})
|
|
60
|
+
@value = options[:value]
|
|
61
|
+
@expiration = options[:expiration]
|
|
62
|
+
@created_time = Time.now
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# @return [Object]
|
|
66
|
+
attr_reader :value
|
|
67
|
+
|
|
68
|
+
def expired?
|
|
69
|
+
return false unless @expiration
|
|
70
|
+
|
|
71
|
+
Time.now - @created_time > @expiration
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
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
|
|
@@ -71,9 +71,10 @@ module Aws
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
if @validate_required && shape.union
|
|
74
|
-
|
|
74
|
+
set_values = @input ? values.length : values.to_h.length
|
|
75
|
+
if set_values > 1
|
|
75
76
|
errors << "multiple values provided to union at #{context} - must contain exactly one of the supported types: #{shape.member_names.join(', ')}"
|
|
76
|
-
elsif
|
|
77
|
+
elsif set_values == 0
|
|
77
78
|
errors << "No values provided to union at #{context} - must contain exactly one of the supported types: #{shape.member_names.join(', ')}"
|
|
78
79
|
end
|
|
79
80
|
end
|
|
@@ -106,6 +107,8 @@ module Aws
|
|
|
106
107
|
# validate members
|
|
107
108
|
member_ref = ref.shape.member
|
|
108
109
|
values.each.with_index do |value, index|
|
|
110
|
+
next unless value
|
|
111
|
+
|
|
109
112
|
shape(member_ref, value, errors, context + "[#{index}]")
|
|
110
113
|
end
|
|
111
114
|
end
|
|
@@ -121,6 +124,8 @@ module Aws
|
|
|
121
124
|
|
|
122
125
|
values.each do |key, value|
|
|
123
126
|
shape(key_ref, key, errors, "#{context} #{key.inspect} key")
|
|
127
|
+
next unless value
|
|
128
|
+
|
|
124
129
|
shape(value_ref, value, errors, context + "[#{key.inspect}]")
|
|
125
130
|
end
|
|
126
131
|
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
|
|
@@ -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
|
|
@@ -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
|
|
@@ -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) }
|
|
@@ -104,7 +113,7 @@ and 10485780 bytes inclusive.
|
|
|
104
113
|
def update_content_encoding(encoding, context)
|
|
105
114
|
headers = context.http_request.headers
|
|
106
115
|
if headers['Content-Encoding']
|
|
107
|
-
headers['Content-Encoding'] +=
|
|
116
|
+
headers['Content-Encoding'] += ", #{encoding}"
|
|
108
117
|
else
|
|
109
118
|
headers['Content-Encoding'] = encoding
|
|
110
119
|
end
|
|
@@ -113,7 +113,6 @@ Specifies which retry algorithm to use. Values are:
|
|
|
113
113
|
functionality of `standard` mode along with automatic client side
|
|
114
114
|
throttling. This is a provisional mode that may change behavior
|
|
115
115
|
in the future.
|
|
116
|
-
|
|
117
116
|
DOCS
|
|
118
117
|
resolve_retry_mode(cfg)
|
|
119
118
|
end
|
|
@@ -235,7 +234,7 @@ a clock skew correction and retry requests with skewed client clocks.
|
|
|
235
234
|
|
|
236
235
|
get_send_token(config)
|
|
237
236
|
add_retry_headers(context)
|
|
238
|
-
response = @handler.call(context)
|
|
237
|
+
response = with_metric(config.retry_mode) { @handler.call(context) }
|
|
239
238
|
error_inspector = Retries::ErrorInspector.new(
|
|
240
239
|
response.error, response.context.http_response.status_code
|
|
241
240
|
)
|
|
@@ -272,6 +271,10 @@ a clock skew correction and retry requests with skewed client clocks.
|
|
|
272
271
|
|
|
273
272
|
private
|
|
274
273
|
|
|
274
|
+
def with_metric(retry_mode, &block)
|
|
275
|
+
Aws::Plugins::UserAgent.metric("RETRY_MODE_#{retry_mode.upcase}", &block)
|
|
276
|
+
end
|
|
277
|
+
|
|
275
278
|
def get_send_token(config)
|
|
276
279
|
# either fail fast or block until a token becomes available
|
|
277
280
|
# must be configurable
|
|
@@ -359,7 +362,7 @@ a clock skew correction and retry requests with skewed client clocks.
|
|
|
359
362
|
class LegacyHandler < Seahorse::Client::Handler
|
|
360
363
|
|
|
361
364
|
def call(context)
|
|
362
|
-
response = @handler.call(context)
|
|
365
|
+
response = with_metric { @handler.call(context) }
|
|
363
366
|
if response.error
|
|
364
367
|
error_inspector = Retries::ErrorInspector.new(
|
|
365
368
|
response.error, response.context.http_response.status_code
|
|
@@ -378,6 +381,10 @@ a clock skew correction and retry requests with skewed client clocks.
|
|
|
378
381
|
|
|
379
382
|
private
|
|
380
383
|
|
|
384
|
+
def with_metric(&block)
|
|
385
|
+
Aws::Plugins::UserAgent.metric('RETRY_MODE_LEGACY', &block)
|
|
386
|
+
end
|
|
387
|
+
|
|
381
388
|
def retry_if_possible(response, error_inspector)
|
|
382
389
|
context = response.context
|
|
383
390
|
if should_retry?(context, error_inspector)
|
|
@@ -159,9 +159,14 @@ module Aws
|
|
|
159
159
|
private
|
|
160
160
|
|
|
161
161
|
def apply_authtype(context, req)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
req.headers['X-Amz-Content-Sha256']
|
|
162
|
+
# only used for eventstreaming at input
|
|
163
|
+
if context[:input_event_emitter]
|
|
164
|
+
req.headers['X-Amz-Content-Sha256'] = 'STREAMING-AWS4-HMAC-SHA256-EVENTS'
|
|
165
|
+
else
|
|
166
|
+
if context.operation['authtype'].eql?('v4-unsigned-body') &&
|
|
167
|
+
req.endpoint.scheme.eql?('https')
|
|
168
|
+
req.headers['X-Amz-Content-Sha256'] ||= 'UNSIGNED-PAYLOAD'
|
|
169
|
+
end
|
|
165
170
|
end
|
|
166
171
|
end
|
|
167
172
|
|