aws-sdk-core 3.103.0 → 3.104.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ec9ea1bbf0113598ad4e0e247cdd31a44c4cf08c2ce5c8ecaae7dc57c13fc60
4
- data.tar.gz: 98bd9b0e2fce6476ec301fb114b9e988dc064f4eea53baf298f16934015d4f5d
3
+ metadata.gz: 369aec7f520055c86a23a3582e05e172467fb49c75f96bf14e1a64f56a0e56a6
4
+ data.tar.gz: d1f709b9bf97a69e831add07882063eb4222b76427972737ab632e45c62e9bec
5
5
  SHA512:
6
- metadata.gz: 3ee931c1b106879439e83cd7b2e0c121e3c62a88c8c4bdf66d4b1e929132828ac32d3fc6a9a7e390320506f7290f30aa554158896e44207c7aff3abfb46a61ce
7
- data.tar.gz: 25a26778c1673d9eed09bef65e0afbe9639870b30b8bbc6f962734440c28fe1d9723f8e537da007b0e1af461ad0386b3e59b6d62d5ac6697056cce992e6c5789
6
+ metadata.gz: 58c5835e6039860ad6214df72d67ac9f2e603bbe3e4b67109e3e351cfecc400449ea1cae41c160a5259093a9c68dc2dd986055b4bb9dc1b7dfa45d4c66b61ff7
7
+ data.tar.gz: acc26eba763959760d6c8f6c7282378b85e05d309aaa3976b59f1fee834ac3efb263f1b32c910594abeb379cc0e62f217d8ce3a6f414a8c4eacb7ce3a0670282
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.103.0
1
+ 3.104.0
@@ -6,9 +6,9 @@ require 'set'
6
6
  module Aws
7
7
  module Log
8
8
  class ParamFilter
9
- # DEPRECATED - this must exist for backwards compatibility. Sensitive
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. To optimize for latency, some APIs may return an
8
- # inconsistent number of responses per page. You should rely on the values of
9
- # the `next_page?` method or using enumerable methods such as `each`
10
- # rather than the number of items returned to iterate through results.
11
- # See below for examples.
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
@@ -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
- api_key = context.params.delete(:api_key)
26
+ if context.params.is_a?(Hash)
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
 
@@ -45,6 +45,6 @@ require_relative 'aws-sdk-sts/customizations'
45
45
  # @service
46
46
  module Aws::STS
47
47
 
48
- GEM_VERSION = '3.103.0'
48
+ GEM_VERSION = '3.104.0'
49
49
 
50
50
  end
@@ -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.103.0'
2192
+ context[:gem_version] = '3.104.0'
2193
2193
  Seahorse::Client::Request.new(handlers, context)
2194
2194
  end
2195
2195
 
@@ -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
 
@@ -14,6 +14,7 @@ module Seahorse
14
14
  Plugins::NetHttp,
15
15
  Plugins::RaiseResponseErrors,
16
16
  Plugins::ResponseTarget,
17
+ Plugins::RequestCallback
17
18
  ])
18
19
 
19
20
  # @api private
@@ -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
@@ -73,7 +73,7 @@ module Seahorse
73
73
 
74
74
  # Completes the http response.
75
75
  #
76
- # @example Completing the response in a singal call
76
+ # @example Completing the response in a single call
77
77
  #
78
78
  # http_response.signal_done(
79
79
  # status_code: 200,
@@ -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)
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 = handler.send(:io, target)
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.103.0
4
+ version: 3.104.0
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-07-01 00:00:00.000000000 Z
11
+ date: 2020-07-15 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