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
@@ -6,80 +6,20 @@ module Aws
|
|
6
6
|
module S3
|
7
7
|
module Plugins
|
8
8
|
# @api private
|
9
|
-
# This plugin is
|
9
|
+
# This plugin is deprecated in favor of modeled
|
10
10
|
# httpChecksumRequired traits.
|
11
11
|
class Md5s < Seahorse::Client::Plugin
|
12
|
-
# These operations allow Content MD5 but are not required by
|
13
|
-
# httpChecksumRequired. This list should not grow.
|
14
|
-
OPTIONAL_OPERATIONS = [
|
15
|
-
:put_object,
|
16
|
-
:upload_part
|
17
|
-
]
|
18
|
-
|
19
|
-
# @api private
|
20
|
-
class Handler < Seahorse::Client::Handler
|
21
|
-
|
22
|
-
CHUNK_SIZE = 1 * 1024 * 1024 # one MB
|
23
|
-
|
24
|
-
def call(context)
|
25
|
-
if !context[:checksum_algorithms] # skip in favor of flexible checksum
|
26
|
-
body = context.http_request.body
|
27
|
-
if body.respond_to?(:size) && body.size > 0
|
28
|
-
context.http_request.headers['Content-Md5'] ||= md5(body)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
@handler.call(context)
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
# @param [File, Tempfile, IO#read, String] value
|
37
|
-
# @return [String<MD5>]
|
38
|
-
def md5(value)
|
39
|
-
if (File === value || Tempfile === value) && !value.path.nil? && File.exist?(value.path)
|
40
|
-
OpenSSL::Digest::MD5.file(value).base64digest
|
41
|
-
elsif value.respond_to?(:read)
|
42
|
-
md5 = OpenSSL::Digest::MD5.new
|
43
|
-
update_in_chunks(md5, value)
|
44
|
-
md5.base64digest
|
45
|
-
else
|
46
|
-
OpenSSL::Digest::MD5.digest(value).base64digest
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def update_in_chunks(digest, io)
|
51
|
-
loop do
|
52
|
-
chunk = io.read(CHUNK_SIZE)
|
53
|
-
break unless chunk
|
54
|
-
digest.update(chunk)
|
55
|
-
end
|
56
|
-
io.rewind
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
12
|
option(:compute_checksums,
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
def add_handlers(handlers, config)
|
73
|
-
if config.compute_checksums
|
74
|
-
# priority set low to ensure md5 is computed AFTER the request is
|
75
|
-
# built but before it is signed
|
76
|
-
handlers.add(
|
77
|
-
Handler,
|
78
|
-
priority: 10, step: :build, operations: OPTIONAL_OPERATIONS
|
79
|
-
)
|
80
|
-
end
|
13
|
+
default: true,
|
14
|
+
doc_type: 'Boolean',
|
15
|
+
docstring: <<~DOCS)
|
16
|
+
This option is deprecated. Please use `:request_checksum_calculation` instead.
|
17
|
+
When `false`, `request_checksum_calculation` is overridden to `when_required`.
|
18
|
+
DOCS
|
19
|
+
|
20
|
+
def after_initialize(client)
|
21
|
+
client.config.request_checksum_calculation = 'when_required' unless client.config.compute_checksums
|
81
22
|
end
|
82
|
-
|
83
23
|
end
|
84
24
|
end
|
85
25
|
end
|
@@ -4,6 +4,11 @@ require 'aws-sigv4'
|
|
4
4
|
|
5
5
|
module Aws
|
6
6
|
module S3
|
7
|
+
# @api private
|
8
|
+
def self.bucket_region_cache
|
9
|
+
@bucket_region_cache ||= BucketRegionCache.new
|
10
|
+
end
|
11
|
+
|
7
12
|
module Plugins
|
8
13
|
# This plugin used to have a V4 signer but it was removed in favor of
|
9
14
|
# generic Sign plugin that uses endpoint auth scheme.
|
@@ -51,7 +56,7 @@ module Aws
|
|
51
56
|
private
|
52
57
|
|
53
58
|
def check_for_cached_region(context, bucket)
|
54
|
-
cached_region = S3
|
59
|
+
cached_region = Aws::S3.bucket_region_cache[bucket]
|
55
60
|
if cached_region &&
|
56
61
|
cached_region != context.config.region &&
|
57
62
|
!S3Signer.custom_endpoint?(context)
|
@@ -97,7 +102,7 @@ module Aws
|
|
97
102
|
end
|
98
103
|
|
99
104
|
def update_bucket_cache(context, actual_region)
|
100
|
-
S3
|
105
|
+
Aws::S3.bucket_region_cache[context.params[:bucket]] = actual_region
|
101
106
|
end
|
102
107
|
|
103
108
|
def fips_region?(resp)
|
@@ -62,18 +62,16 @@ module Aws
|
|
62
62
|
class Handler < Seahorse::Client::Handler
|
63
63
|
|
64
64
|
def call(context)
|
65
|
-
target = context.params[:response_target] || context[:response_target]
|
66
|
-
|
67
65
|
# retry is only supported when range is NOT set on the initial request
|
68
|
-
if supported_target?(
|
69
|
-
add_event_listeners(context
|
66
|
+
if supported_target?(context) && !context.params[:range]
|
67
|
+
add_event_listeners(context)
|
70
68
|
end
|
71
69
|
@handler.call(context)
|
72
70
|
end
|
73
71
|
|
74
72
|
private
|
75
73
|
|
76
|
-
def add_event_listeners(context
|
74
|
+
def add_event_listeners(context)
|
77
75
|
context.http_response.on_headers(200..299) do
|
78
76
|
case context.http_response.body
|
79
77
|
when Seahorse::Client::BlockIO then
|
@@ -123,8 +121,8 @@ module Aws
|
|
123
121
|
context.http_response.body.is_a?(RetryableManagedFile)
|
124
122
|
end
|
125
123
|
|
126
|
-
def supported_target?(
|
127
|
-
case
|
124
|
+
def supported_target?(context)
|
125
|
+
case context[:response_target]
|
128
126
|
when Proc, String, Pathname then true
|
129
127
|
else false
|
130
128
|
end
|
@@ -315,26 +315,28 @@ module Aws
|
|
315
315
|
|
316
316
|
# @!group Fields
|
317
317
|
|
318
|
-
#
|
319
|
-
#
|
320
|
-
#
|
318
|
+
# @!method key(key)
|
319
|
+
# The key to use for the uploaded object. You can use `${filename}`
|
320
|
+
# as a variable in the key. This will be replaced with the name
|
321
|
+
# of the file as provided by the user.
|
321
322
|
#
|
322
|
-
#
|
323
|
-
#
|
324
|
-
#
|
323
|
+
# For example, if the key is given as `/user/betty/${filename}` and
|
324
|
+
# the file uploaded is named `lolcatz.jpg`, the resultant key will
|
325
|
+
# be `/user/betty/lolcatz.jpg`.
|
325
326
|
#
|
326
|
-
#
|
327
|
-
#
|
328
|
-
#
|
327
|
+
# @param [String] key
|
328
|
+
# @see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html)
|
329
|
+
# @return [self]
|
329
330
|
define_field(:key) do |key|
|
330
331
|
@key_set = true
|
331
332
|
with('key', key)
|
332
333
|
end
|
333
334
|
|
334
|
-
#
|
335
|
-
#
|
336
|
-
#
|
337
|
-
#
|
335
|
+
# @!method key_starts_with(prefix)
|
336
|
+
# Specify a prefix the uploaded
|
337
|
+
# @param [String] prefix
|
338
|
+
# @see #key
|
339
|
+
# @return [self]
|
338
340
|
define_field(:key_starts_with) do |prefix|
|
339
341
|
@key_set = true
|
340
342
|
starts_with('key', prefix)
|
@@ -412,26 +414,29 @@ module Aws
|
|
412
414
|
# @return [self]
|
413
415
|
define_field(:content_encoding, 'Content-Encoding', starts_with: true)
|
414
416
|
|
415
|
-
#
|
416
|
-
#
|
417
|
-
#
|
418
|
-
#
|
419
|
-
#
|
420
|
-
#
|
417
|
+
# @!method expires(time)
|
418
|
+
# The date and time at which the object is no longer cacheable.
|
419
|
+
# @note This does not affect the expiration of the presigned post
|
420
|
+
# signature.
|
421
|
+
# @param [Time] time
|
422
|
+
# @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21
|
423
|
+
# @return [self]
|
421
424
|
define_field(:expires) do |time|
|
422
425
|
with('Expires', time.httpdate)
|
423
426
|
end
|
424
427
|
|
425
|
-
#
|
426
|
-
#
|
427
|
-
#
|
428
|
+
# @!method expires_starts_with(prefix)
|
429
|
+
# @param [String] prefix
|
430
|
+
# @see #expires
|
431
|
+
# @return [self]
|
428
432
|
define_field(:expires_starts_with) do |prefix|
|
429
433
|
starts_with('Expires', prefix)
|
430
434
|
end
|
431
435
|
|
432
|
-
#
|
433
|
-
#
|
434
|
-
#
|
436
|
+
# @!method content_length_range(byte_range)
|
437
|
+
# The minimum and maximum allowable size for the uploaded content.
|
438
|
+
# @param [Range<Integer>] byte_range
|
439
|
+
# @return [self]
|
435
440
|
define_field(:content_length_range) do |byte_range|
|
436
441
|
min = byte_range.begin
|
437
442
|
max = byte_range.end
|
@@ -507,10 +512,11 @@ module Aws
|
|
507
512
|
# @return [self]
|
508
513
|
define_field(:website_redirect_location, 'x-amz-website-redirect-location')
|
509
514
|
|
510
|
-
#
|
511
|
-
#
|
512
|
-
#
|
513
|
-
#
|
515
|
+
# @!method metadata(hash)
|
516
|
+
# Metadata hash to store with the uploaded object. Hash keys will be
|
517
|
+
# prefixed with "x-amz-meta-".
|
518
|
+
# @param [Hash<String,String>] hash
|
519
|
+
# @return [self]
|
514
520
|
define_field(:metadata) do |hash|
|
515
521
|
hash.each do |key, value|
|
516
522
|
with("x-amz-meta-#{key}", value)
|
@@ -518,10 +524,11 @@ module Aws
|
|
518
524
|
self
|
519
525
|
end
|
520
526
|
|
521
|
-
#
|
522
|
-
#
|
523
|
-
#
|
524
|
-
#
|
527
|
+
# @!method metadata_starts_with(hash)
|
528
|
+
# Specify allowable prefix for each key in the metadata hash.
|
529
|
+
# @param [Hash<String,String>] hash
|
530
|
+
# @see #metadata
|
531
|
+
# @return [self]
|
525
532
|
define_field(:metadata_starts_with) do |hash|
|
526
533
|
hash.each do |key, value|
|
527
534
|
starts_with("x-amz-meta-#{key}", value)
|
@@ -571,24 +578,26 @@ module Aws
|
|
571
578
|
'x-amz-server-side-encryption-customer-algorithm'
|
572
579
|
)
|
573
580
|
|
574
|
-
#
|
575
|
-
#
|
576
|
-
#
|
581
|
+
# @!method server_side_encryption_customer_key(value)
|
582
|
+
# Specifies the customer-provided encryption key for Amazon S3 to use
|
583
|
+
# in encrypting data. This value is used to store the object and then
|
584
|
+
# it is discarded; Amazon does not store the encryption key.
|
577
585
|
#
|
578
|
-
#
|
586
|
+
# You must also call {#server_side_encryption_customer_algorithm}.
|
579
587
|
#
|
580
|
-
#
|
581
|
-
#
|
582
|
-
#
|
588
|
+
# @param [String] value
|
589
|
+
# @see #server_side_encryption_customer_algorithm
|
590
|
+
# @return [self]
|
583
591
|
define_field(:server_side_encryption_customer_key) do |value|
|
584
592
|
field_name = 'x-amz-server-side-encryption-customer-key'
|
585
593
|
with(field_name, base64(value))
|
586
594
|
with(field_name + '-MD5', base64(OpenSSL::Digest::MD5.digest(value)))
|
587
595
|
end
|
588
596
|
|
589
|
-
#
|
590
|
-
#
|
591
|
-
#
|
597
|
+
# @!method server_side_encryption_customer_key_starts_with(prefix)
|
598
|
+
# @param [String] prefix
|
599
|
+
# @see #server_side_encryption_customer_key
|
600
|
+
# @return [self]
|
592
601
|
define_field(:server_side_encryption_customer_key_starts_with) do |prefix|
|
593
602
|
field_name = 'x-amz-server-side-encryption-customer-key'
|
594
603
|
starts_with(field_name, prefix)
|
data/lib/aws-sdk-s3/presigner.rb
CHANGED
@@ -193,13 +193,14 @@ module Aws
|
|
193
193
|
req, expires_in, secure, time, unsigned_headers, hoist = true
|
194
194
|
)
|
195
195
|
x_amz_headers = {}
|
196
|
-
|
197
196
|
http_req = req.context.http_request
|
198
|
-
|
199
|
-
req.handlers.remove(Aws::S3::Plugins::S3Signer::LegacyHandler)
|
200
|
-
req.handlers.remove(Aws::Plugins::Sign::Handler)
|
201
197
|
req.handlers.remove(Seahorse::Client::Plugins::ContentLength::Handler)
|
202
|
-
|
198
|
+
req.handlers.remove(Aws::Rest::ContentTypeHandler)
|
199
|
+
req.handlers.remove(Aws::Plugins::ChecksumAlgorithm::OptionHandler)
|
200
|
+
req.handlers.remove(Aws::Plugins::ChecksumAlgorithm::ChecksumHandler)
|
201
|
+
req.handlers.remove(Aws::Plugins::InvocationId::Handler)
|
202
|
+
req.handlers.remove(Aws::Plugins::Sign::Handler)
|
203
|
+
req.handlers.remove(Aws::S3::Plugins::S3Signer::LegacyHandler)
|
203
204
|
req.handle(step: :send) do |context|
|
204
205
|
# if an endpoint was not provided, force secure or insecure
|
205
206
|
if context.config.regional_endpoint
|
@@ -232,10 +233,11 @@ module Aws
|
|
232
233
|
end
|
233
234
|
signer = Aws::Sigv4::Signer.new(
|
234
235
|
service: auth_scheme['signingName'] || 's3',
|
235
|
-
region: region || context.config.region,
|
236
|
-
credentials_provider: context.config.credentials,
|
236
|
+
region: context[:sigv4_region] || region || context.config.region,
|
237
|
+
credentials_provider: context[:sigv4_credentials] || context.config.credentials,
|
237
238
|
signing_algorithm: scheme_name.to_sym,
|
238
239
|
uri_escape_path: !!!auth_scheme['disableDoubleEncoding'],
|
240
|
+
normalize_path: !!!auth_scheme['disableNormalizePath'],
|
239
241
|
unsigned_headers: unsigned_headers,
|
240
242
|
apply_checksum_header: false
|
241
243
|
)
|
data/lib/aws-sdk-s3/resource.rb
CHANGED
@@ -41,7 +41,21 @@ module Aws::S3
|
|
41
41
|
# acl: "private", # accepts private, public-read, public-read-write, authenticated-read
|
42
42
|
# bucket: "BucketName", # required
|
43
43
|
# create_bucket_configuration: {
|
44
|
-
# location_constraint: "af-south-1", # accepts af-south-1, ap-east-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ca-central-1, cn-north-1, cn-northwest-1, EU, eu-central-1, eu-north-1, eu-south-1, eu-west-1, eu-west-2, eu-west-3, me-south-1, sa-east-1, us-east-2, us-gov-east-1, us-gov-west-1, us-west-1, us-west-2
|
44
|
+
# location_constraint: "af-south-1", # accepts af-south-1, ap-east-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-south-2, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, ap-southeast-5, ca-central-1, cn-north-1, cn-northwest-1, EU, eu-central-1, eu-central-2, eu-north-1, eu-south-1, eu-south-2, eu-west-1, eu-west-2, eu-west-3, il-central-1, me-central-1, me-south-1, sa-east-1, us-east-2, us-gov-east-1, us-gov-west-1, us-west-1, us-west-2
|
45
|
+
# location: {
|
46
|
+
# type: "AvailabilityZone", # accepts AvailabilityZone, LocalZone
|
47
|
+
# name: "LocationNameAsString",
|
48
|
+
# },
|
49
|
+
# bucket: {
|
50
|
+
# data_redundancy: "SingleAvailabilityZone", # accepts SingleAvailabilityZone, SingleLocalZone
|
51
|
+
# type: "Directory", # accepts Directory
|
52
|
+
# },
|
53
|
+
# tags: [
|
54
|
+
# {
|
55
|
+
# key: "ObjectKey", # required
|
56
|
+
# value: "Value", # required
|
57
|
+
# },
|
58
|
+
# ],
|
45
59
|
# },
|
46
60
|
# grant_full_control: "GrantFullControl",
|
47
61
|
# grant_read: "GrantRead",
|
@@ -54,47 +68,112 @@ module Aws::S3
|
|
54
68
|
# @param [Hash] options ({})
|
55
69
|
# @option options [String] :acl
|
56
70
|
# The canned ACL to apply to the bucket.
|
71
|
+
#
|
72
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
73
|
+
#
|
74
|
+
# </note>
|
57
75
|
# @option options [required, String] :bucket
|
58
76
|
# The name of the bucket to create.
|
77
|
+
#
|
78
|
+
# **General purpose buckets** - For information about bucket naming
|
79
|
+
# restrictions, see [Bucket naming rules][1] in the *Amazon S3 User
|
80
|
+
# Guide*.
|
81
|
+
#
|
82
|
+
# <b>Directory buckets </b> - When you use this operation with a
|
83
|
+
# directory bucket, you must use path-style requests in the format
|
84
|
+
# `https://s3express-control.region-code.amazonaws.com/bucket-name `.
|
85
|
+
# Virtual-hosted-style requests aren't supported. Directory bucket
|
86
|
+
# names must be unique in the chosen Zone (Availability Zone or Local
|
87
|
+
# Zone). Bucket names must also follow the format `
|
88
|
+
# bucket-base-name--zone-id--x-s3` (for example, `
|
89
|
+
# DOC-EXAMPLE-BUCKET--usw2-az1--x-s3`). For information about bucket
|
90
|
+
# naming restrictions, see [Directory bucket naming rules][2] in the
|
91
|
+
# *Amazon S3 User Guide*
|
92
|
+
#
|
93
|
+
#
|
94
|
+
#
|
95
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html
|
96
|
+
# [2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-bucket-naming-rules.html
|
59
97
|
# @option options [Types::CreateBucketConfiguration] :create_bucket_configuration
|
60
98
|
# The configuration information for the bucket.
|
61
99
|
# @option options [String] :grant_full_control
|
62
100
|
# Allows grantee the read, write, read ACP, and write ACP permissions on
|
63
101
|
# the bucket.
|
102
|
+
#
|
103
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
104
|
+
#
|
105
|
+
# </note>
|
64
106
|
# @option options [String] :grant_read
|
65
107
|
# Allows grantee to list the objects in the bucket.
|
108
|
+
#
|
109
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
110
|
+
#
|
111
|
+
# </note>
|
66
112
|
# @option options [String] :grant_read_acp
|
67
113
|
# Allows grantee to read the bucket ACL.
|
114
|
+
#
|
115
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
116
|
+
#
|
117
|
+
# </note>
|
68
118
|
# @option options [String] :grant_write
|
69
119
|
# Allows grantee to create new objects in the bucket.
|
70
120
|
#
|
71
121
|
# For the bucket and object owners of existing objects, also allows
|
72
122
|
# deletions and overwrites of those objects.
|
123
|
+
#
|
124
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
125
|
+
#
|
126
|
+
# </note>
|
73
127
|
# @option options [String] :grant_write_acp
|
74
128
|
# Allows grantee to write the ACL for the applicable bucket.
|
129
|
+
#
|
130
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
131
|
+
#
|
132
|
+
# </note>
|
75
133
|
# @option options [Boolean] :object_lock_enabled_for_bucket
|
76
134
|
# Specifies whether you want S3 Object Lock to be enabled for the new
|
77
135
|
# bucket.
|
136
|
+
#
|
137
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
138
|
+
#
|
139
|
+
# </note>
|
78
140
|
# @option options [String] :object_ownership
|
79
141
|
# The container element for object ownership for a bucket's ownership
|
80
142
|
# controls.
|
81
143
|
#
|
82
|
-
# BucketOwnerPreferred - Objects uploaded to the bucket change
|
83
|
-
# to the bucket owner if the objects are uploaded with the
|
144
|
+
# `BucketOwnerPreferred` - Objects uploaded to the bucket change
|
145
|
+
# ownership to the bucket owner if the objects are uploaded with the
|
84
146
|
# `bucket-owner-full-control` canned ACL.
|
85
147
|
#
|
86
|
-
# ObjectWriter - The uploading account will own the object if the
|
87
|
-
# is uploaded with the `bucket-owner-full-control` canned ACL.
|
148
|
+
# `ObjectWriter` - The uploading account will own the object if the
|
149
|
+
# object is uploaded with the `bucket-owner-full-control` canned ACL.
|
150
|
+
#
|
151
|
+
# `BucketOwnerEnforced` - Access control lists (ACLs) are disabled and
|
152
|
+
# no longer affect permissions. The bucket owner automatically owns and
|
153
|
+
# has full control over every object in the bucket. The bucket only
|
154
|
+
# accepts PUT requests that don't specify an ACL or specify bucket
|
155
|
+
# owner full control ACLs (such as the predefined
|
156
|
+
# `bucket-owner-full-control` canned ACL or a custom ACL in XML format
|
157
|
+
# that grants the same permissions).
|
158
|
+
#
|
159
|
+
# By default, `ObjectOwnership` is set to `BucketOwnerEnforced` and ACLs
|
160
|
+
# are disabled. We recommend keeping ACLs disabled, except in uncommon
|
161
|
+
# use cases where you must control access for each object individually.
|
162
|
+
# For more information about S3 Object Ownership, see [Controlling
|
163
|
+
# ownership of objects and disabling ACLs for your bucket][1] in the
|
164
|
+
# *Amazon S3 User Guide*.
|
165
|
+
#
|
166
|
+
# <note markdown="1"> This functionality is not supported for directory buckets. Directory
|
167
|
+
# buckets use the bucket owner enforced setting for S3 Object Ownership.
|
168
|
+
#
|
169
|
+
# </note>
|
170
|
+
#
|
88
171
|
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
# full control over every object in the bucket. The bucket only accepts
|
92
|
-
# PUT requests that don't specify an ACL or bucket owner full control
|
93
|
-
# ACLs, such as the `bucket-owner-full-control` canned ACL or an
|
94
|
-
# equivalent form of this ACL expressed in the XML format.
|
172
|
+
#
|
173
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html
|
95
174
|
# @return [Bucket]
|
96
175
|
def create_bucket(options = {})
|
97
|
-
Aws::Plugins::UserAgent.
|
176
|
+
Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
98
177
|
@client.create_bucket(options)
|
99
178
|
end
|
100
179
|
Bucket.new(
|
@@ -116,23 +195,49 @@ module Aws::S3
|
|
116
195
|
|
117
196
|
# @example Request syntax with placeholder values
|
118
197
|
#
|
119
|
-
# s3.buckets(
|
198
|
+
# buckets = s3.buckets({
|
199
|
+
# prefix: "Prefix",
|
200
|
+
# bucket_region: "BucketRegion",
|
201
|
+
# })
|
120
202
|
# @param [Hash] options ({})
|
203
|
+
# @option options [String] :prefix
|
204
|
+
# Limits the response to bucket names that begin with the specified
|
205
|
+
# bucket name prefix.
|
206
|
+
# @option options [String] :bucket_region
|
207
|
+
# Limits the response to buckets that are located in the specified
|
208
|
+
# Amazon Web Services Region. The Amazon Web Services Region must be
|
209
|
+
# expressed according to the Amazon Web Services Region code, such as
|
210
|
+
# `us-west-2` for the US West (Oregon) Region. For a list of the valid
|
211
|
+
# values for all of the Amazon Web Services Regions, see [Regions and
|
212
|
+
# Endpoints][1].
|
213
|
+
#
|
214
|
+
# <note markdown="1"> Requests made to a Regional endpoint that is different from the
|
215
|
+
# `bucket-region` parameter are not supported. For example, if you want
|
216
|
+
# to limit the response to your buckets in Region `us-west-2`, the
|
217
|
+
# request must be made to an endpoint in Region `us-west-2`.
|
218
|
+
#
|
219
|
+
# </note>
|
220
|
+
#
|
221
|
+
#
|
222
|
+
#
|
223
|
+
# [1]: https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
|
121
224
|
# @return [Bucket::Collection]
|
122
225
|
def buckets(options = {})
|
123
226
|
batches = Enumerator.new do |y|
|
124
|
-
|
125
|
-
resp = Aws::Plugins::UserAgent.feature('resource') do
|
227
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
126
228
|
@client.list_buckets(options)
|
127
229
|
end
|
128
|
-
resp.
|
129
|
-
batch
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
230
|
+
resp.each_page do |page|
|
231
|
+
batch = []
|
232
|
+
page.data.buckets.each do |b|
|
233
|
+
batch << Bucket.new(
|
234
|
+
name: b.name,
|
235
|
+
data: b,
|
236
|
+
client: @client
|
237
|
+
)
|
238
|
+
end
|
239
|
+
y.yield(batch)
|
134
240
|
end
|
135
|
-
y.yield(batch)
|
136
241
|
end
|
137
242
|
Bucket::Collection.new(batches)
|
138
243
|
end
|