aws-sdk-core 3.191.0 → 3.196.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 +109 -1
- data/VERSION +1 -1
- data/lib/aws-sdk-core/binary/decode_handler.rb +0 -5
- data/lib/aws-sdk-core/binary/event_builder.rb +34 -37
- 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/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 +10 -3
- data/lib/aws-sdk-core/json/parser.rb +4 -1
- data/lib/aws-sdk-core/lru_cache.rb +75 -0
- data/lib/aws-sdk-core/param_validator.rb +7 -2
- data/lib/aws-sdk-core/plugins/invocation_id.rb +1 -11
- data/lib/aws-sdk-core/plugins/protocols/rest_json.rb +3 -16
- data/lib/aws-sdk-core/plugins/protocols/rest_xml.rb +1 -2
- data/lib/aws-sdk-core/plugins/request_compression.rb +1 -1
- data/lib/aws-sdk-core/plugins/sign.rb +8 -3
- data/lib/aws-sdk-core/plugins/user_agent.rb +3 -2
- data/lib/aws-sdk-core/query/ec2_param_builder.rb +5 -7
- data/lib/aws-sdk-core/query/param_builder.rb +2 -2
- data/lib/aws-sdk-core/rest/request/body.rb +32 -5
- data/lib/aws-sdk-core/rest/request/content_type.rb +60 -0
- data/lib/aws-sdk-core/rest/request/endpoint.rb +22 -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/util.rb +39 -0
- data/lib/aws-sdk-core/xml/builder.rb +17 -9
- data/lib/aws-sdk-core/xml/error_handler.rb +24 -8
- 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.rb +1 -0
- data/lib/aws-sdk-sso/client.rb +73 -48
- data/lib/aws-sdk-sso.rb +1 -1
- data/lib/aws-sdk-ssooidc/client.rb +123 -50
- 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 +73 -48
- 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 +1 -0
- data/lib/seahorse/client/h2/handler.rb +1 -0
- data/lib/seahorse/client/net_http/connection_pool.rb +1 -5
- data/lib/seahorse/client/plugin.rb +8 -0
- data/lib/seahorse/client/plugins/net_http.rb +48 -16
- data/lib/seahorse/model/shapes.rb +2 -2
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38baa5f7b8c77b4293d842d10dd49ecb5a89d6379faf9c75defeee9ee32807e0
|
4
|
+
data.tar.gz: bc11ac0a12fe12a01bfb96b73f0aee6a3191093df934d513ba341eee16af3f3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23cfcd58e52393a89a3fc1037d04b34a2f9be5d7c8dd854ec8516b0cb4db63103c4c0fac9baead9f8e2e56796b9a4caa65715080a9a71afdf7520a386d4d180e
|
7
|
+
data.tar.gz: e316e4d7b18f74bce1b5280bd1a26d73d182baae9bc240a95e22b9ce6413817e5d8a9261c1d005cc72dc42db8bb7660011e7d144f8984fedf5eac140453e4e51
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,114 @@
|
|
1
1
|
Unreleased Changes
|
2
2
|
------------------
|
3
3
|
|
4
|
+
3.196.0 (2024-05-13)
|
5
|
+
------------------
|
6
|
+
|
7
|
+
* Feature - Updated Aws::STS::Client with the latest API changes.
|
8
|
+
|
9
|
+
* Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
|
10
|
+
|
11
|
+
* Feature - Updated Aws::SSO::Client with the latest API changes.
|
12
|
+
|
13
|
+
3.195.0 (2024-05-10)
|
14
|
+
------------------
|
15
|
+
|
16
|
+
* Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
|
17
|
+
|
18
|
+
* Feature - Updated request parameters for PKCE support.
|
19
|
+
|
20
|
+
3.194.2 (2024-05-07)
|
21
|
+
------------------
|
22
|
+
|
23
|
+
* Issue - Fix issue where `ConnectionPool` size iteration would prevent a new key from being added to the pool.
|
24
|
+
|
25
|
+
3.194.1 (2024-05-03)
|
26
|
+
------------------
|
27
|
+
|
28
|
+
* Issue - Update EC2 protocol to not serialize empty lists.
|
29
|
+
|
30
|
+
3.194.0 (2024-04-30)
|
31
|
+
------------------
|
32
|
+
|
33
|
+
* Feature - Add an API private cache for S3 Express and Access Grants.
|
34
|
+
|
35
|
+
3.193.0 (2024-04-25)
|
36
|
+
------------------
|
37
|
+
|
38
|
+
* Feature - Updated Aws::STS::Client with the latest API changes.
|
39
|
+
|
40
|
+
* Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
|
41
|
+
|
42
|
+
* Feature - Updated Aws::SSO::Client with the latest API changes.
|
43
|
+
|
44
|
+
* Issue - Update event stream documentation.
|
45
|
+
* Issue - Move `InvocationId` plugin to all clients.
|
46
|
+
* Issue - Handle event streaming content-sha256 header in the signer plugin.
|
47
|
+
* Issue - Add the event stream content type to initial requests.
|
48
|
+
* Issue - Fix `standard` and `adaptive` retry mode for event streams.
|
49
|
+
* Issue - Add `authority` to http2 headers.
|
50
|
+
* Issue - Do not treat single members in event stream structures as implicit payloads.
|
51
|
+
* Issue - Do not wait for initial response headers to start sending input events.
|
52
|
+
|
53
|
+
3.192.1 (2024-04-18)
|
54
|
+
------------------
|
55
|
+
|
56
|
+
* Issue - Drop key/value pair if value is `nil` when deserializing json maps.
|
57
|
+
|
58
|
+
3.192.0 (2024-04-16)
|
59
|
+
------------------
|
60
|
+
|
61
|
+
* Feature - Updated Aws::STS::Client with the latest API changes.
|
62
|
+
|
63
|
+
* Feature - Update serializing/deserializing for all protocols to align with Smithy protocol-tests.
|
64
|
+
* Issue - Allow `nil` values in lists and maps.
|
65
|
+
* Issue - Populate headers for XML and JSON error responses.
|
66
|
+
* Issue - Support fractional seconds when parsing `DateTime` timestamps.
|
67
|
+
* Issue - Correctly serialize flattened lists for Query protocol.
|
68
|
+
* Issue - Correctly serialize payload name in Rest-XML requests.
|
69
|
+
* Issue - Fix an issue where Rest-XML requests do not have a default `Content-Type` header applied.
|
70
|
+
* Issue - Apply appropriate `Content-Type` header for payloads in Rest services.
|
71
|
+
* Issue - Correctly serialize URI label bindings in Rest requests.
|
72
|
+
* Issue - Correctly serialize and parse header bindings in Rest services.
|
73
|
+
* Issue - Ensure that null and empty headers are not sent in Rest requests.
|
74
|
+
* Issue - Ensure keys in query maps do not override modeled keys in Rest requests.
|
75
|
+
* Issue - Ensure empty blob payloads are omitted in Rest requests.
|
76
|
+
* Issue - Support parsing of `NaN`, `Infinity` and `-Infinity` float values.
|
77
|
+
* Issue - Apply appropriate `xmlName` for flattened lists and maps in Rest-XML services.
|
78
|
+
* Issue - Handle serializing of different formats of `xmlNamespace` on shapes.
|
79
|
+
* Issue - Fix deserializing of an empty blob to produce an empty string.
|
80
|
+
* Issue - Fix deserializing an empty self-closed blob to produce an empty string.
|
81
|
+
* Issue - Support parsing of different formats of error data in Rest-XML services.
|
82
|
+
|
83
|
+
3.191.6 (2024-04-02)
|
84
|
+
------------------
|
85
|
+
* Issue - Performance optimization: ensure presence and order of instance variables in `PluginOptions` (#3002).
|
86
|
+
|
87
|
+
3.191.5 (2024-03-26)
|
88
|
+
------------------
|
89
|
+
|
90
|
+
* Issue - Fix `EC2Metadata` and `InstanceProfileCredentials` to respect the port from a configured endpoint from code, ENV, or shared config.
|
91
|
+
|
92
|
+
3.191.4 (2024-03-15)
|
93
|
+
------------------
|
94
|
+
|
95
|
+
* Issue - Ensure output unions work correctly with stub_responses.
|
96
|
+
|
97
|
+
3.191.3 (2024-02-20)
|
98
|
+
------------------
|
99
|
+
|
100
|
+
* Issue - Remove base64 as dependency.
|
101
|
+
|
102
|
+
3.191.2 (2024-02-14)
|
103
|
+
------------------
|
104
|
+
|
105
|
+
* Issue - Add base64 as dependency to prepare for Ruby 3.4 release (#2984).
|
106
|
+
|
107
|
+
3.191.1 (2024-02-07)
|
108
|
+
------------------
|
109
|
+
|
110
|
+
* Issue - Warn on previously silent credential failures (#2981).
|
111
|
+
|
4
112
|
3.191.0 (2024-01-26)
|
5
113
|
------------------
|
6
114
|
|
@@ -10,7 +118,7 @@ Unreleased Changes
|
|
10
118
|
|
11
119
|
* Feature - Updated Aws::SSO::Client with the latest API changes.
|
12
120
|
|
13
|
-
* Feature - Add RBS signature files to support static type checking
|
121
|
+
* Feature - Add RBS signature files to support static type checking
|
14
122
|
|
15
123
|
3.190.3 (2024-01-16)
|
16
124
|
------------------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.196.0
|
@@ -33,11 +33,6 @@ module Aws
|
|
33
33
|
context.operation.errors,
|
34
34
|
context.http_response.body,
|
35
35
|
output_handler)
|
36
|
-
if input_emitter = context[:input_event_emitter]
|
37
|
-
# #emit will be blocked until 200 success
|
38
|
-
# see Aws::EventEmitter#emit
|
39
|
-
input_emitter.signal_queue << "ready"
|
40
|
-
end
|
41
36
|
end
|
42
37
|
|
43
38
|
context.http_response.on_success(200) do
|
@@ -42,41 +42,39 @@ module Aws
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
#
|
46
|
-
if !explicit_payload && !implicit_payload_members.empty?
|
47
|
-
if implicit_payload_members.size > 1
|
48
|
-
payload_shape = Shapes::StructureShape.new
|
49
|
-
implicit_payload_members.each do |m_name, m_ref|
|
50
|
-
payload_shape.add_member(m_name, m_ref)
|
51
|
-
end
|
52
|
-
payload_ref = Shapes::ShapeRef.new(shape: payload_shape)
|
53
|
-
|
54
|
-
payload = build_payload_members(payload_ref, params)
|
55
|
-
else
|
56
|
-
m_name, m_ref = implicit_payload_members.first
|
57
|
-
streaming, content_type = _content_type(m_ref.shape)
|
58
|
-
|
59
|
-
es_headers[":content-type"] = Aws::EventStream::HeaderValue.new(
|
60
|
-
type: "string", value: content_type)
|
61
|
-
payload = _build_payload(streaming, m_ref, params[m_name])
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
|
45
|
+
# handle header members for all cases
|
66
46
|
event_ref.shape.members.each do |member_name, member_ref|
|
67
47
|
if member_ref.eventheader && params[member_name]
|
68
48
|
header_value = params[member_name]
|
69
49
|
es_headers[member_ref.shape.name] = Aws::EventStream::HeaderValue.new(
|
70
|
-
type:
|
50
|
+
type: header_value_type(member_ref.shape, header_value),
|
71
51
|
value: header_value
|
72
52
|
)
|
73
|
-
|
74
|
-
|
75
|
-
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# implict payload
|
57
|
+
if !explicit_payload && !implicit_payload_members.empty?
|
58
|
+
payload_shape = StructureShape.new
|
59
|
+
implicit_payload_members.each do |m_name, m_ref|
|
60
|
+
payload_shape.add_member(m_name, m_ref)
|
61
|
+
end
|
62
|
+
payload_ref = ShapeRef.new(shape: payload_shape)
|
76
63
|
|
77
|
-
|
78
|
-
|
79
|
-
|
64
|
+
payload = build_payload_members(payload_ref, params)
|
65
|
+
.force_encoding(Encoding::BINARY)
|
66
|
+
|
67
|
+
|
68
|
+
es_headers[":content-type"] = Aws::EventStream::HeaderValue.new(
|
69
|
+
type: "string", value: content_type(payload_ref.shape))
|
70
|
+
else
|
71
|
+
# explicit payload, serialize just the payload member
|
72
|
+
event_ref.shape.members.each do |member_name, member_ref|
|
73
|
+
if member_ref.eventpayload && params[member_name]
|
74
|
+
es_headers[":content-type"] = Aws::EventStream::HeaderValue.new(
|
75
|
+
type: "string", value: content_type(member_ref.shape))
|
76
|
+
payload = params[member_name]
|
77
|
+
end
|
80
78
|
end
|
81
79
|
end
|
82
80
|
|
@@ -86,15 +84,15 @@ module Aws
|
|
86
84
|
)
|
87
85
|
end
|
88
86
|
|
89
|
-
def
|
87
|
+
def content_type(shape)
|
90
88
|
case shape
|
91
|
-
when BlobShape then
|
92
|
-
when StringShape then
|
89
|
+
when BlobShape then "application/octet-stream"
|
90
|
+
when StringShape then "text/plain"
|
93
91
|
when StructureShape then
|
94
92
|
if @serializer_class.name.include?('Xml')
|
95
|
-
|
93
|
+
"text/xml"
|
96
94
|
elsif @serializer_class.name.include?('Json')
|
97
|
-
|
95
|
+
"application/json"
|
98
96
|
end
|
99
97
|
else
|
100
98
|
raise Aws::Errors::EventStreamBuilderError.new(
|
@@ -102,7 +100,7 @@ module Aws
|
|
102
100
|
end
|
103
101
|
end
|
104
102
|
|
105
|
-
def
|
103
|
+
def header_value_type(shape, value)
|
106
104
|
case shape
|
107
105
|
when StringShape then "string"
|
108
106
|
when IntegerShape then "integer"
|
@@ -115,10 +113,9 @@ module Aws
|
|
115
113
|
end
|
116
114
|
end
|
117
115
|
|
118
|
-
def
|
119
|
-
|
116
|
+
def build_payload_members(payload_ref, params)
|
117
|
+
@serializer_class.new(payload_ref).serialize(params)
|
120
118
|
end
|
121
|
-
|
122
119
|
end
|
123
120
|
end
|
124
121
|
end
|
@@ -183,7 +183,7 @@ module Aws
|
|
183
183
|
|
184
184
|
def open_connection
|
185
185
|
uri = URI.parse(@endpoint)
|
186
|
-
http = Net::HTTP.new(uri.hostname || @endpoint,
|
186
|
+
http = Net::HTTP.new(uri.hostname || @endpoint, uri.port || @port)
|
187
187
|
http.open_timeout = @http_open_timeout
|
188
188
|
http.read_timeout = @http_read_timeout
|
189
189
|
http.set_debug_output(@http_debug_output) if @http_debug_output
|
@@ -6,7 +6,6 @@ module Aws
|
|
6
6
|
def initialize
|
7
7
|
@listeners = {}
|
8
8
|
@validate_event = true
|
9
|
-
@status = :sleep
|
10
9
|
@signal_queue = Queue.new
|
11
10
|
end
|
12
11
|
|
@@ -40,25 +39,10 @@ module Aws
|
|
40
39
|
Aws::ParamValidator.validate!(
|
41
40
|
@encoder.rules.shape.member(type), params)
|
42
41
|
end
|
43
|
-
_ready_for_events?
|
44
42
|
@stream.data(
|
45
43
|
@encoder.encode(type, params),
|
46
44
|
end_stream: type == :end_stream
|
47
45
|
)
|
48
46
|
end
|
49
|
-
|
50
|
-
private
|
51
|
-
|
52
|
-
def _ready_for_events?
|
53
|
-
return true if @status == :ready
|
54
|
-
|
55
|
-
# blocked until once initial 200 response is received
|
56
|
-
# signal will be available in @signal_queue
|
57
|
-
# and this check will no longer be blocked
|
58
|
-
@signal_queue.pop
|
59
|
-
@status = :ready
|
60
|
-
true
|
61
|
-
end
|
62
|
-
|
63
47
|
end
|
64
48
|
end
|
@@ -215,7 +215,8 @@ module Aws
|
|
215
215
|
_get_credentials(conn, token)
|
216
216
|
end
|
217
217
|
end
|
218
|
-
rescue
|
218
|
+
rescue => e
|
219
|
+
warn("Error retrieving instance profile credentials: #{e}")
|
219
220
|
'{}'
|
220
221
|
end
|
221
222
|
end
|
@@ -261,7 +262,7 @@ module Aws
|
|
261
262
|
|
262
263
|
def open_connection
|
263
264
|
uri = URI.parse(@endpoint)
|
264
|
-
http = Net::HTTP.new(uri.hostname || @endpoint,
|
265
|
+
http = Net::HTTP.new(uri.hostname || @endpoint, uri.port || @port)
|
265
266
|
http.open_timeout = @http_open_timeout
|
266
267
|
http.read_timeout = @http_read_timeout
|
267
268
|
http.set_debug_output(@http_debug_output) if @http_debug_output
|
@@ -8,7 +8,7 @@ module Aws
|
|
8
8
|
|
9
9
|
include Seahorse::Model::Shapes
|
10
10
|
|
11
|
-
def initialize(rules)
|
11
|
+
def initialize(rules, _options = {})
|
12
12
|
@rules = rules
|
13
13
|
end
|
14
14
|
|
@@ -20,6 +20,8 @@ module Aws
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def structure(ref, values)
|
23
|
+
return nil if values.nil?
|
24
|
+
|
23
25
|
shape = ref.shape
|
24
26
|
values.each_pair.with_object({}) do |(key, value), data|
|
25
27
|
if shape.member?(key) && !value.nil?
|
@@ -31,11 +33,15 @@ module Aws
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def list(ref, values)
|
36
|
+
return nil if values.nil?
|
37
|
+
|
34
38
|
member_ref = ref.shape.member
|
35
39
|
values.collect { |value| format(member_ref, value) }
|
36
40
|
end
|
37
41
|
|
38
42
|
def map(ref, values)
|
43
|
+
return nil if values.nil?
|
44
|
+
|
39
45
|
value_ref = ref.shape.value
|
40
46
|
values.each.with_object({}) do |(key, value), data|
|
41
47
|
data[key] = format(value_ref, value)
|
@@ -49,6 +55,7 @@ module Aws
|
|
49
55
|
when MapShape then map(ref, value)
|
50
56
|
when TimestampShape then timestamp(ref, value)
|
51
57
|
when BlobShape then encode(value)
|
58
|
+
when FloatShape then Util.serialize_number(value)
|
52
59
|
else value
|
53
60
|
end
|
54
61
|
end
|
@@ -71,14 +71,21 @@ module Aws
|
|
71
71
|
# some type(code) might contains invalid characters
|
72
72
|
# such as ':' (efs) etc
|
73
73
|
match = rule.shape.name == code.gsub(/[^^a-zA-Z0-9]/, '')
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
next unless match && rule.shape.members.any?
|
75
|
+
|
76
|
+
data = Parser.new(rule).parse(context.http_response.body_contents)
|
77
|
+
# errors support HTTP bindings
|
78
|
+
apply_error_headers(rule, context, data)
|
77
79
|
end
|
78
80
|
end
|
79
81
|
data
|
80
82
|
end
|
81
83
|
|
84
|
+
def apply_error_headers(rule, context, data)
|
85
|
+
headers = Aws::Rest::Response::Headers.new(rule)
|
86
|
+
headers.apply(context.http_response, data)
|
87
|
+
end
|
88
|
+
|
82
89
|
end
|
83
90
|
end
|
84
91
|
end
|
@@ -69,6 +69,8 @@ module Aws
|
|
69
69
|
def map(ref, values, target = nil)
|
70
70
|
target = {} if target.nil?
|
71
71
|
values.each do |key, value|
|
72
|
+
next if value.nil?
|
73
|
+
|
72
74
|
target[key] = parse_ref(ref.shape.value, value)
|
73
75
|
end
|
74
76
|
target
|
@@ -85,6 +87,7 @@ module Aws
|
|
85
87
|
when TimestampShape then time(value)
|
86
88
|
when BlobShape then Base64.decode64(value)
|
87
89
|
when BooleanShape then value.to_s == 'true'
|
90
|
+
when FloatShape then Util.deserialize_number(value)
|
88
91
|
else value
|
89
92
|
end
|
90
93
|
end
|
@@ -93,7 +96,7 @@ module Aws
|
|
93
96
|
# @param [String, Integer] value
|
94
97
|
# @return [Time]
|
95
98
|
def time(value)
|
96
|
-
value.is_a?(Numeric) ? Time.at(value) :
|
99
|
+
value.is_a?(Numeric) ? Time.at(value) : Aws::Util.deserialize_time(value)
|
97
100
|
end
|
98
101
|
|
99
102
|
def flattened_list?(shape)
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -4,23 +4,10 @@ module Aws
|
|
4
4
|
module Plugins
|
5
5
|
module Protocols
|
6
6
|
class RestJson < Seahorse::Client::Plugin
|
7
|
-
|
8
|
-
class ContentTypeHandler < Seahorse::Client::Handler
|
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
|
21
|
-
|
22
7
|
handler(Rest::Handler)
|
23
|
-
|
8
|
+
# Rest::Handler will set a default JSON body, so size can be checked
|
9
|
+
# if this handler is run after serialization.
|
10
|
+
handler(Rest::ContentTypeHandler, priority: 30)
|
24
11
|
handler(Json::ErrorHandler, step: :sign)
|
25
12
|
end
|
26
13
|
|
@@ -104,7 +104,7 @@ and 10485780 bytes inclusive.
|
|
104
104
|
def update_content_encoding(encoding, context)
|
105
105
|
headers = context.http_request.headers
|
106
106
|
if headers['Content-Encoding']
|
107
|
-
headers['Content-Encoding'] +=
|
107
|
+
headers['Content-Encoding'] += ", #{encoding}"
|
108
108
|
else
|
109
109
|
headers['Content-Encoding'] = encoding
|
110
110
|
end
|
@@ -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
|
|
@@ -14,8 +14,9 @@ module Aws
|
|
14
14
|
doc_type: 'String',
|
15
15
|
docstring: <<-DOCS) do |cfg|
|
16
16
|
A unique and opaque application ID that is appended to the
|
17
|
-
User-Agent header as app
|
18
|
-
maximum length of 50.
|
17
|
+
User-Agent header as app/sdk_ua_app_id. It should have a
|
18
|
+
maximum length of 50. This variable is sourced from environment
|
19
|
+
variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
|
19
20
|
DOCS
|
20
21
|
app_id = ENV['AWS_SDK_UA_APP_ID']
|
21
22
|
app_id ||= Aws.shared_config.sdk_ua_app_id(profile: cfg.profile)
|
@@ -31,13 +31,11 @@ module Aws
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def list(ref, values, prefix)
|
34
|
-
if values.empty?
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
format(member_ref, value, "#{prefix}.#{n+1}")
|
40
|
-
end
|
34
|
+
return if values.empty?
|
35
|
+
|
36
|
+
member_ref = ref.shape.member
|
37
|
+
values.each.with_index do |value, n|
|
38
|
+
format(member_ref, value, "#{prefix}.#{n + 1}")
|
41
39
|
end
|
42
40
|
end
|
43
41
|
|