aws-sdk-core 3.46.2 → 3.126.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +1258 -0
  3. data/LICENSE.txt +202 -0
  4. data/VERSION +1 -1
  5. data/lib/aws-defaults/default_configuration.rb +153 -0
  6. data/lib/aws-defaults/defaults_mode_config_resolver.rb +107 -0
  7. data/lib/aws-defaults.rb +3 -0
  8. data/lib/aws-sdk-core/arn.rb +92 -0
  9. data/lib/aws-sdk-core/arn_parser.rb +40 -0
  10. data/lib/aws-sdk-core/assume_role_credentials.rb +20 -0
  11. data/lib/aws-sdk-core/assume_role_web_identity_credentials.rb +109 -0
  12. data/lib/aws-sdk-core/async_client_stubs.rb +82 -0
  13. data/lib/aws-sdk-core/binary/decode_handler.rb +11 -1
  14. data/lib/aws-sdk-core/binary/encode_handler.rb +34 -0
  15. data/lib/aws-sdk-core/binary/event_builder.rb +124 -0
  16. data/lib/aws-sdk-core/binary/event_parser.rb +50 -18
  17. data/lib/aws-sdk-core/binary/event_stream_decoder.rb +7 -2
  18. data/lib/aws-sdk-core/binary/event_stream_encoder.rb +55 -0
  19. data/lib/aws-sdk-core/binary.rb +5 -0
  20. data/lib/aws-sdk-core/client_side_monitoring/publisher.rb +11 -1
  21. data/lib/aws-sdk-core/client_side_monitoring/request_metrics.rb +2 -0
  22. data/lib/aws-sdk-core/client_stubs.rb +16 -13
  23. data/lib/aws-sdk-core/credential_provider.rb +1 -30
  24. data/lib/aws-sdk-core/credential_provider_chain.rb +102 -40
  25. data/lib/aws-sdk-core/credentials.rb +2 -0
  26. data/lib/aws-sdk-core/deprecations.rb +17 -11
  27. data/lib/aws-sdk-core/eager_loader.rb +2 -0
  28. data/lib/aws-sdk-core/ec2_metadata.rb +238 -0
  29. data/lib/aws-sdk-core/ecs_credentials.rb +18 -9
  30. data/lib/aws-sdk-core/endpoint_cache.rb +16 -11
  31. data/lib/aws-sdk-core/errors.rb +138 -15
  32. data/lib/aws-sdk-core/event_emitter.rb +44 -0
  33. data/lib/aws-sdk-core/ini_parser.rb +2 -0
  34. data/lib/aws-sdk-core/instance_profile_credentials.rb +179 -42
  35. data/lib/aws-sdk-core/json/builder.rb +2 -0
  36. data/lib/aws-sdk-core/json/error_handler.rb +21 -2
  37. data/lib/aws-sdk-core/json/handler.rb +21 -1
  38. data/lib/aws-sdk-core/json/json_engine.rb +12 -8
  39. data/lib/aws-sdk-core/json/oj_engine.rb +35 -6
  40. data/lib/aws-sdk-core/json/parser.rb +10 -0
  41. data/lib/aws-sdk-core/json.rb +11 -28
  42. data/lib/aws-sdk-core/log/formatter.rb +16 -4
  43. data/lib/aws-sdk-core/log/handler.rb +2 -0
  44. data/lib/aws-sdk-core/log/param_filter.rb +38 -13
  45. data/lib/aws-sdk-core/log/param_formatter.rb +2 -0
  46. data/lib/aws-sdk-core/pageable_response.rb +48 -24
  47. data/lib/aws-sdk-core/pager.rb +5 -0
  48. data/lib/aws-sdk-core/param_converter.rb +2 -0
  49. data/lib/aws-sdk-core/param_validator.rb +63 -7
  50. data/lib/aws-sdk-core/plugins/api_key.rb +5 -1
  51. data/lib/aws-sdk-core/plugins/apig_authorizer_token.rb +2 -0
  52. data/lib/aws-sdk-core/plugins/apig_credentials_configuration.rb +2 -0
  53. data/lib/aws-sdk-core/plugins/apig_user_agent.rb +2 -0
  54. data/lib/aws-sdk-core/plugins/client_metrics_plugin.rb +28 -1
  55. data/lib/aws-sdk-core/plugins/client_metrics_send_plugin.rb +2 -0
  56. data/lib/aws-sdk-core/plugins/credentials_configuration.rb +26 -7
  57. data/lib/aws-sdk-core/plugins/defaults_mode.rb +40 -0
  58. data/lib/aws-sdk-core/plugins/endpoint_discovery.rb +12 -4
  59. data/lib/aws-sdk-core/plugins/endpoint_pattern.rb +8 -6
  60. data/lib/aws-sdk-core/plugins/event_stream_configuration.rb +16 -0
  61. data/lib/aws-sdk-core/plugins/global_configuration.rb +2 -0
  62. data/lib/aws-sdk-core/plugins/helpful_socket_errors.rb +2 -0
  63. data/lib/aws-sdk-core/plugins/http_checksum.rb +57 -0
  64. data/lib/aws-sdk-core/plugins/idempotency_token.rb +2 -0
  65. data/lib/aws-sdk-core/plugins/invocation_id.rb +35 -0
  66. data/lib/aws-sdk-core/plugins/jsonvalue_converter.rb +2 -0
  67. data/lib/aws-sdk-core/plugins/logging.rb +2 -0
  68. data/lib/aws-sdk-core/plugins/param_converter.rb +2 -0
  69. data/lib/aws-sdk-core/plugins/param_validator.rb +2 -0
  70. data/lib/aws-sdk-core/plugins/protocols/api_gateway.rb +19 -0
  71. data/lib/aws-sdk-core/plugins/protocols/ec2.rb +2 -0
  72. data/lib/aws-sdk-core/plugins/protocols/json_rpc.rb +2 -0
  73. data/lib/aws-sdk-core/plugins/protocols/query.rb +2 -0
  74. data/lib/aws-sdk-core/plugins/protocols/rest_json.rb +18 -1
  75. data/lib/aws-sdk-core/plugins/protocols/rest_xml.rb +2 -0
  76. data/lib/aws-sdk-core/plugins/recursion_detection.rb +27 -0
  77. data/lib/aws-sdk-core/plugins/regional_endpoint.rb +74 -16
  78. data/lib/aws-sdk-core/plugins/response_paging.rb +2 -0
  79. data/lib/aws-sdk-core/plugins/retries/client_rate_limiter.rb +139 -0
  80. data/lib/aws-sdk-core/plugins/retries/clock_skew.rb +100 -0
  81. data/lib/aws-sdk-core/plugins/retries/error_inspector.rb +146 -0
  82. data/lib/aws-sdk-core/plugins/retries/retry_quota.rb +59 -0
  83. data/lib/aws-sdk-core/plugins/retry_errors.rb +295 -107
  84. data/lib/aws-sdk-core/plugins/signature_v2.rb +2 -0
  85. data/lib/aws-sdk-core/plugins/signature_v4.rb +28 -25
  86. data/lib/aws-sdk-core/plugins/stub_responses.rb +24 -7
  87. data/lib/aws-sdk-core/plugins/transfer_encoding.rb +53 -0
  88. data/lib/aws-sdk-core/plugins/user_agent.rb +6 -8
  89. data/lib/aws-sdk-core/process_credentials.rb +12 -5
  90. data/lib/aws-sdk-core/query/ec2_param_builder.rb +2 -0
  91. data/lib/aws-sdk-core/query/handler.rb +2 -0
  92. data/lib/aws-sdk-core/query/param.rb +2 -0
  93. data/lib/aws-sdk-core/query/param_builder.rb +2 -0
  94. data/lib/aws-sdk-core/query/param_list.rb +2 -0
  95. data/lib/aws-sdk-core/query.rb +2 -0
  96. data/lib/aws-sdk-core/refreshing_credentials.rb +15 -2
  97. data/lib/aws-sdk-core/resources/collection.rb +2 -0
  98. data/lib/aws-sdk-core/rest/handler.rb +2 -0
  99. data/lib/aws-sdk-core/rest/request/body.rb +21 -1
  100. data/lib/aws-sdk-core/rest/request/builder.rb +2 -0
  101. data/lib/aws-sdk-core/rest/request/endpoint.rb +10 -3
  102. data/lib/aws-sdk-core/rest/request/headers.rb +20 -6
  103. data/lib/aws-sdk-core/rest/request/querystring_builder.rb +4 -2
  104. data/lib/aws-sdk-core/rest/response/body.rb +2 -0
  105. data/lib/aws-sdk-core/rest/response/headers.rb +6 -3
  106. data/lib/aws-sdk-core/rest/response/parser.rb +2 -0
  107. data/lib/aws-sdk-core/rest/response/status_code.rb +2 -0
  108. data/lib/aws-sdk-core/rest.rb +2 -0
  109. data/lib/aws-sdk-core/shared_config.rb +153 -127
  110. data/lib/aws-sdk-core/shared_credentials.rb +9 -1
  111. data/lib/aws-sdk-core/sso_credentials.rb +136 -0
  112. data/lib/aws-sdk-core/structure.rb +14 -4
  113. data/lib/aws-sdk-core/stubbing/data_applicator.rb +2 -0
  114. data/lib/aws-sdk-core/stubbing/empty_stub.rb +2 -0
  115. data/lib/aws-sdk-core/stubbing/protocols/api_gateway.rb +2 -0
  116. data/lib/aws-sdk-core/stubbing/protocols/ec2.rb +2 -0
  117. data/lib/aws-sdk-core/stubbing/protocols/json.rb +3 -1
  118. data/lib/aws-sdk-core/stubbing/protocols/query.rb +4 -2
  119. data/lib/aws-sdk-core/stubbing/protocols/rest.rb +52 -7
  120. data/lib/aws-sdk-core/stubbing/protocols/rest_json.rb +3 -1
  121. data/lib/aws-sdk-core/stubbing/protocols/rest_xml.rb +2 -2
  122. data/lib/aws-sdk-core/stubbing/stub_data.rb +15 -4
  123. data/lib/aws-sdk-core/stubbing/xml_error.rb +2 -0
  124. data/lib/aws-sdk-core/type_builder.rb +2 -0
  125. data/lib/aws-sdk-core/util.rb +6 -0
  126. data/lib/aws-sdk-core/waiters/errors.rb +2 -0
  127. data/lib/aws-sdk-core/waiters/poller.rb +2 -0
  128. data/lib/aws-sdk-core/waiters/waiter.rb +4 -2
  129. data/lib/aws-sdk-core/waiters.rb +2 -0
  130. data/lib/aws-sdk-core/xml/builder.rb +5 -3
  131. data/lib/aws-sdk-core/xml/default_list.rb +2 -0
  132. data/lib/aws-sdk-core/xml/default_map.rb +2 -0
  133. data/lib/aws-sdk-core/xml/doc_builder.rb +15 -4
  134. data/lib/aws-sdk-core/xml/error_handler.rb +29 -4
  135. data/lib/aws-sdk-core/xml/parser/engines/libxml.rb +2 -0
  136. data/lib/aws-sdk-core/xml/parser/engines/nokogiri.rb +2 -0
  137. data/lib/aws-sdk-core/xml/parser/engines/oga.rb +2 -0
  138. data/lib/aws-sdk-core/xml/parser/engines/ox.rb +3 -1
  139. data/lib/aws-sdk-core/xml/parser/engines/rexml.rb +4 -1
  140. data/lib/aws-sdk-core/xml/parser/frame.rb +25 -0
  141. data/lib/aws-sdk-core/xml/parser/parsing_error.rb +2 -0
  142. data/lib/aws-sdk-core/xml/parser/stack.rb +2 -0
  143. data/lib/aws-sdk-core/xml/parser.rb +7 -0
  144. data/lib/aws-sdk-core/xml.rb +2 -0
  145. data/lib/aws-sdk-core.rb +23 -4
  146. data/lib/aws-sdk-sso/client.rb +568 -0
  147. data/lib/aws-sdk-sso/client_api.rb +190 -0
  148. data/lib/aws-sdk-sso/customizations.rb +1 -0
  149. data/lib/aws-sdk-sso/errors.rb +102 -0
  150. data/lib/aws-sdk-sso/resource.rb +26 -0
  151. data/lib/aws-sdk-sso/types.rb +352 -0
  152. data/lib/aws-sdk-sso.rb +55 -0
  153. data/lib/aws-sdk-sts/client.rb +1282 -531
  154. data/lib/aws-sdk-sts/client_api.rb +76 -1
  155. data/lib/aws-sdk-sts/customizations.rb +4 -0
  156. data/lib/aws-sdk-sts/errors.rb +153 -1
  157. data/lib/aws-sdk-sts/plugins/sts_regional_endpoints.rb +38 -0
  158. data/lib/aws-sdk-sts/presigner.rb +75 -0
  159. data/lib/aws-sdk-sts/resource.rb +4 -1
  160. data/lib/aws-sdk-sts/types.rb +958 -229
  161. data/lib/aws-sdk-sts.rb +16 -6
  162. data/lib/seahorse/client/async_base.rb +52 -0
  163. data/lib/seahorse/client/async_response.rb +64 -0
  164. data/lib/seahorse/client/base.rb +7 -2
  165. data/lib/seahorse/client/block_io.rb +6 -2
  166. data/lib/seahorse/client/configuration.rb +7 -1
  167. data/lib/seahorse/client/events.rb +3 -1
  168. data/lib/seahorse/client/h2/connection.rb +250 -0
  169. data/lib/seahorse/client/h2/handler.rb +152 -0
  170. data/lib/seahorse/client/handler.rb +2 -0
  171. data/lib/seahorse/client/handler_builder.rb +2 -0
  172. data/lib/seahorse/client/handler_list.rb +2 -0
  173. data/lib/seahorse/client/handler_list_entry.rb +6 -4
  174. data/lib/seahorse/client/http/async_response.rb +44 -0
  175. data/lib/seahorse/client/http/headers.rb +2 -0
  176. data/lib/seahorse/client/http/request.rb +5 -3
  177. data/lib/seahorse/client/http/response.rb +18 -11
  178. data/lib/seahorse/client/logging/formatter.rb +6 -2
  179. data/lib/seahorse/client/logging/handler.rb +2 -0
  180. data/lib/seahorse/client/managed_file.rb +2 -0
  181. data/lib/seahorse/client/net_http/connection_pool.rb +30 -23
  182. data/lib/seahorse/client/net_http/handler.rb +24 -7
  183. data/lib/seahorse/client/net_http/patches.rb +15 -84
  184. data/lib/seahorse/client/networking_error.rb +30 -0
  185. data/lib/seahorse/client/plugin.rb +10 -7
  186. data/lib/seahorse/client/plugin_list.rb +2 -0
  187. data/lib/seahorse/client/plugins/content_length.rb +14 -3
  188. data/lib/seahorse/client/plugins/endpoint.rb +4 -2
  189. data/lib/seahorse/client/plugins/h2.rb +69 -0
  190. data/lib/seahorse/client/plugins/logging.rb +2 -0
  191. data/lib/seahorse/client/plugins/net_http.rb +39 -3
  192. data/lib/seahorse/client/plugins/operation_methods.rb +2 -0
  193. data/lib/seahorse/client/plugins/raise_response_errors.rb +2 -0
  194. data/lib/seahorse/client/plugins/request_callback.rb +110 -0
  195. data/lib/seahorse/client/plugins/response_target.rb +23 -14
  196. data/lib/seahorse/client/request.rb +2 -0
  197. data/lib/seahorse/client/request_context.rb +2 -0
  198. data/lib/seahorse/client/response.rb +5 -5
  199. data/lib/seahorse/model/api.rb +10 -0
  200. data/lib/seahorse/model/authorizer.rb +2 -0
  201. data/lib/seahorse/model/operation.rb +9 -0
  202. data/lib/seahorse/model/shapes.rb +29 -2
  203. data/lib/seahorse/util.rb +8 -1
  204. data/lib/seahorse/version.rb +2 -0
  205. data/lib/seahorse.rb +12 -0
  206. metadata +64 -14
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Aws
2
4
  # @api private
3
5
  # a LRU cache caching endpoints data
@@ -47,8 +49,8 @@ module Aws
47
49
  @mutex.synchronize do
48
50
  # delete the least recent used endpoint when cache is full
49
51
  unless @entries.size < @max_entries
50
- old_key, _ = @entries.shift
51
- self.delete_polling_thread(old_key)
52
+ old_key, = @entries.shift
53
+ delete_polling_thread(old_key)
52
54
  end
53
55
  # delete old value if exists
54
56
  @entries.delete(key)
@@ -60,10 +62,12 @@ module Aws
60
62
  # @param [String] key
61
63
  # @return [Boolean]
62
64
  def key?(key)
63
- if @entries.key?(key) && (@entries[key].nil? || @entries[key].expired?)
64
- self.delete(key)
65
+ @mutex.synchronize do
66
+ if @entries.key?(key) && (@entries[key].nil? || @entries[key].expired?)
67
+ @entries.delete(key)
68
+ end
69
+ @entries.key?(key)
65
70
  end
66
- @entries.key?(key)
67
71
  end
68
72
 
69
73
  # checking whether an polling thread exist for the key
@@ -84,7 +88,7 @@ module Aws
84
88
  # kill the old polling thread and remove it from pool
85
89
  # @param [String] key
86
90
  def delete_polling_thread(key)
87
- Thread.kill(@pool[key]) if self.threads_key?(key)
91
+ Thread.kill(@pool[key]) if threads_key?(key)
88
92
  @pool.delete(key)
89
93
  end
90
94
 
@@ -109,7 +113,7 @@ module Aws
109
113
  if _endpoint_operation_identifier(ctx)
110
114
  parts << ctx.operation_name
111
115
  ctx.operation.input.shape.members.inject(parts) do |p, (name, ref)|
112
- p << ctx.params[name] if ref["endpointdiscoveryid"]
116
+ p << ctx.params[name] if ref['endpointdiscoveryid']
113
117
  p
114
118
  end
115
119
  end
@@ -141,7 +145,7 @@ module Aws
141
145
  # build identifier params when available
142
146
  params[:operation] = ctx.operation.name
143
147
  ctx.operation.input.shape.members.inject(params) do |p, (name, ref)|
144
- if ref["endpointdiscoveryid"]
148
+ if ref['endpointdiscoveryid']
145
149
  p[:identifiers] ||= {}
146
150
  p[:identifiers][ref.location_name] = ctx.params[name]
147
151
  end
@@ -153,19 +157,20 @@ module Aws
153
157
  endpoint_operation_name = ctx.config.api.endpoint_operation
154
158
  ctx.client.send(endpoint_operation_name, params)
155
159
  rescue Aws::Errors::ServiceError
156
- nil
160
+ nil
157
161
  end
158
162
  end
159
163
 
160
164
  def _endpoint_operation_identifier(ctx)
161
165
  return @require_identifier unless @require_identifier.nil?
166
+
162
167
  operation_name = ctx.config.api.endpoint_operation
163
168
  operation = ctx.config.api.operation(operation_name)
164
169
  @require_identifier = operation.input.shape.members.any?
165
170
  end
166
171
 
167
172
  class Endpoint
168
-
173
+
169
174
  # default endpoint cache time, 1 minute
170
175
  CACHE_PERIOD = 1
171
176
 
@@ -175,7 +180,7 @@ module Aws
175
180
  @created_time = Time.now
176
181
  end
177
182
 
178
- # [String] valid URI address (with path)
183
+ # [String] valid URI address (with path)
179
184
  attr_reader :address
180
185
 
181
186
  def expired?
@@ -1,4 +1,4 @@
1
- require 'thread'
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Aws
4
4
  module Errors
@@ -13,10 +13,13 @@ module Aws
13
13
 
14
14
  # @param [Seahorse::Client::RequestContext] context
15
15
  # @param [String] message
16
- def initialize(context, message)
16
+ # @param [Aws::Structure] data
17
+ def initialize(context, message, data = Aws::EmptyStructure.new)
17
18
  @code = self.class.code
18
19
  @context = context
19
- super(message)
20
+ @data = data
21
+ @message = message && !message.empty? ? message : self.class.to_s
22
+ super(@message)
20
23
  end
21
24
 
22
25
  # @return [String]
@@ -26,12 +29,43 @@ module Aws
26
29
  # that triggered the remote service to return this error.
27
30
  attr_reader :context
28
31
 
32
+ # @return [Aws::Structure]
33
+ attr_reader :data
34
+
29
35
  class << self
30
36
 
31
37
  # @return [String]
32
38
  attr_accessor :code
33
39
 
34
40
  end
41
+
42
+ # @api private undocumented
43
+ def retryable?
44
+ false
45
+ end
46
+
47
+ # @api private undocumented
48
+ def throttling?
49
+ false
50
+ end
51
+ end
52
+
53
+ # Raised when InstanceProfileCredentialsProvider or
54
+ # EcsCredentialsProvider fails to parse the metadata response after retries
55
+ class MetadataParserError < RuntimeError
56
+ def initialize(*args)
57
+ msg = 'Failed to parse metadata service response.'
58
+ super(msg)
59
+ end
60
+ end
61
+
62
+ # Raised when a `streaming` operation has `requiresLength` trait
63
+ # enabled but request payload size/length cannot be calculated
64
+ class MissingContentLength < RuntimeError
65
+ def initialize(*args)
66
+ msg = 'Required `Content-Length` value missing for the request.'
67
+ super(msg)
68
+ end
35
69
  end
36
70
 
37
71
  # Rasied when endpoint discovery failed for operations
@@ -39,7 +73,7 @@ module Aws
39
73
  class EndpointDiscoveryError < RuntimeError
40
74
  def initialize(*args)
41
75
  msg = 'Endpoint discovery failed for the operation or discovered endpoint is not working, '\
42
- 'request will keep failing until endpoint discovery succeeds or :endpoint option is provided.'
76
+ 'request will keep failing until endpoint discovery succeeds or :endpoint option is provided.'
43
77
  super(msg)
44
78
  end
45
79
  end
@@ -51,17 +85,25 @@ module Aws
51
85
 
52
86
  def initialize(name)
53
87
  msg = "Missing required parameter #{name} to construct"\
54
- " endpoint host prefix. You can disable host prefix by"\
55
- " setting :disable_host_prefix_injection to `true`."
88
+ ' endpoint host prefix. You can disable host prefix by'\
89
+ ' setting :disable_host_prefix_injection to `true`.'
56
90
  super(msg)
57
91
  end
58
92
 
59
93
  end
60
94
 
95
+ # Raised when attempting to #signal an event before
96
+ # making an async request
97
+ class SignalEventError < RuntimeError; end
98
+
61
99
  # Raised when EventStream Parser failed to parse
62
100
  # a raw event message
63
101
  class EventStreamParserError < RuntimeError; end
64
102
 
103
+ # Raise when EventStream Builder failed to build
104
+ # an event message with parameters provided
105
+ class EventStreamBuilderError < RuntimeError; end
106
+
65
107
  # Error event in an event stream which has event_type :error
66
108
  # error code and error message can be retrieved when available.
67
109
  #
@@ -93,6 +135,29 @@ module Aws
93
135
 
94
136
  end
95
137
 
138
+ # Raised when ARN string input doesn't follow the standard:
139
+ # https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-arns
140
+ class InvalidARNError < RuntimeError; end
141
+
142
+ # Raised when the region from the ARN string is different from the :region
143
+ # configured on the service client.
144
+ class InvalidARNRegionError < RuntimeError
145
+ def initialize(*args)
146
+ msg = 'ARN region is different from the configured client region.'
147
+ super(msg)
148
+ end
149
+ end
150
+
151
+ # Raised when the partition of the ARN region is different than the
152
+ # partition of the :region configured on the service client.
153
+ class InvalidARNPartitionError < RuntimeError
154
+ def initialize(*args)
155
+ msg = 'ARN region partition is different from the configured '\
156
+ 'client region partition.'
157
+ super(msg)
158
+ end
159
+ end
160
+
96
161
  # Various plugins perform client-side checksums of responses.
97
162
  # This error indicates a checksum failed.
98
163
  class ChecksumError < RuntimeError; end
@@ -126,19 +191,66 @@ module Aws
126
191
  end
127
192
  end
128
193
 
194
+ # Raised when :web_identity_token_file parameter is not
195
+ # provided or the file doesn't exist when initializing
196
+ # AssumeRoleWebIdentityCredentials credential provider
197
+ class MissingWebIdentityTokenFile < RuntimeError
198
+ def initialize(*args)
199
+ msg = 'Missing :web_identity_token_file parameter or'\
200
+ ' invalid file path provided for'\
201
+ ' Aws::AssumeRoleWebIdentityCredentials provider'
202
+ super(msg)
203
+ end
204
+ end
205
+
129
206
  # Raised when a credentials provider process returns a JSON
130
207
  # payload with either invalid version number or malformed contents
131
208
  class InvalidProcessCredentialsPayload < RuntimeError; end
132
209
 
210
+ # Raised when SSO Credentials are invalid
211
+ class InvalidSSOCredentials < RuntimeError; end
212
+
213
+ # Raised when there is a circular reference in chained
214
+ # source_profiles
215
+ class SourceProfileCircularReferenceError < RuntimeError; end
216
+
133
217
  # Raised when a client is constructed and region is not specified.
134
218
  class MissingRegionError < ArgumentError
135
219
  def initialize(*args)
136
- msg = "missing region; use :region option or "
137
- msg << "export region name to ENV['AWS_REGION']"
220
+ msg = 'No region was provided. Configure the `:region` option or '\
221
+ "export the region name to ENV['AWS_REGION']"
138
222
  super(msg)
139
223
  end
140
224
  end
141
225
 
226
+ # Raised when a client is contsructed and the region is not valid.
227
+ class InvalidRegionError < ArgumentError
228
+ def initialize(*args)
229
+ super(<<-MSG)
230
+ Invalid `:region` option was provided.
231
+
232
+ * Not every service is available in every region.
233
+
234
+ * Never suffix region names with availability zones.
235
+ Use "us-east-1", not "us-east-1a"
236
+
237
+ Known AWS regions include (not specific to this service):
238
+
239
+ #{possible_regions}
240
+ MSG
241
+ end
242
+
243
+ private
244
+
245
+ def possible_regions
246
+ Aws.partitions.each_with_object([]) do |partition, region_names|
247
+ partition.regions.each do |region|
248
+ region_names << region.name
249
+ end
250
+ end.join("\n")
251
+ end
252
+ end
253
+
142
254
  # Raised when attempting to connect to an endpoint and a `SocketError`
143
255
  # is received from the HTTP client. This error is typically the result
144
256
  # of configuring an invalid `:region`.
@@ -151,14 +263,14 @@ module Aws
151
263
  super(<<-MSG)
152
264
  Encountered a `SocketError` while attempting to connect to:
153
265
 
154
- #{endpoint.to_s}
266
+ #{endpoint}
155
267
 
156
268
  This is typically the result of an invalid `:region` option or a
157
269
  poorly formatted `:endpoint` option.
158
270
 
159
271
  * Avoid configuring the `:endpoint` option directly. Endpoints are constructed
160
- from the `:region`. The `:endpoint` option is reserved for connecting to
161
- non-standard test endpoints.
272
+ from the `:region`. The `:endpoint` option is reserved for certain services
273
+ or for connecting to non-standard test endpoints.
162
274
 
163
275
  * Not every service is available in every region.
164
276
 
@@ -180,14 +292,21 @@ Known AWS regions include (not specific to this service):
180
292
  private
181
293
 
182
294
  def possible_regions
183
- Aws.partitions.inject([]) do |region_names, partition|
295
+ Aws.partitions.each_with_object([]) do |partition, region_names|
184
296
  partition.regions.each do |region|
185
297
  region_names << region.name
186
298
  end
187
- region_names
188
299
  end.join("\n")
189
300
  end
301
+ end
190
302
 
303
+ # Raised when attempting to retry a request
304
+ # and no capacity is available to retry (See adaptive retry_mode)
305
+ class RetryCapacityNotAvailableError < RuntimeError
306
+ def initialize(*args)
307
+ msg = 'Insufficient client side capacity available to retry request.'
308
+ super(msg)
309
+ end
191
310
  end
192
311
 
193
312
  # This module is mixed into another module, providing dynamic
@@ -205,7 +324,7 @@ Known AWS regions include (not specific to this service):
205
324
  module DynamicErrors
206
325
 
207
326
  def self.extended(submodule)
208
- submodule.instance_variable_set("@const_set_mutex", Mutex.new)
327
+ submodule.instance_variable_set('@const_set_mutex', Mutex.new)
209
328
  submodule.const_set(:ServiceError, Class.new(ServiceError))
210
329
  end
211
330
 
@@ -223,7 +342,11 @@ Known AWS regions include (not specific to this service):
223
342
  def error_class(error_code)
224
343
  constant = error_class_constant(error_code)
225
344
  if error_const_set?(constant)
226
- const_get(constant)
345
+ # modeled error class exist
346
+ # set code attribute
347
+ err_class = const_get(constant)
348
+ err_class.code = constant.to_s
349
+ err_class
227
350
  else
228
351
  set_error_constant(constant)
229
352
  end
@@ -1,10 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Aws
2
4
  class EventEmitter
3
5
 
4
6
  def initialize
5
7
  @listeners = {}
8
+ @validate_event = true
9
+ @status = :sleep
10
+ @signal_queue = Queue.new
6
11
  end
7
12
 
13
+ attr_accessor :stream
14
+
15
+ attr_accessor :encoder
16
+
17
+ attr_accessor :validate_event
18
+
19
+ attr_accessor :signal_queue
20
+
8
21
  def on(type, callback)
9
22
  (@listeners[type] ||= []) << callback
10
23
  end
@@ -16,5 +29,36 @@ module Aws
16
29
  end
17
30
  end
18
31
 
32
+ def emit(type, params)
33
+ unless @stream
34
+ raise Aws::Errors::SignalEventError.new(
35
+ "Singaling events before making async request"\
36
+ " is not allowed."
37
+ )
38
+ end
39
+ if @validate_event && type != :end_stream
40
+ Aws::ParamValidator.validate!(
41
+ @encoder.rules.shape.member(type), params)
42
+ end
43
+ _ready_for_events?
44
+ @stream.data(
45
+ @encoder.encode(type, params),
46
+ end_stream: type == :end_stream
47
+ )
48
+ end
49
+
50
+ private
51
+
52
+ def _ready_for_events?
53
+ return true if @status == :ready
54
+
55
+ # blocked until once initial 200 response is received
56
+ # signal will be available in @signal_queue
57
+ # and this check will no longer be blocked
58
+ @signal_queue.pop
59
+ @status = :ready
60
+ true
61
+ end
62
+
19
63
  end
20
64
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Aws
2
4
  # @api private
3
5
  class IniParser