aws-sdk-core 3.196.1 → 3.199.0

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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-core/binary/decode_handler.rb +3 -4
  5. data/lib/aws-sdk-core/binary/encode_handler.rb +1 -1
  6. data/lib/aws-sdk-core/binary/event_stream_decoder.rb +1 -0
  7. data/lib/aws-sdk-core/binary/event_stream_encoder.rb +4 -3
  8. data/lib/aws-sdk-core/cbor/cbor_engine.rb +19 -0
  9. data/lib/aws-sdk-core/cbor/decoder.rb +310 -0
  10. data/lib/aws-sdk-core/cbor/encoder.rb +243 -0
  11. data/lib/aws-sdk-core/cbor.rb +106 -0
  12. data/lib/aws-sdk-core/client_stubs.rb +3 -2
  13. data/lib/aws-sdk-core/endpoints/matchers.rb +5 -1
  14. data/lib/aws-sdk-core/error_handler.rb +41 -0
  15. data/lib/aws-sdk-core/json/error_handler.rb +6 -8
  16. data/lib/aws-sdk-core/json/handler.rb +5 -6
  17. data/lib/aws-sdk-core/json/json_engine.rb +3 -1
  18. data/lib/aws-sdk-core/json/oj_engine.rb +7 -1
  19. data/lib/aws-sdk-core/json/parser.rb +2 -0
  20. data/lib/aws-sdk-core/json.rb +43 -14
  21. data/lib/aws-sdk-core/pageable_response.rb +1 -1
  22. data/lib/aws-sdk-core/plugins/client_metrics_send_plugin.rb +14 -2
  23. data/lib/aws-sdk-core/plugins/global_configuration.rb +8 -9
  24. data/lib/aws-sdk-core/plugins/protocols/api_gateway.rb +3 -1
  25. data/lib/aws-sdk-core/plugins/protocols/ec2.rb +2 -24
  26. data/lib/aws-sdk-core/plugins/protocols/json_rpc.rb +6 -8
  27. data/lib/aws-sdk-core/plugins/protocols/query.rb +4 -2
  28. data/lib/aws-sdk-core/plugins/protocols/rest_json.rb +4 -3
  29. data/lib/aws-sdk-core/plugins/protocols/rest_xml.rb +5 -1
  30. data/lib/aws-sdk-core/plugins/protocols/rpc_v2.rb +17 -0
  31. data/lib/aws-sdk-core/plugins/request_compression.rb +10 -1
  32. data/lib/aws-sdk-core/plugins/retry_errors.rb +10 -3
  33. data/lib/aws-sdk-core/plugins/user_agent.rb +58 -24
  34. data/lib/aws-sdk-core/process_credentials.rb +45 -27
  35. data/lib/aws-sdk-core/query/ec2_handler.rb +27 -0
  36. data/lib/aws-sdk-core/query/handler.rb +4 -4
  37. data/lib/aws-sdk-core/query.rb +2 -1
  38. data/lib/aws-sdk-core/rest/{request/content_type.rb → content_type_handler.rb} +1 -1
  39. data/lib/aws-sdk-core/rest/handler.rb +3 -4
  40. data/lib/aws-sdk-core/rest/request/endpoint.rb +3 -1
  41. data/lib/aws-sdk-core/rest.rb +1 -1
  42. data/lib/aws-sdk-core/rpc_v2/builder.rb +62 -0
  43. data/lib/aws-sdk-core/rpc_v2/content_type_handler.rb +45 -0
  44. data/lib/aws-sdk-core/rpc_v2/error_handler.rb +84 -0
  45. data/lib/aws-sdk-core/rpc_v2/handler.rb +74 -0
  46. data/lib/aws-sdk-core/rpc_v2/parser.rb +90 -0
  47. data/lib/aws-sdk-core/rpc_v2.rb +6 -0
  48. data/lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb +41 -0
  49. data/lib/aws-sdk-core/util.rb +4 -4
  50. data/lib/aws-sdk-core/waiters/poller.rb +1 -1
  51. data/lib/aws-sdk-core/xml/error_handler.rb +11 -37
  52. data/lib/aws-sdk-core/xml/parser.rb +2 -6
  53. data/lib/aws-sdk-core.rb +6 -2
  54. data/lib/aws-sdk-sso/client.rb +6 -3
  55. data/lib/aws-sdk-sso.rb +1 -1
  56. data/lib/aws-sdk-ssooidc/client.rb +6 -3
  57. data/lib/aws-sdk-ssooidc.rb +1 -1
  58. data/lib/aws-sdk-sts/client.rb +6 -3
  59. data/lib/aws-sdk-sts.rb +1 -1
  60. data/lib/seahorse/client/base.rb +17 -7
  61. data/lib/seahorse/client/handler.rb +1 -1
  62. data/lib/seahorse/client/plugins/endpoint.rb +0 -1
  63. metadata +22 -8
  64. /data/lib/aws-sdk-core/xml/parser/{engines/libxml.rb → libxml_engine.rb} +0 -0
  65. /data/lib/aws-sdk-core/xml/parser/{engines/nokogiri.rb → nokogiri_engine.rb} +0 -0
  66. /data/lib/aws-sdk-core/xml/parser/{engines/oga.rb → oga_engine.rb} +0 -0
  67. /data/lib/aws-sdk-core/xml/parser/{engines/ox.rb → ox_engine.rb} +0 -0
  68. /data/lib/aws-sdk-core/xml/parser/{engines/rexml.rb → rexml_engine.rb} +0 -0
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'time'
4
+
5
+ module Aws
6
+ module RpcV2
7
+ class Parser
8
+ include Seahorse::Model::Shapes
9
+
10
+ # @param [Seahorse::Model::ShapeRef] rules
11
+ def initialize(rules, query_compatible: false)
12
+ @rules = rules
13
+ @query_compatible = query_compatible
14
+ end
15
+
16
+ def parse(cbor, target = nil)
17
+ return {} if cbor.empty?
18
+
19
+ parse_ref(@rules, Cbor.decode(cbor), target)
20
+ end
21
+
22
+ private
23
+
24
+ def structure(ref, values, target = nil)
25
+ shape = ref.shape
26
+ target = ref.shape.struct_class.new if target.nil?
27
+ values.each do |key, value|
28
+ member_name, member_ref = shape.member_by_location_name(key)
29
+ if member_ref
30
+ target[member_name] = parse_ref(member_ref, value)
31
+ elsif shape.union && key != '__type'
32
+ target[:unknown] = { 'name' => key, 'value' => value }
33
+ end
34
+ end
35
+ # In services that were previously Query/XML, members that were
36
+ # "flattened" defaulted to empty lists. In JSON, these values are nil,
37
+ # which is backwards incompatible. To preserve backwards compatibility,
38
+ # we set a default value of [] for these members.
39
+ if @query_compatible
40
+ ref.shape.members.each do |member_name, member_target|
41
+ next unless target[member_name].nil?
42
+
43
+ if flattened_list?(member_target.shape)
44
+ target[member_name] = []
45
+ elsif flattened_map?(member_target.shape)
46
+ target[member_name] = {}
47
+ end
48
+ end
49
+ end
50
+
51
+ if shape.union
52
+ # convert to subclass
53
+ member_subclass = shape.member_subclass(target.member).new
54
+ member_subclass[target.member] = target.value
55
+ target = member_subclass
56
+ end
57
+ target
58
+ end
59
+
60
+ def list(ref, values, target = nil)
61
+ target = [] if target.nil?
62
+ values.each do |value|
63
+ target << parse_ref(ref.shape.member, value)
64
+ end
65
+ target
66
+ end
67
+
68
+ def map(ref, values, target = nil)
69
+ target = {} if target.nil?
70
+ values.each do |key, value|
71
+ target[key] = parse_ref(ref.shape.value, value) unless value.nil?
72
+ end
73
+ target
74
+ end
75
+
76
+ def parse_ref(ref, value, target = nil)
77
+ if value.nil?
78
+ nil
79
+ else
80
+ case ref.shape
81
+ when StructureShape then structure(ref, value, target)
82
+ when ListShape then list(ref, value, target)
83
+ when MapShape then map(ref, value, target)
84
+ else value
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,6 @@
1
+ require_relative 'cbor'
2
+ require_relative 'rpc_v2/handler'
3
+ require_relative 'rpc_v2/content_type_handler'
4
+ require_relative 'rpc_v2/error_handler'
5
+ require_relative 'rpc_v2/builder'
6
+ require_relative 'rpc_v2/parser'
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aws
4
+ module Stubbing
5
+ module Protocols
6
+ class RpcV2
7
+
8
+ def stub_data(api, operation, data)
9
+ resp = Seahorse::Client::Http::Response.new
10
+ resp.status_code = 200
11
+ resp.headers['Content-Type'] = content_type(api)
12
+ resp.headers['x-amzn-RequestId'] = 'stubbed-request-id'
13
+ resp.body = build_body(operation, data)
14
+ resp
15
+ end
16
+
17
+ def stub_error(error_code)
18
+ http_resp = Seahorse::Client::Http::Response.new
19
+ http_resp.status_code = 400
20
+ http_resp.body = <<-JSON.strip
21
+ {
22
+ "code": #{error_code.inspect},
23
+ "message": "stubbed-response-error-message"
24
+ }
25
+ JSON
26
+ http_resp
27
+ end
28
+
29
+ private
30
+
31
+ def content_type(api)
32
+ 'application/cbor'
33
+ end
34
+
35
+ def build_body(operation, data)
36
+ Aws::RpcV2::Builder.new(operation.output).serialize(data)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -90,16 +90,16 @@ module Aws
90
90
  end
91
91
  end
92
92
 
93
- # @param [String, Integer] value
93
+ # @param [String] value
94
94
  # @return [Time]
95
95
  def deserialize_time(value)
96
96
  case value
97
97
  when nil then nil
98
- when /^\d+$/ then Time.at(value.to_i)
98
+ when /^[\d.]+$/ then Time.at(value.to_f).utc
99
99
  else
100
100
  begin
101
- fractional_time = Time.parse(value).utc.to_f
102
- Time.at(fractional_time)
101
+ fractional_time = Time.parse(value).to_f
102
+ Time.at(fractional_time).utc
103
103
  rescue ArgumentError
104
104
  raise "unhandled timestamp format `#{value}'"
105
105
  end
@@ -62,7 +62,7 @@ module Aws
62
62
  def send_request(options)
63
63
  req = options[:client].build_request(@operation_name, options[:params])
64
64
  req.handlers.remove(RAISE_HANDLER)
65
- Aws::Plugins::UserAgent.feature('waiter') do
65
+ Aws::Plugins::UserAgent.metric('WAITER') do
66
66
  req.send_request
67
67
  end
68
68
  end
@@ -4,7 +4,7 @@ require 'cgi'
4
4
 
5
5
  module Aws
6
6
  module Xml
7
- class ErrorHandler < Seahorse::Client::Handler
7
+ class ErrorHandler < Aws::ErrorHandler
8
8
 
9
9
  def call(context)
10
10
  @handler.call(context).on(300..599) do |response|
@@ -15,32 +15,19 @@ module Aws
15
15
 
16
16
  private
17
17
 
18
- def error(context)
19
- body = context.http_response.body_contents
20
- if body.empty?
21
- code = http_status_error_code(context)
22
- message = ''
23
- data = EmptyStructure.new
24
- else
25
- code, message, data = extract_error(body, context)
26
- end
27
- context[:request_id] = request_id(body)
28
- errors_module = context.client.class.errors_module
29
- errors_module.error_class(code).new(context, message, data)
30
- end
31
-
32
18
  def extract_error(body, context)
19
+ context[:request_id] = request_id(body)
33
20
  code = error_code(body, context)
34
21
  [
35
22
  code,
36
23
  error_message(body),
37
- error_data(context, code)
24
+ error_data(context, body, code)
38
25
  ]
39
26
  end
40
27
 
41
- def error_data(context, code)
28
+ def error_data(context, body, code)
42
29
  data = EmptyStructure.new
43
- if error_rules = context.operation.errors
30
+ if (error_rules = context.operation.errors)
44
31
  error_rules.each do |rule|
45
32
  # query protocol may have custom error code
46
33
  # reference: https://smithy.io/2.0/aws/protocols/aws-query-protocol.html#error-code-resolution
@@ -48,7 +35,7 @@ module Aws
48
35
  match = (code == error_shape_code || code == rule.shape.name)
49
36
  next unless match && rule.shape.members.any?
50
37
 
51
- data = parse_error_data(rule, context.http_response.body_contents)
38
+ data = parse_error_data(rule, body)
52
39
  # supporting HTTP bindings
53
40
  apply_error_headers(rule, context, data)
54
41
  end
@@ -62,7 +49,7 @@ module Aws
62
49
  # errors may nested under <Errors><Error>structure_data</Error></Errors>
63
50
  # Or may be flat and under <Error>structure_data</Error>
64
51
  body = body.tr("\n", '')
65
- if matches = body.match(/<Error>(.+?)<\/Error>/)
52
+ if (matches = body.match(/<Error>(.+?)<\/Error>/))
66
53
  Parser.new(rule).parse("<#{rule.shape.name}>#{matches[1]}</#{rule.shape.name}>")
67
54
  else
68
55
  EmptyStructure.new
@@ -75,28 +62,15 @@ module Aws
75
62
  end
76
63
 
77
64
  def error_code(body, context)
78
- if matches = body.match(/<Code>(.+?)<\/Code>/)
65
+ if (matches = body.match(/<Code>(.+?)<\/Code>/))
79
66
  remove_prefix(unescape(matches[1]), context)
80
67
  else
81
68
  http_status_error_code(context)
82
69
  end
83
70
  end
84
71
 
85
- def http_status_error_code(context)
86
- status_code = context.http_response.status_code
87
- {
88
- 302 => 'MovedTemporarily',
89
- 304 => 'NotModified',
90
- 400 => 'BadRequest',
91
- 403 => 'Forbidden',
92
- 404 => 'NotFound',
93
- 412 => 'PreconditionFailed',
94
- 413 => 'RequestEntityTooLarge',
95
- }[status_code] || "Http#{status_code}Error"
96
- end
97
-
98
72
  def remove_prefix(error_code, context)
99
- if prefix = context.config.api.metadata['errorPrefix']
73
+ if (prefix = context.config.api.metadata['errorPrefix'])
100
74
  error_code.sub(/^#{prefix}/, '')
101
75
  else
102
76
  error_code
@@ -104,7 +78,7 @@ module Aws
104
78
  end
105
79
 
106
80
  def error_message(body)
107
- if matches = body.match(/<Message>(.+?)<\/Message>/m)
81
+ if (matches = body.match(/<Message>(.+?)<\/Message>/m))
108
82
  unescape(matches[1])
109
83
  else
110
84
  ''
@@ -112,7 +86,7 @@ module Aws
112
86
  end
113
87
 
114
88
  def request_id(body)
115
- if matches = body.match(/<RequestId>(.+?)<\/RequestId>/m)
89
+ if (matches = body.match(/<RequestId>(.+?)<\/RequestId>/m))
116
90
  matches[1]
117
91
  end
118
92
  end
@@ -5,7 +5,6 @@ module Aws
5
5
  module Xml
6
6
  # A SAX-style XML parser that uses a shape context to handle types.
7
7
  class Parser
8
-
9
8
  # @param [Seahorse::Model::ShapeRef] rules
10
9
  def initialize(rules, options = {})
11
10
  @rules = rules
@@ -47,8 +46,7 @@ module Aws
47
46
  # * :libxml
48
47
  # * :nokogiri
49
48
  # * :rexml
50
- #
51
- def engine= engine
49
+ def engine=(engine)
52
50
  @engine = Class === engine ? engine : load_engine(engine)
53
51
  end
54
52
 
@@ -60,7 +58,6 @@ module Aws
60
58
  # * {LibxmlEngine}
61
59
  # * {NokogiriEngine}
62
60
  # * {RexmlEngine}
63
- #
64
61
  def engine
65
62
  set_default_engine unless @engine
66
63
  @engine
@@ -80,7 +77,7 @@ module Aws
80
77
  private
81
78
 
82
79
  def load_engine(name)
83
- require "aws-sdk-core/xml/parser/engines/#{name}"
80
+ require "aws-sdk-core/xml/parser/#{name}_engine"
84
81
  const_name = name[0].upcase + name[1..-1] + 'Engine'
85
82
  const_get(const_name)
86
83
  end
@@ -94,7 +91,6 @@ module Aws
94
91
  end
95
92
 
96
93
  set_default_engine
97
-
98
94
  end
99
95
  end
100
96
  end
data/lib/aws-sdk-core.rb CHANGED
@@ -63,19 +63,23 @@ require_relative 'aws-sdk-core/stubbing/xml_error'
63
63
 
64
64
  # stubbing protocols
65
65
 
66
- require_relative 'aws-sdk-core/stubbing/protocols/ec2'
67
66
  require_relative 'aws-sdk-core/stubbing/protocols/json'
68
- require_relative 'aws-sdk-core/stubbing/protocols/query'
69
67
  require_relative 'aws-sdk-core/stubbing/protocols/rest'
70
68
  require_relative 'aws-sdk-core/stubbing/protocols/rest_json'
71
69
  require_relative 'aws-sdk-core/stubbing/protocols/rest_xml'
70
+ require_relative 'aws-sdk-core/stubbing/protocols/query'
71
+ require_relative 'aws-sdk-core/stubbing/protocols/ec2'
72
+ require_relative 'aws-sdk-core/stubbing/protocols/rpc_v2'
72
73
  require_relative 'aws-sdk-core/stubbing/protocols/api_gateway'
73
74
 
74
75
  # protocols
75
76
 
77
+ require_relative 'aws-sdk-core/error_handler'
76
78
  require_relative 'aws-sdk-core/rest'
77
79
  require_relative 'aws-sdk-core/xml'
78
80
  require_relative 'aws-sdk-core/json'
81
+ require_relative 'aws-sdk-core/query'
82
+ require_relative 'aws-sdk-core/rpc_v2'
79
83
 
80
84
  # event stream
81
85
 
@@ -89,6 +89,11 @@ module Aws::SSO
89
89
 
90
90
  # @overload initialize(options)
91
91
  # @param [Hash] options
92
+ #
93
+ # @option options [Array<Seahorse::Client::Plugin>] :plugins ([]])
94
+ # A list of plugins to apply to the client. Each plugin is either a
95
+ # class name or an instance of a plugin class.
96
+ #
92
97
  # @option options [required, Aws::CredentialProvider] :credentials
93
98
  # Your AWS credentials. This can be an instance of any one of the
94
99
  # following classes:
@@ -209,7 +214,6 @@ module Aws::SSO
209
214
  # 'https://example.com'
210
215
  # 'http://example.com:123'
211
216
  #
212
- #
213
217
  # @option options [Integer] :endpoint_cache_max_entries (1000)
214
218
  # Used for the maximum size limit of the LRU cache storing endpoints data
215
219
  # for endpoint discovery enabled operations. Defaults to 1000.
@@ -298,7 +302,6 @@ module Aws::SSO
298
302
  # throttling. This is a provisional mode that may change behavior
299
303
  # in the future.
300
304
  #
301
- #
302
305
  # @option options [String] :sdk_ua_app_id
303
306
  # A unique and opaque application ID that is appended to the
304
307
  # User-Agent header as app/sdk_ua_app_id. It should have a
@@ -630,7 +633,7 @@ module Aws::SSO
630
633
  params: params,
631
634
  config: config)
632
635
  context[:gem_name] = 'aws-sdk-core'
633
- context[:gem_version] = '3.196.1'
636
+ context[:gem_version] = '3.199.0'
634
637
  Seahorse::Client::Request.new(handlers, context)
635
638
  end
636
639
 
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.196.1'
57
+ GEM_VERSION = '3.199.0'
58
58
 
59
59
  end
@@ -89,6 +89,11 @@ module Aws::SSOOIDC
89
89
 
90
90
  # @overload initialize(options)
91
91
  # @param [Hash] options
92
+ #
93
+ # @option options [Array<Seahorse::Client::Plugin>] :plugins ([]])
94
+ # A list of plugins to apply to the client. Each plugin is either a
95
+ # class name or an instance of a plugin class.
96
+ #
92
97
  # @option options [required, Aws::CredentialProvider] :credentials
93
98
  # Your AWS credentials. This can be an instance of any one of the
94
99
  # following classes:
@@ -209,7 +214,6 @@ module Aws::SSOOIDC
209
214
  # 'https://example.com'
210
215
  # 'http://example.com:123'
211
216
  #
212
- #
213
217
  # @option options [Integer] :endpoint_cache_max_entries (1000)
214
218
  # Used for the maximum size limit of the LRU cache storing endpoints data
215
219
  # for endpoint discovery enabled operations. Defaults to 1000.
@@ -298,7 +302,6 @@ module Aws::SSOOIDC
298
302
  # throttling. This is a provisional mode that may change behavior
299
303
  # in the future.
300
304
  #
301
- #
302
305
  # @option options [String] :sdk_ua_app_id
303
306
  # A unique and opaque application ID that is appended to the
304
307
  # User-Agent header as app/sdk_ua_app_id. It should have a
@@ -983,7 +986,7 @@ module Aws::SSOOIDC
983
986
  params: params,
984
987
  config: config)
985
988
  context[:gem_name] = 'aws-sdk-core'
986
- context[:gem_version] = '3.196.1'
989
+ context[:gem_version] = '3.199.0'
987
990
  Seahorse::Client::Request.new(handlers, context)
988
991
  end
989
992
 
@@ -54,6 +54,6 @@ require_relative 'aws-sdk-ssooidc/customizations'
54
54
  # @!group service
55
55
  module Aws::SSOOIDC
56
56
 
57
- GEM_VERSION = '3.196.1'
57
+ GEM_VERSION = '3.199.0'
58
58
 
59
59
  end
@@ -91,6 +91,11 @@ module Aws::STS
91
91
 
92
92
  # @overload initialize(options)
93
93
  # @param [Hash] options
94
+ #
95
+ # @option options [Array<Seahorse::Client::Plugin>] :plugins ([]])
96
+ # A list of plugins to apply to the client. Each plugin is either a
97
+ # class name or an instance of a plugin class.
98
+ #
94
99
  # @option options [required, Aws::CredentialProvider] :credentials
95
100
  # Your AWS credentials. This can be an instance of any one of the
96
101
  # following classes:
@@ -211,7 +216,6 @@ module Aws::STS
211
216
  # 'https://example.com'
212
217
  # 'http://example.com:123'
213
218
  #
214
- #
215
219
  # @option options [Integer] :endpoint_cache_max_entries (1000)
216
220
  # Used for the maximum size limit of the LRU cache storing endpoints data
217
221
  # for endpoint discovery enabled operations. Defaults to 1000.
@@ -300,7 +304,6 @@ module Aws::STS
300
304
  # throttling. This is a provisional mode that may change behavior
301
305
  # in the future.
302
306
  #
303
- #
304
307
  # @option options [String] :sdk_ua_app_id
305
308
  # A unique and opaque application ID that is appended to the
306
309
  # User-Agent header as app/sdk_ua_app_id. It should have a
@@ -2377,7 +2380,7 @@ module Aws::STS
2377
2380
  params: params,
2378
2381
  config: config)
2379
2382
  context[:gem_name] = 'aws-sdk-core'
2380
- context[:gem_version] = '3.196.1'
2383
+ context[:gem_version] = '3.199.0'
2381
2384
  Seahorse::Client::Request.new(handlers, context)
2382
2385
  end
2383
2386
 
data/lib/aws-sdk-sts.rb CHANGED
@@ -54,6 +54,6 @@ require_relative 'aws-sdk-sts/customizations'
54
54
  # @!group service
55
55
  module Aws::STS
56
56
 
57
- GEM_VERSION = '3.196.1'
57
+ GEM_VERSION = '3.199.0'
58
58
 
59
59
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'thread'
4
-
5
3
  module Seahorse
6
4
  module Client
7
5
  class Base
@@ -60,6 +58,7 @@ module Seahorse
60
58
  def build_config(plugins, options)
61
59
  config = Configuration.new
62
60
  config.add_option(:api)
61
+ config.add_option(:plugins)
63
62
  plugins.each do |plugin|
64
63
  plugin.add_options(config) if plugin.respond_to?(:add_options)
65
64
  end
@@ -96,9 +95,9 @@ module Seahorse
96
95
  class << self
97
96
 
98
97
  def new(options = {})
99
- plugins = build_plugins
100
98
  options = options.dup
101
- before_initialize(plugins, options)
99
+ plugins = build_plugins(self.plugins + options.fetch(:plugins, []))
100
+ plugins = before_initialize(plugins, options)
102
101
  client = allocate
103
102
  client.send(:initialize, plugins, options)
104
103
  client
@@ -209,17 +208,28 @@ module Seahorse
209
208
  include(operations_module)
210
209
  end
211
210
 
212
- def build_plugins
211
+ def build_plugins(plugins)
213
212
  plugins.map { |plugin| plugin.is_a?(Class) ? plugin.new : plugin }
214
213
  end
215
214
 
216
215
  def before_initialize(plugins, options)
217
- plugins.each do |plugin|
218
- plugin.before_initialize(self, options) if plugin.respond_to?(:before_initialize)
216
+ queue = Queue.new
217
+ plugins.each { |plugin| queue.push(plugin) }
218
+ until queue.empty?
219
+ plugin = queue.pop
220
+ next unless plugin.respond_to?(:before_initialize)
221
+
222
+ plugins_before = options.fetch(:plugins, [])
223
+ plugin.before_initialize(self, options)
224
+ plugins_after = build_plugins(options.fetch(:plugins, []) - plugins_before)
225
+ # Plugins with before_initialize can add other plugins
226
+ plugins_after.each { |p| queue.push(p); plugins << p }
219
227
  end
228
+ plugins
220
229
  end
221
230
 
222
231
  def inherited(subclass)
232
+ super
223
233
  subclass.instance_variable_set('@plugins', PluginList.new(@plugins))
224
234
  end
225
235
 
@@ -15,7 +15,7 @@ module Seahorse
15
15
  attr_accessor :handler
16
16
 
17
17
  # @param [RequestContext] context
18
- # @return [Response]
18
+ # @return [Seahorse::Response]
19
19
  def call(context)
20
20
  @handler.call(context)
21
21
  end
@@ -17,7 +17,6 @@ be a URI formatted like:
17
17
  'http://example.com'
18
18
  'https://example.com'
19
19
  'http://example.com:123'
20
-
21
20
  DOCS
22
21
 
23
22
  def add_handlers(handlers, config)
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.196.1
4
+ version: 3.199.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: 2024-05-14 00:00:00.000000000 Z
11
+ date: 2024-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath
@@ -111,6 +111,10 @@ files:
111
111
  - lib/aws-sdk-core/binary/event_parser.rb
112
112
  - lib/aws-sdk-core/binary/event_stream_decoder.rb
113
113
  - lib/aws-sdk-core/binary/event_stream_encoder.rb
114
+ - lib/aws-sdk-core/cbor.rb
115
+ - lib/aws-sdk-core/cbor/cbor_engine.rb
116
+ - lib/aws-sdk-core/cbor/decoder.rb
117
+ - lib/aws-sdk-core/cbor/encoder.rb
114
118
  - lib/aws-sdk-core/client_side_monitoring/publisher.rb
115
119
  - lib/aws-sdk-core/client_side_monitoring/request_metrics.rb
116
120
  - lib/aws-sdk-core/client_stubs.rb
@@ -136,6 +140,7 @@ files:
136
140
  - lib/aws-sdk-core/endpoints/templater.rb
137
141
  - lib/aws-sdk-core/endpoints/tree_rule.rb
138
142
  - lib/aws-sdk-core/endpoints/url.rb
143
+ - lib/aws-sdk-core/error_handler.rb
139
144
  - lib/aws-sdk-core/errors.rb
140
145
  - lib/aws-sdk-core/event_emitter.rb
141
146
  - lib/aws-sdk-core/ini_parser.rb
@@ -184,6 +189,7 @@ files:
184
189
  - lib/aws-sdk-core/plugins/protocols/query.rb
185
190
  - lib/aws-sdk-core/plugins/protocols/rest_json.rb
186
191
  - lib/aws-sdk-core/plugins/protocols/rest_xml.rb
192
+ - lib/aws-sdk-core/plugins/protocols/rpc_v2.rb
187
193
  - lib/aws-sdk-core/plugins/recursion_detection.rb
188
194
  - lib/aws-sdk-core/plugins/regional_endpoint.rb
189
195
  - lib/aws-sdk-core/plugins/request_compression.rb
@@ -201,6 +207,7 @@ files:
201
207
  - lib/aws-sdk-core/plugins/user_agent.rb
202
208
  - lib/aws-sdk-core/process_credentials.rb
203
209
  - lib/aws-sdk-core/query.rb
210
+ - lib/aws-sdk-core/query/ec2_handler.rb
204
211
  - lib/aws-sdk-core/query/ec2_param_builder.rb
205
212
  - lib/aws-sdk-core/query/handler.rb
206
213
  - lib/aws-sdk-core/query/param.rb
@@ -210,10 +217,10 @@ files:
210
217
  - lib/aws-sdk-core/refreshing_token.rb
211
218
  - lib/aws-sdk-core/resources/collection.rb
212
219
  - lib/aws-sdk-core/rest.rb
220
+ - lib/aws-sdk-core/rest/content_type_handler.rb
213
221
  - lib/aws-sdk-core/rest/handler.rb
214
222
  - lib/aws-sdk-core/rest/request/body.rb
215
223
  - lib/aws-sdk-core/rest/request/builder.rb
216
- - lib/aws-sdk-core/rest/request/content_type.rb
217
224
  - lib/aws-sdk-core/rest/request/endpoint.rb
218
225
  - lib/aws-sdk-core/rest/request/headers.rb
219
226
  - lib/aws-sdk-core/rest/request/querystring_builder.rb
@@ -222,6 +229,12 @@ files:
222
229
  - lib/aws-sdk-core/rest/response/headers.rb
223
230
  - lib/aws-sdk-core/rest/response/parser.rb
224
231
  - lib/aws-sdk-core/rest/response/status_code.rb
232
+ - lib/aws-sdk-core/rpc_v2.rb
233
+ - lib/aws-sdk-core/rpc_v2/builder.rb
234
+ - lib/aws-sdk-core/rpc_v2/content_type_handler.rb
235
+ - lib/aws-sdk-core/rpc_v2/error_handler.rb
236
+ - lib/aws-sdk-core/rpc_v2/handler.rb
237
+ - lib/aws-sdk-core/rpc_v2/parser.rb
225
238
  - lib/aws-sdk-core/shared_config.rb
226
239
  - lib/aws-sdk-core/shared_credentials.rb
227
240
  - lib/aws-sdk-core/sso_credentials.rb
@@ -237,6 +250,7 @@ files:
237
250
  - lib/aws-sdk-core/stubbing/protocols/rest.rb
238
251
  - lib/aws-sdk-core/stubbing/protocols/rest_json.rb
239
252
  - lib/aws-sdk-core/stubbing/protocols/rest_xml.rb
253
+ - lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb
240
254
  - lib/aws-sdk-core/stubbing/stub_data.rb
241
255
  - lib/aws-sdk-core/stubbing/xml_error.rb
242
256
  - lib/aws-sdk-core/token.rb
@@ -255,13 +269,13 @@ files:
255
269
  - lib/aws-sdk-core/xml/doc_builder.rb
256
270
  - lib/aws-sdk-core/xml/error_handler.rb
257
271
  - lib/aws-sdk-core/xml/parser.rb
258
- - lib/aws-sdk-core/xml/parser/engines/libxml.rb
259
- - lib/aws-sdk-core/xml/parser/engines/nokogiri.rb
260
- - lib/aws-sdk-core/xml/parser/engines/oga.rb
261
- - lib/aws-sdk-core/xml/parser/engines/ox.rb
262
- - lib/aws-sdk-core/xml/parser/engines/rexml.rb
263
272
  - lib/aws-sdk-core/xml/parser/frame.rb
273
+ - lib/aws-sdk-core/xml/parser/libxml_engine.rb
274
+ - lib/aws-sdk-core/xml/parser/nokogiri_engine.rb
275
+ - lib/aws-sdk-core/xml/parser/oga_engine.rb
276
+ - lib/aws-sdk-core/xml/parser/ox_engine.rb
264
277
  - lib/aws-sdk-core/xml/parser/parsing_error.rb
278
+ - lib/aws-sdk-core/xml/parser/rexml_engine.rb
265
279
  - lib/aws-sdk-core/xml/parser/stack.rb
266
280
  - lib/aws-sdk-sso.rb
267
281
  - lib/aws-sdk-sso/client.rb