aws-sdk-core 3.103.0 → 3.104.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/aws-sdk-core/ecs_credentials.rb +3 -4
- data/lib/aws-sdk-core/instance_profile_credentials.rb +3 -4
- data/lib/aws-sdk-core/json.rb +1 -1
- data/lib/aws-sdk-core/log/param_filter.rb +2 -2
- data/lib/aws-sdk-core/pageable_response.rb +8 -6
- data/lib/aws-sdk-core/param_validator.rb +23 -4
- data/lib/aws-sdk-core/plugins/api_key.rb +3 -1
- data/lib/aws-sdk-core/plugins/stub_responses.rb +2 -0
- data/lib/aws-sdk-core/process_credentials.rb +2 -2
- data/lib/aws-sdk-core/rest/response/headers.rb +1 -2
- data/lib/aws-sdk-core/stubbing/protocols/rest.rb +1 -1
- data/lib/aws-sdk-sts.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +1 -1
- data/lib/seahorse.rb +1 -0
- data/lib/seahorse/client/base.rb +1 -0
- data/lib/seahorse/client/block_io.rb +3 -2
- data/lib/seahorse/client/http/response.rb +1 -1
- data/lib/seahorse/client/net_http/connection_pool.rb +3 -4
- data/lib/seahorse/client/plugins/request_callback.rb +110 -0
- data/lib/seahorse/client/plugins/response_target.rb +3 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 680ba60978f23c0aa45dd61bded4e7f2cc89b45e4edb3604f4ccfe906b5b2e94
|
4
|
+
data.tar.gz: d0332b0ee610e3941c61350863bf49849a24a9ba7ce40e539fca8bf89ad9506b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 792e9f570ce9179c26e49265fb2ddc3fbbffa545516dbf69503f5402c6ab036157645c459324ab72be0b217d0f2ae92e97c9cb7e5534f4328d89565a437b0521
|
7
|
+
data.tar.gz: 6480bf69a614e7c8f8e2b3bad0065cf9b50772c24b5e4afdf95b7c1895d1f013d05f4232de50d988bb0ff536f8bb86dd45ad1d9b4a8aa37ca2ced320932db13e
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.104.4
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'json'
|
4
3
|
require 'time'
|
5
4
|
require 'net/http'
|
6
5
|
|
@@ -81,8 +80,8 @@ module Aws
|
|
81
80
|
# service is responding but is returning invalid JSON documents
|
82
81
|
# in response to the GET profile credentials call.
|
83
82
|
begin
|
84
|
-
retry_errors([
|
85
|
-
c =
|
83
|
+
retry_errors([Aws::Json::ParseError, StandardError], max_retries: 3) do
|
84
|
+
c = Aws::Json.load(get_credentials.to_s)
|
86
85
|
@credentials = Credentials.new(
|
87
86
|
c['AccessKeyId'],
|
88
87
|
c['SecretAccessKey'],
|
@@ -90,7 +89,7 @@ module Aws
|
|
90
89
|
)
|
91
90
|
@expiration = c['Expiration'] ? Time.iso8601(c['Expiration']) : nil
|
92
91
|
end
|
93
|
-
rescue
|
92
|
+
rescue Aws::Json::ParseError
|
94
93
|
raise Aws::Errors::MetadataParserError.new
|
95
94
|
end
|
96
95
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'json'
|
4
3
|
require 'time'
|
5
4
|
require 'net/http'
|
6
5
|
|
@@ -92,8 +91,8 @@ module Aws
|
|
92
91
|
# service is responding but is returning invalid JSON documents
|
93
92
|
# in response to the GET profile credentials call.
|
94
93
|
begin
|
95
|
-
retry_errors([
|
96
|
-
c =
|
94
|
+
retry_errors([Aws::Json::ParseError, StandardError], max_retries: 3) do
|
95
|
+
c = Aws::Json.load(get_credentials.to_s)
|
97
96
|
@credentials = Credentials.new(
|
98
97
|
c['AccessKeyId'],
|
99
98
|
c['SecretAccessKey'],
|
@@ -101,7 +100,7 @@ module Aws
|
|
101
100
|
)
|
102
101
|
@expiration = c['Expiration'] ? Time.iso8601(c['Expiration']) : nil
|
103
102
|
end
|
104
|
-
rescue
|
103
|
+
rescue Aws::Json::ParseError
|
105
104
|
raise Aws::Errors::MetadataParserError
|
106
105
|
end
|
107
106
|
end
|
data/lib/aws-sdk-core/json.rb
CHANGED
@@ -6,9 +6,9 @@ require 'set'
|
|
6
6
|
module Aws
|
7
7
|
module Log
|
8
8
|
class ParamFilter
|
9
|
-
# DEPRECATED -
|
9
|
+
# DEPRECATED - This must exist for backwards compatibility. Sensitive
|
10
10
|
# members are now computed for each request/response type. This can be
|
11
|
-
# removed in a new major version.
|
11
|
+
# removed in a new major version. This list is no longer updated.
|
12
12
|
#
|
13
13
|
# A managed list of sensitive parameters that should be filtered from
|
14
14
|
# logs. This is updated automatically as part of each release. See the
|
@@ -1,14 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Aws
|
4
|
-
|
5
4
|
# Decorates a {Seahorse::Client::Response} with paging convenience methods.
|
6
5
|
# Some AWS calls provide paged responses to limit the amount of data returned
|
7
|
-
# with each response.
|
8
|
-
# inconsistent number of responses per page.
|
9
|
-
# the `next_page?` method or using enumerable methods such as `each`
|
10
|
-
#
|
11
|
-
#
|
6
|
+
# with each response. To optimize for latency, some APIs may return an
|
7
|
+
# inconsistent number of responses per page. You should rely on the values of
|
8
|
+
# the `next_page?` method or using enumerable methods such as `each` rather
|
9
|
+
# than the number of items returned to iterate through results. See below for
|
10
|
+
# examples.
|
11
|
+
#
|
12
|
+
# @note Methods such as `to_json` will enumerate all of the responses before
|
13
|
+
# returning the full response as JSON.
|
12
14
|
#
|
13
15
|
# # Paged Responses Are Enumerable
|
14
16
|
# The simplest way to handle paged response data is to use the built-in
|
@@ -143,8 +143,22 @@ module Aws
|
|
143
143
|
errors << expected_got(context, "true or false", value)
|
144
144
|
end
|
145
145
|
when BlobShape
|
146
|
-
unless value.is_a?(String)
|
147
|
-
|
146
|
+
unless value.is_a?(String)
|
147
|
+
if streaming_input?(ref)
|
148
|
+
unless io_like?(value, _require_size = false)
|
149
|
+
errors << expected_got(
|
150
|
+
context,
|
151
|
+
"a String or IO like object that supports read and rewind",
|
152
|
+
value
|
153
|
+
)
|
154
|
+
end
|
155
|
+
elsif !io_like?(value, _require_size = true)
|
156
|
+
errors << expected_got(
|
157
|
+
context,
|
158
|
+
"a String or IO like object that supports read, rewind, and size",
|
159
|
+
value
|
160
|
+
)
|
161
|
+
end
|
148
162
|
end
|
149
163
|
else
|
150
164
|
raise "unhandled shape type: #{ref.shape.class.name}"
|
@@ -167,8 +181,13 @@ module Aws
|
|
167
181
|
end
|
168
182
|
end
|
169
183
|
|
170
|
-
def io_like?(value)
|
171
|
-
value.respond_to?(:read) && value.respond_to?(:rewind)
|
184
|
+
def io_like?(value, require_size = true)
|
185
|
+
value.respond_to?(:read) && value.respond_to?(:rewind) &&
|
186
|
+
(!require_size || value.respond_to?(:size))
|
187
|
+
end
|
188
|
+
|
189
|
+
def streaming_input?(ref)
|
190
|
+
(ref["streaming"] || ref.shape["streaming"])
|
172
191
|
end
|
173
192
|
|
174
193
|
def error_messages(errors)
|
@@ -23,7 +23,9 @@ When provided, `x-api-key` header will be injected with the value provided.
|
|
23
23
|
class OptionHandler < Seahorse::Client::Handler
|
24
24
|
def call(context)
|
25
25
|
if context.operation.require_apikey
|
26
|
-
|
26
|
+
if context.params.is_a?(Hash) && context.params[:api_key]
|
27
|
+
api_key = context.params.delete(:api_key)
|
28
|
+
end
|
27
29
|
api_key = context.config.api_key if api_key.nil?
|
28
30
|
context[:api_key] = api_key
|
29
31
|
end
|
@@ -40,6 +40,8 @@ requests are made, and retries are disabled.
|
|
40
40
|
client.handlers.remove(ClientMetricsPlugin::Handler)
|
41
41
|
client.handlers.remove(ClientMetricsSendPlugin::LatencyHandler)
|
42
42
|
client.handlers.remove(ClientMetricsSendPlugin::AttemptHandler)
|
43
|
+
client.handlers.remove(Seahorse::Client::Plugins::RequestCallback::OptionHandler)
|
44
|
+
client.handlers.remove(Seahorse::Client::Plugins::RequestCallback::ReadCallbackHandler)
|
43
45
|
end
|
44
46
|
end
|
45
47
|
|
@@ -42,8 +42,8 @@ module Aws
|
|
42
42
|
|
43
43
|
if process_status.success?
|
44
44
|
begin
|
45
|
-
creds_json =
|
46
|
-
rescue
|
45
|
+
creds_json = Aws::Json.load(raw_out)
|
46
|
+
rescue Aws::Json::ParseError
|
47
47
|
raise Errors::InvalidProcessCredentialsPayload.new("Invalid JSON response")
|
48
48
|
end
|
49
49
|
payload_version = creds_json['Version']
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'time'
|
4
4
|
require 'base64'
|
5
|
-
require 'json'
|
6
5
|
|
7
6
|
module Aws
|
8
7
|
module Rest
|
@@ -68,7 +67,7 @@ module Aws
|
|
68
67
|
end
|
69
68
|
|
70
69
|
def extract_json_trait(value)
|
71
|
-
|
70
|
+
Aws::Json.load(Base64.decode64(value))
|
72
71
|
end
|
73
72
|
|
74
73
|
end
|
@@ -120,7 +120,7 @@ module Aws
|
|
120
120
|
|
121
121
|
def encode_unknown_event(opts, event_type, event_data)
|
122
122
|
# right now h2 events are only rest_json
|
123
|
-
opts[:payload] = StringIO.new(
|
123
|
+
opts[:payload] = StringIO.new(Aws::Json.dump(event_data))
|
124
124
|
opts[:headers][':event-type'] = Aws::EventStream::HeaderValue.new(
|
125
125
|
value: event_type.to_s,
|
126
126
|
type: 'string'
|
data/lib/aws-sdk-sts.rb
CHANGED
data/lib/aws-sdk-sts/client.rb
CHANGED
@@ -2189,7 +2189,7 @@ module Aws::STS
|
|
2189
2189
|
params: params,
|
2190
2190
|
config: config)
|
2191
2191
|
context[:gem_name] = 'aws-sdk-core'
|
2192
|
-
context[:gem_version] = '3.
|
2192
|
+
context[:gem_version] = '3.104.4'
|
2193
2193
|
Seahorse::Client::Request.new(handlers, context)
|
2194
2194
|
end
|
2195
2195
|
|
data/lib/seahorse.rb
CHANGED
@@ -50,6 +50,7 @@ require_relative 'seahorse/client/plugins/net_http'
|
|
50
50
|
require_relative 'seahorse/client/plugins/h2'
|
51
51
|
require_relative 'seahorse/client/plugins/raise_response_errors'
|
52
52
|
require_relative 'seahorse/client/plugins/response_target'
|
53
|
+
require_relative 'seahorse/client/plugins/request_callback'
|
53
54
|
|
54
55
|
# model
|
55
56
|
|
data/lib/seahorse/client/base.rb
CHANGED
@@ -4,7 +4,8 @@ module Seahorse
|
|
4
4
|
module Client
|
5
5
|
class BlockIO
|
6
6
|
|
7
|
-
def initialize(&block)
|
7
|
+
def initialize(headers = nil, &block)
|
8
|
+
@headers = headers
|
8
9
|
@block = block
|
9
10
|
@size = 0
|
10
11
|
end
|
@@ -12,7 +13,7 @@ module Seahorse
|
|
12
13
|
# @param [String] chunk
|
13
14
|
# @return [Integer]
|
14
15
|
def write(chunk)
|
15
|
-
@block.call(chunk)
|
16
|
+
@block.call(chunk, @headers)
|
16
17
|
ensure
|
17
18
|
chunk.bytesize.tap { |chunk_size| @size += chunk_size }
|
18
19
|
end
|
@@ -171,10 +171,9 @@ module Seahorse
|
|
171
171
|
# seconds to wait when opening an HTTP session before raising a
|
172
172
|
# `Timeout::Error`.
|
173
173
|
#
|
174
|
-
# @option options [
|
175
|
-
# number of seconds to wait for response data.
|
176
|
-
# safely
|
177
|
-
# per-request on the session yielded by {#session_for}.
|
174
|
+
# @option options [Float] :http_read_timeout (60) The default
|
175
|
+
# number of seconds to wait for response data. This value can be
|
176
|
+
# safely set per-request on the session yielded by {#session_for}.
|
178
177
|
#
|
179
178
|
# @option options [Float] :http_idle_timeout (5) The number of
|
180
179
|
# seconds a connection is allowed to sit idle before it is
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
require 'forwardable'
|
5
|
+
|
6
|
+
module Seahorse
|
7
|
+
module Client
|
8
|
+
module Plugins
|
9
|
+
|
10
|
+
# @api private
|
11
|
+
class ReadCallbackIO
|
12
|
+
extend Forwardable
|
13
|
+
def_delegators :@io, :size
|
14
|
+
|
15
|
+
def initialize(io, on_read = nil)
|
16
|
+
@io = io
|
17
|
+
@on_read = on_read if on_read.is_a? Proc
|
18
|
+
@bytes_read = 0
|
19
|
+
|
20
|
+
# Some IO objects support readpartial - IO.copy_stream used by the
|
21
|
+
# request will call readpartial if available, so define a wrapper
|
22
|
+
# for it if the underlying IO supports it.
|
23
|
+
if @io.respond_to?(:readpartial)
|
24
|
+
def self.readpartial(*args)
|
25
|
+
@io.readpartial(*args).tap do |chunk|
|
26
|
+
handle_chunk(chunk)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
attr_reader :io
|
33
|
+
|
34
|
+
def read(*args)
|
35
|
+
@io.read(*args).tap do |chunk|
|
36
|
+
handle_chunk(chunk)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def handle_chunk(chunk)
|
43
|
+
@bytes_read += chunk.bytesize if chunk && chunk.respond_to?(:bytesize)
|
44
|
+
total_size = @io.respond_to?(:size) ? @io.size : nil
|
45
|
+
@on_read.call(chunk, @bytes_read, total_size) if @on_read
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# @api private
|
50
|
+
class RequestCallback < Plugin
|
51
|
+
|
52
|
+
option(
|
53
|
+
:on_chunk_sent,
|
54
|
+
default: nil,
|
55
|
+
doc_type: 'Proc',
|
56
|
+
docstring: <<-DOCS)
|
57
|
+
When a Proc object is provided, it will be used as callback when each chunk
|
58
|
+
of the request body is sent. It provides three arguments: the chunk,
|
59
|
+
the number of bytes read from the body, and the total number of
|
60
|
+
bytes in the body.
|
61
|
+
DOCS
|
62
|
+
|
63
|
+
# @api private
|
64
|
+
class OptionHandler < Client::Handler
|
65
|
+
def call(context)
|
66
|
+
if context.params.is_a?(Hash) && context.params[:on_chunk_sent]
|
67
|
+
on_chunk_sent = context.params.delete(:on_chunk_sent)
|
68
|
+
end
|
69
|
+
on_chunk_sent = context.config.on_chunk_sent if on_chunk_sent.nil?
|
70
|
+
context[:on_chunk_sent] = on_chunk_sent if on_chunk_sent
|
71
|
+
@handler.call(context)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# @api private
|
76
|
+
class ReadCallbackHandler < Client::Handler
|
77
|
+
def call(context)
|
78
|
+
if (callback = context[:on_chunk_sent])
|
79
|
+
context.http_request.body = ReadCallbackIO.new(
|
80
|
+
context.http_request.body,
|
81
|
+
callback
|
82
|
+
)
|
83
|
+
add_event_listeners(context)
|
84
|
+
end
|
85
|
+
@handler.call(context)
|
86
|
+
end
|
87
|
+
|
88
|
+
def add_event_listeners(context)
|
89
|
+
# unwrap the request body as soon as we start receiving a response
|
90
|
+
context.http_response.on_headers do
|
91
|
+
body = context.http_request.body
|
92
|
+
if body.is_a? ReadCallbackIO
|
93
|
+
context.http_request.body = body.io
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# OptionHandler is needed to remove :on_chunk_sent
|
100
|
+
# from the params before build
|
101
|
+
handler(OptionHandler, step: :initialize)
|
102
|
+
|
103
|
+
# ReadCallbackHandlerneeds to go late in the call stack
|
104
|
+
# other plugins including Sigv4 and content_md5 read the request body
|
105
|
+
# and rewind it
|
106
|
+
handler(ReadCallbackHandler, step: :sign, priority: 0)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -34,7 +34,7 @@ module Seahorse
|
|
34
34
|
# an existing ManagedFile or BlockIO and those
|
35
35
|
# should be reused.
|
36
36
|
if context.http_response.body.is_a? StringIO
|
37
|
-
context.http_response.body =
|
37
|
+
context.http_response.body = io(target, context.http_response.headers)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -62,9 +62,9 @@ module Seahorse
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
def io(target)
|
65
|
+
def io(target, headers)
|
66
66
|
case target
|
67
|
-
when Proc then BlockIO.new(&target)
|
67
|
+
when Proc then BlockIO.new(headers, &target)
|
68
68
|
when String, Pathname then ManagedFile.new(target, 'w+b')
|
69
69
|
else target
|
70
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.104.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jmespath
|
@@ -263,6 +263,7 @@ files:
|
|
263
263
|
- lib/seahorse/client/plugins/net_http.rb
|
264
264
|
- lib/seahorse/client/plugins/operation_methods.rb
|
265
265
|
- lib/seahorse/client/plugins/raise_response_errors.rb
|
266
|
+
- lib/seahorse/client/plugins/request_callback.rb
|
266
267
|
- lib/seahorse/client/plugins/response_target.rb
|
267
268
|
- lib/seahorse/client/request.rb
|
268
269
|
- lib/seahorse/client/request_context.rb
|