aws-sdk-core 3.120.0 → 3.121.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cffcb4c7676f524de7a5bc7c51c469a16e8c27f1ac92de56f8ae28ee9e3bc9c
4
- data.tar.gz: a554f8b9a51cbd10c33b66b2fb24bd53d91a9e2e6d01230d5f0556120fccf3e5
3
+ metadata.gz: ca78fa40d16ef2a56d695fd3149837b9c9b41f12fe4584d0c6e9920cf88e0696
4
+ data.tar.gz: b907fc2f3b8c3fac0c26a615f7bb310f110875d0c4baab3dce38a8b91ee64cb9
5
5
  SHA512:
6
- metadata.gz: 0acde7aff11a5e5b486286158f1b9091b260ac710801cb22c38cc9f22194e2775bc74ce79557f3d77a483c1f3d1e0a01ccd3f5d81f7e37d131d1f182aca7100c
7
- data.tar.gz: 684765f97f0da7ca5ddfe9ae43b9a12ccc0020e0459666e91c430ea77ba3746b07eb53caa0fe63a8aba42aa9cf64d88b29307944fcd1e6e54533470c90d94682
6
+ metadata.gz: 6e8ec45394f4e8b8b0f960c85192968cb811e09a1f23b31cb531df9a2eb81fffad4e5420ce5cf714fefa6b4dd0622588d39f1a340284ce3c5bde4603e55d03c8
7
+ data.tar.gz: ec673c9df67c90297099d4243d44d48bc290c3b0169899c9cd6e40058dcc40db29775fa40d814025e24c94d6bb9ebda7a118781516859f17c2c3a83f320161ec
data/CHANGELOG.md CHANGED
@@ -1,6 +1,30 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.121.3 (2021-10-20)
5
+ ------------------
6
+
7
+ * Issue - Use endpointPrefix when looking up the `signing_region` from the `EndpointProvider`.
8
+
9
+ 3.121.2 (2021-10-18)
10
+ ------------------
11
+
12
+ * Issue - Fix an issue where Rest JSON services do not have a `Content-Type` header.
13
+
14
+ * Issue - Remove blank `Content-Type` header from Net::HTTP handler, and prevent a default from being set.
15
+
16
+ * Issue - Set `Content-Length` only for HTTP methods that take a body.
17
+
18
+ 3.121.1 (2021-09-24)
19
+ ------------------
20
+
21
+ * Issue - Fix error in finding union member for boolean shapes with `false` values.
22
+
23
+ 3.121.0 (2021-09-02)
24
+ ------------------
25
+
26
+ * Feature - Add support for S3 Multi-region access point configuration.
27
+
4
28
  3.120.0 (2021-09-01)
5
29
  ------------------
6
30
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.120.0
1
+ 3.121.3
@@ -4,9 +4,26 @@ module Aws
4
4
  module Plugins
5
5
  module Protocols
6
6
  class ApiGateway < 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
+
7
22
  handler(Rest::Handler)
23
+ handler(ContentTypeHandler, priority: 30)
8
24
  handler(Json::ErrorHandler, step: :sign)
9
25
  end
26
+
10
27
  end
11
28
  end
12
29
  end
@@ -5,10 +5,25 @@ module Aws
5
5
  module Protocols
6
6
  class RestJson < Seahorse::Client::Plugin
7
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
+
8
22
  handler(Rest::Handler)
23
+ handler(ContentTypeHandler, priority: 30)
9
24
  handler(Json::ErrorHandler, step: :sign)
10
-
11
25
  end
26
+
12
27
  end
13
28
  end
14
29
  end
@@ -37,7 +37,7 @@ module Aws
37
37
  if prefix && cfg.endpoint.to_s.match(/#{prefix}\.amazonaws\.com/)
38
38
  'us-east-1'
39
39
  elsif cfg.region
40
- Aws::Partitions::EndpointProvider.signing_region(cfg.region, cfg.sigv4_name)
40
+ Aws::Partitions::EndpointProvider.signing_region(cfg.region, prefix)
41
41
  end
42
42
  end
43
43
 
@@ -17,11 +17,29 @@ module Aws
17
17
  # @param [Seahorse::Client::Http::Request] http_req
18
18
  # @param [Hash] params
19
19
  def apply(http_req, params)
20
- http_req.body = build_body(params)
20
+ body = build_body(params)
21
+ # for rest-json, ensure we send at least an empty object
22
+ # don't send an empty object for streaming? case.
23
+ if body.nil? && @serializer_class == Json::Builder &&
24
+ modeled_body? && !streaming?
25
+ body = '{}'
26
+ end
27
+ http_req.body = body
21
28
  end
22
29
 
23
30
  private
24
31
 
32
+ # operation is modeled for body when it is modeled for a payload
33
+ # either with payload trait or normal members.
34
+ def modeled_body?
35
+ return true if @rules[:payload]
36
+ @rules.shape.members.each do |member|
37
+ _name, shape = member
38
+ return true if shape.location.nil?
39
+ end
40
+ false
41
+ end
42
+
25
43
  def build_body(params)
26
44
  if streaming?
27
45
  params[@rules[:payload]]
@@ -175,7 +175,8 @@ module Aws
175
175
  :csm_port,
176
176
  :sts_regional_endpoints,
177
177
  :s3_use_arn_region,
178
- :s3_us_east_1_regional_endpoint
178
+ :s3_us_east_1_regional_endpoint,
179
+ :s3_disable_multiregion_access_points
179
180
  )
180
181
 
181
182
  private
@@ -73,7 +73,7 @@ module Aws
73
73
 
74
74
  module Union
75
75
  def member
76
- self.members.select { |k| self[k] }.first
76
+ self.members.select { |k| self[k] != nil }.first
77
77
  end
78
78
 
79
79
  def value
@@ -29,7 +29,6 @@ require 'aws-sdk-core/plugins/transfer_encoding.rb'
29
29
  require 'aws-sdk-core/plugins/http_checksum.rb'
30
30
  require 'aws-sdk-core/plugins/signature_v4.rb'
31
31
  require 'aws-sdk-core/plugins/protocols/rest_json.rb'
32
- require 'aws-sdk-sso/plugins/content_type.rb'
33
32
 
34
33
  Aws::Plugins::GlobalConfiguration.add_identifier(:sso)
35
34
 
@@ -76,7 +75,6 @@ module Aws::SSO
76
75
  add_plugin(Aws::Plugins::HttpChecksum)
77
76
  add_plugin(Aws::Plugins::SignatureV4)
78
77
  add_plugin(Aws::Plugins::Protocols::RestJson)
79
- add_plugin(Aws::SSO::Plugins::ContentType)
80
78
 
81
79
  # @overload initialize(options)
82
80
  # @param [Hash] options
@@ -523,7 +521,7 @@ module Aws::SSO
523
521
  params: params,
524
522
  config: config)
525
523
  context[:gem_name] = 'aws-sdk-core'
526
- context[:gem_version] = '3.120.0'
524
+ context[:gem_version] = '3.121.3'
527
525
  Seahorse::Client::Request.new(handlers, context)
528
526
  end
529
527
 
data/lib/aws-sdk-sso.rb CHANGED
@@ -50,6 +50,6 @@ require_relative 'aws-sdk-sso/customizations'
50
50
  # @!group service
51
51
  module Aws::SSO
52
52
 
53
- GEM_VERSION = '3.120.0'
53
+ GEM_VERSION = '3.121.3'
54
54
 
55
55
  end
@@ -2303,7 +2303,7 @@ module Aws::STS
2303
2303
  params: params,
2304
2304
  config: config)
2305
2305
  context[:gem_name] = 'aws-sdk-core'
2306
- context[:gem_version] = '3.120.0'
2306
+ context[:gem_version] = '3.121.3'
2307
2307
  Seahorse::Client::Request.new(handlers, context)
2308
2308
  end
2309
2309
 
data/lib/aws-sdk-sts.rb CHANGED
@@ -50,6 +50,6 @@ require_relative 'aws-sdk-sts/customizations'
50
50
  # @!group service
51
51
  module Aws::STS
52
52
 
53
- GEM_VERSION = '3.120.0'
53
+ GEM_VERSION = '3.121.3'
54
54
 
55
55
  end
@@ -74,8 +74,9 @@ module Seahorse
74
74
  # @return [void]
75
75
  def transmit(config, req, resp)
76
76
  session(config, req) do |http|
77
+ # Monkey patch default content-type set by Net::HTTP
78
+ Thread.current[:net_http_skip_default_content_type] = true
77
79
  http.request(build_net_request(req)) do |net_resp|
78
-
79
80
  status_code = net_resp.code.to_i
80
81
  headers = extract_headers(net_resp)
81
82
 
@@ -96,6 +97,9 @@ module Seahorse
96
97
  rescue => error
97
98
  # not retryable
98
99
  resp.signal_error(error)
100
+ ensure
101
+ # ensure we turn off monkey patch in case of error
102
+ Thread.current[:net_http_skip_default_content_type] = nil
99
103
  end
100
104
 
101
105
  def complete_response(req, resp, bytes_received)
@@ -147,7 +151,12 @@ module Seahorse
147
151
  def build_net_request(request)
148
152
  request_class = net_http_request_class(request)
149
153
  req = request_class.new(request.endpoint.request_uri, headers(request))
150
- req.body_stream = request.body
154
+ # Net::HTTP adds a default Content-Type when a body is present.
155
+ # Set the body stream when it has an unknown size or when it is > 0.
156
+ if !request.body.respond_to?(:size) ||
157
+ (request.body.respond_to?(:size) && request.body.size > 0)
158
+ req.body_stream = request.body
159
+ end
151
160
  req
152
161
  end
153
162
 
@@ -166,14 +175,13 @@ module Seahorse
166
175
  # @return [Hash] Returns a vanilla hash of headers to send with the
167
176
  # HTTP request.
168
177
  def headers(request)
169
- # Net::HTTP adds default headers for content-type to POSTs (1.8.7+)
170
- # and accept-encoding (2.0.0+). Setting a default empty value defeats
171
- # this.
178
+ # Net::HTTP adds a default header for accept-encoding (2.0.0+).
179
+ # Setting a default empty value defeats this.
172
180
  #
173
- # Removing these are necessary for most services to not break request
181
+ # Removing this is necessary for most services to not break request
174
182
  # signatures as well as dynamodb crc32 checks (these fail if the
175
183
  # response is gzipped).
176
- headers = { 'content-type' => '', 'accept-encoding' => '' }
184
+ headers = { 'accept-encoding' => '' }
177
185
  request.headers.each_pair do |key, value|
178
186
  headers[key] = value
179
187
  end
@@ -11,10 +11,26 @@ module Seahorse
11
11
  module Patches
12
12
 
13
13
  def self.apply!
14
+ Net::HTTPGenericRequest.prepend(PatchDefaultContentType)
14
15
  return unless RUBY_VERSION < '2.5'
16
+
15
17
  Net::HTTP::IDEMPOTENT_METHODS_.clear
16
18
  end
17
19
 
20
+ # For requests with bodys, Net::HTTP sets a default content type of:
21
+ # 'application/x-www-form-urlencoded'
22
+ # There are cases where we should not send content type at all.
23
+ # Even when no body is supplied, Net::HTTP uses a default empty body
24
+ # and sets it anyway. This patch disables the behavior when a Thread
25
+ # local variable is set.
26
+ module PatchDefaultContentType
27
+ def supply_default_content_type
28
+ return if Thread.current[:net_http_skip_default_content_type]
29
+
30
+ super
31
+ end
32
+ end
33
+
18
34
  end
19
35
  end
20
36
  end
@@ -7,16 +7,22 @@ module Seahorse
7
7
 
8
8
  # @api private
9
9
  class Handler < Client::Handler
10
+ # https://github.com/ruby/net-http/blob/master/lib/net/http/requests.rb
11
+ # Methods without body are forwards compatible, because content-length
12
+ # may be set for requests without body but is technically incorrect.
13
+ METHODS_WITHOUT_BODY = Set.new(
14
+ %w[GET HEAD DELETE OPTIONS TRACE COPY MOVE]
15
+ )
10
16
 
11
17
  def call(context)
12
- # If it's an IO object and not a File / String / String IO
13
- if context.http_request.body.respond_to?(:size)
14
- length = context.http_request.body.size
15
- context.http_request.headers['Content-Length'] = length
18
+ body = context.http_request.body
19
+ method = context.http_request.http_method
20
+ # We use Net::HTTP with body_stream which doesn't do this by default
21
+ if body.respond_to?(:size) && !METHODS_WITHOUT_BODY.include?(method)
22
+ context.http_request.headers['Content-Length'] = body.size
16
23
  end
17
24
  @handler.call(context)
18
25
  end
19
-
20
26
  end
21
27
 
22
28
  handler(Handler, step: :sign, priority: 0)
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.120.0
4
+ version: 3.121.3
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: 2021-09-01 00:00:00.000000000 Z
11
+ date: 2021-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath
@@ -230,7 +230,6 @@ files:
230
230
  - lib/aws-sdk-sso/client_api.rb
231
231
  - lib/aws-sdk-sso/customizations.rb
232
232
  - lib/aws-sdk-sso/errors.rb
233
- - lib/aws-sdk-sso/plugins/content_type.rb
234
233
  - lib/aws-sdk-sso/resource.rb
235
234
  - lib/aws-sdk-sso/types.rb
236
235
  - lib/aws-sdk-sts.rb
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Aws
4
- module SSO
5
- module Plugins
6
- class ContentType < Seahorse::Client::Plugin
7
-
8
- def add_handlers(handlers, config)
9
- handlers.add(Handler)
10
- end
11
-
12
- class Handler < Seahorse::Client::Handler
13
- def call(context)
14
- # Some operations break when given an empty content-type header.
15
- # The SDK adds this blank content-type header
16
- # since Net::HTTP provides a default that can break services.
17
- # We're setting one here even though it's not used or necessary.
18
- context.http_request.headers['content-type'] = 'application/json'
19
- @handler.call(context)
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end