aws-sdk-core 3.117.0 → 3.120.0

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: 87480a79b026cd9f4a732927079633d67b5fa7cb0150c3cef3c7eedd954d179d
4
- data.tar.gz: 42e118b53803b2d5bb5514059852fe684f4f64a22fadee010541851eca299fc5
3
+ metadata.gz: 2cffcb4c7676f524de7a5bc7c51c469a16e8c27f1ac92de56f8ae28ee9e3bc9c
4
+ data.tar.gz: a554f8b9a51cbd10c33b66b2fb24bd53d91a9e2e6d01230d5f0556120fccf3e5
5
5
  SHA512:
6
- metadata.gz: 71053f9fca038e4fb57084f29d972034e845d58c45a973ac3e9690717689ba74228d6b1d25c2b1e473e8f2358091916875dfd3ffb90ed4ece0b36aaa38d9e81e
7
- data.tar.gz: 6e353f5356d8a61a4cfc70dce05f176859e5180e53b7de74c09bf1da7e57d0a5ac9f7cc58a584880b98b95d8518da62ed22adac942cf8d37a596300ea9caa102
6
+ metadata.gz: 0acde7aff11a5e5b486286158f1b9091b260ac710801cb22c38cc9f22194e2775bc74ce79557f3d77a483c1f3d1e0a01ccd3f5d81f7e37d131d1f182aca7100c
7
+ data.tar.gz: 684765f97f0da7ca5ddfe9ae43b9a12ccc0020e0459666e91c430ea77ba3746b07eb53caa0fe63a8aba42aa9cf64d88b29307944fcd1e6e54533470c90d94682
data/CHANGELOG.md CHANGED
@@ -1,6 +1,26 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.120.0 (2021-09-01)
5
+ ------------------
6
+
7
+ * Feature - AWS SDK for Ruby no longer supports Ruby runtime versions 1.9, 2.0, 2.1, and 2.2.
8
+
9
+ 3.119.1 (2021-08-20)
10
+ ------------------
11
+
12
+ * Issue - Refactored `Aws::Json::Engine` to remove dead code and replaced usage of `JSON.load` with `JSON.parse`.
13
+
14
+ 3.119.0 (2021-07-30)
15
+ ------------------
16
+
17
+ * Feature - Support Document Types. Document types are used to carry open content. A document type value is serialized using the same format as its surroundings and requires no additional encoding or escaping.(#2523)
18
+
19
+ 3.118.0 (2021-07-28)
20
+ ------------------
21
+
22
+ * Feature - Add support for Tagged Unions using a "sealed" classes like approach where each union member has a corresponding subclass.
23
+
4
24
  3.117.0 (2021-07-12)
5
25
  ------------------
6
26
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.117.0
1
+ 3.120.0
@@ -2,16 +2,18 @@
2
2
 
3
3
  module Aws
4
4
  module Json
5
- class JSONEngine
5
+ module JSONEngine
6
+ class << self
7
+ def load(json)
8
+ JSON.parse(json)
9
+ rescue JSON::ParserError => e
10
+ raise ParseError.new(e)
11
+ end
6
12
 
7
- def self.load(json)
8
- JSON.load(json)
13
+ def dump(value)
14
+ JSON.dump(value)
15
+ end
9
16
  end
10
-
11
- def self.dump(value)
12
- JSON.dump(value)
13
- end
14
-
15
17
  end
16
18
  end
17
19
  end
@@ -2,16 +2,43 @@
2
2
 
3
3
  module Aws
4
4
  module Json
5
- class OjEngine
5
+ module OjEngine
6
+ # @api private
7
+ LOAD_OPTIONS = { mode: :compat, symbol_keys: false, empty_string: false }.freeze
6
8
 
7
- def self.load(json)
8
- Oj.load(json)
9
- end
9
+ # @api private
10
+ DUMP_OPTIONS = { mode: :compat }.freeze
11
+
12
+ class << self
13
+ def load(json)
14
+ Oj.load(json, LOAD_OPTIONS)
15
+ rescue *PARSE_ERRORS => e
16
+ raise ParseError.new(e)
17
+ end
18
+
19
+ def dump(value)
20
+ Oj.dump(value, DUMP_OPTIONS)
21
+ end
22
+
23
+ private
24
+
25
+ # Oj before 1.4.0 does not define Oj::ParseError and instead raises
26
+ # SyntaxError on failure
27
+ def detect_oj_parse_errors
28
+ require 'oj'
10
29
 
11
- def self.dump(value)
12
- Oj.dump(value)
30
+ if Oj.const_defined?(:ParseError)
31
+ [Oj::ParseError, EncodingError, JSON::ParserError]
32
+ else
33
+ [SyntaxError]
34
+ end
35
+ rescue LoadError
36
+ nil
37
+ end
13
38
  end
14
39
 
40
+ # @api private
41
+ PARSE_ERRORS = detect_oj_parse_errors
15
42
  end
16
43
  end
17
44
  end
@@ -28,8 +28,16 @@ module Aws
28
28
  member_name, member_ref = shape.member_by_location_name(key)
29
29
  if member_ref
30
30
  target[member_name] = parse_ref(member_ref, value)
31
+ elsif shape.union
32
+ target[:unknown] = { 'name' => key, 'value' => value }
31
33
  end
32
34
  end
35
+ if shape.union
36
+ # convert to subclass
37
+ member_subclass = shape.member_subclass(target.member).new
38
+ member_subclass[target.member] = target.value
39
+ target = member_subclass
40
+ end
33
41
  target
34
42
  end
35
43
 
@@ -5,6 +5,8 @@ require_relative 'json/builder'
5
5
  require_relative 'json/error_handler'
6
6
  require_relative 'json/handler'
7
7
  require_relative 'json/parser'
8
+ require_relative 'json/json_engine'
9
+ require_relative 'json/oj_engine'
8
10
 
9
11
  module Aws
10
12
  # @api private
@@ -20,9 +22,7 @@ module Aws
20
22
 
21
23
  class << self
22
24
  def load(json)
23
- ENGINE.load(json, *ENGINE_LOAD_OPTIONS)
24
- rescue *ENGINE_ERRORS => e
25
- raise ParseError, e
25
+ ENGINE.load(json)
26
26
  end
27
27
 
28
28
  def load_file(path)
@@ -30,38 +30,20 @@ module Aws
30
30
  end
31
31
 
32
32
  def dump(value)
33
- ENGINE.dump(value, *ENGINE_DUMP_OPTIONS)
33
+ ENGINE.dump(value)
34
34
  end
35
35
 
36
36
  private
37
37
 
38
- def oj_engine
38
+ def select_engine
39
39
  require 'oj'
40
- [
41
- Oj,
42
- [{ mode: :compat, symbol_keys: false, empty_string: false }],
43
- [{ mode: :compat }],
44
- oj_parse_error
45
- ]
40
+ OjEngine
46
41
  rescue LoadError
47
- false
48
- end
49
-
50
- def json_engine
51
- [JSON, [], [], [JSON::ParserError]]
52
- end
53
-
54
- def oj_parse_error
55
- if Oj.const_defined?('ParseError')
56
- [Oj::ParseError, EncodingError, JSON::ParserError]
57
- else
58
- [SyntaxError]
59
- end
42
+ JSONEngine
60
43
  end
61
44
  end
62
45
 
63
46
  # @api private
64
- ENGINE, ENGINE_LOAD_OPTIONS, ENGINE_DUMP_OPTIONS, ENGINE_ERRORS =
65
- oj_engine || json_engine
47
+ ENGINE = select_engine
66
48
  end
67
49
  end
@@ -26,7 +26,8 @@ module Aws
26
26
 
27
27
  def filter(values, type)
28
28
  case values
29
- when Struct, Hash then filter_hash(values, type)
29
+ when Struct then filter_struct(values, type)
30
+ when Hash then filter_hash(values, type)
30
31
  when Array then filter_array(values, type)
31
32
  else values
32
33
  end
@@ -34,6 +35,13 @@ module Aws
34
35
 
35
36
  private
36
37
 
38
+ def filter_struct(values, type)
39
+ if values.class.include? Aws::Structure::Union
40
+ values = { values.member => values.value }
41
+ end
42
+ filter_hash(values, type)
43
+ end
44
+
37
45
  def filter_hash(values, type)
38
46
  if type.const_defined?('SENSITIVE')
39
47
  filters = type::SENSITIVE + @additional_filters
@@ -70,6 +70,14 @@ module Aws
70
70
  end
71
71
  end
72
72
 
73
+ if @validate_required && shape.union
74
+ if values.length > 1
75
+ errors << "multiple values provided to union at #{context} - must contain exactly one of the supported types: #{shape.member_names.join(', ')}"
76
+ elsif values.length == 0
77
+ errors << "No values provided to union at #{context} - must contain exactly one of the supported types: #{shape.member_names.join(', ')}"
78
+ end
79
+ end
80
+
73
81
  # validate non-nil members
74
82
  values.each_pair do |name, value|
75
83
  unless value.nil?
@@ -117,11 +125,32 @@ module Aws
117
125
  end
118
126
  end
119
127
 
128
+ def document(ref, value, errors, context)
129
+ document_types = [Hash, Array, Numeric, String, TrueClass, FalseClass, NilClass]
130
+ unless document_types.any? { |t| value.is_a?(t) }
131
+ errors << expected_got(context, "one of #{document_types.join(', ')}", value)
132
+ end
133
+
134
+ # recursively validate types for aggregated types
135
+ case value
136
+ when Hash
137
+ value.each do |k, v|
138
+ document(ref, v, errors, context + "[#{k}]")
139
+ end
140
+ when Array
141
+ value.each do |v|
142
+ document(ref, v, errors, context)
143
+ end
144
+ end
145
+
146
+ end
147
+
120
148
  def shape(ref, value, errors, context)
121
149
  case ref.shape
122
150
  when StructureShape then structure(ref, value, errors, context)
123
151
  when ListShape then list(ref, value, errors, context)
124
152
  when MapShape then map(ref, value, errors, context)
153
+ when DocumentShape then document(ref, value, errors, context)
125
154
  when StringShape
126
155
  unless value.is_a?(String)
127
156
  errors << expected_got(context, "a String", value)
@@ -70,11 +70,20 @@ module Aws
70
70
  end
71
71
 
72
72
  end
73
+
74
+ module Union
75
+ def member
76
+ self.members.select { |k| self[k] }.first
77
+ end
78
+
79
+ def value
80
+ self[member] if member
81
+ end
82
+ end
73
83
  end
74
84
 
75
85
  # @api private
76
86
  class EmptyStructure < Struct.new('AwsEmptyStructure')
77
87
  include(Aws::Structure)
78
88
  end
79
-
80
89
  end
@@ -1,16 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- use_system_rexml = ((RUBY_VERSION <=> "2.0.0") < 0)
4
- if use_system_rexml
5
- require "rbconfig"
6
- $LOAD_PATH.unshift(RbConfig::CONFIG["rubylibdir"])
7
- end
8
-
9
3
  require 'rexml/document'
10
4
  require 'rexml/streamlistener'
11
5
 
12
- $LOAD_PATH.shift if use_system_rexml
13
-
14
6
  module Aws
15
7
  module Xml
16
8
  class Parser
@@ -95,6 +95,8 @@ module Aws
95
95
  def child_frame(xml_name)
96
96
  if @member = @members[xml_name]
97
97
  Frame.new(xml_name, self, @member[:ref])
98
+ elsif @ref.shape.union
99
+ UnknownMemberFrame.new(xml_name, self, nil, @result)
98
100
  else
99
101
  NullFrame.new(xml_name, self)
100
102
  end
@@ -106,10 +108,24 @@ module Aws
106
108
  @result[@member[:name]][child.key.result] = child.value.result
107
109
  when FlatListFrame
108
110
  @result[@member[:name]] << child.result
111
+ when UnknownMemberFrame
112
+ @result[:unknown] = { 'name' => child.path.last, 'value' => child.result }
109
113
  when NullFrame
110
114
  else
111
115
  @result[@member[:name]] = child.result
112
116
  end
117
+
118
+ if @ref.shape.union
119
+ # a union may only have one member set
120
+ # convert to the union subclass
121
+ # The default Struct created will have defaults set for all values
122
+ # This also sets only one of the values leaving everything else nil
123
+ # as required for unions
124
+ set_member_name = @member ? @member[:name] : :unknown
125
+ member_subclass = @ref.shape.member_subclass(set_member_name).new # shape.member_subclass(target.member).new
126
+ member_subclass[set_member_name] = @result[set_member_name]
127
+ @result = member_subclass
128
+ end
113
129
  end
114
130
 
115
131
  private
@@ -242,6 +258,12 @@ module Aws
242
258
  end
243
259
  end
244
260
 
261
+ class UnknownMemberFrame < Frame
262
+ def result
263
+ @text.join
264
+ end
265
+ end
266
+
245
267
  class BlobFrame < Frame
246
268
  def result
247
269
  @text.empty? ? nil : Base64.decode64(@text.join)
@@ -302,6 +324,7 @@ module Aws
302
324
  MapShape => MapFrame,
303
325
  StringShape => StringFrame,
304
326
  StructureShape => StructureFrame,
327
+ UnionShape => StructureFrame,
305
328
  TimestampShape => TimestampFrame,
306
329
  }
307
330
 
@@ -523,7 +523,7 @@ module Aws::SSO
523
523
  params: params,
524
524
  config: config)
525
525
  context[:gem_name] = 'aws-sdk-core'
526
- context[:gem_version] = '3.117.0'
526
+ context[:gem_version] = '3.120.0'
527
527
  Seahorse::Client::Request.new(handlers, context)
528
528
  end
529
529
 
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.117.0'
53
+ GEM_VERSION = '3.120.0'
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.117.0'
2306
+ context[:gem_version] = '3.120.0'
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.117.0'
53
+ GEM_VERSION = '3.120.0'
54
54
 
55
55
  end
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- if RUBY_VERSION >= '2.1'
4
- begin
5
- require 'http/2'
6
- rescue LoadError; end
7
- end
3
+ begin
4
+ require 'http/2'
5
+ rescue LoadError; end
8
6
  require 'openssl'
9
7
  require 'socket'
10
8
 
@@ -1,10 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- if RUBY_VERSION >= '2.1'
4
- begin
5
- require 'http/2'
6
- rescue LoadError; end
7
- end
3
+ begin
4
+ require 'http/2'
5
+ rescue LoadError; end
6
+
8
7
  require 'securerandom'
9
8
 
10
9
  module Seahorse
@@ -12,96 +12,9 @@ module Seahorse
12
12
 
13
13
  def self.apply!
14
14
  return unless RUBY_VERSION < '2.5'
15
- if RUBY_VERSION >= '2.3'
16
- Net::HTTP::IDEMPOTENT_METHODS_.clear
17
- return
18
- end
19
- # no further patches needed for above versions
20
-
21
- if RUBY_VERSION >= '2.0'
22
- Net::HTTP.send(:include, Ruby_2)
23
- Net::HTTP::IDEMPOTENT_METHODS_.clear
24
- elsif RUBY_VERSION >= '1.9.3'
25
- Net::HTTP.send(:include, Ruby_1_9_3)
26
- end
27
- Net::HTTP.send(:alias_method, :old_transport_request, :transport_request)
28
- Net::HTTP.send(:alias_method, :transport_request, :new_transport_request)
15
+ Net::HTTP::IDEMPOTENT_METHODS_.clear
29
16
  end
30
17
 
31
- module Ruby_2
32
- def new_transport_request(req)
33
- count = 0
34
- begin
35
- begin_transport req
36
- res = catch(:response) {
37
- req.exec @socket, @curr_http_version, edit_path(req.path)
38
- begin
39
- res = Net::HTTPResponse.read_new(@socket)
40
- res.decode_content = req.decode_content
41
- end while res.kind_of?(Net::HTTPInformation)
42
-
43
- res.uri = req.uri
44
-
45
- res
46
- }
47
- res.reading_body(@socket, req.response_body_permitted?) {
48
- yield res if block_given?
49
- }
50
- rescue Net::OpenTimeout
51
- raise
52
- rescue Net::ReadTimeout, IOError, EOFError,
53
- Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE,
54
- # avoid a dependency on OpenSSL
55
- defined?(OpenSSL::SSL) ? OpenSSL::SSL::SSLError : IOError,
56
- Timeout::Error => exception
57
- if count == 0 && Net::HTTP::IDEMPOTENT_METHODS_.include?(req.method)
58
- count += 1
59
- @socket.close if @socket and not @socket.closed?
60
- D "Conn close because of error #{exception}, and retry"
61
- if req.body_stream
62
- if req.body_stream.respond_to?(:rewind)
63
- req.body_stream.rewind
64
- else
65
- raise
66
- end
67
- end
68
- retry
69
- end
70
- D "Conn close because of error #{exception}"
71
- @socket.close if @socket and not @socket.closed?
72
- raise
73
- end
74
-
75
- end_transport req, res
76
- res
77
- rescue => exception
78
- D "Conn close because of error #{exception}"
79
- @socket.close if @socket and not @socket.closed?
80
- raise exception
81
- end
82
- end
83
-
84
- module Ruby_1_9_3
85
- def new_transport_request(req)
86
- begin_transport req
87
- res = catch(:response) {
88
- req.exec @socket, @curr_http_version, edit_path(req.path)
89
- begin
90
- res = Net::HTTPResponse.read_new(@socket)
91
- end while res.kind_of?(Net::HTTPContinue)
92
- res
93
- }
94
- res.reading_body(@socket, req.response_body_permitted?) {
95
- yield res if block_given?
96
- }
97
- end_transport req, res
98
- res
99
- rescue => exception
100
- D "Conn close because of error #{exception}"
101
- @socket.close if @socket and not @socket.closed?
102
- raise exception
103
- end
104
- end
105
18
  end
106
19
  end
107
20
  end
@@ -61,6 +61,9 @@ module Seahorse
61
61
  # @return [Boolean]
62
62
  attr_accessor :eventheader_type
63
63
 
64
+ # @return [Boolean]
65
+ attr_accessor :document
66
+
64
67
  # @return [String, nil]
65
68
  def location
66
69
  @location || (shape && shape[:location])
@@ -114,6 +117,9 @@ module Seahorse
114
117
  # @return [String, nil]
115
118
  attr_accessor :documentation
116
119
 
120
+ # @return [Boolean]
121
+ attr_accessor :union
122
+
117
123
  # Gets metadata for the given `key`.
118
124
  def [](key)
119
125
  @metadata[key.to_s]
@@ -264,8 +270,27 @@ module Seahorse
264
270
 
265
271
  end
266
272
 
273
+ class UnionShape < StructureShape
274
+ def initialize(options = {})
275
+ @member_subclasses = {}
276
+ super options.merge(union: true)
277
+ end
278
+
279
+ # @api private
280
+ def member_subclass(member)
281
+ @member_subclasses[member]
282
+ end
283
+
284
+ # @api private
285
+ def add_member_subclass(member, subclass)
286
+ @member_subclasses[member] = subclass
287
+ end
288
+ end
289
+
267
290
  class TimestampShape < Shape; end
268
291
 
292
+ class DocumentShape < Shape; end
293
+
269
294
  end
270
295
  end
271
296
  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.117.0
4
+ version: 3.120.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: 2021-07-12 00:00:00.000000000 Z
11
+ date: 2021-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath
@@ -300,7 +300,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
300
300
  requirements:
301
301
  - - ">="
302
302
  - !ruby/object:Gem::Version
303
- version: '0'
303
+ version: '2.3'
304
304
  required_rubygems_version: !ruby/object:Gem::Requirement
305
305
  requirements:
306
306
  - - ">="