aws-sdk-core 3.191.1 → 3.229.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 (181) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +539 -1
  3. data/VERSION +1 -1
  4. data/lib/aws-defaults/default_configuration.rb +1 -2
  5. data/lib/aws-defaults.rb +4 -1
  6. data/lib/aws-sdk-core/arn.rb +1 -3
  7. data/lib/aws-sdk-core/assume_role_credentials.rb +13 -5
  8. data/lib/aws-sdk-core/assume_role_web_identity_credentials.rb +14 -7
  9. data/lib/aws-sdk-core/binary/decode_handler.rb +3 -9
  10. data/lib/aws-sdk-core/binary/encode_handler.rb +1 -1
  11. data/lib/aws-sdk-core/binary/event_builder.rb +34 -37
  12. data/lib/aws-sdk-core/binary/event_stream_decoder.rb +1 -0
  13. data/lib/aws-sdk-core/binary/event_stream_encoder.rb +4 -3
  14. data/lib/aws-sdk-core/cbor/decoder.rb +308 -0
  15. data/lib/aws-sdk-core/cbor/encoder.rb +243 -0
  16. data/lib/aws-sdk-core/cbor.rb +53 -0
  17. data/lib/aws-sdk-core/client_side_monitoring.rb +9 -0
  18. data/lib/aws-sdk-core/client_stubs.rb +30 -55
  19. data/lib/aws-sdk-core/credential_provider.rb +4 -0
  20. data/lib/aws-sdk-core/credential_provider_chain.rb +38 -11
  21. data/lib/aws-sdk-core/credentials.rb +19 -6
  22. data/lib/aws-sdk-core/ec2_metadata.rb +1 -1
  23. data/lib/aws-sdk-core/ecs_credentials.rb +1 -0
  24. data/lib/aws-sdk-core/endpoints/endpoint.rb +3 -1
  25. data/lib/aws-sdk-core/endpoints/matchers.rb +8 -10
  26. data/lib/aws-sdk-core/endpoints.rb +101 -21
  27. data/lib/aws-sdk-core/error_handler.rb +46 -0
  28. data/lib/aws-sdk-core/errors.rb +11 -2
  29. data/lib/aws-sdk-core/event_emitter.rb +1 -17
  30. data/lib/aws-sdk-core/instance_profile_credentials.rb +148 -158
  31. data/lib/aws-sdk-core/json/builder.rb +8 -1
  32. data/lib/aws-sdk-core/json/error_handler.rb +29 -13
  33. data/lib/aws-sdk-core/json/handler.rb +6 -6
  34. data/lib/aws-sdk-core/json/json_engine.rb +3 -1
  35. data/lib/aws-sdk-core/json/oj_engine.rb +7 -1
  36. data/lib/aws-sdk-core/json/parser.rb +6 -1
  37. data/lib/aws-sdk-core/json.rb +43 -14
  38. data/lib/aws-sdk-core/log/param_filter.rb +2 -2
  39. data/lib/aws-sdk-core/log/param_formatter.rb +7 -3
  40. data/lib/aws-sdk-core/log.rb +10 -0
  41. data/lib/aws-sdk-core/lru_cache.rb +75 -0
  42. data/lib/aws-sdk-core/pageable_response.rb +1 -1
  43. data/lib/aws-sdk-core/param_validator.rb +7 -2
  44. data/lib/aws-sdk-core/plugins/bearer_authorization.rb +2 -0
  45. data/lib/aws-sdk-core/plugins/checksum_algorithm.rb +332 -169
  46. data/lib/aws-sdk-core/plugins/client_metrics_plugin.rb +0 -1
  47. data/lib/aws-sdk-core/plugins/client_metrics_send_plugin.rb +14 -2
  48. data/lib/aws-sdk-core/plugins/credentials_configuration.rb +77 -57
  49. data/lib/aws-sdk-core/plugins/endpoint_pattern.rb +40 -32
  50. data/lib/aws-sdk-core/plugins/global_configuration.rb +8 -9
  51. data/lib/aws-sdk-core/plugins/http_checksum.rb +2 -8
  52. data/lib/aws-sdk-core/plugins/invocation_id.rb +1 -11
  53. data/lib/aws-sdk-core/plugins/protocols/api_gateway.rb +3 -1
  54. data/lib/aws-sdk-core/plugins/protocols/ec2.rb +2 -24
  55. data/lib/aws-sdk-core/plugins/protocols/json_rpc.rb +6 -8
  56. data/lib/aws-sdk-core/plugins/protocols/query.rb +4 -2
  57. data/lib/aws-sdk-core/plugins/protocols/rest_json.rb +3 -15
  58. data/lib/aws-sdk-core/plugins/protocols/rest_xml.rb +3 -0
  59. data/lib/aws-sdk-core/plugins/protocols/rpc_v2.rb +17 -0
  60. data/lib/aws-sdk-core/plugins/regional_endpoint.rb +74 -25
  61. data/lib/aws-sdk-core/plugins/request_compression.rb +11 -2
  62. data/lib/aws-sdk-core/plugins/retry_errors.rb +10 -3
  63. data/lib/aws-sdk-core/plugins/sign.rb +42 -26
  64. data/lib/aws-sdk-core/plugins/signature_v2.rb +2 -1
  65. data/lib/aws-sdk-core/plugins/signature_v4.rb +2 -1
  66. data/lib/aws-sdk-core/plugins/stub_responses.rb +58 -9
  67. data/lib/aws-sdk-core/plugins/telemetry.rb +75 -0
  68. data/lib/aws-sdk-core/plugins/transfer_encoding.rb +16 -9
  69. data/lib/aws-sdk-core/plugins/user_agent.rb +101 -26
  70. data/lib/aws-sdk-core/plugins.rb +39 -0
  71. data/lib/aws-sdk-core/process_credentials.rb +48 -29
  72. data/lib/aws-sdk-core/query/ec2_handler.rb +27 -0
  73. data/lib/aws-sdk-core/query/ec2_param_builder.rb +5 -7
  74. data/lib/aws-sdk-core/query/handler.rb +4 -4
  75. data/lib/aws-sdk-core/query/param_builder.rb +2 -2
  76. data/lib/aws-sdk-core/query.rb +2 -1
  77. data/lib/aws-sdk-core/resources.rb +8 -0
  78. data/lib/aws-sdk-core/rest/content_type_handler.rb +60 -0
  79. data/lib/aws-sdk-core/rest/handler.rb +3 -4
  80. data/lib/aws-sdk-core/rest/request/body.rb +32 -5
  81. data/lib/aws-sdk-core/rest/request/endpoint.rb +24 -4
  82. data/lib/aws-sdk-core/rest/request/headers.rb +15 -7
  83. data/lib/aws-sdk-core/rest/request/querystring_builder.rb +23 -11
  84. data/lib/aws-sdk-core/rest/response/body.rb +15 -1
  85. data/lib/aws-sdk-core/rest/response/header_list_parser.rb +79 -0
  86. data/lib/aws-sdk-core/rest/response/headers.rb +8 -3
  87. data/lib/aws-sdk-core/rest.rb +1 -0
  88. data/lib/aws-sdk-core/rpc_v2/builder.rb +62 -0
  89. data/lib/aws-sdk-core/rpc_v2/cbor_engine.rb +18 -0
  90. data/lib/aws-sdk-core/rpc_v2/content_type_handler.rb +47 -0
  91. data/lib/aws-sdk-core/rpc_v2/error_handler.rb +95 -0
  92. data/lib/aws-sdk-core/rpc_v2/handler.rb +79 -0
  93. data/lib/aws-sdk-core/rpc_v2/parser.rb +98 -0
  94. data/lib/aws-sdk-core/rpc_v2.rb +69 -0
  95. data/lib/aws-sdk-core/shared_config.rb +79 -22
  96. data/lib/aws-sdk-core/shared_credentials.rb +1 -7
  97. data/lib/aws-sdk-core/sso_credentials.rb +4 -1
  98. data/lib/aws-sdk-core/static_token_provider.rb +1 -2
  99. data/lib/aws-sdk-core/stubbing/protocols/ec2.rb +12 -11
  100. data/lib/aws-sdk-core/stubbing/protocols/json.rb +11 -10
  101. data/lib/aws-sdk-core/stubbing/protocols/query.rb +7 -6
  102. data/lib/aws-sdk-core/stubbing/protocols/rest.rb +2 -1
  103. data/lib/aws-sdk-core/stubbing/protocols/rest_json.rb +9 -8
  104. data/lib/aws-sdk-core/stubbing/protocols/rest_xml.rb +6 -5
  105. data/lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb +39 -0
  106. data/lib/aws-sdk-core/stubbing.rb +22 -0
  107. data/lib/aws-sdk-core/telemetry/base.rb +177 -0
  108. data/lib/aws-sdk-core/telemetry/no_op.rb +70 -0
  109. data/lib/aws-sdk-core/telemetry/otel.rb +235 -0
  110. data/lib/aws-sdk-core/telemetry/span_kind.rb +22 -0
  111. data/lib/aws-sdk-core/telemetry/span_status.rb +59 -0
  112. data/lib/aws-sdk-core/telemetry.rb +78 -0
  113. data/lib/aws-sdk-core/token.rb +3 -3
  114. data/lib/aws-sdk-core/token_provider.rb +4 -0
  115. data/lib/aws-sdk-core/token_provider_chain.rb +2 -6
  116. data/lib/aws-sdk-core/util.rb +41 -1
  117. data/lib/aws-sdk-core/waiters/poller.rb +10 -5
  118. data/lib/aws-sdk-core/xml/builder.rb +17 -9
  119. data/lib/aws-sdk-core/xml/error_handler.rb +35 -43
  120. data/lib/aws-sdk-core/xml/parser/frame.rb +4 -20
  121. data/lib/aws-sdk-core/xml/parser/stack.rb +2 -0
  122. data/lib/aws-sdk-core/xml/parser.rb +2 -6
  123. data/lib/aws-sdk-core.rb +82 -107
  124. data/lib/aws-sdk-sso/client.rb +189 -96
  125. data/lib/aws-sdk-sso/client_api.rb +7 -0
  126. data/lib/aws-sdk-sso/endpoint_parameters.rb +9 -6
  127. data/lib/aws-sdk-sso/endpoint_provider.rb +14 -18
  128. data/lib/aws-sdk-sso/endpoints.rb +2 -54
  129. data/lib/aws-sdk-sso/plugins/endpoints.rb +19 -20
  130. data/lib/aws-sdk-sso/types.rb +1 -0
  131. data/lib/aws-sdk-sso.rb +15 -11
  132. data/lib/aws-sdk-ssooidc/client.rb +274 -116
  133. data/lib/aws-sdk-ssooidc/client_api.rb +33 -0
  134. data/lib/aws-sdk-ssooidc/endpoint_parameters.rb +9 -6
  135. data/lib/aws-sdk-ssooidc/endpoint_provider.rb +14 -18
  136. data/lib/aws-sdk-ssooidc/endpoints.rb +2 -54
  137. data/lib/aws-sdk-ssooidc/errors.rb +21 -0
  138. data/lib/aws-sdk-ssooidc/plugins/endpoints.rb +19 -20
  139. data/lib/aws-sdk-ssooidc/types.rb +125 -24
  140. data/lib/aws-sdk-ssooidc.rb +15 -11
  141. data/lib/aws-sdk-sts/client.rb +397 -148
  142. data/lib/aws-sdk-sts/client_api.rb +36 -8
  143. data/lib/aws-sdk-sts/customizations.rb +5 -1
  144. data/lib/aws-sdk-sts/endpoint_parameters.rb +10 -9
  145. data/lib/aws-sdk-sts/endpoint_provider.rb +50 -55
  146. data/lib/aws-sdk-sts/endpoints.rb +2 -118
  147. data/lib/aws-sdk-sts/errors.rb +15 -0
  148. data/lib/aws-sdk-sts/plugins/endpoints.rb +19 -28
  149. data/lib/aws-sdk-sts/presigner.rb +2 -6
  150. data/lib/aws-sdk-sts/types.rb +171 -28
  151. data/lib/aws-sdk-sts.rb +15 -11
  152. data/lib/seahorse/client/async_base.rb +4 -5
  153. data/lib/seahorse/client/async_response.rb +19 -0
  154. data/lib/seahorse/client/base.rb +18 -21
  155. data/lib/seahorse/client/h2/connection.rb +18 -28
  156. data/lib/seahorse/client/h2/handler.rb +14 -3
  157. data/lib/seahorse/client/handler.rb +1 -1
  158. data/lib/seahorse/client/http/response.rb +1 -1
  159. data/lib/seahorse/client/net_http/connection_pool.rb +15 -12
  160. data/lib/seahorse/client/net_http/handler.rb +21 -9
  161. data/lib/seahorse/client/networking_error.rb +1 -1
  162. data/lib/seahorse/client/plugin.rb +8 -0
  163. data/lib/seahorse/client/plugins/endpoint.rb +0 -1
  164. data/lib/seahorse/client/plugins/h2.rb +4 -4
  165. data/lib/seahorse/client/plugins/net_http.rb +57 -16
  166. data/lib/seahorse/client/request_context.rb +9 -2
  167. data/lib/seahorse/client/response.rb +2 -0
  168. data/lib/seahorse/model/shapes.rb +2 -2
  169. data/lib/seahorse/util.rb +2 -1
  170. data/sig/aws-sdk-core/async_client_stubs.rbs +21 -0
  171. data/sig/aws-sdk-core/telemetry/base.rbs +46 -0
  172. data/sig/aws-sdk-core/telemetry/otel.rbs +22 -0
  173. data/sig/aws-sdk-core/telemetry/span_kind.rbs +15 -0
  174. data/sig/aws-sdk-core/telemetry/span_status.rbs +24 -0
  175. data/sig/seahorse/client/async_base.rbs +18 -0
  176. metadata +96 -23
  177. /data/lib/aws-sdk-core/xml/parser/{engines/libxml.rb → libxml_engine.rb} +0 -0
  178. /data/lib/aws-sdk-core/xml/parser/{engines/nokogiri.rb → nokogiri_engine.rb} +0 -0
  179. /data/lib/aws-sdk-core/xml/parser/{engines/oga.rb → oga_engine.rb} +0 -0
  180. /data/lib/aws-sdk-core/xml/parser/{engines/ox.rb → ox_engine.rb} +0 -0
  181. /data/lib/aws-sdk-core/xml/parser/{engines/rexml.rb → rexml_engine.rb} +0 -0
@@ -27,6 +27,12 @@ module Seahorse
27
27
  class Handler < Client::Handler
28
28
 
29
29
  def call(context)
30
+ span_wrapper(context) { _call(context) }
31
+ end
32
+
33
+ private
34
+
35
+ def _call(context)
30
36
  stream = nil
31
37
  begin
32
38
  conn = context.client.connection
@@ -80,8 +86,6 @@ module Seahorse
80
86
  )
81
87
  end
82
88
 
83
- private
84
-
85
89
  def _register_callbacks(resp, stream, stream_mutex, close_condition, sync_queue)
86
90
  stream.on(:headers) do |headers|
87
91
  resp.signal_headers(headers)
@@ -126,6 +130,7 @@ module Seahorse
126
130
  # https://http2.github.io/http2-spec/#rfc.section.8.1.2.3
127
131
  def _h2_headers(req)
128
132
  headers = {}
133
+ headers[':authority'] = req.endpoint.host
129
134
  headers[':method'] = req.http_method.upcase
130
135
  headers[':scheme'] = req.endpoint.scheme
131
136
  headers[':path'] = req.endpoint.path.empty? ? '/' : req.endpoint.path
@@ -145,8 +150,14 @@ module Seahorse
145
150
  end
146
151
  end
147
152
 
153
+ def span_wrapper(context, &block)
154
+ context.tracer.in_span(
155
+ 'Handler.H2',
156
+ attributes: Aws::Telemetry.http_request_attrs(context),
157
+ &block
158
+ )
159
+ end
148
160
  end
149
-
150
161
  end
151
162
  end
152
163
  end
@@ -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
@@ -66,8 +66,8 @@ module Seahorse
66
66
  # @param [string] chunk
67
67
  def signal_data(chunk)
68
68
  unless chunk == ''
69
- @body.write(chunk)
70
69
  emit(:data, chunk)
70
+ @body.write(chunk)
71
71
  end
72
72
  end
73
73
 
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'cgi'
3
+ require "cgi/escape"
4
+ require "cgi/util" if RUBY_VERSION < "3.5"
4
5
  require 'net/http'
5
6
  require 'net/https'
6
7
  require 'delegate'
@@ -34,7 +35,9 @@ module Seahorse
34
35
  ssl_ca_bundle: nil,
35
36
  ssl_ca_directory: nil,
36
37
  ssl_ca_store: nil,
37
- ssl_timeout: nil
38
+ ssl_timeout: nil,
39
+ ssl_cert: nil,
40
+ ssl_key: nil
38
41
  }
39
42
 
40
43
  # @api private
@@ -119,11 +122,7 @@ module Seahorse
119
122
  # pool, not counting those currently in use.
120
123
  def size
121
124
  @pool_mutex.synchronize do
122
- size = 0
123
- @pool.each_pair do |endpoint,sessions|
124
- size += sessions.size
125
- end
126
- size
125
+ @pool.values.flatten.size
127
126
  end
128
127
  end
129
128
 
@@ -142,9 +141,7 @@ module Seahorse
142
141
  # @return [nil]
143
142
  def empty!
144
143
  @pool_mutex.synchronize do
145
- @pool.each_pair do |endpoint,sessions|
146
- sessions.each(&:finish)
147
- end
144
+ @pool.values.flatten.map(&:finish)
148
145
  @pool.clear
149
146
  end
150
147
  nil
@@ -252,7 +249,9 @@ module Seahorse
252
249
  :ssl_ca_bundle => options[:ssl_ca_bundle],
253
250
  :ssl_ca_directory => options[:ssl_ca_directory],
254
251
  :ssl_ca_store => options[:ssl_ca_store],
255
- :ssl_timeout => options[:ssl_timeout]
252
+ :ssl_timeout => options[:ssl_timeout],
253
+ :ssl_cert => options[:ssl_cert],
254
+ :ssl_key => options[:ssl_key]
256
255
  }
257
256
  end
258
257
 
@@ -297,6 +296,8 @@ module Seahorse
297
296
  http.ca_file = ssl_ca_bundle if ssl_ca_bundle
298
297
  http.ca_path = ssl_ca_directory if ssl_ca_directory
299
298
  http.cert_store = ssl_ca_store if ssl_ca_store
299
+ http.cert = ssl_cert if ssl_cert
300
+ http.key = ssl_key if ssl_key
300
301
  else
301
302
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
302
303
  end
@@ -312,7 +313,7 @@ module Seahorse
312
313
  # @note **Must** be called behind a `@pool_mutex` synchronize block.
313
314
  def _clean
314
315
  now = Aws::Util.monotonic_milliseconds
315
- @pool.each_pair do |endpoint,sessions|
316
+ @pool.values.each do |sessions|
316
317
  sessions.delete_if do |session|
317
318
  if session.last_used.nil? or now - session.last_used > http_idle_timeout * 1000
318
319
  session.finish
@@ -336,6 +337,8 @@ module Seahorse
336
337
  attr_reader :last_used
337
338
 
338
339
  def __getobj__
340
+ return yield if block_given? && !defined?(@http)
341
+
339
342
  @http
340
343
  end
341
344
 
@@ -23,17 +23,12 @@ module Seahorse
23
23
 
24
24
  NETWORK_ERRORS = [
25
25
  SocketError, EOFError, IOError, Timeout::Error,
26
- Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE,
27
- Errno::EINVAL, Errno::ETIMEDOUT, OpenSSL::SSL::SSLError,
28
- Errno::EHOSTUNREACH, Errno::ECONNREFUSED,
26
+ Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE, Errno::EINVAL,
27
+ Errno::ETIMEDOUT, Errno::EHOSTUNREACH, Errno::ECONNREFUSED,
28
+ OpenSSL::SSL::SSLError, OpenSSL::SSL::SSLErrorWaitReadable,
29
29
  Net::HTTPFatalError # for proxy connection failures
30
30
  ]
31
31
 
32
- # does not exist in Ruby 1.9.3
33
- if OpenSSL::SSL.const_defined?(:SSLErrorWaitReadable)
34
- NETWORK_ERRORS << OpenSSL::SSL::SSLErrorWaitReadable
35
- end
36
-
37
32
  # @api private
38
33
  DNS_ERROR_MESSAGES = [
39
34
  'getaddrinfo: nodename nor servname provided, or not known', # MacOS
@@ -47,7 +42,13 @@ module Seahorse
47
42
  # @param [RequestContext] context
48
43
  # @return [Response]
49
44
  def call(context)
50
- transmit(context.config, context.http_request, context.http_response)
45
+ span_wrapper(context) do
46
+ transmit(
47
+ context.config,
48
+ context.http_request,
49
+ context.http_response
50
+ )
51
+ end
51
52
  Response.new(context: context)
52
53
  end
53
54
 
@@ -197,6 +198,17 @@ module Seahorse
197
198
  end
198
199
  end
199
200
 
201
+ def span_wrapper(context, &block)
202
+ context.tracer.in_span(
203
+ 'Handler.NetHttp',
204
+ attributes: Aws::Telemetry.http_request_attrs(context)
205
+ ) do |span|
206
+ block.call
207
+ span.add_attributes(
208
+ Aws::Telemetry.http_response_attrs(context)
209
+ )
210
+ end
211
+ end
200
212
  end
201
213
  end
202
214
  end
@@ -39,7 +39,7 @@ module Seahorse
39
39
 
40
40
  end
41
41
 
42
- # Rasied when trying to use an closed connection
42
+ # Raised when trying to use an closed connection
43
43
  class Http2ConnectionClosedError < StandardError; end
44
44
  end
45
45
  end
@@ -111,7 +111,15 @@ module Seahorse
111
111
 
112
112
  def initialize(name, options = {})
113
113
  @name = name
114
+ # prevent unstable object shapes by ensuring
115
+ # order and presence of instance variables
116
+ @default = nil
117
+ @default_block = nil
118
+ @required = nil
119
+ @doc_type = nil
114
120
  @doc_default = nil
121
+ @docstring = nil
122
+ @rbs_type = nil
115
123
  options.each_pair do |opt_name, opt_value|
116
124
  self.send("#{opt_name}=", opt_value)
117
125
  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)
@@ -53,10 +53,10 @@ When `true`, SSL peer certificates are verified when establishing a connection.
53
53
  When `true`, HTTP2 debug output will be sent to the `:logger`.
54
54
  DOCS
55
55
 
56
- option(:enable_alpn, default: false, doc_type: 'Boolean', docstring: <<-DOCS)
57
- Set to `true` to enable ALPN in HTTP2 over TLS. Requires Openssl version >= 1.0.2.
58
- Defaults to false. Note: not all service HTTP2 operations supports ALPN on server
59
- side, please refer to service documentation.
56
+ option(:enable_alpn, default: true, doc_type: 'Boolean', docstring: <<-DOCS)
57
+ Set to `false` to disable ALPN in HTTP2 over TLS. ALPN requires Openssl version >= 1.0.2.
58
+ Note: RFC7540 requires HTTP2 to use ALPN over TLS but some
59
+ services may not fully support ALPN and require setting this to `false`.
60
60
  DOCS
61
61
 
62
62
  option(:logger)
@@ -7,37 +7,78 @@ module Seahorse
7
7
  module Plugins
8
8
  class NetHttp < Plugin
9
9
 
10
- option(:http_proxy, default: nil, doc_type: String, docstring: '')
11
-
12
- option(:http_open_timeout, default: 15, doc_type: Integer, docstring: '') do |cfg|
10
+ option(:http_proxy, default: nil, doc_type: "URI::HTTP,String", docstring: <<-DOCS)
11
+ A proxy to send requests through. Formatted like 'http://proxy.com:123'.
12
+ DOCS
13
+
14
+ option(:http_open_timeout, default: 15, doc_type: Float, docstring: <<-DOCS) do |cfg|
15
+ The default number of seconds to wait for response data.
16
+ This value can safely be set per-request on the session.
17
+ DOCS
13
18
  resolve_http_open_timeout(cfg)
14
19
  end
15
20
 
16
- option(:http_read_timeout, default: 60, doc_type: Integer, docstring: '') do |cfg|
21
+ option(:http_read_timeout, default: 60, doc_type: Float, docstring: <<-DOCS) do |cfg|
22
+ The default number of seconds to wait for response data.
23
+ This value can safely be set per-request on the session.
24
+ DOCS
17
25
  resolve_http_read_timeout(cfg)
18
26
  end
19
27
 
20
- option(:http_idle_timeout, default: 5, doc_type: Integer, docstring: '')
21
-
22
- option(:http_continue_timeout, default: 1, doc_type: Integer, docstring: '')
23
-
24
- option(:http_wire_trace, default: false, doc_type: 'Boolean', docstring: '')
25
-
26
- option(:ssl_verify_peer, default: true, doc_type: 'Boolean', docstring: '')
27
-
28
- option(:ssl_ca_bundle, doc_type: String, docstring: '') do |cfg|
28
+ option(:http_idle_timeout, default: 5, doc_type: Float, docstring: <<-DOCS)
29
+ The number of seconds a connection is allowed to sit idle before it
30
+ is considered stale. Stale connections are closed and removed from the
31
+ pool before making a request.
32
+ DOCS
33
+
34
+ option(:http_continue_timeout, default: 1, doc_type: Float, docstring: <<-DOCS)
35
+ The number of seconds to wait for a 100-continue response before sending the
36
+ request body. This option has no effect unless the request has "Expect"
37
+ header set to "100-continue". Defaults to `nil` which disables this
38
+ behaviour. This value can safely be set per request on the session.
39
+ DOCS
40
+
41
+ option(:http_wire_trace, default: false, doc_type: 'Boolean', docstring: <<-DOCS)
42
+ When `true`, HTTP debug output will be sent to the `:logger`.
43
+ DOCS
44
+
45
+ option(:ssl_verify_peer, default: true, doc_type: 'Boolean', docstring: <<-DOCS)
46
+ When `true`, SSL peer certificates are verified when establishing a connection.
47
+ DOCS
48
+
49
+ option(:ssl_ca_bundle, doc_type: String, docstring: <<-DOCS) do |cfg|
50
+ Full path to the SSL certificate authority bundle file that should be used when
51
+ verifying peer certificates. If you do not pass `:ssl_ca_bundle` or
52
+ `:ssl_ca_directory` the the system default will be used if available.
53
+ DOCS
29
54
  ENV['AWS_CA_BUNDLE'] ||
30
55
  Aws.shared_config.ca_bundle(profile: cfg.profile) if cfg.respond_to?(:profile)
31
56
  end
32
57
 
33
- option(:ssl_ca_directory, default: nil, doc_type: String, docstring: '')
58
+ option(:ssl_ca_directory, default: nil, doc_type: String, docstring: <<-DOCS)
59
+ Full path of the directory that contains the unbundled SSL certificate
60
+ authority files for verifying peer certificates. If you do
61
+ not pass `:ssl_ca_bundle` or `:ssl_ca_directory` the the system
62
+ default will be used if available.
63
+ DOCS
34
64
 
35
- option(:ssl_ca_store, default: nil, doc_type: String, docstring: '')
65
+ option(:ssl_ca_store, default: nil, doc_type: String, docstring: <<-DOCS)
66
+ Sets the X509::Store to verify peer certificate.
67
+ DOCS
36
68
 
37
- option(:ssl_timeout, default: nil, doc_type: Float, docstring: '') do |cfg|
69
+ option(:ssl_timeout, default: nil, doc_type: Float, docstring: 'Sets the SSL timeout in seconds') do |cfg|
38
70
  resolve_ssl_timeout(cfg)
39
71
  end
40
72
 
73
+ option(:ssl_cert, default: nil, doc_type: OpenSSL::X509::Certificate, docstring: <<-DOCS)
74
+ Sets a client certificate when creating http connections.
75
+ DOCS
76
+
77
+
78
+ option(:ssl_key, default: nil, doc_type: OpenSSL::PKey, docstring: <<-DOCS)
79
+ Sets a client key when creating http connections.
80
+ DOCS
81
+
41
82
  option(:logger) # for backwards compat
42
83
 
43
84
  handler(Client::NetHttp::Handler, step: :send)
@@ -5,15 +5,18 @@ require 'stringio'
5
5
  module Seahorse
6
6
  module Client
7
7
  class RequestContext
8
-
8
+ # @param [Hash] options
9
9
  # @option options [required,Symbol] :operation_name (nil)
10
10
  # @option options [required,Model::Operation] :operation (nil)
11
11
  # @option options [Model::Authorizer] :authorizer (nil)
12
+ # @option options [Client] :client (nil)
12
13
  # @option options [Hash] :params ({})
13
14
  # @option options [Configuration] :config (nil)
14
15
  # @option options [Http::Request] :http_request (Http::Request.new)
15
16
  # @option options [Http::Response] :http_response (Http::Response.new)
16
- # and #rewind.
17
+ # @option options [Integer] :retries (0)
18
+ # @option options [Aws::Telemetry::TracerBase] :tracer (Aws::Telemetry::NoOpTracer.new)
19
+ # @option options [Hash] :metadata ({})
17
20
  def initialize(options = {})
18
21
  @operation_name = options[:operation_name]
19
22
  @operation = options[:operation]
@@ -24,6 +27,7 @@ module Seahorse
24
27
  @http_request = options[:http_request] || Http::Request.new
25
28
  @http_response = options[:http_response] || Http::Response.new
26
29
  @retries = 0
30
+ @tracer = options[:tracer] || Aws::Telemetry::NoOpTracer.new
27
31
  @metadata = {}
28
32
  end
29
33
 
@@ -54,6 +58,9 @@ module Seahorse
54
58
  # @return [Integer]
55
59
  attr_accessor :retries
56
60
 
61
+ # @return [Tracer]
62
+ attr_accessor :tracer
63
+
57
64
  # @return [Hash]
58
65
  attr_reader :metadata
59
66
 
@@ -75,6 +75,8 @@ module Seahorse
75
75
  # Necessary to define as a subclass of Delegator
76
76
  # @api private
77
77
  def __getobj__
78
+ return yield if block_given? && !defined?(@data)
79
+
78
80
  @data
79
81
  end
80
82
 
@@ -75,7 +75,7 @@ module Seahorse
75
75
 
76
76
  # @return [String, nil]
77
77
  def location_name
78
- @location_name || (shape && shape[:location_name])
78
+ @location_name || (shape && shape['locationName'])
79
79
  end
80
80
 
81
81
  def location_name= location_name
@@ -86,7 +86,7 @@ module Seahorse
86
86
  def [](key)
87
87
  if @metadata.key?(key.to_s)
88
88
  @metadata[key.to_s]
89
- else
89
+ elsif @shape
90
90
  @shape[key.to_s]
91
91
  end
92
92
  end
data/lib/seahorse/util.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'cgi'
3
+ require "cgi/escape"
4
+ require "cgi/util" if RUBY_VERSION < "3.5"
4
5
 
5
6
  module Seahorse
6
7
  # @api private
@@ -0,0 +1,21 @@
1
+ module Aws
2
+ module AsyncClientStubs
3
+ include ClientStubs
4
+
5
+ def send_events: () -> untyped
6
+
7
+ class StubsStream
8
+ def initialize: () -> void
9
+
10
+ attr_accessor send_events: untyped
11
+
12
+ attr_reader state: Symbol
13
+
14
+ def data: (untyped bytes, ?::Hash[untyped, untyped] options) -> untyped
15
+
16
+ def closed?: () -> bool
17
+
18
+ def close: () -> void
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,46 @@
1
+ module Aws
2
+ module Telemetry
3
+ class TelemetryProviderBase
4
+ def initialize: (?tracer_provider: TracerProviderBase, ?context_manager: ContextManagerBase) -> void
5
+ attr_reader tracer_provider: TracerProviderBase
6
+
7
+ attr_reader context_manager: ContextManagerBase
8
+ end
9
+
10
+ class TracerProviderBase
11
+ def tracer: (?String name) -> TracerBase
12
+ end
13
+
14
+ class TracerBase
15
+ def start_span: (String name, ?untyped with_parent, ?Hash[String, untyped] attributes, ?SpanKind kind) -> SpanBase
16
+
17
+ def in_span: (String name, ?Hash[String, untyped] attributes, ?SpanKind kind) -> SpanBase
18
+
19
+ def current_span: () -> SpanBase
20
+ end
21
+
22
+ class SpanBase
23
+ def set_attribute: (String key, untyped value) -> self
24
+ alias []= set_attribute
25
+
26
+ def add_attributes: (Hash[String, untyped] attributes) -> self
27
+
28
+ def add_event: (String name, ?Hash[String, untyped] attributes) -> self
29
+
30
+ def status=: (SpanStatus status) -> void
31
+
32
+ def finish: (?Time end_timestamp) -> self
33
+
34
+ def record_exception: (untyped exception, ?Hash[String, untyped] attributes) -> void
35
+ end
36
+
37
+ class ContextManagerBase
38
+ def current: () -> untyped
39
+
40
+ def attach: (untyped context) -> untyped
41
+
42
+ def detach: (untyped token) -> bool
43
+ end
44
+
45
+ end
46
+ end
@@ -0,0 +1,22 @@
1
+ module Aws
2
+ module Telemetry
3
+ class OTelProvider < TelemetryProviderBase
4
+ def initialize: () -> void
5
+ end
6
+
7
+ class OTelTracerProvider < TracerProviderBase
8
+ def initialize: () -> void
9
+ end
10
+
11
+ class OTelTracer < TracerBase
12
+ def initialize: (untyped tracer) -> void
13
+ end
14
+
15
+ class OTelSpan < SpanBase
16
+ def initialize: (untyped span) -> void
17
+ end
18
+
19
+ class OTelContextManager < ContextManagerBase
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ module Aws
2
+ module Telemetry
3
+ module SpanKind
4
+ INTERNAL: :internal
5
+
6
+ SERVER: :server
7
+
8
+ CLIENT: :client
9
+
10
+ CONSUMER: :consumer
11
+
12
+ PRODUCER: :producer
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,24 @@
1
+ module Aws
2
+ module Telemetry
3
+ class SpanStatus
4
+
5
+ def self.unset: (?::String description) -> SpanStatus
6
+
7
+ def self.ok: (?::String description) -> SpanStatus
8
+
9
+ def self.error: (?::String description) -> SpanStatus
10
+
11
+ def initialize: (Integer code, ?description: ::String) -> void
12
+
13
+ attr_reader code: Integer
14
+
15
+ attr_reader description: String
16
+
17
+ OK: 0
18
+
19
+ UNSET: 1
20
+
21
+ ERROR: 2
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,18 @@
1
+ module Seahorse
2
+ module Client
3
+ class AsyncBase < Base
4
+
5
+ def self.new: (?untyped options) -> instance
6
+
7
+ attr_reader connection: untyped
8
+
9
+ def operation_names: () -> Array[Symbol]
10
+
11
+ def close_connection: () -> Symbol
12
+
13
+ def new_connection: () -> untyped
14
+
15
+ def connection_errors: () -> Array[untyped]
16
+ end
17
+ end
18
+ end