aws-sdk-s3 1.127.0 → 1.141.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +87 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-s3/bucket.rb +421 -81
- data/lib/aws-sdk-s3/bucket_acl.rb +9 -9
- data/lib/aws-sdk-s3/bucket_cors.rb +12 -12
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +12 -12
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +12 -12
- data/lib/aws-sdk-s3/bucket_logging.rb +16 -9
- data/lib/aws-sdk-s3/bucket_notification.rb +3 -3
- data/lib/aws-sdk-s3/bucket_policy.rb +58 -14
- data/lib/aws-sdk-s3/bucket_request_payment.rb +9 -9
- data/lib/aws-sdk-s3/bucket_tagging.rb +12 -12
- data/lib/aws-sdk-s3/bucket_versioning.rb +27 -27
- data/lib/aws-sdk-s3/bucket_website.rb +12 -12
- data/lib/aws-sdk-s3/client.rb +5707 -2536
- data/lib/aws-sdk-s3/client_api.rb +111 -16
- data/lib/aws-sdk-s3/customizations/errors.rb +1 -1
- data/lib/aws-sdk-s3/customizations/object.rb +63 -0
- data/lib/aws-sdk-s3/customizations.rb +5 -0
- data/lib/aws-sdk-s3/endpoint_parameters.rb +36 -0
- data/lib/aws-sdk-s3/endpoint_provider.rb +104 -246
- data/lib/aws-sdk-s3/endpoints.rb +440 -0
- data/lib/aws-sdk-s3/express_credentials.rb +55 -0
- data/lib/aws-sdk-s3/express_credentials_cache.rb +30 -0
- data/lib/aws-sdk-s3/express_credentials_provider.rb +36 -0
- data/lib/aws-sdk-s3/file_downloader.rb +142 -21
- data/lib/aws-sdk-s3/multipart_file_uploader.rb +0 -1
- data/lib/aws-sdk-s3/multipart_stream_uploader.rb +0 -1
- data/lib/aws-sdk-s3/multipart_upload.rb +69 -16
- data/lib/aws-sdk-s3/multipart_upload_part.rb +160 -35
- data/lib/aws-sdk-s3/object.rb +1504 -235
- data/lib/aws-sdk-s3/object_acl.rb +29 -15
- data/lib/aws-sdk-s3/object_multipart_copier.rb +33 -17
- data/lib/aws-sdk-s3/object_summary.rb +1367 -254
- data/lib/aws-sdk-s3/object_version.rb +297 -42
- data/lib/aws-sdk-s3/plugins/endpoints.rb +13 -2
- data/lib/aws-sdk-s3/plugins/express_session_auth.rb +90 -0
- data/lib/aws-sdk-s3/plugins/location_constraint.rb +3 -1
- data/lib/aws-sdk-s3/plugins/md5s.rb +2 -1
- data/lib/aws-sdk-s3/presigned_post.rb +52 -43
- data/lib/aws-sdk-s3/presigner.rb +2 -2
- data/lib/aws-sdk-s3/resource.rb +83 -11
- data/lib/aws-sdk-s3/types.rb +4500 -1351
- data/lib/aws-sdk-s3.rb +1 -1
- metadata +11 -7
@@ -56,6 +56,10 @@ module Aws::S3
|
|
56
56
|
|
57
57
|
# If present, indicates that the requester was successfully charged for
|
58
58
|
# the request.
|
59
|
+
#
|
60
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
61
|
+
#
|
62
|
+
# </note>
|
59
63
|
# @return [String]
|
60
64
|
def request_charged
|
61
65
|
data[:request_charged]
|
@@ -261,12 +265,12 @@ module Aws::S3
|
|
261
265
|
# [1]: http://www.ietf.org/rfc/rfc1864.txt
|
262
266
|
# @option options [String] :checksum_algorithm
|
263
267
|
# Indicates the algorithm used to create the checksum for the object
|
264
|
-
# when
|
265
|
-
# functionality if
|
266
|
-
# must be a corresponding `x-amz-checksum` or `x-amz-trailer`
|
267
|
-
# sent. Otherwise, Amazon S3 fails the request with the HTTP
|
268
|
-
# `400 Bad Request`. For more information, see [Checking
|
269
|
-
# integrity][1] in the *Amazon S3 User Guide*.
|
268
|
+
# when you use the SDK. This header will not provide any additional
|
269
|
+
# functionality if you don't use the SDK. When you send this header,
|
270
|
+
# there must be a corresponding `x-amz-checksum` or `x-amz-trailer`
|
271
|
+
# header sent. Otherwise, Amazon S3 fails the request with the HTTP
|
272
|
+
# status code `400 Bad Request`. For more information, see [Checking
|
273
|
+
# object integrity][1] in the *Amazon S3 User Guide*.
|
270
274
|
#
|
271
275
|
# If you provide an individual checksum, Amazon S3 ignores any provided
|
272
276
|
# `ChecksumAlgorithm` parameter.
|
@@ -278,15 +282,15 @@ module Aws::S3
|
|
278
282
|
# Allows grantee the read, write, read ACP, and write ACP permissions on
|
279
283
|
# the bucket.
|
280
284
|
#
|
281
|
-
# This
|
285
|
+
# This functionality is not supported for Amazon S3 on Outposts.
|
282
286
|
# @option options [String] :grant_read
|
283
287
|
# Allows grantee to list the objects in the bucket.
|
284
288
|
#
|
285
|
-
# This
|
289
|
+
# This functionality is not supported for Amazon S3 on Outposts.
|
286
290
|
# @option options [String] :grant_read_acp
|
287
291
|
# Allows grantee to read the bucket ACL.
|
288
292
|
#
|
289
|
-
# This
|
293
|
+
# This functionality is not supported for Amazon S3 on Outposts.
|
290
294
|
# @option options [String] :grant_write
|
291
295
|
# Allows grantee to create new objects in the bucket.
|
292
296
|
#
|
@@ -295,23 +299,33 @@ module Aws::S3
|
|
295
299
|
# @option options [String] :grant_write_acp
|
296
300
|
# Allows grantee to write the ACL for the applicable bucket.
|
297
301
|
#
|
298
|
-
# This
|
302
|
+
# This functionality is not supported for Amazon S3 on Outposts.
|
299
303
|
# @option options [String] :request_payer
|
300
304
|
# Confirms that the requester knows that they will be charged for the
|
301
305
|
# request. Bucket owners need not specify this parameter in their
|
302
|
-
# requests.
|
306
|
+
# requests. If either the source or destination S3 bucket has Requester
|
307
|
+
# Pays enabled, the requester will pay for corresponding charges to copy
|
308
|
+
# the object. For information about downloading objects from Requester
|
303
309
|
# Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
|
304
310
|
# in the *Amazon S3 User Guide*.
|
305
311
|
#
|
312
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
313
|
+
#
|
314
|
+
# </note>
|
315
|
+
#
|
306
316
|
#
|
307
317
|
#
|
308
318
|
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
309
319
|
# @option options [String] :version_id
|
310
|
-
#
|
320
|
+
# Version ID used to reference a specific version of the object.
|
321
|
+
#
|
322
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
323
|
+
#
|
324
|
+
# </note>
|
311
325
|
# @option options [String] :expected_bucket_owner
|
312
|
-
# The account ID of the expected bucket owner. If the
|
313
|
-
#
|
314
|
-
# Forbidden` (access denied).
|
326
|
+
# The account ID of the expected bucket owner. If the account ID that
|
327
|
+
# you provide does not match the actual owner of the bucket, the request
|
328
|
+
# fails with the HTTP status code `403 Forbidden` (access denied).
|
315
329
|
# @return [Types::PutObjectAclOutput]
|
316
330
|
def put(options = {})
|
317
331
|
options = options.merge(
|
@@ -15,18 +15,21 @@ module Aws
|
|
15
15
|
MAX_PARTS = 10_000
|
16
16
|
|
17
17
|
# @option options [Client] :client
|
18
|
-
# @option [Integer] :min_part_size (52428800)
|
19
|
-
# Defaults to 50MB.
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
18
|
+
# @option options [Integer] :min_part_size (52428800)
|
19
|
+
# Size of copied parts. Defaults to 50MB.
|
20
|
+
# @option options [Integer] :thread_count (10) Number of concurrent
|
21
|
+
# threads to use for copying parts.
|
22
|
+
# @option options [Boolean] :use_source_parts (false) Use part sizes
|
23
|
+
# defined on the source object if any exist. If copying or moving an
|
24
|
+
# object that is already multipart, this does not re-part the object,
|
25
|
+
# instead re-using the part definitions on the original. That means
|
26
|
+
# the etag and any checksums will not change. This is especially
|
27
|
+
# useful if the source object has parts with varied sizes.
|
23
28
|
def initialize(options = {})
|
29
|
+
@use_source_parts = options.delete(:use_source_parts) || false
|
24
30
|
@thread_count = options.delete(:thread_count) || 10
|
25
31
|
@min_part_size = options.delete(:min_part_size) || (FIVE_MB * 10)
|
26
32
|
@client = options[:client] || Client.new
|
27
|
-
if options[:checksum_algorithm]
|
28
|
-
raise ArgumentError, 'Multipart Copy does not support setting :checksum_algorithm'
|
29
|
-
end
|
30
33
|
end
|
31
34
|
|
32
35
|
# @return [Client]
|
@@ -78,10 +81,9 @@ module Aws
|
|
78
81
|
end
|
79
82
|
|
80
83
|
def copy_part(part)
|
81
|
-
{
|
82
|
-
|
83
|
-
|
84
|
-
}
|
84
|
+
@client.upload_part_copy(part).copy_part_result.to_h.merge({
|
85
|
+
part_number: part[:part_number]
|
86
|
+
}).tap { |result| result.delete(:last_modified) }
|
85
87
|
end
|
86
88
|
|
87
89
|
def complete_upload(parts, options)
|
@@ -104,24 +106,37 @@ module Aws
|
|
104
106
|
parts = []
|
105
107
|
options = options_for(:upload_part_copy, options)
|
106
108
|
while offset < size
|
109
|
+
part_size = calculate_part_size(part_number, default_part_size, options)
|
107
110
|
parts << options.merge({
|
108
111
|
part_number: part_number,
|
109
|
-
copy_source_range: byte_range(offset,
|
112
|
+
copy_source_range: byte_range(offset, part_size, size),
|
110
113
|
})
|
111
114
|
part_number += 1
|
112
|
-
offset +=
|
115
|
+
offset += part_size
|
113
116
|
end
|
114
117
|
parts
|
115
118
|
end
|
116
119
|
|
117
|
-
def byte_range(offset,
|
118
|
-
if offset +
|
119
|
-
"bytes=#{offset}-#{offset +
|
120
|
+
def byte_range(offset, part_size, size)
|
121
|
+
if offset + part_size < size
|
122
|
+
"bytes=#{offset}-#{offset + part_size - 1}"
|
120
123
|
else
|
121
124
|
"bytes=#{offset}-#{size - 1}"
|
122
125
|
end
|
123
126
|
end
|
124
127
|
|
128
|
+
def calculate_part_size(part_number, default_part_size, options)
|
129
|
+
if @use_source_parts && source_has_parts(options)
|
130
|
+
source_metadata(options.merge({ part_number: part_number }))[:content_length]
|
131
|
+
else
|
132
|
+
default_part_size
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def source_has_parts(options)
|
137
|
+
@source_has_parts ||= source_metadata(options.merge({ part_number: 1 }))[:parts_count]
|
138
|
+
end
|
139
|
+
|
125
140
|
def source_metadata(options)
|
126
141
|
if options[:content_length]
|
127
142
|
return { content_length: options.delete(:content_length) }
|
@@ -138,6 +153,7 @@ module Aws
|
|
138
153
|
key = CGI.unescape(key)
|
139
154
|
opts = { bucket: bucket, key: key }
|
140
155
|
opts[:version_id] = version_id if version_id
|
156
|
+
opts[:part_number] = options[:part_number] if options[:part_number]
|
141
157
|
client.head_object(opts).to_h
|
142
158
|
end
|
143
159
|
|