aws-sdk-s3 1.30.1 → 1.112.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +883 -0
- data/LICENSE.txt +202 -0
- data/VERSION +1 -0
- data/lib/aws-sdk-s3/arn/access_point_arn.rb +69 -0
- data/lib/aws-sdk-s3/arn/multi_region_access_point_arn.rb +68 -0
- data/lib/aws-sdk-s3/arn/object_lambda_arn.rb +69 -0
- data/lib/aws-sdk-s3/arn/outpost_access_point_arn.rb +74 -0
- data/lib/aws-sdk-s3/bucket.rb +298 -77
- data/lib/aws-sdk-s3/bucket_acl.rb +41 -14
- data/lib/aws-sdk-s3/bucket_cors.rb +51 -13
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +38 -15
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +40 -15
- data/lib/aws-sdk-s3/bucket_logging.rb +36 -15
- data/lib/aws-sdk-s3/bucket_notification.rb +44 -15
- data/lib/aws-sdk-s3/bucket_policy.rb +35 -13
- data/lib/aws-sdk-s3/bucket_region_cache.rb +2 -0
- data/lib/aws-sdk-s3/bucket_request_payment.rb +35 -12
- data/lib/aws-sdk-s3/bucket_tagging.rb +43 -13
- data/lib/aws-sdk-s3/bucket_versioning.rb +70 -12
- data/lib/aws-sdk-s3/bucket_website.rb +50 -13
- data/lib/aws-sdk-s3/client.rb +7889 -661
- data/lib/aws-sdk-s3/client_api.rb +436 -2
- data/lib/aws-sdk-s3/customizations/bucket.rb +59 -16
- data/lib/aws-sdk-s3/customizations/multipart_upload.rb +2 -0
- data/lib/aws-sdk-s3/customizations/object.rb +200 -62
- data/lib/aws-sdk-s3/customizations/object_summary.rb +5 -0
- data/lib/aws-sdk-s3/customizations/types/list_object_versions_output.rb +2 -0
- data/lib/aws-sdk-s3/customizations.rb +4 -1
- data/lib/aws-sdk-s3/encryption/client.rb +23 -6
- data/lib/aws-sdk-s3/encryption/decrypt_handler.rb +71 -29
- data/lib/aws-sdk-s3/encryption/default_cipher_provider.rb +43 -5
- data/lib/aws-sdk-s3/encryption/default_key_provider.rb +2 -0
- data/lib/aws-sdk-s3/encryption/encrypt_handler.rb +13 -2
- data/lib/aws-sdk-s3/encryption/errors.rb +2 -0
- data/lib/aws-sdk-s3/encryption/io_auth_decrypter.rb +2 -0
- data/lib/aws-sdk-s3/encryption/io_decrypter.rb +11 -3
- data/lib/aws-sdk-s3/encryption/io_encrypter.rb +2 -0
- data/lib/aws-sdk-s3/encryption/key_provider.rb +2 -0
- data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +34 -3
- data/lib/aws-sdk-s3/encryption/materials.rb +8 -6
- data/lib/aws-sdk-s3/encryption/utils.rb +25 -0
- data/lib/aws-sdk-s3/encryption.rb +4 -0
- data/lib/aws-sdk-s3/encryptionV2/client.rb +566 -0
- data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +222 -0
- data/lib/aws-sdk-s3/encryptionV2/default_cipher_provider.rb +170 -0
- data/lib/aws-sdk-s3/encryptionV2/default_key_provider.rb +40 -0
- data/lib/aws-sdk-s3/encryptionV2/encrypt_handler.rb +65 -0
- data/lib/aws-sdk-s3/encryptionV2/errors.rb +37 -0
- data/lib/aws-sdk-s3/encryptionV2/io_auth_decrypter.rb +58 -0
- data/lib/aws-sdk-s3/encryptionV2/io_decrypter.rb +37 -0
- data/lib/aws-sdk-s3/encryptionV2/io_encrypter.rb +73 -0
- data/lib/aws-sdk-s3/encryptionV2/key_provider.rb +31 -0
- data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +169 -0
- data/lib/aws-sdk-s3/encryptionV2/materials.rb +60 -0
- data/lib/aws-sdk-s3/encryptionV2/utils.rb +103 -0
- data/lib/aws-sdk-s3/encryption_v2.rb +23 -0
- data/lib/aws-sdk-s3/errors.rb +123 -1
- data/lib/aws-sdk-s3/event_streams.rb +20 -7
- data/lib/aws-sdk-s3/file_downloader.rb +17 -10
- data/lib/aws-sdk-s3/file_part.rb +11 -6
- data/lib/aws-sdk-s3/file_uploader.rb +33 -14
- data/lib/aws-sdk-s3/legacy_signer.rb +17 -25
- data/lib/aws-sdk-s3/multipart_file_uploader.rb +53 -13
- data/lib/aws-sdk-s3/multipart_stream_uploader.rb +20 -7
- data/lib/aws-sdk-s3/multipart_upload.rb +64 -28
- data/lib/aws-sdk-s3/multipart_upload_error.rb +2 -0
- data/lib/aws-sdk-s3/multipart_upload_part.rb +117 -43
- data/lib/aws-sdk-s3/object.rb +656 -152
- data/lib/aws-sdk-s3/object_acl.rb +65 -20
- data/lib/aws-sdk-s3/object_copier.rb +2 -0
- data/lib/aws-sdk-s3/object_multipart_copier.rb +2 -0
- data/lib/aws-sdk-s3/object_summary.rb +485 -138
- data/lib/aws-sdk-s3/object_version.rb +117 -60
- data/lib/aws-sdk-s3/plugins/accelerate.rb +38 -38
- data/lib/aws-sdk-s3/plugins/arn.rb +254 -0
- data/lib/aws-sdk-s3/plugins/bucket_dns.rb +8 -8
- data/lib/aws-sdk-s3/plugins/bucket_name_restrictions.rb +25 -3
- data/lib/aws-sdk-s3/plugins/dualstack.rb +38 -33
- data/lib/aws-sdk-s3/plugins/expect_100_continue.rb +4 -4
- data/lib/aws-sdk-s3/plugins/get_bucket_location_fix.rb +3 -1
- data/lib/aws-sdk-s3/plugins/http_200_errors.rb +11 -3
- data/lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb +73 -0
- data/lib/aws-sdk-s3/plugins/location_constraint.rb +2 -0
- data/lib/aws-sdk-s3/plugins/md5s.rb +30 -28
- data/lib/aws-sdk-s3/plugins/object_lambda_endpoint.rb +25 -0
- data/lib/aws-sdk-s3/plugins/redirects.rb +2 -0
- data/lib/aws-sdk-s3/plugins/s3_host_id.rb +2 -0
- data/lib/aws-sdk-s3/plugins/s3_signer.rb +89 -36
- data/lib/aws-sdk-s3/plugins/sse_cpk.rb +3 -1
- data/lib/aws-sdk-s3/plugins/streaming_retry.rb +118 -0
- data/lib/aws-sdk-s3/plugins/url_encoded_keys.rb +2 -0
- data/lib/aws-sdk-s3/presigned_post.rb +101 -49
- data/lib/aws-sdk-s3/presigner.rb +168 -66
- data/lib/aws-sdk-s3/resource.rb +41 -5
- data/lib/aws-sdk-s3/types.rb +6768 -1033
- data/lib/aws-sdk-s3/waiters.rb +67 -1
- data/lib/aws-sdk-s3.rb +12 -6
- metadata +37 -13
@@ -1,11 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# WARNING ABOUT GENERATED CODE
|
2
4
|
#
|
3
5
|
# This file is generated. See the contributing guide for more information:
|
4
|
-
# https://github.com/aws/aws-sdk-ruby/blob/
|
6
|
+
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
|
5
7
|
#
|
6
8
|
# WARNING ABOUT GENERATED CODE
|
7
9
|
|
8
10
|
module Aws::S3
|
11
|
+
|
9
12
|
class ObjectVersion
|
10
13
|
|
11
14
|
extend Aws::Deprecations
|
@@ -27,6 +30,7 @@ module Aws::S3
|
|
27
30
|
@id = extract_id(args, options)
|
28
31
|
@data = options.delete(:data)
|
29
32
|
@client = options.delete(:client) || Client.new(options)
|
33
|
+
@waiter_block_warned = false
|
30
34
|
end
|
31
35
|
|
32
36
|
# @!group Read-Only Attributes
|
@@ -46,6 +50,7 @@ module Aws::S3
|
|
46
50
|
@id
|
47
51
|
end
|
48
52
|
|
53
|
+
# The entity tag is an MD5 hash of that version of the object.
|
49
54
|
# @return [String]
|
50
55
|
def etag
|
51
56
|
data[:etag]
|
@@ -88,6 +93,7 @@ module Aws::S3
|
|
88
93
|
data[:last_modified]
|
89
94
|
end
|
90
95
|
|
96
|
+
# Specifies the owner of the object.
|
91
97
|
# @return [Types::Owner]
|
92
98
|
def owner
|
93
99
|
data[:owner]
|
@@ -128,7 +134,8 @@ module Aws::S3
|
|
128
134
|
# Waiter polls an API operation until a resource enters a desired
|
129
135
|
# state.
|
130
136
|
#
|
131
|
-
# @note The waiting operation is performed on a copy. The original resource
|
137
|
+
# @note The waiting operation is performed on a copy. The original resource
|
138
|
+
# remains unchanged.
|
132
139
|
#
|
133
140
|
# ## Basic Usage
|
134
141
|
#
|
@@ -141,13 +148,15 @@ module Aws::S3
|
|
141
148
|
#
|
142
149
|
# ## Example
|
143
150
|
#
|
144
|
-
# instance.wait_until(max_attempts:10, delay:5)
|
151
|
+
# instance.wait_until(max_attempts:10, delay:5) do |instance|
|
152
|
+
# instance.state.name == 'running'
|
153
|
+
# end
|
145
154
|
#
|
146
155
|
# ## Configuration
|
147
156
|
#
|
148
157
|
# You can configure the maximum number of polling attempts, and the
|
149
|
-
# delay (in seconds) between each polling attempt. The waiting condition is
|
150
|
-
# by passing a block to {#wait_until}:
|
158
|
+
# delay (in seconds) between each polling attempt. The waiting condition is
|
159
|
+
# set by passing a block to {#wait_until}:
|
151
160
|
#
|
152
161
|
# # poll for ~25 seconds
|
153
162
|
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
@@ -178,17 +187,16 @@ module Aws::S3
|
|
178
187
|
# # resource did not enter the desired state in time
|
179
188
|
# end
|
180
189
|
#
|
190
|
+
# @yieldparam [Resource] resource to be used in the waiting condition.
|
181
191
|
#
|
182
|
-
# @
|
183
|
-
#
|
184
|
-
#
|
185
|
-
# because the waiter has entered a state that it will not transition
|
186
|
-
# out of, preventing success.
|
192
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter
|
193
|
+
# terminates because the waiter has entered a state that it will not
|
194
|
+
# transition out of, preventing success.
|
187
195
|
#
|
188
196
|
# yet successful.
|
189
197
|
#
|
190
|
-
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is
|
191
|
-
# while polling for a resource that is not expected.
|
198
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is
|
199
|
+
# encountered while polling for a resource that is not expected.
|
192
200
|
#
|
193
201
|
# @raise [NotImplementedError] Raised when the resource does not
|
194
202
|
#
|
@@ -226,20 +234,32 @@ module Aws::S3
|
|
226
234
|
# mfa: "MFA",
|
227
235
|
# request_payer: "requester", # accepts requester
|
228
236
|
# bypass_governance_retention: false,
|
237
|
+
# expected_bucket_owner: "AccountId",
|
229
238
|
# })
|
230
239
|
# @param [Hash] options ({})
|
231
240
|
# @option options [String] :mfa
|
232
241
|
# The concatenation of the authentication device's serial number, a
|
233
242
|
# space, and the value that is displayed on your authentication device.
|
243
|
+
# Required to permanently delete a versioned object if versioning is
|
244
|
+
# configured with MFA delete enabled.
|
234
245
|
# @option options [String] :request_payer
|
235
|
-
# Confirms that the requester knows that
|
236
|
-
#
|
237
|
-
# requests.
|
238
|
-
# buckets
|
239
|
-
#
|
246
|
+
# Confirms that the requester knows that they will be charged for the
|
247
|
+
# request. Bucket owners need not specify this parameter in their
|
248
|
+
# requests. For information about downloading objects from requester
|
249
|
+
# pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
|
250
|
+
# in the *Amazon S3 User Guide*.
|
251
|
+
#
|
252
|
+
#
|
253
|
+
#
|
254
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
240
255
|
# @option options [Boolean] :bypass_governance_retention
|
241
256
|
# Indicates whether S3 Object Lock should bypass Governance-mode
|
242
|
-
# restrictions to process this operation.
|
257
|
+
# restrictions to process this operation. To use this header, you must
|
258
|
+
# have the `s3:PutBucketPublicAccessBlock` permission.
|
259
|
+
# @option options [String] :expected_bucket_owner
|
260
|
+
# The account ID of the expected bucket owner. If the bucket is owned by
|
261
|
+
# a different account, the request will fail with an HTTP `403 (Access
|
262
|
+
# Denied)` error.
|
243
263
|
# @return [Types::DeleteObjectOutput]
|
244
264
|
def delete(options = {})
|
245
265
|
options = options.merge(
|
@@ -270,6 +290,7 @@ module Aws::S3
|
|
270
290
|
# sse_customer_key_md5: "SSECustomerKeyMD5",
|
271
291
|
# request_payer: "requester", # accepts requester
|
272
292
|
# part_number: 1,
|
293
|
+
# expected_bucket_owner: "AccountId",
|
273
294
|
# })
|
274
295
|
# @param [Hash] options ({})
|
275
296
|
# @option options [String] :if_match
|
@@ -286,44 +307,61 @@ module Aws::S3
|
|
286
307
|
# time, otherwise return a 412 (precondition failed).
|
287
308
|
# @option options [String] :range
|
288
309
|
# Downloads the specified range bytes of an object. For more information
|
289
|
-
# about the HTTP Range header,
|
290
|
-
#
|
310
|
+
# about the HTTP Range header, see
|
311
|
+
# [https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35][1].
|
312
|
+
#
|
313
|
+
# <note markdown="1"> Amazon S3 doesn't support retrieving multiple ranges of data per
|
314
|
+
# `GET` request.
|
315
|
+
#
|
316
|
+
# </note>
|
317
|
+
#
|
318
|
+
#
|
319
|
+
#
|
320
|
+
# [1]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
|
291
321
|
# @option options [String] :response_cache_control
|
292
|
-
# Sets the Cache-Control header of the response.
|
322
|
+
# Sets the `Cache-Control` header of the response.
|
293
323
|
# @option options [String] :response_content_disposition
|
294
|
-
# Sets the Content-Disposition header of the response
|
324
|
+
# Sets the `Content-Disposition` header of the response
|
295
325
|
# @option options [String] :response_content_encoding
|
296
|
-
# Sets the Content-Encoding header of the response.
|
326
|
+
# Sets the `Content-Encoding` header of the response.
|
297
327
|
# @option options [String] :response_content_language
|
298
|
-
# Sets the Content-Language header of the response.
|
328
|
+
# Sets the `Content-Language` header of the response.
|
299
329
|
# @option options [String] :response_content_type
|
300
|
-
# Sets the Content-Type header of the response.
|
330
|
+
# Sets the `Content-Type` header of the response.
|
301
331
|
# @option options [Time,DateTime,Date,Integer,String] :response_expires
|
302
|
-
# Sets the Expires header of the response.
|
332
|
+
# Sets the `Expires` header of the response.
|
303
333
|
# @option options [String] :sse_customer_algorithm
|
304
|
-
# Specifies the algorithm to use to when
|
305
|
-
# AES256).
|
334
|
+
# Specifies the algorithm to use to when decrypting the object (for
|
335
|
+
# example, AES256).
|
306
336
|
# @option options [String] :sse_customer_key
|
307
|
-
# Specifies the customer-provided encryption key for Amazon S3 to
|
308
|
-
#
|
309
|
-
#
|
310
|
-
# appropriate for use with the algorithm specified in the
|
311
|
-
# x-amz-server-side
|
337
|
+
# Specifies the customer-provided encryption key for Amazon S3 used to
|
338
|
+
# encrypt the data. This value is used to decrypt the object when
|
339
|
+
# recovering it and must match the one used when storing the data. The
|
340
|
+
# key must be appropriate for use with the algorithm specified in the
|
341
|
+
# `x-amz-server-side-encryption-customer-algorithm` header.
|
312
342
|
# @option options [String] :sse_customer_key_md5
|
313
343
|
# Specifies the 128-bit MD5 digest of the encryption key according to
|
314
344
|
# RFC 1321. Amazon S3 uses this header for a message integrity check to
|
315
|
-
# ensure the encryption key was transmitted without error.
|
345
|
+
# ensure that the encryption key was transmitted without error.
|
316
346
|
# @option options [String] :request_payer
|
317
|
-
# Confirms that the requester knows that
|
318
|
-
#
|
319
|
-
# requests.
|
320
|
-
# buckets
|
321
|
-
#
|
347
|
+
# Confirms that the requester knows that they will be charged for the
|
348
|
+
# request. Bucket owners need not specify this parameter in their
|
349
|
+
# requests. For information about downloading objects from requester
|
350
|
+
# pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
|
351
|
+
# in the *Amazon S3 User Guide*.
|
352
|
+
#
|
353
|
+
#
|
354
|
+
#
|
355
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
322
356
|
# @option options [Integer] :part_number
|
323
357
|
# Part number of the object being read. This is a positive integer
|
324
358
|
# between 1 and 10,000. Effectively performs a 'ranged' GET request
|
325
359
|
# for the part specified. Useful for downloading just a part of an
|
326
360
|
# object.
|
361
|
+
# @option options [String] :expected_bucket_owner
|
362
|
+
# The account ID of the expected bucket owner. If the bucket is owned by
|
363
|
+
# a different account, the request will fail with an HTTP `403 (Access
|
364
|
+
# Denied)` error.
|
327
365
|
# @return [Types::GetObjectOutput]
|
328
366
|
def get(options = {}, &block)
|
329
367
|
options = options.merge(
|
@@ -348,6 +386,7 @@ module Aws::S3
|
|
348
386
|
# sse_customer_key_md5: "SSECustomerKeyMD5",
|
349
387
|
# request_payer: "requester", # accepts requester
|
350
388
|
# part_number: 1,
|
389
|
+
# expected_bucket_owner: "AccountId",
|
351
390
|
# })
|
352
391
|
# @param [Hash] options ({})
|
353
392
|
# @option options [String] :if_match
|
@@ -363,33 +402,40 @@ module Aws::S3
|
|
363
402
|
# Return the object only if it has not been modified since the specified
|
364
403
|
# time, otherwise return a 412 (precondition failed).
|
365
404
|
# @option options [String] :range
|
366
|
-
#
|
367
|
-
#
|
368
|
-
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
|
405
|
+
# Because `HeadObject` returns only the metadata for an object, this
|
406
|
+
# parameter has no effect.
|
369
407
|
# @option options [String] :sse_customer_algorithm
|
370
|
-
# Specifies the algorithm to use to when encrypting the object (
|
371
|
-
# AES256).
|
408
|
+
# Specifies the algorithm to use to when encrypting the object (for
|
409
|
+
# example, AES256).
|
372
410
|
# @option options [String] :sse_customer_key
|
373
411
|
# Specifies the customer-provided encryption key for Amazon S3 to use in
|
374
412
|
# encrypting data. This value is used to store the object and then it is
|
375
|
-
# discarded; Amazon does not store the encryption key. The key must
|
376
|
-
# appropriate for use with the algorithm specified in the
|
377
|
-
# x-amz-server-side
|
413
|
+
# discarded; Amazon S3 does not store the encryption key. The key must
|
414
|
+
# be appropriate for use with the algorithm specified in the
|
415
|
+
# `x-amz-server-side-encryption-customer-algorithm` header.
|
378
416
|
# @option options [String] :sse_customer_key_md5
|
379
417
|
# Specifies the 128-bit MD5 digest of the encryption key according to
|
380
418
|
# RFC 1321. Amazon S3 uses this header for a message integrity check to
|
381
|
-
# ensure the encryption key was transmitted without error.
|
419
|
+
# ensure that the encryption key was transmitted without error.
|
382
420
|
# @option options [String] :request_payer
|
383
|
-
# Confirms that the requester knows that
|
384
|
-
#
|
385
|
-
# requests.
|
386
|
-
# buckets
|
387
|
-
#
|
421
|
+
# Confirms that the requester knows that they will be charged for the
|
422
|
+
# request. Bucket owners need not specify this parameter in their
|
423
|
+
# requests. For information about downloading objects from requester
|
424
|
+
# pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
|
425
|
+
# in the *Amazon S3 User Guide*.
|
426
|
+
#
|
427
|
+
#
|
428
|
+
#
|
429
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
388
430
|
# @option options [Integer] :part_number
|
389
431
|
# Part number of the object being read. This is a positive integer
|
390
432
|
# between 1 and 10,000. Effectively performs a 'ranged' HEAD request
|
391
433
|
# for the part specified. Useful querying about the size of the part and
|
392
434
|
# the number of parts in this object.
|
435
|
+
# @option options [String] :expected_bucket_owner
|
436
|
+
# The account ID of the expected bucket owner. If the bucket is owned by
|
437
|
+
# a different account, the request will fail with an HTTP `403 (Access
|
438
|
+
# Denied)` error.
|
393
439
|
# @return [Types::HeadObjectOutput]
|
394
440
|
def head(options = {})
|
395
441
|
options = options.merge(
|
@@ -468,21 +514,32 @@ module Aws::S3
|
|
468
514
|
# mfa: "MFA",
|
469
515
|
# request_payer: "requester", # accepts requester
|
470
516
|
# bypass_governance_retention: false,
|
517
|
+
# expected_bucket_owner: "AccountId",
|
471
518
|
# })
|
472
519
|
# @param options ({})
|
473
520
|
# @option options [String] :mfa
|
474
521
|
# The concatenation of the authentication device's serial number, a
|
475
522
|
# space, and the value that is displayed on your authentication device.
|
523
|
+
# Required to permanently delete a versioned object if versioning is
|
524
|
+
# configured with MFA delete enabled.
|
476
525
|
# @option options [String] :request_payer
|
477
|
-
# Confirms that the requester knows that
|
478
|
-
#
|
479
|
-
# requests.
|
480
|
-
# buckets
|
481
|
-
#
|
526
|
+
# Confirms that the requester knows that they will be charged for the
|
527
|
+
# request. Bucket owners need not specify this parameter in their
|
528
|
+
# requests. For information about downloading objects from requester
|
529
|
+
# pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
|
530
|
+
# in the *Amazon S3 User Guide*.
|
531
|
+
#
|
532
|
+
#
|
533
|
+
#
|
534
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
482
535
|
# @option options [Boolean] :bypass_governance_retention
|
483
536
|
# Specifies whether you want to delete this object even if it has a
|
484
|
-
# Governance-type Object Lock in place.
|
485
|
-
#
|
537
|
+
# Governance-type Object Lock in place. To use this header, you must
|
538
|
+
# have the `s3:PutBucketPublicAccessBlock` permission.
|
539
|
+
# @option options [String] :expected_bucket_owner
|
540
|
+
# The account ID of the expected bucket owner. If the bucket is owned by
|
541
|
+
# a different account, the request will fail with an HTTP `403 (Access
|
542
|
+
# Denied)` error.
|
486
543
|
# @return [void]
|
487
544
|
def batch_delete!(options = {})
|
488
545
|
batch_enum.each do |batch|
|
@@ -1,36 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Aws
|
2
4
|
module S3
|
3
5
|
module Plugins
|
4
|
-
|
5
6
|
# Provides support for using `Aws::S3::Client` with Amazon S3 Transfer
|
6
7
|
# Acceleration.
|
7
8
|
#
|
8
9
|
# Go here for more information about transfer acceleration:
|
9
10
|
# [http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html](http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html)
|
10
11
|
class Accelerate < Seahorse::Client::Plugin
|
11
|
-
|
12
|
-
|
12
|
+
option(
|
13
|
+
:use_accelerate_endpoint,
|
13
14
|
default: false,
|
14
15
|
doc_type: 'Boolean',
|
15
16
|
docstring: <<-DOCS)
|
16
17
|
When set to `true`, accelerated bucket endpoints will be used
|
17
18
|
for all object operations. You must first enable accelerate for
|
18
|
-
each bucket.
|
19
|
+
each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html).
|
19
20
|
DOCS
|
20
21
|
|
21
22
|
def add_handlers(handlers, config)
|
22
23
|
operations = config.api.operation_names - [
|
23
|
-
:create_bucket, :list_buckets, :delete_bucket
|
24
|
+
:create_bucket, :list_buckets, :delete_bucket
|
24
25
|
]
|
25
|
-
handlers
|
26
|
-
|
26
|
+
# Need 2 handlers so that the context can be set for other plugins
|
27
|
+
# and to remove :use_accelerate_endpoint from the params.
|
28
|
+
handlers.add(
|
29
|
+
OptionHandler, step: :initialize, operations: operations
|
30
|
+
)
|
31
|
+
handlers.add(
|
32
|
+
AccelerateHandler, step: :build, priority: 11, operations: operations
|
33
|
+
)
|
27
34
|
end
|
28
35
|
|
29
36
|
# @api private
|
30
37
|
class OptionHandler < Seahorse::Client::Handler
|
31
38
|
def call(context)
|
32
|
-
|
39
|
+
# Support client configuration and per-operation configuration
|
40
|
+
if context.params.is_a?(Hash)
|
41
|
+
accelerate = context.params.delete(:use_accelerate_endpoint)
|
42
|
+
end
|
33
43
|
accelerate = context.config.use_accelerate_endpoint if accelerate.nil?
|
44
|
+
# Raise if :endpoint and accelerate are both provided
|
45
|
+
if accelerate && !context.config.regional_endpoint
|
46
|
+
raise ArgumentError,
|
47
|
+
'Cannot use both :use_accelerate_endpoint and :endpoint'
|
48
|
+
end
|
49
|
+
# Raise if :use_fips_endpoint and accelerate are both provided
|
50
|
+
if accelerate && context.config.use_fips_endpoint
|
51
|
+
raise ArgumentError,
|
52
|
+
'Cannot use both :use_accelerate_endpoint and '\
|
53
|
+
':use_fips_endpoint'
|
54
|
+
end
|
34
55
|
context[:use_accelerate_endpoint] = accelerate
|
35
56
|
@handler.call(context)
|
36
57
|
end
|
@@ -38,39 +59,24 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3
|
|
38
59
|
|
39
60
|
# @api private
|
40
61
|
class AccelerateHandler < Seahorse::Client::Handler
|
41
|
-
|
42
62
|
def call(context)
|
43
|
-
if context[:use_accelerate_endpoint]
|
44
|
-
|
45
|
-
|
46
|
-
else
|
47
|
-
use_accelerate_endpoint(context)
|
48
|
-
end
|
63
|
+
if context.config.regional_endpoint && context[:use_accelerate_endpoint]
|
64
|
+
dualstack = !!context[:use_dualstack_endpoint]
|
65
|
+
use_accelerate_endpoint(context, dualstack)
|
49
66
|
end
|
50
67
|
@handler.call(context)
|
51
68
|
end
|
52
69
|
|
53
70
|
private
|
54
71
|
|
55
|
-
def use_accelerate_endpoint(context)
|
72
|
+
def use_accelerate_endpoint(context, dualstack)
|
56
73
|
bucket_name = context.params[:bucket]
|
57
74
|
validate_bucket_name!(bucket_name)
|
58
75
|
endpoint = URI.parse(context.http_request.endpoint.to_s)
|
59
76
|
endpoint.scheme = 'https'
|
60
77
|
endpoint.port = 443
|
61
|
-
endpoint.host = "#{bucket_name}.s3-accelerate
|
62
|
-
|
63
|
-
# s3 accelerate endpoint doesn't work with 'expect' header
|
64
|
-
context.http_request.headers.delete('expect')
|
65
|
-
end
|
66
|
-
|
67
|
-
def use_combined_accelerate_dualstack_endpoint(context)
|
68
|
-
bucket_name = context.params[:bucket]
|
69
|
-
validate_bucket_name!(bucket_name)
|
70
|
-
endpoint = URI.parse(context.http_request.endpoint.to_s)
|
71
|
-
endpoint.scheme = 'https'
|
72
|
-
endpoint.port = 443
|
73
|
-
endpoint.host = "#{bucket_name}.s3-accelerate.dualstack.amazonaws.com"
|
78
|
+
endpoint.host = "#{bucket_name}.s3-accelerate"\
|
79
|
+
"#{'.dualstack' if dualstack}.amazonaws.com"
|
74
80
|
context.http_request.endpoint = endpoint.to_s
|
75
81
|
# s3 accelerate endpoint doesn't work with 'expect' header
|
76
82
|
context.http_request.headers.delete('expect')
|
@@ -78,17 +84,11 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3
|
|
78
84
|
|
79
85
|
def validate_bucket_name!(bucket_name)
|
80
86
|
unless BucketDns.dns_compatible?(bucket_name, _ssl = true)
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
end
|
85
|
-
if bucket_name.include?('.')
|
86
|
-
msg = "unable to use `accelerate: true` on buckets with dots"
|
87
|
-
msg << "in their name: #{bucket_name.inspect}"
|
88
|
-
raise ArgumentError, msg
|
87
|
+
raise ArgumentError,
|
88
|
+
'Unable to use `use_accelerate_endpoint: true` on buckets '\
|
89
|
+
'with non-DNS compatible names.'
|
89
90
|
end
|
90
91
|
end
|
91
|
-
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|