aws-sdk-s3 1.128.0 → 1.199.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +450 -1
- data/VERSION +1 -1
- data/lib/aws-sdk-s3/access_grants_credentials.rb +57 -0
- data/lib/aws-sdk-s3/access_grants_credentials_provider.rb +250 -0
- data/lib/aws-sdk-s3/bucket.rb +720 -128
- data/lib/aws-sdk-s3/bucket_acl.rb +18 -17
- data/lib/aws-sdk-s3/bucket_cors.rb +22 -21
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +23 -18
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +76 -19
- data/lib/aws-sdk-s3/bucket_logging.rb +21 -14
- data/lib/aws-sdk-s3/bucket_notification.rb +6 -6
- data/lib/aws-sdk-s3/bucket_policy.rb +65 -20
- data/lib/aws-sdk-s3/bucket_region_cache.rb +9 -5
- data/lib/aws-sdk-s3/bucket_request_payment.rb +15 -15
- data/lib/aws-sdk-s3/bucket_tagging.rb +19 -19
- data/lib/aws-sdk-s3/bucket_versioning.rb +41 -41
- data/lib/aws-sdk-s3/bucket_website.rb +19 -19
- data/lib/aws-sdk-s3/client.rb +9352 -3264
- data/lib/aws-sdk-s3/client_api.rb +697 -164
- data/lib/aws-sdk-s3/customizations/bucket.rb +1 -1
- data/lib/aws-sdk-s3/customizations/errors.rb +16 -3
- data/lib/aws-sdk-s3/customizations/object.rb +112 -56
- data/lib/aws-sdk-s3/customizations/object_summary.rb +5 -0
- data/lib/aws-sdk-s3/customizations/object_version.rb +13 -0
- data/lib/aws-sdk-s3/customizations.rb +26 -31
- data/lib/aws-sdk-s3/encryption/client.rb +2 -2
- data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +2 -2
- data/lib/aws-sdk-s3/encryptionV2/client.rb +2 -2
- data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +2 -2
- data/lib/aws-sdk-s3/endpoint_parameters.rb +54 -15
- data/lib/aws-sdk-s3/endpoint_provider.rb +439 -456
- data/lib/aws-sdk-s3/endpoints.rb +629 -1261
- data/lib/aws-sdk-s3/errors.rb +58 -0
- data/lib/aws-sdk-s3/express_credentials.rb +55 -0
- data/lib/aws-sdk-s3/express_credentials_provider.rb +59 -0
- data/lib/aws-sdk-s3/file_downloader.rb +156 -69
- data/lib/aws-sdk-s3/file_uploader.rb +4 -6
- data/lib/aws-sdk-s3/legacy_signer.rb +2 -1
- data/lib/aws-sdk-s3/multipart_download_error.rb +8 -0
- data/lib/aws-sdk-s3/multipart_file_uploader.rb +56 -69
- data/lib/aws-sdk-s3/multipart_stream_uploader.rb +84 -91
- data/lib/aws-sdk-s3/multipart_upload.rb +179 -26
- data/lib/aws-sdk-s3/multipart_upload_error.rb +3 -4
- data/lib/aws-sdk-s3/multipart_upload_part.rb +201 -60
- data/lib/aws-sdk-s3/object.rb +2007 -281
- data/lib/aws-sdk-s3/object_acl.rb +43 -23
- data/lib/aws-sdk-s3/object_copier.rb +1 -1
- data/lib/aws-sdk-s3/object_multipart_copier.rb +44 -25
- data/lib/aws-sdk-s3/object_summary.rb +1735 -232
- data/lib/aws-sdk-s3/object_version.rb +394 -52
- data/lib/aws-sdk-s3/plugins/access_grants.rb +178 -0
- data/lib/aws-sdk-s3/plugins/checksum_algorithm.rb +31 -0
- data/lib/aws-sdk-s3/plugins/endpoints.rb +32 -208
- data/lib/aws-sdk-s3/plugins/express_session_auth.rb +88 -0
- data/lib/aws-sdk-s3/plugins/http_200_errors.rb +55 -18
- data/lib/aws-sdk-s3/plugins/location_constraint.rb +3 -1
- data/lib/aws-sdk-s3/plugins/md5s.rb +10 -70
- data/lib/aws-sdk-s3/plugins/s3_signer.rb +7 -2
- data/lib/aws-sdk-s3/plugins/streaming_retry.rb +5 -7
- data/lib/aws-sdk-s3/plugins/url_encoded_keys.rb +2 -1
- data/lib/aws-sdk-s3/presigned_post.rb +52 -43
- data/lib/aws-sdk-s3/presigner.rb +9 -7
- data/lib/aws-sdk-s3/resource.rb +127 -22
- data/lib/aws-sdk-s3/transfer_manager.rb +252 -0
- data/lib/aws-sdk-s3/types.rb +8068 -1887
- data/lib/aws-sdk-s3.rb +35 -31
- data/sig/bucket.rbs +231 -0
- data/sig/bucket_acl.rbs +78 -0
- data/sig/bucket_cors.rbs +69 -0
- data/sig/bucket_lifecycle.rbs +88 -0
- data/sig/bucket_lifecycle_configuration.rbs +115 -0
- data/sig/bucket_logging.rbs +76 -0
- data/sig/bucket_notification.rbs +114 -0
- data/sig/bucket_policy.rbs +59 -0
- data/sig/bucket_request_payment.rbs +54 -0
- data/sig/bucket_tagging.rbs +65 -0
- data/sig/bucket_versioning.rbs +77 -0
- data/sig/bucket_website.rbs +93 -0
- data/sig/client.rbs +2584 -0
- data/sig/customizations/bucket.rbs +19 -0
- data/sig/customizations/object.rbs +38 -0
- data/sig/customizations/object_summary.rbs +35 -0
- data/sig/errors.rbs +44 -0
- data/sig/multipart_upload.rbs +120 -0
- data/sig/multipart_upload_part.rbs +109 -0
- data/sig/object.rbs +462 -0
- data/sig/object_acl.rbs +86 -0
- data/sig/object_summary.rbs +345 -0
- data/sig/object_version.rbs +143 -0
- data/sig/resource.rbs +141 -0
- data/sig/types.rbs +2866 -0
- data/sig/waiters.rbs +95 -0
- metadata +44 -12
- data/lib/aws-sdk-s3/plugins/skip_whole_multipart_get_checksums.rb +0 -31
@@ -55,7 +55,17 @@ module Aws::S3
|
|
55
55
|
end
|
56
56
|
|
57
57
|
# If present, indicates that the requester was successfully charged for
|
58
|
-
# the request.
|
58
|
+
# the request. For more information, see [Using Requester Pays buckets
|
59
|
+
# for storage transfers and usage][1] in the *Amazon Simple Storage
|
60
|
+
# Service user guide*.
|
61
|
+
#
|
62
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
63
|
+
#
|
64
|
+
# </note>
|
65
|
+
#
|
66
|
+
#
|
67
|
+
#
|
68
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RequesterPaysBuckets.html
|
59
69
|
# @return [String]
|
60
70
|
def request_charged
|
61
71
|
data[:request_charged]
|
@@ -75,7 +85,7 @@ module Aws::S3
|
|
75
85
|
#
|
76
86
|
# @return [self]
|
77
87
|
def load
|
78
|
-
resp = Aws::Plugins::UserAgent.
|
88
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
79
89
|
@client.get_object_acl(
|
80
90
|
bucket: @bucket_name,
|
81
91
|
key: @object_key
|
@@ -195,7 +205,7 @@ module Aws::S3
|
|
195
205
|
:retry
|
196
206
|
end
|
197
207
|
end
|
198
|
-
Aws::Plugins::UserAgent.
|
208
|
+
Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
199
209
|
Aws::Waiters::Waiter.new(options).wait({})
|
200
210
|
end
|
201
211
|
end
|
@@ -225,7 +235,7 @@ module Aws::S3
|
|
225
235
|
# },
|
226
236
|
# },
|
227
237
|
# content_md5: "ContentMD5",
|
228
|
-
# checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
|
238
|
+
# checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256, CRC64NVME
|
229
239
|
# grant_full_control: "GrantFullControl",
|
230
240
|
# grant_read: "GrantRead",
|
231
241
|
# grant_read_acp: "GrantReadACP",
|
@@ -247,9 +257,9 @@ module Aws::S3
|
|
247
257
|
# Contains the elements that set the ACL permissions for an object per
|
248
258
|
# grantee.
|
249
259
|
# @option options [String] :content_md5
|
250
|
-
# The
|
251
|
-
# used as a message integrity check to verify that the request body
|
252
|
-
# not corrupted in transit. For more information, go to [RFC
|
260
|
+
# The Base64 encoded 128-bit `MD5` digest of the data. This header must
|
261
|
+
# be used as a message integrity check to verify that the request body
|
262
|
+
# was not corrupted in transit. For more information, go to [RFC
|
253
263
|
# 1864.>][1]
|
254
264
|
#
|
255
265
|
# For requests made using the Amazon Web Services Command Line Interface
|
@@ -261,12 +271,12 @@ module Aws::S3
|
|
261
271
|
# [1]: http://www.ietf.org/rfc/rfc1864.txt
|
262
272
|
# @option options [String] :checksum_algorithm
|
263
273
|
# 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*.
|
274
|
+
# when you use the SDK. This header will not provide any additional
|
275
|
+
# functionality if you don't use the SDK. When you send this header,
|
276
|
+
# there must be a corresponding `x-amz-checksum` or `x-amz-trailer`
|
277
|
+
# header sent. Otherwise, Amazon S3 fails the request with the HTTP
|
278
|
+
# status code `400 Bad Request`. For more information, see [Checking
|
279
|
+
# object integrity][1] in the *Amazon S3 User Guide*.
|
270
280
|
#
|
271
281
|
# If you provide an individual checksum, Amazon S3 ignores any provided
|
272
282
|
# `ChecksumAlgorithm` parameter.
|
@@ -278,15 +288,15 @@ module Aws::S3
|
|
278
288
|
# Allows grantee the read, write, read ACP, and write ACP permissions on
|
279
289
|
# the bucket.
|
280
290
|
#
|
281
|
-
# This
|
291
|
+
# This functionality is not supported for Amazon S3 on Outposts.
|
282
292
|
# @option options [String] :grant_read
|
283
293
|
# Allows grantee to list the objects in the bucket.
|
284
294
|
#
|
285
|
-
# This
|
295
|
+
# This functionality is not supported for Amazon S3 on Outposts.
|
286
296
|
# @option options [String] :grant_read_acp
|
287
297
|
# Allows grantee to read the bucket ACL.
|
288
298
|
#
|
289
|
-
# This
|
299
|
+
# This functionality is not supported for Amazon S3 on Outposts.
|
290
300
|
# @option options [String] :grant_write
|
291
301
|
# Allows grantee to create new objects in the bucket.
|
292
302
|
#
|
@@ -295,30 +305,40 @@ module Aws::S3
|
|
295
305
|
# @option options [String] :grant_write_acp
|
296
306
|
# Allows grantee to write the ACL for the applicable bucket.
|
297
307
|
#
|
298
|
-
# This
|
308
|
+
# This functionality is not supported for Amazon S3 on Outposts.
|
299
309
|
# @option options [String] :request_payer
|
300
310
|
# Confirms that the requester knows that they will be charged for the
|
301
311
|
# request. Bucket owners need not specify this parameter in their
|
302
|
-
# requests.
|
312
|
+
# requests. If either the source or destination S3 bucket has Requester
|
313
|
+
# Pays enabled, the requester will pay for corresponding charges to copy
|
314
|
+
# the object. For information about downloading objects from Requester
|
303
315
|
# Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
|
304
316
|
# in the *Amazon S3 User Guide*.
|
305
317
|
#
|
318
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
319
|
+
#
|
320
|
+
# </note>
|
321
|
+
#
|
306
322
|
#
|
307
323
|
#
|
308
324
|
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
309
325
|
# @option options [String] :version_id
|
310
|
-
#
|
326
|
+
# Version ID used to reference a specific version of the object.
|
327
|
+
#
|
328
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
329
|
+
#
|
330
|
+
# </note>
|
311
331
|
# @option options [String] :expected_bucket_owner
|
312
|
-
# The account ID of the expected bucket owner. If the
|
313
|
-
#
|
314
|
-
# Forbidden` (access denied).
|
332
|
+
# The account ID of the expected bucket owner. If the account ID that
|
333
|
+
# you provide does not match the actual owner of the bucket, the request
|
334
|
+
# fails with the HTTP status code `403 Forbidden` (access denied).
|
315
335
|
# @return [Types::PutObjectAclOutput]
|
316
336
|
def put(options = {})
|
317
337
|
options = options.merge(
|
318
338
|
bucket: @bucket_name,
|
319
339
|
key: @object_key
|
320
340
|
)
|
321
|
-
resp = Aws::Plugins::UserAgent.
|
341
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
322
342
|
@client.put_object_acl(options)
|
323
343
|
end
|
324
344
|
resp.data
|
@@ -28,7 +28,7 @@ module Aws
|
|
28
28
|
options[:bucket] = target_bucket
|
29
29
|
options[:key] = target_key
|
30
30
|
options[:copy_source] = copy_source(source)
|
31
|
-
Aws::Plugins::UserAgent.
|
31
|
+
Aws::Plugins::UserAgent.metric('S3_TRANSFER') do
|
32
32
|
if options.delete(:multipart_copy)
|
33
33
|
apply_source_client(source, options)
|
34
34
|
ObjectMultipartCopier.new(@options).copy(options)
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'thread'
|
4
|
-
require
|
4
|
+
require "cgi/escape"
|
5
|
+
require "cgi/util" if RUBY_VERSION < "3.5"
|
5
6
|
|
6
7
|
module Aws
|
7
8
|
module S3
|
@@ -15,18 +16,21 @@ module Aws
|
|
15
16
|
MAX_PARTS = 10_000
|
16
17
|
|
17
18
|
# @option options [Client] :client
|
18
|
-
# @option [Integer] :min_part_size (52428800)
|
19
|
-
# Defaults to 50MB.
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
19
|
+
# @option options [Integer] :min_part_size (52428800)
|
20
|
+
# Size of copied parts. Defaults to 50MB.
|
21
|
+
# @option options [Integer] :thread_count (10) Number of concurrent
|
22
|
+
# threads to use for copying parts.
|
23
|
+
# @option options [Boolean] :use_source_parts (false) Use part sizes
|
24
|
+
# defined on the source object if any exist. If copying or moving an
|
25
|
+
# object that is already multipart, this does not re-part the object,
|
26
|
+
# instead re-using the part definitions on the original. That means
|
27
|
+
# the etag and any checksums will not change. This is especially
|
28
|
+
# useful if the source object has parts with varied sizes.
|
23
29
|
def initialize(options = {})
|
30
|
+
@use_source_parts = options.delete(:use_source_parts) || false
|
24
31
|
@thread_count = options.delete(:thread_count) || 10
|
25
32
|
@min_part_size = options.delete(:min_part_size) || (FIVE_MB * 10)
|
26
33
|
@client = options[:client] || Client.new
|
27
|
-
if options[:checksum_algorithm]
|
28
|
-
raise ArgumentError, 'Multipart Copy does not support setting :checksum_algorithm'
|
29
|
-
end
|
30
34
|
end
|
31
35
|
|
32
36
|
# @return [Client]
|
@@ -78,10 +82,9 @@ module Aws
|
|
78
82
|
end
|
79
83
|
|
80
84
|
def copy_part(part)
|
81
|
-
{
|
82
|
-
|
83
|
-
|
84
|
-
}
|
85
|
+
@client.upload_part_copy(part).copy_part_result.to_h.merge({
|
86
|
+
part_number: part[:part_number]
|
87
|
+
}).tap { |result| result.delete(:last_modified) }
|
85
88
|
end
|
86
89
|
|
87
90
|
def complete_upload(parts, options)
|
@@ -104,28 +107,39 @@ module Aws
|
|
104
107
|
parts = []
|
105
108
|
options = options_for(:upload_part_copy, options)
|
106
109
|
while offset < size
|
110
|
+
part_size = calculate_part_size(part_number, default_part_size, options)
|
107
111
|
parts << options.merge({
|
108
112
|
part_number: part_number,
|
109
|
-
copy_source_range: byte_range(offset,
|
113
|
+
copy_source_range: byte_range(offset, part_size, size),
|
110
114
|
})
|
111
115
|
part_number += 1
|
112
|
-
offset +=
|
116
|
+
offset += part_size
|
113
117
|
end
|
114
118
|
parts
|
115
119
|
end
|
116
120
|
|
117
|
-
def byte_range(offset,
|
118
|
-
if offset +
|
119
|
-
"bytes=#{offset}-#{offset +
|
121
|
+
def byte_range(offset, part_size, size)
|
122
|
+
if offset + part_size < size
|
123
|
+
"bytes=#{offset}-#{offset + part_size - 1}"
|
120
124
|
else
|
121
125
|
"bytes=#{offset}-#{size - 1}"
|
122
126
|
end
|
123
127
|
end
|
124
128
|
|
125
|
-
def
|
126
|
-
if options
|
127
|
-
|
129
|
+
def calculate_part_size(part_number, default_part_size, options)
|
130
|
+
if @use_source_parts && source_has_parts(options)
|
131
|
+
source_metadata(options.merge({ part_number: part_number }))[:content_length]
|
132
|
+
else
|
133
|
+
default_part_size
|
128
134
|
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def source_has_parts(options)
|
138
|
+
@source_has_parts ||= source_metadata(options.merge({ part_number: 1 }))[:parts_count]
|
139
|
+
end
|
140
|
+
|
141
|
+
def source_metadata(options)
|
142
|
+
return options.slice(:content_length) if options[:content_length]
|
129
143
|
|
130
144
|
client = options[:copy_source_client] || @client
|
131
145
|
|
@@ -135,10 +149,15 @@ module Aws
|
|
135
149
|
bucket, key = options[:copy_source].match(/([^\/]+?)\/(.+)/)[1,2]
|
136
150
|
end
|
137
151
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
152
|
+
head_opts = { bucket: bucket, key: CGI.unescape(key) }.tap { |opts|
|
153
|
+
opts[:version_id] = version_id if version_id
|
154
|
+
opts[:part_number] = options[:part_number] if options[:part_number]
|
155
|
+
}
|
156
|
+
|
157
|
+
client.head_object(head_opts).to_h.tap { |head|
|
158
|
+
head.delete(:server_side_encryption)
|
159
|
+
head.delete(:ssekms_key_id)
|
160
|
+
}
|
142
161
|
end
|
143
162
|
|
144
163
|
def default_part_size(source_size)
|