aws-sdk-s3 1.111.3 → 1.113.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.
@@ -36,6 +36,17 @@ module Aws
36
36
  def rewind; end
37
37
  end
38
38
 
39
+ class NonRetryableStreamingError < StandardError
40
+
41
+ def initialize(error)
42
+ super('Unable to retry request - retry could result in processing duplicated chunks.')
43
+ set_backtrace(error.backtrace)
44
+ @original_error = error
45
+ end
46
+
47
+ attr_reader :original_error
48
+ end
49
+
39
50
  # This handler works with the ResponseTarget plugin to provide smart
40
51
  # retries of S3 streaming operations that support the range parameter
41
52
  # (currently only: get_object). When a 200 OK with a TruncatedBodyError
@@ -84,8 +95,18 @@ module Aws
84
95
  end
85
96
 
86
97
  context.http_response.on_error do |error|
87
- if retryable_body?(context) && truncated_body?(error)
88
- context.http_request.headers[:range] = "bytes=#{context.http_response.body.size}-"
98
+ if retryable_body?(context)
99
+ if truncated_body?(error)
100
+ context.http_request.headers[:range] = "bytes=#{context.http_response.body.size}-"
101
+ else
102
+ case context.http_response.body
103
+ when RetryableManagedFile
104
+ # call rewind on the underlying file
105
+ context.http_response.body.instance_variable_get(:@file).rewind
106
+ else
107
+ raise NonRetryableStreamingError, error
108
+ end
109
+ end
89
110
  end
90
111
  end
91
112
  end
@@ -98,7 +98,7 @@ module Aws
98
98
  # or call the associated method.
99
99
  #
100
100
  # ```ruby
101
- # post = Aws::S3::PresignedPost.new(creds, region, bucket).
101
+ # post = Aws::S3::PresignedPost.new(creds, region, bucket)
102
102
  # post.content_type('text/plain')
103
103
  # ```
104
104
  #
@@ -182,6 +182,11 @@ module Aws
182
182
  # the post policy.
183
183
  # @param [String] bucket_region Region of the target bucket.
184
184
  # @param [String] bucket_name Name of the target bucket.
185
+ # @option options [Boolean] :use_accelerate_endpoint (false) When `true`,
186
+ # PresignedPost will attempt to use accelerated endpoint.
187
+ # @option options [String] :url See {PresignedPost#url}.
188
+ # @option options [Sting, Array<String>] :allow_any
189
+ # See {PresignedPost#allow_any}.
185
190
  # @option options [Time] :signature_expiration Specify when the signature on
186
191
  # the post will expire. Defaults to one hour from creation of the
187
192
  # presigned post. May not exceed one week from creation time.
@@ -206,7 +211,7 @@ module Aws
206
211
  # See {PresignedPost#content_encoding}.
207
212
  # @option options [String] :content_encoding_starts_with
208
213
  # See {PresignedPost#content_encoding_starts_with}.
209
- # @option options [String] :expires See {PresignedPost#expires}.
214
+ # @option options [Time] :expires See {PresignedPost#expires}.
210
215
  # @option options [String] :expires_starts_with
211
216
  # See {PresignedPost#expires_starts_with}.
212
217
  # @option options [Range<Integer>] :content_length_range
@@ -233,6 +238,8 @@ module Aws
233
238
  # See {PresignedPost#server_side_encryption_customer_algorithm}.
234
239
  # @option options [String] :server_side_encryption_customer_key
235
240
  # See {PresignedPost#server_side_encryption_customer_key}.
241
+ # @option options [String] :server_side_encryption_customer_key_starts_with
242
+ # See {PresignedPost#server_side_encryption_customer_key_starts_with}.
236
243
  def initialize(credentials, bucket_region, bucket_name, options = {})
237
244
  @credentials = credentials.credentials
238
245
  @bucket_region = bucket_region