aws-sdk-s3 1.21.0 → 1.117.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +930 -0
- data/LICENSE.txt +202 -0
- data/VERSION +1 -0
- data/lib/aws-sdk-s3/bucket.rb +393 -75
- data/lib/aws-sdk-s3/bucket_acl.rb +57 -14
- data/lib/aws-sdk-s3/bucket_cors.rb +67 -13
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +54 -15
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +56 -15
- data/lib/aws-sdk-s3/bucket_logging.rb +52 -15
- data/lib/aws-sdk-s3/bucket_notification.rb +47 -17
- data/lib/aws-sdk-s3/bucket_policy.rb +51 -13
- data/lib/aws-sdk-s3/bucket_region_cache.rb +2 -0
- data/lib/aws-sdk-s3/bucket_request_payment.rb +51 -12
- data/lib/aws-sdk-s3/bucket_tagging.rb +59 -13
- data/lib/aws-sdk-s3/bucket_versioning.rb +118 -12
- data/lib/aws-sdk-s3/bucket_website.rb +66 -13
- data/lib/aws-sdk-s3/client.rb +11422 -2518
- data/lib/aws-sdk-s3/client_api.rb +1196 -155
- data/lib/aws-sdk-s3/customizations/bucket.rb +53 -36
- 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 +11 -3
- 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/endpoint_parameters.rb +142 -0
- data/lib/aws-sdk-s3/endpoint_provider.rb +2020 -0
- data/lib/aws-sdk-s3/endpoints.rb +2149 -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 +78 -19
- data/lib/aws-sdk-s3/multipart_stream_uploader.rb +54 -15
- data/lib/aws-sdk-s3/multipart_upload.rb +178 -28
- data/lib/aws-sdk-s3/multipart_upload_error.rb +2 -0
- data/lib/aws-sdk-s3/multipart_upload_part.rb +237 -44
- data/lib/aws-sdk-s3/object.rb +897 -154
- data/lib/aws-sdk-s3/object_acl.rb +81 -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 +649 -139
- data/lib/aws-sdk-s3/object_version.rb +167 -65
- data/lib/aws-sdk-s3/plugins/accelerate.rb +17 -64
- data/lib/aws-sdk-s3/plugins/arn.rb +70 -0
- data/lib/aws-sdk-s3/plugins/bucket_dns.rb +7 -43
- data/lib/aws-sdk-s3/plugins/bucket_name_restrictions.rb +20 -3
- data/lib/aws-sdk-s3/plugins/dualstack.rb +7 -50
- data/lib/aws-sdk-s3/plugins/endpoints.rb +262 -0
- data/lib/aws-sdk-s3/plugins/expect_100_continue.rb +5 -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 +44 -0
- data/lib/aws-sdk-s3/plugins/location_constraint.rb +2 -0
- data/lib/aws-sdk-s3/plugins/md5s.rb +34 -27
- 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 +55 -92
- data/lib/aws-sdk-s3/plugins/skip_whole_multipart_get_checksums.rb +31 -0
- data/lib/aws-sdk-s3/plugins/sse_cpk.rb +3 -1
- data/lib/aws-sdk-s3/plugins/streaming_retry.rb +139 -0
- data/lib/aws-sdk-s3/plugins/url_encoded_keys.rb +2 -0
- data/lib/aws-sdk-s3/presigned_post.rb +108 -56
- data/lib/aws-sdk-s3/presigner.rb +169 -77
- data/lib/aws-sdk-s3/resource.rb +45 -5
- data/lib/aws-sdk-s3/types.rb +8564 -3891
- data/lib/aws-sdk-s3/waiters.rb +67 -1
- data/lib/aws-sdk-s3.rb +16 -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,11 +50,18 @@ 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]
|
52
57
|
end
|
53
58
|
|
59
|
+
# The algorithm that was used to create a checksum of the object.
|
60
|
+
# @return [Array<String>]
|
61
|
+
def checksum_algorithm
|
62
|
+
data[:checksum_algorithm]
|
63
|
+
end
|
64
|
+
|
54
65
|
# Size in bytes of the object.
|
55
66
|
# @return [Integer]
|
56
67
|
def size
|
@@ -88,6 +99,7 @@ module Aws::S3
|
|
88
99
|
data[:last_modified]
|
89
100
|
end
|
90
101
|
|
102
|
+
# Specifies the owner of the object.
|
91
103
|
# @return [Types::Owner]
|
92
104
|
def owner
|
93
105
|
data[:owner]
|
@@ -128,7 +140,8 @@ module Aws::S3
|
|
128
140
|
# Waiter polls an API operation until a resource enters a desired
|
129
141
|
# state.
|
130
142
|
#
|
131
|
-
# @note The waiting operation is performed on a copy. The original resource
|
143
|
+
# @note The waiting operation is performed on a copy. The original resource
|
144
|
+
# remains unchanged.
|
132
145
|
#
|
133
146
|
# ## Basic Usage
|
134
147
|
#
|
@@ -141,13 +154,15 @@ module Aws::S3
|
|
141
154
|
#
|
142
155
|
# ## Example
|
143
156
|
#
|
144
|
-
# instance.wait_until(max_attempts:10, delay:5)
|
157
|
+
# instance.wait_until(max_attempts:10, delay:5) do |instance|
|
158
|
+
# instance.state.name == 'running'
|
159
|
+
# end
|
145
160
|
#
|
146
161
|
# ## Configuration
|
147
162
|
#
|
148
163
|
# 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}:
|
164
|
+
# delay (in seconds) between each polling attempt. The waiting condition is
|
165
|
+
# set by passing a block to {#wait_until}:
|
151
166
|
#
|
152
167
|
# # poll for ~25 seconds
|
153
168
|
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
@@ -178,17 +193,16 @@ module Aws::S3
|
|
178
193
|
# # resource did not enter the desired state in time
|
179
194
|
# end
|
180
195
|
#
|
196
|
+
# @yieldparam [Resource] resource to be used in the waiting condition.
|
181
197
|
#
|
182
|
-
# @
|
183
|
-
#
|
184
|
-
#
|
185
|
-
# because the waiter has entered a state that it will not transition
|
186
|
-
# out of, preventing success.
|
198
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter
|
199
|
+
# terminates because the waiter has entered a state that it will not
|
200
|
+
# transition out of, preventing success.
|
187
201
|
#
|
188
202
|
# yet successful.
|
189
203
|
#
|
190
|
-
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is
|
191
|
-
# while polling for a resource that is not expected.
|
204
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is
|
205
|
+
# encountered while polling for a resource that is not expected.
|
192
206
|
#
|
193
207
|
# @raise [NotImplementedError] Raised when the resource does not
|
194
208
|
#
|
@@ -225,17 +239,33 @@ module Aws::S3
|
|
225
239
|
# object_version.delete({
|
226
240
|
# mfa: "MFA",
|
227
241
|
# request_payer: "requester", # accepts requester
|
242
|
+
# bypass_governance_retention: false,
|
243
|
+
# expected_bucket_owner: "AccountId",
|
228
244
|
# })
|
229
245
|
# @param [Hash] options ({})
|
230
246
|
# @option options [String] :mfa
|
231
247
|
# The concatenation of the authentication device's serial number, a
|
232
248
|
# space, and the value that is displayed on your authentication device.
|
249
|
+
# Required to permanently delete a versioned object if versioning is
|
250
|
+
# configured with MFA delete enabled.
|
233
251
|
# @option options [String] :request_payer
|
234
|
-
# Confirms that the requester knows that
|
235
|
-
#
|
236
|
-
# requests.
|
237
|
-
# buckets
|
238
|
-
#
|
252
|
+
# Confirms that the requester knows that they will be charged for the
|
253
|
+
# request. Bucket owners need not specify this parameter in their
|
254
|
+
# requests. For information about downloading objects from Requester
|
255
|
+
# Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
|
256
|
+
# in the *Amazon S3 User Guide*.
|
257
|
+
#
|
258
|
+
#
|
259
|
+
#
|
260
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
261
|
+
# @option options [Boolean] :bypass_governance_retention
|
262
|
+
# Indicates whether S3 Object Lock should bypass Governance-mode
|
263
|
+
# restrictions to process this operation. To use this header, you must
|
264
|
+
# have the `s3:BypassGovernanceRetention` permission.
|
265
|
+
# @option options [String] :expected_bucket_owner
|
266
|
+
# The account ID of the expected bucket owner. If the bucket is owned by
|
267
|
+
# a different account, the request fails with the HTTP status code `403
|
268
|
+
# Forbidden` (access denied).
|
239
269
|
# @return [Types::DeleteObjectOutput]
|
240
270
|
def delete(options = {})
|
241
271
|
options = options.merge(
|
@@ -266,60 +296,81 @@ module Aws::S3
|
|
266
296
|
# sse_customer_key_md5: "SSECustomerKeyMD5",
|
267
297
|
# request_payer: "requester", # accepts requester
|
268
298
|
# part_number: 1,
|
299
|
+
# expected_bucket_owner: "AccountId",
|
300
|
+
# checksum_mode: "ENABLED", # accepts ENABLED
|
269
301
|
# })
|
270
302
|
# @param [Hash] options ({})
|
271
303
|
# @option options [String] :if_match
|
272
304
|
# Return the object only if its entity tag (ETag) is the same as the one
|
273
|
-
# specified
|
305
|
+
# specified; otherwise, return a 412 (precondition failed) error.
|
274
306
|
# @option options [Time,DateTime,Date,Integer,String] :if_modified_since
|
275
307
|
# Return the object only if it has been modified since the specified
|
276
|
-
# time
|
308
|
+
# time; otherwise, return a 304 (not modified) error.
|
277
309
|
# @option options [String] :if_none_match
|
278
310
|
# Return the object only if its entity tag (ETag) is different from the
|
279
|
-
# one specified
|
311
|
+
# one specified; otherwise, return a 304 (not modified) error.
|
280
312
|
# @option options [Time,DateTime,Date,Integer,String] :if_unmodified_since
|
281
313
|
# Return the object only if it has not been modified since the specified
|
282
|
-
# time
|
314
|
+
# time; otherwise, return a 412 (precondition failed) error.
|
283
315
|
# @option options [String] :range
|
284
316
|
# Downloads the specified range bytes of an object. For more information
|
285
|
-
# about the HTTP Range header,
|
286
|
-
#
|
317
|
+
# about the HTTP Range header, see
|
318
|
+
# [https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35][1].
|
319
|
+
#
|
320
|
+
# <note markdown="1"> Amazon S3 doesn't support retrieving multiple ranges of data per
|
321
|
+
# `GET` request.
|
322
|
+
#
|
323
|
+
# </note>
|
324
|
+
#
|
325
|
+
#
|
326
|
+
#
|
327
|
+
# [1]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
|
287
328
|
# @option options [String] :response_cache_control
|
288
|
-
# Sets the Cache-Control header of the response.
|
329
|
+
# Sets the `Cache-Control` header of the response.
|
289
330
|
# @option options [String] :response_content_disposition
|
290
|
-
# Sets the Content-Disposition header of the response
|
331
|
+
# Sets the `Content-Disposition` header of the response
|
291
332
|
# @option options [String] :response_content_encoding
|
292
|
-
# Sets the Content-Encoding header of the response.
|
333
|
+
# Sets the `Content-Encoding` header of the response.
|
293
334
|
# @option options [String] :response_content_language
|
294
|
-
# Sets the Content-Language header of the response.
|
335
|
+
# Sets the `Content-Language` header of the response.
|
295
336
|
# @option options [String] :response_content_type
|
296
|
-
# Sets the Content-Type header of the response.
|
337
|
+
# Sets the `Content-Type` header of the response.
|
297
338
|
# @option options [Time,DateTime,Date,Integer,String] :response_expires
|
298
|
-
# Sets the Expires header of the response.
|
339
|
+
# Sets the `Expires` header of the response.
|
299
340
|
# @option options [String] :sse_customer_algorithm
|
300
|
-
# Specifies the algorithm to use to when
|
301
|
-
# AES256).
|
341
|
+
# Specifies the algorithm to use to when decrypting the object (for
|
342
|
+
# example, AES256).
|
302
343
|
# @option options [String] :sse_customer_key
|
303
|
-
# Specifies the customer-provided encryption key for Amazon S3 to
|
304
|
-
#
|
305
|
-
#
|
306
|
-
# appropriate for use with the algorithm specified in the
|
307
|
-
# x-amz-server-side
|
344
|
+
# Specifies the customer-provided encryption key for Amazon S3 used to
|
345
|
+
# encrypt the data. This value is used to decrypt the object when
|
346
|
+
# recovering it and must match the one used when storing the data. The
|
347
|
+
# key must be appropriate for use with the algorithm specified in the
|
348
|
+
# `x-amz-server-side-encryption-customer-algorithm` header.
|
308
349
|
# @option options [String] :sse_customer_key_md5
|
309
350
|
# Specifies the 128-bit MD5 digest of the encryption key according to
|
310
351
|
# RFC 1321. Amazon S3 uses this header for a message integrity check to
|
311
|
-
# ensure the encryption key was transmitted without error.
|
352
|
+
# ensure that the encryption key was transmitted without error.
|
312
353
|
# @option options [String] :request_payer
|
313
|
-
# Confirms that the requester knows that
|
314
|
-
#
|
315
|
-
# requests.
|
316
|
-
# buckets
|
317
|
-
#
|
354
|
+
# Confirms that the requester knows that they will be charged for the
|
355
|
+
# request. Bucket owners need not specify this parameter in their
|
356
|
+
# requests. For information about downloading objects from Requester
|
357
|
+
# Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
|
358
|
+
# in the *Amazon S3 User Guide*.
|
359
|
+
#
|
360
|
+
#
|
361
|
+
#
|
362
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
318
363
|
# @option options [Integer] :part_number
|
319
364
|
# Part number of the object being read. This is a positive integer
|
320
365
|
# between 1 and 10,000. Effectively performs a 'ranged' GET request
|
321
366
|
# for the part specified. Useful for downloading just a part of an
|
322
367
|
# object.
|
368
|
+
# @option options [String] :expected_bucket_owner
|
369
|
+
# The account ID of the expected bucket owner. If the bucket is owned by
|
370
|
+
# a different account, the request fails with the HTTP status code `403
|
371
|
+
# Forbidden` (access denied).
|
372
|
+
# @option options [String] :checksum_mode
|
373
|
+
# To retrieve the checksum, this mode must be enabled.
|
323
374
|
# @return [Types::GetObjectOutput]
|
324
375
|
def get(options = {}, &block)
|
325
376
|
options = options.merge(
|
@@ -344,48 +395,64 @@ module Aws::S3
|
|
344
395
|
# sse_customer_key_md5: "SSECustomerKeyMD5",
|
345
396
|
# request_payer: "requester", # accepts requester
|
346
397
|
# part_number: 1,
|
398
|
+
# expected_bucket_owner: "AccountId",
|
399
|
+
# checksum_mode: "ENABLED", # accepts ENABLED
|
347
400
|
# })
|
348
401
|
# @param [Hash] options ({})
|
349
402
|
# @option options [String] :if_match
|
350
403
|
# Return the object only if its entity tag (ETag) is the same as the one
|
351
|
-
# specified
|
404
|
+
# specified; otherwise, return a 412 (precondition failed) error.
|
352
405
|
# @option options [Time,DateTime,Date,Integer,String] :if_modified_since
|
353
406
|
# Return the object only if it has been modified since the specified
|
354
|
-
# time
|
407
|
+
# time; otherwise, return a 304 (not modified) error.
|
355
408
|
# @option options [String] :if_none_match
|
356
409
|
# Return the object only if its entity tag (ETag) is different from the
|
357
|
-
# one specified
|
410
|
+
# one specified; otherwise, return a 304 (not modified) error.
|
358
411
|
# @option options [Time,DateTime,Date,Integer,String] :if_unmodified_since
|
359
412
|
# Return the object only if it has not been modified since the specified
|
360
|
-
# time
|
413
|
+
# time; otherwise, return a 412 (precondition failed) error.
|
361
414
|
# @option options [String] :range
|
362
|
-
#
|
363
|
-
#
|
364
|
-
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
|
415
|
+
# Because `HeadObject` returns only the metadata for an object, this
|
416
|
+
# parameter has no effect.
|
365
417
|
# @option options [String] :sse_customer_algorithm
|
366
|
-
# Specifies the algorithm to use to when encrypting the object (
|
367
|
-
# AES256).
|
418
|
+
# Specifies the algorithm to use to when encrypting the object (for
|
419
|
+
# example, AES256).
|
368
420
|
# @option options [String] :sse_customer_key
|
369
421
|
# Specifies the customer-provided encryption key for Amazon S3 to use in
|
370
422
|
# encrypting data. This value is used to store the object and then it is
|
371
|
-
# discarded; Amazon does not store the encryption key. The key must
|
372
|
-
# appropriate for use with the algorithm specified in the
|
373
|
-
# x-amz-server-side
|
423
|
+
# discarded; Amazon S3 does not store the encryption key. The key must
|
424
|
+
# be appropriate for use with the algorithm specified in the
|
425
|
+
# `x-amz-server-side-encryption-customer-algorithm` header.
|
374
426
|
# @option options [String] :sse_customer_key_md5
|
375
427
|
# Specifies the 128-bit MD5 digest of the encryption key according to
|
376
428
|
# RFC 1321. Amazon S3 uses this header for a message integrity check to
|
377
|
-
# ensure the encryption key was transmitted without error.
|
429
|
+
# ensure that the encryption key was transmitted without error.
|
378
430
|
# @option options [String] :request_payer
|
379
|
-
# Confirms that the requester knows that
|
380
|
-
#
|
381
|
-
# requests.
|
382
|
-
# buckets
|
383
|
-
#
|
431
|
+
# Confirms that the requester knows that they will be charged for the
|
432
|
+
# request. Bucket owners need not specify this parameter in their
|
433
|
+
# requests. For information about downloading objects from Requester
|
434
|
+
# Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
|
435
|
+
# in the *Amazon S3 User Guide*.
|
436
|
+
#
|
437
|
+
#
|
438
|
+
#
|
439
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
384
440
|
# @option options [Integer] :part_number
|
385
441
|
# Part number of the object being read. This is a positive integer
|
386
442
|
# between 1 and 10,000. Effectively performs a 'ranged' HEAD request
|
387
443
|
# for the part specified. Useful querying about the size of the part and
|
388
444
|
# the number of parts in this object.
|
445
|
+
# @option options [String] :expected_bucket_owner
|
446
|
+
# The account ID of the expected bucket owner. If the bucket is owned by
|
447
|
+
# a different account, the request fails with the HTTP status code `403
|
448
|
+
# Forbidden` (access denied).
|
449
|
+
# @option options [String] :checksum_mode
|
450
|
+
# To retrieve the checksum, this parameter must be enabled.
|
451
|
+
#
|
452
|
+
# In addition, if you enable `ChecksumMode` and the object is encrypted
|
453
|
+
# with Amazon Web Services Key Management Service (Amazon Web Services
|
454
|
+
# KMS), you must have permission to use the `kms:Decrypt` action for the
|
455
|
+
# request to succeed.
|
389
456
|
# @return [Types::HeadObjectOutput]
|
390
457
|
def head(options = {})
|
391
458
|
options = options.merge(
|
@@ -463,17 +530,52 @@ module Aws::S3
|
|
463
530
|
# object_version.batch_delete!({
|
464
531
|
# mfa: "MFA",
|
465
532
|
# request_payer: "requester", # accepts requester
|
533
|
+
# bypass_governance_retention: false,
|
534
|
+
# expected_bucket_owner: "AccountId",
|
535
|
+
# checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
|
466
536
|
# })
|
467
537
|
# @param options ({})
|
468
538
|
# @option options [String] :mfa
|
469
539
|
# The concatenation of the authentication device's serial number, a
|
470
540
|
# space, and the value that is displayed on your authentication device.
|
541
|
+
# Required to permanently delete a versioned object if versioning is
|
542
|
+
# configured with MFA delete enabled.
|
471
543
|
# @option options [String] :request_payer
|
472
|
-
# Confirms that the requester knows that
|
473
|
-
#
|
474
|
-
# requests.
|
475
|
-
# buckets
|
476
|
-
#
|
544
|
+
# Confirms that the requester knows that they will be charged for the
|
545
|
+
# request. Bucket owners need not specify this parameter in their
|
546
|
+
# requests. For information about downloading objects from Requester
|
547
|
+
# Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
|
548
|
+
# in the *Amazon S3 User Guide*.
|
549
|
+
#
|
550
|
+
#
|
551
|
+
#
|
552
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
553
|
+
# @option options [Boolean] :bypass_governance_retention
|
554
|
+
# Specifies whether you want to delete this object even if it has a
|
555
|
+
# Governance-type Object Lock in place. To use this header, you must
|
556
|
+
# have the `s3:BypassGovernanceRetention` permission.
|
557
|
+
# @option options [String] :expected_bucket_owner
|
558
|
+
# The account ID of the expected bucket owner. If the bucket is owned by
|
559
|
+
# a different account, the request fails with the HTTP status code `403
|
560
|
+
# Forbidden` (access denied).
|
561
|
+
# @option options [String] :checksum_algorithm
|
562
|
+
# Indicates the algorithm used to create the checksum for the object
|
563
|
+
# when using the SDK. This header will not provide any additional
|
564
|
+
# functionality if not using the SDK. When sending this header, there
|
565
|
+
# must be a corresponding `x-amz-checksum` or `x-amz-trailer` header
|
566
|
+
# sent. Otherwise, Amazon S3 fails the request with the HTTP status code
|
567
|
+
# `400 Bad Request`. For more information, see [Checking object
|
568
|
+
# integrity][1] in the *Amazon S3 User Guide*.
|
569
|
+
#
|
570
|
+
# If you provide an individual checksum, Amazon S3 ignores any provided
|
571
|
+
# `ChecksumAlgorithm` parameter.
|
572
|
+
#
|
573
|
+
# This checksum algorithm must be the same for all parts and it match
|
574
|
+
# the checksum value supplied in the `CreateMultipartUpload` request.
|
575
|
+
#
|
576
|
+
#
|
577
|
+
#
|
578
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
|
477
579
|
# @return [void]
|
478
580
|
def batch_delete!(options = {})
|
479
581
|
batch_enum.each do |batch|
|
@@ -1,94 +1,47 @@
|
|
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.add(
|
26
|
-
|
26
|
+
handlers.add(
|
27
|
+
OptionHandler, step: :initialize, operations: operations
|
28
|
+
)
|
27
29
|
end
|
28
30
|
|
29
31
|
# @api private
|
30
32
|
class OptionHandler < Seahorse::Client::Handler
|
31
33
|
def call(context)
|
32
|
-
|
33
|
-
|
34
|
-
context
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# @api private
|
40
|
-
class AccelerateHandler < Seahorse::Client::Handler
|
41
|
-
|
42
|
-
def call(context)
|
43
|
-
if context[:use_accelerate_endpoint]
|
44
|
-
if context[:use_dualstack_endpoint]
|
45
|
-
use_combined_accelerate_dualstack_endpoint(context)
|
46
|
-
else
|
47
|
-
use_accelerate_endpoint(context)
|
48
|
-
end
|
34
|
+
# Support client configuration and per-operation configuration
|
35
|
+
# TODO: move this to an options hash and warn here.
|
36
|
+
if context.params.is_a?(Hash)
|
37
|
+
accelerate = context.params.delete(:use_accelerate_endpoint)
|
49
38
|
end
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
def use_accelerate_endpoint(context)
|
56
|
-
bucket_name = context.params[:bucket]
|
57
|
-
validate_bucket_name!(bucket_name)
|
58
|
-
endpoint = URI.parse(context.http_request.endpoint.to_s)
|
59
|
-
endpoint.scheme = 'https'
|
60
|
-
endpoint.port = 443
|
61
|
-
endpoint.host = "#{bucket_name}.s3-accelerate.amazonaws.com"
|
62
|
-
context.http_request.endpoint = endpoint.to_s
|
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"
|
74
|
-
context.http_request.endpoint = endpoint.to_s
|
75
|
-
# s3 accelerate endpoint doesn't work with 'expect' header
|
76
|
-
context.http_request.headers.delete('expect')
|
77
|
-
end
|
78
|
-
|
79
|
-
def validate_bucket_name!(bucket_name)
|
80
|
-
unless BucketDns.dns_compatible?(bucket_name, _ssl = true)
|
81
|
-
msg = "unable to use `accelerate: true` on buckets with "
|
82
|
-
msg << "non-DNS compatible names"
|
83
|
-
raise ArgumentError, msg
|
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
|
39
|
+
if accelerate.nil?
|
40
|
+
accelerate = context.config.use_accelerate_endpoint
|
89
41
|
end
|
42
|
+
context[:use_accelerate_endpoint] = accelerate
|
43
|
+
@handler.call(context)
|
90
44
|
end
|
91
|
-
|
92
45
|
end
|
93
46
|
end
|
94
47
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module S3
|
5
|
+
module Plugins
|
6
|
+
# When an accesspoint ARN is provided for :bucket in S3 operations, this
|
7
|
+
# plugin resolves the request endpoint from the ARN when possible.
|
8
|
+
# @api private
|
9
|
+
class ARN < Seahorse::Client::Plugin
|
10
|
+
option(
|
11
|
+
:s3_use_arn_region,
|
12
|
+
default: true,
|
13
|
+
doc_type: 'Boolean',
|
14
|
+
docstring: <<-DOCS) do |cfg|
|
15
|
+
For S3 ARNs passed into the `:bucket` parameter, this option will
|
16
|
+
use the region in the ARN, allowing for cross-region requests to
|
17
|
+
be made. Set to `false` to use the client's region instead.
|
18
|
+
DOCS
|
19
|
+
resolve_s3_use_arn_region(cfg)
|
20
|
+
end
|
21
|
+
|
22
|
+
option(
|
23
|
+
:s3_disable_multiregion_access_points,
|
24
|
+
default: false,
|
25
|
+
doc_type: 'Boolean',
|
26
|
+
docstring: <<-DOCS) do |cfg|
|
27
|
+
When set to `false` this will option will raise errors when multi-region
|
28
|
+
access point ARNs are used. Multi-region access points can potentially
|
29
|
+
result in cross region requests.
|
30
|
+
DOCS
|
31
|
+
resolve_s3_disable_multiregion_access_points(cfg)
|
32
|
+
end
|
33
|
+
|
34
|
+
class << self
|
35
|
+
private
|
36
|
+
|
37
|
+
def resolve_s3_use_arn_region(cfg)
|
38
|
+
value = ENV['AWS_S3_USE_ARN_REGION'] ||
|
39
|
+
Aws.shared_config.s3_use_arn_region(profile: cfg.profile) ||
|
40
|
+
'true'
|
41
|
+
value = Aws::Util.str_2_bool(value)
|
42
|
+
# Raise if provided value is not true or false
|
43
|
+
if value.nil?
|
44
|
+
raise ArgumentError,
|
45
|
+
'Must provide either `true` or `false` for the '\
|
46
|
+
'`s3_use_arn_region` profile option or for '\
|
47
|
+
"ENV['AWS_S3_USE_ARN_REGION']."
|
48
|
+
end
|
49
|
+
value
|
50
|
+
end
|
51
|
+
|
52
|
+
def resolve_s3_disable_multiregion_access_points(cfg)
|
53
|
+
value = ENV['AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS'] ||
|
54
|
+
Aws.shared_config.s3_disable_multiregion_access_points(profile: cfg.profile) ||
|
55
|
+
'false'
|
56
|
+
value = Aws::Util.str_2_bool(value)
|
57
|
+
# Raise if provided value is not true or false
|
58
|
+
if value.nil?
|
59
|
+
raise ArgumentError,
|
60
|
+
'Must provide either `true` or `false` for '\
|
61
|
+
's3_use_arn_region profile option or for '\
|
62
|
+
"ENV['AWS_S3_USE_ARN_REGION']"
|
63
|
+
end
|
64
|
+
value
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Aws
|
2
4
|
module S3
|
3
5
|
module Plugins
|
@@ -21,47 +23,10 @@ When set to `true`, the bucket name is always left in the
|
|
21
23
|
request URI and never moved to the host as a sub-domain.
|
22
24
|
DOCS
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
# @api private
|
29
|
-
class Handler < Seahorse::Client::Handler
|
30
|
-
|
31
|
-
def call(context)
|
32
|
-
move_dns_compat_bucket_to_subdomain(context)
|
33
|
-
@handler.call(context)
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def move_dns_compat_bucket_to_subdomain(context)
|
39
|
-
bucket_name = context.params[:bucket]
|
40
|
-
endpoint = context.http_request.endpoint
|
41
|
-
if
|
42
|
-
bucket_name &&
|
43
|
-
BucketDns.dns_compatible?(bucket_name, https?(endpoint)) &&
|
44
|
-
context.operation_name.to_s != 'get_bucket_location'
|
45
|
-
then
|
46
|
-
move_bucket_to_subdomain(bucket_name, endpoint)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def move_bucket_to_subdomain(bucket_name, endpoint)
|
51
|
-
endpoint.host = "#{bucket_name}.#{endpoint.host}"
|
52
|
-
path = endpoint.path.sub("/#{bucket_name}", '')
|
53
|
-
path = "/#{path}" unless path.match(/^\//)
|
54
|
-
endpoint.path = path
|
55
|
-
end
|
56
|
-
|
57
|
-
def https?(uri)
|
58
|
-
uri.scheme == 'https'
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
26
|
+
# These class methods were originally used in a handler in this plugin.
|
27
|
+
# SigV2 legacy signer needs this logic so we keep it here as utility.
|
28
|
+
# New endpoint resolution will check this as a matcher.
|
63
29
|
class << self
|
64
|
-
|
65
30
|
# @param [String] bucket_name
|
66
31
|
# @param [Boolean] ssl
|
67
32
|
# @return [Boolean]
|
@@ -73,15 +38,14 @@ request URI and never moved to the host as a sub-domain.
|
|
73
38
|
end
|
74
39
|
end
|
75
40
|
|
76
|
-
|
77
|
-
|
41
|
+
# @param [String] bucket_name
|
42
|
+
# @return [Boolean]
|
78
43
|
def valid_subdomain?(bucket_name)
|
79
44
|
bucket_name.size < 64 &&
|
80
45
|
bucket_name =~ /^[a-z0-9][a-z0-9.-]+[a-z0-9]$/ &&
|
81
46
|
bucket_name !~ /(\d+\.){3}\d+/ &&
|
82
47
|
bucket_name !~ /[.-]{2}/
|
83
48
|
end
|
84
|
-
|
85
49
|
end
|
86
50
|
end
|
87
51
|
end
|