aws-sdk-core 3.117.0 → 3.118.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: f880e91159fbbd13553271c925b06c11172de5ffda9f8931ae4ee66b09160100
4
+ data.tar.gz: 47f884e80449f6bffacc2babc3f96ba2248694aaab27da5bdbbaf895f29a0ec5
5
5
  SHA512:
6
- metadata.gz: 71053f9fca038e4fb57084f29d972034e845d58c45a973ac3e9690717689ba74228d6b1d25c2b1e473e8f2358091916875dfd3ffb90ed4ece0b36aaa38d9e81e
7
- data.tar.gz: 6e353f5356d8a61a4cfc70dce05f176859e5180e53b7de74c09bf1da7e57d0a5ac9f7cc58a584880b98b95d8518da62ed22adac942cf8d37a596300ea9caa102
6
+ metadata.gz: d776a66ce68988249850ffb707f23cabc7097232042dcb4425bdb1dc027a445d6adeacfb496758340cf66865cf2e5597c6d3ae67b48d81814b24d1d40ecdc6d9
7
+ data.tar.gz: afe710d79ca075dfa33da32ef42356f0ccc60362bb6b66d0aa76f5171141df24418288b48e3c12bb0fd40c8a650cee273177756a7993b4b44099f83f2b7c8253
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.118.0 (2021-07-28)
5
+ ------------------
6
+
7
+ * Feature - Add support for Tagged Unions using a "sealed" classes like approach where each union member has a corresponding subclass.
8
+
4
9
  3.117.0 (2021-07-12)
5
10
  ------------------
6
11
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.117.0
1
+ 3.118.0
@@ -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
 
@@ -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?
@@ -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
@@ -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
 
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.118.0'
54
54
 
55
55
  end
@@ -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.118.0'
527
527
  Seahorse::Client::Request.new(handlers, context)
528
528
  end
529
529
 
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.118.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.118.0'
2307
2307
  Seahorse::Client::Request.new(handlers, context)
2308
2308
  end
2309
2309
 
@@ -114,6 +114,9 @@ module Seahorse
114
114
  # @return [String, nil]
115
115
  attr_accessor :documentation
116
116
 
117
+ # @return [Boolean]
118
+ attr_accessor :union
119
+
117
120
  # Gets metadata for the given `key`.
118
121
  def [](key)
119
122
  @metadata[key.to_s]
@@ -264,6 +267,23 @@ module Seahorse
264
267
 
265
268
  end
266
269
 
270
+ class UnionShape < StructureShape
271
+ def initialize(options = {})
272
+ @member_subclasses = {}
273
+ super options.merge(union: true)
274
+ end
275
+
276
+ # @api private
277
+ def member_subclass(member)
278
+ @member_subclasses[member]
279
+ end
280
+
281
+ # @api private
282
+ def add_member_subclass(member, subclass)
283
+ @member_subclasses[member] = subclass
284
+ end
285
+ end
286
+
267
287
  class TimestampShape < Shape; end
268
288
 
269
289
  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.118.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-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath