aws-sdk-core 3.121.1 → 3.121.6

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: 6045e01344ede12d88ef25ca9815ce3b267a0b08335e9f97753e5fd357f05a83
4
- data.tar.gz: f0e783887c602e49acfa7837f0434a39936b786325846553e5db075f4c48b416
3
+ metadata.gz: 2d1e4fbf8c98bc0d54f4f6ec16a185ed87bb223549e5766fc8a1b62e63f601d7
4
+ data.tar.gz: 6664442786370782a056f504b193210b21b0ee5fe174c68fbd962bf37aec9407
5
5
  SHA512:
6
- metadata.gz: 9ffa8d2716f3ecc99d5d52139811ef43d82250350be7b8db687bfa9cc25c8d046be6102f62dce196e9b85394c0b0c1db9df8356ff106c793ab232118e26682b2
7
- data.tar.gz: 3c14caf81ef5425d0d5ee7f1b1d3f1dab3df5dfdb5673cbbe023120cef954fde6cdbf26e52cfcf74a62ef3863d14cf5d3dad6105007fc15960f8e60ab5b2a1a9
6
+ metadata.gz: 512190e5152cf45e7adc39ea601302174297aee06d6c9cba16bbb91392265390e3afa300f5c3f0e0acd5f6006bac73d45344b25a0f843a22cbffdec115035eee
7
+ data.tar.gz: bda1e426b67de3c684269c9bd1027ce059263b45b89c907019a26dd856421fc93f8558c3d3b3e77f6caa3d8c0a807e1d407d4d16b28e98d5fc40e547cc8c7ca1
data/CHANGELOG.md CHANGED
@@ -1,6 +1,37 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.121.6 (2021-11-02)
5
+ ------------------
6
+
7
+ * Issue - Improve `SSOCredentials` error handling when profile file does not exist (#2605)
8
+
9
+ 3.121.5 (2021-10-29)
10
+ ------------------
11
+
12
+ * Issue - bump minimum version of `aws-partitions` (#2603).
13
+
14
+ 3.121.4 (2021-10-28)
15
+ ------------------
16
+
17
+ * Issue - This version has been yanked. (#2603).
18
+
19
+ * Issue - use the `EndpointProvider` to lookup signing region and name.
20
+
21
+ 3.121.3 (2021-10-20)
22
+ ------------------
23
+
24
+ * Issue - Use endpointPrefix when looking up the `signing_region` from the `EndpointProvider`.
25
+
26
+ 3.121.2 (2021-10-18)
27
+ ------------------
28
+
29
+ * Issue - Fix an issue where Rest JSON services do not have a `Content-Type` header.
30
+
31
+ * Issue - Remove blank `Content-Type` header from Net::HTTP handler, and prevent a default from being set.
32
+
33
+ * Issue - Set `Content-Length` only for HTTP methods that take a body.
34
+
4
35
  3.121.1 (2021-09-24)
5
36
  ------------------
6
37
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.121.1
1
+ 3.121.6
@@ -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
@@ -12,32 +12,22 @@ module Aws
12
12
  end
13
13
 
14
14
  option(:sigv4_name) do |cfg|
15
- cfg.api.metadata['signingName'] || cfg.api.metadata['endpointPrefix']
15
+ signingName = if cfg.region
16
+ Aws::Partitions::EndpointProvider.signing_service(
17
+ cfg.region, cfg.api.metadata['endpointPrefix']
18
+ )
19
+ end
20
+ signingName || cfg.api.metadata['signingName'] || cfg.api.metadata['endpointPrefix']
16
21
  end
17
22
 
18
23
  option(:sigv4_region) do |cfg|
19
-
20
- # The signature version 4 signing region is most
21
- # commonly the configured region. There are a few
22
- # notable exceptions:
23
- #
24
- # * Some services have a global endpoint to the entire
25
- # partition. For example, when constructing a route53
26
- # client for a region like "us-west-2", we will
27
- # always use "route53.amazonaws.com". This endpoint
28
- # is actually global to the entire partition,
29
- # and must be signed as "us-east-1".
30
- #
31
- # * When the region is configured, but it is configured
32
- # to a non region, such as "aws-global". This is similar
33
- # to the previous case. We use the Aws::Partitions::EndpointProvider
34
- # to resolve to the actual signing region.
35
- #
36
- prefix = cfg.api.metadata['endpointPrefix']
37
- if prefix && cfg.endpoint.to_s.match(/#{prefix}\.amazonaws\.com/)
38
- 'us-east-1'
39
- elsif cfg.region
40
- Aws::Partitions::EndpointProvider.signing_region(cfg.region, cfg.sigv4_name)
24
+ if cfg.region
25
+ if cfg.respond_to?(:sts_regional_endpoints)
26
+ sts_regional = cfg.sts_regional_endpoints
27
+ end
28
+ Aws::Partitions::EndpointProvider.signing_region(
29
+ cfg.region, cfg.api.metadata['endpointPrefix'], sts_regional
30
+ )
41
31
  end
42
32
  end
43
33
 
@@ -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]]
@@ -100,7 +100,7 @@ module Aws
100
100
  raise ArgumentError, 'Cached SSO Token is expired.'
101
101
  end
102
102
  cached_token
103
- rescue Aws::Json::ParseError, ArgumentError
103
+ rescue Errno::ENOENT, Aws::Json::ParseError, ArgumentError
104
104
  raise Errors::InvalidSSOCredentials, SSO_LOGIN_GUIDANCE
105
105
  end
106
106
 
@@ -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.121.1'
524
+ context[:gem_version] = '3.121.6'
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.121.1'
53
+ GEM_VERSION = '3.121.6'
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.121.1'
2306
+ context[:gem_version] = '3.121.6'
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.121.1'
53
+ GEM_VERSION = '3.121.6'
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.121.1
4
+ version: 3.121.6
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-24 00:00:00.000000000 Z
11
+ date: 2021-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '1'
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 1.239.0
36
+ version: 1.520.1
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '1'
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 1.239.0
46
+ version: 1.520.1
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: aws-sigv4
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -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