aws-sdk-core 3.185.0 → 3.187.1

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: 8b349088694d49324665364f4038b350e918b6db7f8987473a7a4a8ded10e1f7
4
- data.tar.gz: 665e4f12235cfe6fc9ee326981acb8b2bff3329d30f5c0e45a2b8113a6f563a8
3
+ metadata.gz: 561667b57fedf978414b0b67a7f19b73b01efa69bdfdd5db8a08c27c010f7b18
4
+ data.tar.gz: 460eec65537106f724e800ef0f81508fc714903da611ac8807071109d560206d
5
5
  SHA512:
6
- metadata.gz: 3c3e4dfc2aa8eac44b4188987415aa9c129020e062a29c4dde335ef44c985c89b45d3b90ff980f3671b32746da762498ce1a2d4ebfaeb9e4ac77d15a24e5b5c3
7
- data.tar.gz: 9d6dacf14ed1d093275a1b631d4cb90f330daf6bd4f4625d57768a4173aad627d65e953e41b4dc447fa2e9db87f0af401204c2c56c68b47fec37910b80a73eb5
6
+ metadata.gz: 63ec538568fc713a797c3f4f8c775482e0e2da2b8ea6938c9c8b7366aa52a36606d5e2feed58f8475306217a7e4599843a7c98889046dc4ea2a2a15ee339d8c9
7
+ data.tar.gz: c09ed8f0ba5302dbd470132a01c759851eacaab6c18f93034d95e3b755c645fae03702d80e4f1fb20630a2407d778ed60b2a8740f809255e5d00cef89120a982
data/CHANGELOG.md CHANGED
@@ -1,6 +1,33 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.187.1 (2023-11-20)
5
+ ------------------
6
+
7
+ * Issue - For `awsQueryCompatible` services, default an empty list or map for shapes that were previously flattened in the query protocol.
8
+
9
+ 3.187.0 (2023-11-17)
10
+ ------------------
11
+
12
+ * Feature - Updated Aws::STS::Client with the latest API changes.
13
+
14
+ * Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
15
+
16
+ 3.186.0 (2023-11-02)
17
+ ------------------
18
+
19
+ * Feature - Support disabling IMDSv1 in `InstanceProfileCredentials` using `ENV['AWS_EC2_METADATA_V1_DISABLED']`, `ec2_metadata_v1_disabled` shared config, or the `disable_imds_v1` credentials option.
20
+
21
+ 3.185.2 (2023-10-31)
22
+ ------------------
23
+
24
+ * Issue - Fix query string support to lists of booleans, floats, integers and timestamps per rest-json protocol.
25
+
26
+ 3.185.1 (2023-10-05)
27
+ ------------------
28
+
29
+ * Issue - Ignore `__type` when deserializing Unions.
30
+
4
31
  3.185.0 (2023-10-02)
5
32
  ------------------
6
33
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.185.0
1
+ 3.187.1
@@ -53,6 +53,8 @@ module Aws
53
53
  # @option options [String] :endpoint_mode ('IPv4') The endpoint mode for
54
54
  # the instance metadata service. This is either 'IPv4' ('169.254.169.254')
55
55
  # or 'IPv6' ('[fd00:ec2::254]').
56
+ # @option options [Boolean] :disable_imds_v1 (false) Disable the use of the
57
+ # legacy EC2 Metadata Service v1.
56
58
  # @option options [String] :ip_address ('169.254.169.254') Deprecated. Use
57
59
  # :endpoint instead. The IP address for the endpoint.
58
60
  # @option options [Integer] :port (80)
@@ -77,6 +79,9 @@ module Aws
77
79
  endpoint_mode = resolve_endpoint_mode(options)
78
80
  @endpoint = resolve_endpoint(options, endpoint_mode)
79
81
  @port = options[:port] || 80
82
+ @disable_imds_v1 = resolve_disable_v1(options)
83
+ # Flag for if v2 flow fails, skip future attempts
84
+ @imds_v1_fallback = false
80
85
  @http_open_timeout = options[:http_open_timeout] || 1
81
86
  @http_read_timeout = options[:http_read_timeout] || 1
82
87
  @http_debug_output = options[:http_debug_output]
@@ -123,6 +128,16 @@ module Aws
123
128
  end
124
129
  end
125
130
 
131
+ def resolve_disable_v1(options)
132
+ value = options[:disable_imds_v1]
133
+ value ||= ENV['AWS_EC2_METADATA_V1_DISABLED']
134
+ value ||= Aws.shared_config.ec2_metadata_v1_disabled(
135
+ profile: options[:profile]
136
+ )
137
+ value = value.to_s.downcase if value
138
+ Aws::Util.str_2_bool(value) || false
139
+ end
140
+
126
141
  def backoff(backoff)
127
142
  case backoff
128
143
  when Proc then backoff
@@ -141,7 +156,7 @@ module Aws
141
156
  # service is responding but is returning invalid JSON documents
142
157
  # in response to the GET profile credentials call.
143
158
  begin
144
- retry_errors([Aws::Json::ParseError, StandardError], max_retries: 3) do
159
+ retry_errors([Aws::Json::ParseError], max_retries: 3) do
145
160
  c = Aws::Json.load(get_credentials.to_s)
146
161
  if empty_credentials?(@credentials)
147
162
  @credentials = Credentials.new(
@@ -173,7 +188,6 @@ module Aws
173
188
  end
174
189
  end
175
190
  end
176
-
177
191
  end
178
192
  rescue Aws::Json::ParseError
179
193
  raise Aws::Errors::MetadataParserError
@@ -191,34 +205,14 @@ module Aws
191
205
  open_connection do |conn|
192
206
  # attempt to fetch token to start secure flow first
193
207
  # and rescue to failover
194
- begin
195
- retry_errors(NETWORK_ERRORS, max_retries: @retries) do
196
- unless token_set?
197
- created_time = Time.now
198
- token_value, ttl = http_put(
199
- conn, METADATA_TOKEN_PATH, @token_ttl
200
- )
201
- @token = Token.new(token_value, ttl, created_time) if token_value && ttl
202
- end
203
- end
204
- rescue *NETWORK_ERRORS
205
- # token attempt failed, reset token
206
- # fallback to non-token mode
207
- @token = nil
208
- end
209
-
208
+ fetch_token(conn) unless @imds_v1_fallback
210
209
  token = @token.value if token_set?
211
210
 
212
- begin
213
- metadata = http_get(conn, METADATA_PATH_BASE, token)
214
- profile_name = metadata.lines.first.strip
215
- http_get(conn, METADATA_PATH_BASE + profile_name, token)
216
- rescue TokenExpiredError
217
- # Token has expired, reset it
218
- # The next retry should fetch it
219
- @token = nil
220
- raise Non200Response
221
- end
211
+ # disable insecure flow if we couldn't get token
212
+ # and imds v1 is disabled
213
+ raise TokenRetrivalError if token.nil? && @disable_imds_v1
214
+
215
+ _get_credentials(conn, token)
222
216
  end
223
217
  end
224
218
  rescue
@@ -227,6 +221,36 @@ module Aws
227
221
  end
228
222
  end
229
223
 
224
+ def fetch_token(conn)
225
+ retry_errors(NETWORK_ERRORS, max_retries: @retries) do
226
+ unless token_set?
227
+ created_time = Time.now
228
+ token_value, ttl = http_put(
229
+ conn, METADATA_TOKEN_PATH, @token_ttl
230
+ )
231
+ @token = Token.new(token_value, ttl, created_time) if token_value && ttl
232
+ end
233
+ end
234
+ rescue *NETWORK_ERRORS
235
+ # token attempt failed, reset token
236
+ # fallback to non-token mode
237
+ @token = nil
238
+ @imds_v1_fallback = true
239
+ end
240
+
241
+ # token is optional - if nil, uses v1 (insecure) flow
242
+ def _get_credentials(conn, token)
243
+ metadata = http_get(conn, METADATA_PATH_BASE, token)
244
+ profile_name = metadata.lines.first.strip
245
+ http_get(conn, METADATA_PATH_BASE + profile_name, token)
246
+ rescue TokenExpiredError
247
+ # Token has expired, reset it
248
+ # The next retry should fetch it
249
+ @token = nil
250
+ @imds_v1_fallback = false
251
+ raise Non200Response
252
+ end
253
+
230
254
  def token_set?
231
255
  @token && !@token.expired?
232
256
  end
@@ -276,8 +300,6 @@ module Aws
276
300
  ]
277
301
  when 400
278
302
  raise TokenRetrivalError
279
- when 401
280
- raise TokenExpiredError
281
303
  else
282
304
  raise Non200Response
283
305
  end
@@ -59,7 +59,10 @@ module Aws
59
59
  end
60
60
  resp_struct
61
61
  else
62
- Parser.new(rules).parse(json == '' ? '{}' : json)
62
+ Parser.new(
63
+ rules,
64
+ query_compatible: query_compatible?(context)
65
+ ).parse(json == '' ? '{}' : json)
63
66
  end
64
67
  else
65
68
  EmptyStructure.new
@@ -83,6 +86,10 @@ module Aws
83
86
  context.config.simple_json
84
87
  end
85
88
 
89
+ def query_compatible?(context)
90
+ context.config.api.metadata.key?('awsQueryCompatible')
91
+ end
92
+
86
93
  end
87
94
  end
88
95
  end
@@ -10,8 +10,9 @@ module Aws
10
10
  include Seahorse::Model::Shapes
11
11
 
12
12
  # @param [Seahorse::Model::ShapeRef] rules
13
- def initialize(rules)
13
+ def initialize(rules, query_compatible: false)
14
14
  @rules = rules
15
+ @query_compatible = query_compatible
15
16
  end
16
17
 
17
18
  # @param [String<JSON>] json
@@ -28,10 +29,26 @@ module Aws
28
29
  member_name, member_ref = shape.member_by_location_name(key)
29
30
  if member_ref
30
31
  target[member_name] = parse_ref(member_ref, value)
31
- elsif shape.union
32
+ elsif shape.union && key != '__type'
32
33
  target[:unknown] = { 'name' => key, 'value' => value }
33
34
  end
34
35
  end
36
+ # In services that were previously Query/XML, members that were
37
+ # "flattened" defaulted to empty lists. In JSON, these values are nil,
38
+ # which is backwards incompatible. To preserve backwards compatibility,
39
+ # we set a default value of [] for these members.
40
+ if @query_compatible
41
+ ref.shape.members.each do |member_name, member_target|
42
+ next unless target[member_name].nil?
43
+
44
+ if flattened_list?(member_target.shape)
45
+ target[member_name] = []
46
+ elsif flattened_map?(member_target.shape)
47
+ target[member_name] = {}
48
+ end
49
+ end
50
+ end
51
+
35
52
  if shape.union
36
53
  # convert to subclass
37
54
  member_subclass = shape.member_subclass(target.member).new
@@ -79,6 +96,14 @@ module Aws
79
96
  value.is_a?(Numeric) ? Time.at(value) : Time.parse(value)
80
97
  end
81
98
 
99
+ def flattened_list?(shape)
100
+ shape.is_a?(ListShape) && shape.flattened
101
+ end
102
+
103
+ def flattened_map?(shape)
104
+ shape.is_a?(MapShape) && shape.flattened
105
+ end
106
+
82
107
  end
83
108
  end
84
109
  end
@@ -4,9 +4,16 @@ module Aws
4
4
  module Rest
5
5
  module Request
6
6
  class QuerystringBuilder
7
-
8
7
  include Seahorse::Model::Shapes
9
8
 
9
+ SUPPORTED_TYPES = [
10
+ BooleanShape,
11
+ FloatShape,
12
+ IntegerShape,
13
+ StringShape,
14
+ TimestampShape
15
+ ].freeze
16
+
10
17
  # Provide shape references and param values:
11
18
  #
12
19
  # [
@@ -33,29 +40,12 @@ module Aws
33
40
  def build_part(shape_ref, param_value)
34
41
  case shape_ref.shape
35
42
  # supported scalar types
36
- when StringShape, BooleanShape, FloatShape, IntegerShape, StringShape
37
- param_name = shape_ref.location_name
38
- "#{param_name}=#{escape(param_value.to_s)}"
39
- when TimestampShape
40
- param_name = shape_ref.location_name
41
- "#{param_name}=#{escape(timestamp(shape_ref, param_value))}"
43
+ when *SUPPORTED_TYPES
44
+ "#{shape_ref.location_name}=#{query_value(shape_ref, param_value)}"
42
45
  when MapShape
43
- if StringShape === shape_ref.shape.value.shape
44
- query_map_of_string(param_value)
45
- elsif ListShape === shape_ref.shape.value.shape
46
- query_map_of_string_list(param_value)
47
- else
48
- msg = "only map of string and string list supported"
49
- raise NotImplementedError, msg
50
- end
46
+ generate_query_map(shape_ref, param_value)
51
47
  when ListShape
52
- if StringShape === shape_ref.shape.member.shape
53
- list_of_strings(shape_ref.location_name, param_value)
54
- else
55
- msg = "Only list of strings supported, got "\
56
- "#{shape_ref.shape.member.shape.class.name}"
57
- raise NotImplementedError, msg
58
- end
48
+ generate_query_list(shape_ref, param_value)
59
49
  else
60
50
  raise NotImplementedError
61
51
  end
@@ -71,6 +61,37 @@ module Aws
71
61
  end
72
62
  end
73
63
 
64
+ def query_value(ref, value)
65
+ case ref.shape
66
+ when TimestampShape
67
+ escape(timestamp(ref, value))
68
+ when *SUPPORTED_TYPES
69
+ escape(value.to_s)
70
+ else
71
+ raise NotImplementedError
72
+ end
73
+ end
74
+
75
+ def generate_query_list(ref, values)
76
+ member_ref = ref.shape.member
77
+ values.map do |value|
78
+ value = query_value(member_ref, value)
79
+ "#{ref.location_name}=#{value}"
80
+ end
81
+ end
82
+
83
+ def generate_query_map(ref, value)
84
+ case ref.shape.value.shape
85
+ when StringShape
86
+ query_map_of_string(value)
87
+ when ListShape
88
+ query_map_of_string_list(value)
89
+ else
90
+ msg = 'Only map of string and string list supported'
91
+ raise NotImplementedError, msg
92
+ end
93
+ end
94
+
74
95
  def query_map_of_string(hash)
75
96
  list = []
76
97
  hash.each_pair do |key, value|
@@ -89,16 +110,9 @@ module Aws
89
110
  list
90
111
  end
91
112
 
92
- def list_of_strings(name, values)
93
- values.map do |value|
94
- "#{name}=#{escape(value)}"
95
- end
96
- end
97
-
98
113
  def escape(string)
99
114
  Seahorse::Util.uri_escape(string)
100
115
  end
101
-
102
116
  end
103
117
  end
104
118
  end
@@ -205,6 +205,7 @@ module Aws
205
205
  :use_fips_endpoint,
206
206
  :ec2_metadata_service_endpoint,
207
207
  :ec2_metadata_service_endpoint_mode,
208
+ :ec2_metadata_v1_disabled,
208
209
  :max_attempts,
209
210
  :retry_mode,
210
211
  :adaptive_retry_wait_to_fill,
@@ -605,7 +605,7 @@ module Aws::SSO
605
605
  params: params,
606
606
  config: config)
607
607
  context[:gem_name] = 'aws-sdk-core'
608
- context[:gem_version] = '3.185.0'
608
+ context[:gem_version] = '3.187.1'
609
609
  Seahorse::Client::Request.new(handlers, context)
610
610
  end
611
611
 
data/lib/aws-sdk-sso.rb CHANGED
@@ -54,6 +54,6 @@ require_relative 'aws-sdk-sso/customizations'
54
54
  # @!group service
55
55
  module Aws::SSO
56
56
 
57
- GEM_VERSION = '3.185.0'
57
+ GEM_VERSION = '3.187.1'
58
58
 
59
59
  end