aws-sdk-s3 1.122.0 → 1.157.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 +238 -0
- 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 +507 -114
- data/lib/aws-sdk-s3/bucket_acl.rb +18 -12
- data/lib/aws-sdk-s3/bucket_cors.rb +24 -16
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +24 -16
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +24 -16
- data/lib/aws-sdk-s3/bucket_logging.rb +25 -12
- data/lib/aws-sdk-s3/bucket_notification.rb +12 -6
- data/lib/aws-sdk-s3/bucket_policy.rb +70 -18
- data/lib/aws-sdk-s3/bucket_region_cache.rb +9 -5
- data/lib/aws-sdk-s3/bucket_request_payment.rb +18 -12
- data/lib/aws-sdk-s3/bucket_tagging.rb +24 -16
- data/lib/aws-sdk-s3/bucket_versioning.rb +42 -32
- data/lib/aws-sdk-s3/bucket_website.rb +24 -16
- data/lib/aws-sdk-s3/client.rb +6048 -2781
- data/lib/aws-sdk-s3/client_api.rb +148 -20
- data/lib/aws-sdk-s3/customizations/bucket.rb +3 -1
- data/lib/aws-sdk-s3/customizations/errors.rb +16 -3
- data/lib/aws-sdk-s3/customizations/object.rb +91 -18
- data/lib/aws-sdk-s3/customizations.rb +8 -0
- data/lib/aws-sdk-s3/encryption/client.rb +6 -2
- data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +13 -9
- data/lib/aws-sdk-s3/encryptionV2/client.rb +6 -2
- data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +1 -0
- data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +10 -6
- data/lib/aws-sdk-s3/endpoint_parameters.rb +44 -0
- data/lib/aws-sdk-s3/endpoint_provider.rb +111 -252
- data/lib/aws-sdk-s3/endpoints.rb +540 -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 +169 -44
- data/lib/aws-sdk-s3/file_uploader.rb +8 -6
- data/lib/aws-sdk-s3/multipart_file_uploader.rb +4 -4
- data/lib/aws-sdk-s3/multipart_stream_uploader.rb +10 -7
- data/lib/aws-sdk-s3/multipart_upload.rb +81 -20
- data/lib/aws-sdk-s3/multipart_upload_part.rb +169 -38
- data/lib/aws-sdk-s3/object.rb +1571 -261
- data/lib/aws-sdk-s3/object_acl.rb +38 -18
- data/lib/aws-sdk-s3/object_copier.rb +7 -5
- data/lib/aws-sdk-s3/object_multipart_copier.rb +42 -24
- data/lib/aws-sdk-s3/object_summary.rb +1422 -276
- data/lib/aws-sdk-s3/object_version.rb +344 -47
- data/lib/aws-sdk-s3/plugins/access_grants.rb +178 -0
- data/lib/aws-sdk-s3/plugins/endpoints.rb +14 -2
- data/lib/aws-sdk-s3/plugins/express_session_auth.rb +97 -0
- data/lib/aws-sdk-s3/plugins/http_200_errors.rb +53 -16
- 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/plugins/s3_signer.rb +7 -2
- data/lib/aws-sdk-s3/presigned_post.rb +52 -43
- data/lib/aws-sdk-s3/presigner.rb +8 -4
- data/lib/aws-sdk-s3/resource.rb +89 -13
- data/lib/aws-sdk-s3/types.rb +4879 -1513
- data/lib/aws-sdk-s3.rb +1 -1
- data/sig/bucket.rbs +212 -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 +111 -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 +2381 -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 +34 -0
- data/sig/multipart_upload.rbs +110 -0
- data/sig/multipart_upload_part.rbs +105 -0
- data/sig/object.rbs +442 -0
- data/sig/object_acl.rbs +86 -0
- data/sig/object_summary.rbs +334 -0
- data/sig/object_version.rbs +137 -0
- data/sig/resource.rbs +127 -0
- data/sig/types.rbs +2568 -0
- data/sig/waiters.rbs +95 -0
- metadata +43 -11
@@ -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]
|
@@ -75,10 +79,12 @@ module Aws::S3
|
|
75
79
|
#
|
76
80
|
# @return [self]
|
77
81
|
def load
|
78
|
-
resp =
|
82
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
83
|
+
@client.get_object_acl(
|
79
84
|
bucket: @bucket_name,
|
80
85
|
key: @object_key
|
81
86
|
)
|
87
|
+
end
|
82
88
|
@data = resp.data
|
83
89
|
self
|
84
90
|
end
|
@@ -193,7 +199,9 @@ module Aws::S3
|
|
193
199
|
:retry
|
194
200
|
end
|
195
201
|
end
|
196
|
-
Aws::
|
202
|
+
Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
203
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
204
|
+
end
|
197
205
|
end
|
198
206
|
|
199
207
|
# @!group Actions
|
@@ -257,12 +265,12 @@ module Aws::S3
|
|
257
265
|
# [1]: http://www.ietf.org/rfc/rfc1864.txt
|
258
266
|
# @option options [String] :checksum_algorithm
|
259
267
|
# Indicates the algorithm used to create the checksum for the object
|
260
|
-
# when
|
261
|
-
# functionality if
|
262
|
-
# must be a corresponding `x-amz-checksum` or `x-amz-trailer`
|
263
|
-
# sent. Otherwise, Amazon S3 fails the request with the HTTP
|
264
|
-
# `400 Bad Request`. For more information, see [Checking
|
265
|
-
# 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*.
|
266
274
|
#
|
267
275
|
# If you provide an individual checksum, Amazon S3 ignores any provided
|
268
276
|
# `ChecksumAlgorithm` parameter.
|
@@ -274,15 +282,15 @@ module Aws::S3
|
|
274
282
|
# Allows grantee the read, write, read ACP, and write ACP permissions on
|
275
283
|
# the bucket.
|
276
284
|
#
|
277
|
-
# This
|
285
|
+
# This functionality is not supported for Amazon S3 on Outposts.
|
278
286
|
# @option options [String] :grant_read
|
279
287
|
# Allows grantee to list the objects in the bucket.
|
280
288
|
#
|
281
|
-
# This
|
289
|
+
# This functionality is not supported for Amazon S3 on Outposts.
|
282
290
|
# @option options [String] :grant_read_acp
|
283
291
|
# Allows grantee to read the bucket ACL.
|
284
292
|
#
|
285
|
-
# This
|
293
|
+
# This functionality is not supported for Amazon S3 on Outposts.
|
286
294
|
# @option options [String] :grant_write
|
287
295
|
# Allows grantee to create new objects in the bucket.
|
288
296
|
#
|
@@ -291,30 +299,42 @@ module Aws::S3
|
|
291
299
|
# @option options [String] :grant_write_acp
|
292
300
|
# Allows grantee to write the ACL for the applicable bucket.
|
293
301
|
#
|
294
|
-
# This
|
302
|
+
# This functionality is not supported for Amazon S3 on Outposts.
|
295
303
|
# @option options [String] :request_payer
|
296
304
|
# Confirms that the requester knows that they will be charged for the
|
297
305
|
# request. Bucket owners need not specify this parameter in their
|
298
|
-
# 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
|
299
309
|
# Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
|
300
310
|
# in the *Amazon S3 User Guide*.
|
301
311
|
#
|
312
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
313
|
+
#
|
314
|
+
# </note>
|
315
|
+
#
|
302
316
|
#
|
303
317
|
#
|
304
318
|
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
305
319
|
# @option options [String] :version_id
|
306
|
-
#
|
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>
|
307
325
|
# @option options [String] :expected_bucket_owner
|
308
|
-
# The account ID of the expected bucket owner. If the
|
309
|
-
#
|
310
|
-
# 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).
|
311
329
|
# @return [Types::PutObjectAclOutput]
|
312
330
|
def put(options = {})
|
313
331
|
options = options.merge(
|
314
332
|
bucket: @bucket_name,
|
315
333
|
key: @object_key
|
316
334
|
)
|
317
|
-
resp =
|
335
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
336
|
+
@client.put_object_acl(options)
|
337
|
+
end
|
318
338
|
resp.data
|
319
339
|
end
|
320
340
|
|
@@ -28,11 +28,13 @@ module Aws
|
|
28
28
|
options[:bucket] = target_bucket
|
29
29
|
options[:key] = target_key
|
30
30
|
options[:copy_source] = copy_source(source)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
Aws::Plugins::UserAgent.metric('S3_TRANSFER') do
|
32
|
+
if options.delete(:multipart_copy)
|
33
|
+
apply_source_client(source, options)
|
34
|
+
ObjectMultipartCopier.new(@options).copy(options)
|
35
|
+
else
|
36
|
+
@object.client.copy_object(options)
|
37
|
+
end
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
@@ -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,28 +106,39 @@ 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
|
|
125
|
-
def
|
126
|
-
if options
|
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
|
128
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
|
+
|
140
|
+
def source_metadata(options)
|
141
|
+
return options.slice(:content_length) if options[:content_length]
|
129
142
|
|
130
143
|
client = options[:copy_source_client] || @client
|
131
144
|
|
@@ -135,10 +148,15 @@ module Aws
|
|
135
148
|
bucket, key = options[:copy_source].match(/([^\/]+?)\/(.+)/)[1,2]
|
136
149
|
end
|
137
150
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
151
|
+
head_opts = { bucket: bucket, key: CGI.unescape(key) }.tap { |opts|
|
152
|
+
opts[:version_id] = version_id if version_id
|
153
|
+
opts[:part_number] = options[:part_number] if options[:part_number]
|
154
|
+
}
|
155
|
+
|
156
|
+
client.head_object(head_opts).to_h.tap { |head|
|
157
|
+
head.delete(:server_side_encryption)
|
158
|
+
head.delete(:ssekms_key_id)
|
159
|
+
}
|
142
160
|
end
|
143
161
|
|
144
162
|
def default_part_size(source_size)
|