aws-sdk-s3 1.147.0 → 1.163.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +103 -2
- 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 +209 -69
- data/lib/aws-sdk-s3/bucket_acl.rb +3 -3
- data/lib/aws-sdk-s3/bucket_cors.rb +4 -4
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +4 -4
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +4 -4
- data/lib/aws-sdk-s3/bucket_logging.rb +3 -3
- data/lib/aws-sdk-s3/bucket_notification.rb +3 -3
- data/lib/aws-sdk-s3/bucket_policy.rb +4 -4
- data/lib/aws-sdk-s3/bucket_region_cache.rb +9 -5
- data/lib/aws-sdk-s3/bucket_request_payment.rb +3 -3
- data/lib/aws-sdk-s3/bucket_tagging.rb +4 -4
- data/lib/aws-sdk-s3/bucket_versioning.rb +5 -5
- data/lib/aws-sdk-s3/bucket_website.rb +4 -4
- data/lib/aws-sdk-s3/client.rb +1653 -637
- data/lib/aws-sdk-s3/client_api.rb +35 -3
- data/lib/aws-sdk-s3/customizations/bucket.rb +1 -1
- data/lib/aws-sdk-s3/customizations/errors.rb +15 -2
- data/lib/aws-sdk-s3/customizations/object.rb +5 -5
- data/lib/aws-sdk-s3/customizations.rb +4 -1
- 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 +8 -0
- data/lib/aws-sdk-s3/endpoint_provider.rb +1 -0
- data/lib/aws-sdk-s3/endpoints.rb +199 -397
- data/lib/aws-sdk-s3/express_credentials_provider.rb +27 -4
- data/lib/aws-sdk-s3/file_downloader.rb +1 -1
- data/lib/aws-sdk-s3/file_uploader.rb +1 -1
- data/lib/aws-sdk-s3/multipart_stream_uploader.rb +1 -1
- data/lib/aws-sdk-s3/multipart_upload.rb +24 -4
- data/lib/aws-sdk-s3/multipart_upload_part.rb +3 -3
- data/lib/aws-sdk-s3/object.rb +394 -137
- data/lib/aws-sdk-s3/object_acl.rb +3 -3
- data/lib/aws-sdk-s3/object_copier.rb +1 -1
- data/lib/aws-sdk-s3/object_multipart_copier.rb +10 -8
- data/lib/aws-sdk-s3/object_summary.rb +358 -115
- data/lib/aws-sdk-s3/object_version.rb +46 -9
- data/lib/aws-sdk-s3/plugins/access_grants.rb +178 -0
- data/lib/aws-sdk-s3/plugins/endpoints.rb +10 -1
- data/lib/aws-sdk-s3/plugins/express_session_auth.rb +8 -2
- data/lib/aws-sdk-s3/plugins/http_200_errors.rb +53 -16
- data/lib/aws-sdk-s3/plugins/s3_signer.rb +7 -2
- data/lib/aws-sdk-s3/presigner.rb +1 -0
- data/lib/aws-sdk-s3/resource.rb +12 -10
- data/lib/aws-sdk-s3/types.rb +966 -350
- data/lib/aws-sdk-s3.rb +1 -1
- data/sig/bucket.rbs +1 -0
- data/sig/client.rbs +38 -2
- data/sig/customizations/bucket.rbs +19 -0
- data/sig/customizations/object.rbs +38 -0
- data/sig/customizations/object_summary.rbs +35 -0
- data/sig/multipart_upload.rbs +1 -0
- data/sig/object.rbs +7 -0
- data/sig/object_summary.rbs +1 -0
- data/sig/object_version.rbs +6 -0
- data/sig/resource.rbs +6 -1
- data/sig/types.rbs +25 -2
- data/sig/waiters.rbs +12 -0
- metadata +12 -7
- data/lib/aws-sdk-s3/express_credentials_cache.rb +0 -30
@@ -2,30 +2,53 @@
|
|
2
2
|
|
3
3
|
module Aws
|
4
4
|
module S3
|
5
|
+
# @api private
|
6
|
+
def self.express_credentials_cache
|
7
|
+
@express_credentials_cache ||= LRUCache.new(max_entries: 100)
|
8
|
+
end
|
9
|
+
|
5
10
|
# Returns Credentials class for S3 Express. Accepts CreateSession
|
6
11
|
# params as options. See {Client#create_session} for details.
|
7
12
|
class ExpressCredentialsProvider
|
8
13
|
# @param [Hash] options
|
9
|
-
# @option options [Client] :client The S3 client used to create the
|
14
|
+
# @option options [Client] :client The S3 client used to create the
|
15
|
+
# session.
|
10
16
|
# @option options [String] :session_mode (see: {Client#create_session})
|
17
|
+
# @option options [Boolean] :caching (true) When true, credentials will
|
18
|
+
# be cached.
|
11
19
|
# @option options [Callable] :before_refresh Proc called before
|
12
20
|
# credentials are refreshed.
|
13
21
|
def initialize(options = {})
|
14
22
|
@client = options.delete(:client)
|
23
|
+
@caching = options.delete(:caching) != false
|
15
24
|
@options = options
|
16
|
-
|
25
|
+
return unless @caching
|
26
|
+
|
27
|
+
@cache = Aws::S3.express_credentials_cache
|
17
28
|
end
|
18
29
|
|
19
30
|
def express_credentials_for(bucket)
|
20
|
-
@
|
31
|
+
if @caching
|
32
|
+
cached_credentials_for(bucket)
|
33
|
+
else
|
34
|
+
new_credentials_for(bucket)
|
35
|
+
end
|
21
36
|
end
|
22
37
|
|
23
38
|
attr_accessor :client
|
24
39
|
|
25
40
|
private
|
26
41
|
|
42
|
+
def cached_credentials_for(bucket)
|
43
|
+
if @cache.key?(bucket)
|
44
|
+
@cache[bucket]
|
45
|
+
else
|
46
|
+
@cache[bucket] = new_credentials_for(bucket)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
27
50
|
def new_credentials_for(bucket)
|
28
|
-
|
51
|
+
ExpressCredentials.new(
|
29
52
|
bucket: bucket,
|
30
53
|
client: @client,
|
31
54
|
**@options
|
@@ -37,7 +37,7 @@ module Aws
|
|
37
37
|
# objects smaller than the multipart threshold.
|
38
38
|
# @return [void]
|
39
39
|
def upload(source, options = {})
|
40
|
-
Aws::Plugins::UserAgent.
|
40
|
+
Aws::Plugins::UserAgent.metric('S3_TRANSFER') do
|
41
41
|
if File.size(source) >= multipart_threshold
|
42
42
|
MultipartFileUploader.new(@options).upload(source, options)
|
43
43
|
else
|
@@ -46,7 +46,7 @@ module Aws
|
|
46
46
|
# @option options [Integer] :thread_count (THREAD_COUNT)
|
47
47
|
# @return [Seahorse::Client::Response] - the CompleteMultipartUploadResponse
|
48
48
|
def upload(options = {}, &block)
|
49
|
-
Aws::Plugins::UserAgent.
|
49
|
+
Aws::Plugins::UserAgent.metric('S3_TRANSFER') do
|
50
50
|
upload_id = initiate_upload(options)
|
51
51
|
parts = upload_parts(upload_id, options, &block)
|
52
52
|
complete_upload(upload_id, parts, options)
|
@@ -227,7 +227,7 @@ module Aws::S3
|
|
227
227
|
:retry
|
228
228
|
end
|
229
229
|
end
|
230
|
-
Aws::Plugins::UserAgent.
|
230
|
+
Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
231
231
|
Aws::Waiters::Waiter.new(options).wait({})
|
232
232
|
end
|
233
233
|
end
|
@@ -268,7 +268,7 @@ module Aws::S3
|
|
268
268
|
key: @object_key,
|
269
269
|
upload_id: @id
|
270
270
|
)
|
271
|
-
resp = Aws::Plugins::UserAgent.
|
271
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
272
272
|
@client.abort_multipart_upload(options)
|
273
273
|
end
|
274
274
|
resp.data
|
@@ -295,6 +295,7 @@ module Aws::S3
|
|
295
295
|
# checksum_sha256: "ChecksumSHA256",
|
296
296
|
# request_payer: "requester", # accepts requester
|
297
297
|
# expected_bucket_owner: "AccountId",
|
298
|
+
# if_none_match: "IfNoneMatch",
|
298
299
|
# sse_customer_algorithm: "SSECustomerAlgorithm",
|
299
300
|
# sse_customer_key: "SSECustomerKey",
|
300
301
|
# sse_customer_key_md5: "SSECustomerKeyMD5",
|
@@ -362,6 +363,25 @@ module Aws::S3
|
|
362
363
|
# The account ID of the expected bucket owner. If the account ID that
|
363
364
|
# you provide does not match the actual owner of the bucket, the request
|
364
365
|
# fails with the HTTP status code `403 Forbidden` (access denied).
|
366
|
+
# @option options [String] :if_none_match
|
367
|
+
# Uploads the object only if the object key name does not already exist
|
368
|
+
# in the bucket specified. Otherwise, Amazon S3 returns a `412
|
369
|
+
# Precondition Failed` error.
|
370
|
+
#
|
371
|
+
# If a conflicting operation occurs during the upload S3 returns a `409
|
372
|
+
# ConditionalRequestConflict` response. On a 409 failure you should
|
373
|
+
# re-initiate the multipart upload with `CreateMultipartUpload` and
|
374
|
+
# re-upload each part.
|
375
|
+
#
|
376
|
+
# Expects the '*' (asterisk) character.
|
377
|
+
#
|
378
|
+
# For more information about conditional requests, see [RFC 7232][1], or
|
379
|
+
# [Conditional requests][2] in the *Amazon S3 User Guide*.
|
380
|
+
#
|
381
|
+
#
|
382
|
+
#
|
383
|
+
# [1]: https://tools.ietf.org/html/rfc7232
|
384
|
+
# [2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/conditional-requests.html
|
365
385
|
# @option options [String] :sse_customer_algorithm
|
366
386
|
# The server-side encryption (SSE) algorithm used to encrypt the object.
|
367
387
|
# This parameter is required only when the object was created using a
|
@@ -409,7 +429,7 @@ module Aws::S3
|
|
409
429
|
key: @object_key,
|
410
430
|
upload_id: @id
|
411
431
|
)
|
412
|
-
Aws::Plugins::UserAgent.
|
432
|
+
Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
413
433
|
@client.complete_multipart_upload(options)
|
414
434
|
end
|
415
435
|
Object.new(
|
@@ -519,7 +539,7 @@ module Aws::S3
|
|
519
539
|
key: @object_key,
|
520
540
|
upload_id: @id
|
521
541
|
)
|
522
|
-
resp = Aws::Plugins::UserAgent.
|
542
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
523
543
|
@client.list_parts(options)
|
524
544
|
end
|
525
545
|
resp.each_page do |page|
|
@@ -262,7 +262,7 @@ module Aws::S3
|
|
262
262
|
:retry
|
263
263
|
end
|
264
264
|
end
|
265
|
-
Aws::Plugins::UserAgent.
|
265
|
+
Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
266
266
|
Aws::Waiters::Waiter.new(options).wait({})
|
267
267
|
end
|
268
268
|
end
|
@@ -500,7 +500,7 @@ module Aws::S3
|
|
500
500
|
upload_id: @multipart_upload_id,
|
501
501
|
part_number: @part_number
|
502
502
|
)
|
503
|
-
resp = Aws::Plugins::UserAgent.
|
503
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
504
504
|
@client.upload_part_copy(options)
|
505
505
|
end
|
506
506
|
resp.data
|
@@ -650,7 +650,7 @@ module Aws::S3
|
|
650
650
|
upload_id: @multipart_upload_id,
|
651
651
|
part_number: @part_number
|
652
652
|
)
|
653
|
-
resp = Aws::Plugins::UserAgent.
|
653
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
654
654
|
@client.upload_part(options)
|
655
655
|
end
|
656
656
|
resp.data
|