aws-sdk-s3 1.151.0 → 1.208.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 +352 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-s3/access_grants_credentials_provider.rb +12 -3
- data/lib/aws-sdk-s3/bucket.rb +358 -109
- data/lib/aws-sdk-s3/bucket_acl.rb +10 -9
- data/lib/aws-sdk-s3/bucket_cors.rb +10 -9
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +11 -6
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +64 -7
- data/lib/aws-sdk-s3/bucket_logging.rb +5 -5
- data/lib/aws-sdk-s3/bucket_notification.rb +3 -3
- data/lib/aws-sdk-s3/bucket_policy.rb +14 -13
- data/lib/aws-sdk-s3/bucket_request_payment.rb +6 -6
- data/lib/aws-sdk-s3/bucket_tagging.rb +7 -7
- data/lib/aws-sdk-s3/bucket_versioning.rb +47 -14
- data/lib/aws-sdk-s3/bucket_website.rb +7 -7
- data/lib/aws-sdk-s3/client.rb +5530 -2075
- data/lib/aws-sdk-s3/client_api.rb +660 -162
- data/lib/aws-sdk-s3/customizations/bucket.rb +1 -1
- data/lib/aws-sdk-s3/customizations/object.rb +87 -91
- 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 +28 -39
- data/lib/aws-sdk-s3/default_executor.rb +103 -0
- data/lib/aws-sdk-s3/encryption/client.rb +4 -4
- data/lib/aws-sdk-s3/encryption/default_cipher_provider.rb +2 -0
- data/lib/aws-sdk-s3/encryption/encrypt_handler.rb +2 -0
- data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +4 -2
- data/lib/aws-sdk-s3/encryptionV2/client.rb +100 -25
- data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +7 -162
- data/lib/aws-sdk-s3/encryptionV2/decryption.rb +205 -0
- data/lib/aws-sdk-s3/encryptionV2/default_cipher_provider.rb +17 -0
- data/lib/aws-sdk-s3/encryptionV2/encrypt_handler.rb +2 -0
- data/lib/aws-sdk-s3/encryptionV2/io_encrypter.rb +2 -0
- data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +10 -2
- data/lib/aws-sdk-s3/encryptionV2/utils.rb +5 -0
- data/lib/aws-sdk-s3/encryptionV3/client.rb +885 -0
- data/lib/aws-sdk-s3/encryptionV3/decrypt_handler.rb +98 -0
- data/lib/aws-sdk-s3/encryptionV3/decryption.rb +244 -0
- data/lib/aws-sdk-s3/encryptionV3/default_cipher_provider.rb +159 -0
- data/lib/aws-sdk-s3/encryptionV3/default_key_provider.rb +35 -0
- data/lib/aws-sdk-s3/encryptionV3/encrypt_handler.rb +98 -0
- data/lib/aws-sdk-s3/encryptionV3/errors.rb +47 -0
- data/lib/aws-sdk-s3/encryptionV3/io_auth_decrypter.rb +60 -0
- data/lib/aws-sdk-s3/encryptionV3/io_decrypter.rb +35 -0
- data/lib/aws-sdk-s3/encryptionV3/io_encrypter.rb +84 -0
- data/lib/aws-sdk-s3/encryptionV3/key_provider.rb +28 -0
- data/lib/aws-sdk-s3/encryptionV3/kms_cipher_provider.rb +159 -0
- data/lib/aws-sdk-s3/encryptionV3/materials.rb +58 -0
- data/lib/aws-sdk-s3/encryptionV3/utils.rb +321 -0
- data/lib/aws-sdk-s3/encryption_v2.rb +1 -0
- data/lib/aws-sdk-s3/encryption_v3.rb +24 -0
- data/lib/aws-sdk-s3/endpoint_parameters.rb +37 -34
- data/lib/aws-sdk-s3/endpoint_provider.rb +572 -277
- data/lib/aws-sdk-s3/endpoints.rb +566 -1612
- data/lib/aws-sdk-s3/errors.rb +58 -0
- data/lib/aws-sdk-s3/file_downloader.rb +192 -146
- data/lib/aws-sdk-s3/file_uploader.rb +10 -14
- 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 +105 -102
- data/lib/aws-sdk-s3/multipart_stream_uploader.rb +97 -108
- data/lib/aws-sdk-s3/multipart_upload.rb +112 -12
- data/lib/aws-sdk-s3/multipart_upload_error.rb +3 -4
- data/lib/aws-sdk-s3/multipart_upload_part.rb +55 -39
- data/lib/aws-sdk-s3/object.rb +713 -227
- data/lib/aws-sdk-s3/object_acl.rb +15 -9
- data/lib/aws-sdk-s3/object_copier.rb +1 -1
- data/lib/aws-sdk-s3/object_multipart_copier.rb +2 -1
- data/lib/aws-sdk-s3/object_summary.rb +592 -173
- data/lib/aws-sdk-s3/object_version.rb +102 -17
- data/lib/aws-sdk-s3/plugins/access_grants.rb +75 -5
- data/lib/aws-sdk-s3/plugins/checksum_algorithm.rb +31 -0
- data/lib/aws-sdk-s3/plugins/endpoints.rb +25 -213
- data/lib/aws-sdk-s3/plugins/express_session_auth.rb +18 -21
- data/lib/aws-sdk-s3/plugins/http_200_errors.rb +55 -18
- data/lib/aws-sdk-s3/plugins/md5s.rb +10 -71
- 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/presigner.rb +5 -5
- data/lib/aws-sdk-s3/resource.rb +53 -20
- data/lib/aws-sdk-s3/transfer_manager.rb +303 -0
- data/lib/aws-sdk-s3/types.rb +4705 -1528
- data/lib/aws-sdk-s3.rb +35 -31
- data/sig/bucket.rbs +28 -9
- data/sig/bucket_acl.rbs +1 -1
- data/sig/bucket_cors.rbs +1 -1
- data/sig/bucket_lifecycle.rbs +1 -1
- data/sig/bucket_lifecycle_configuration.rbs +8 -4
- data/sig/bucket_logging.rbs +1 -1
- data/sig/bucket_policy.rbs +1 -1
- data/sig/bucket_request_payment.rbs +1 -1
- data/sig/bucket_tagging.rbs +1 -1
- data/sig/bucket_versioning.rbs +3 -3
- data/sig/bucket_website.rbs +1 -1
- data/sig/client.rbs +322 -72
- data/sig/errors.rbs +10 -0
- data/sig/multipart_upload.rbs +13 -3
- data/sig/multipart_upload_part.rbs +5 -1
- data/sig/object.rbs +44 -16
- data/sig/object_acl.rbs +1 -1
- data/sig/object_summary.rbs +29 -16
- data/sig/object_version.rbs +15 -3
- data/sig/resource.rbs +20 -5
- data/sig/types.rbs +403 -66
- data/sig/waiters.rbs +12 -0
- metadata +29 -12
- data/lib/aws-sdk-s3/plugins/skip_whole_multipart_get_checksums.rb +0 -31
|
@@ -29,33 +29,30 @@ for different buckets.
|
|
|
29
29
|
# @api private
|
|
30
30
|
class Handler < Seahorse::Client::Handler
|
|
31
31
|
def call(context)
|
|
32
|
-
if (
|
|
33
|
-
# S3 Express endpoint - turn off md5 and enable crc32 default
|
|
34
|
-
if props['backend'] == 'S3Express'
|
|
35
|
-
if context.operation_name == :put_object || checksum_required?(context)
|
|
36
|
-
context[:default_request_checksum_algorithm] = 'CRC32'
|
|
37
|
-
end
|
|
38
|
-
context[:s3_express_endpoint] = true
|
|
39
|
-
end
|
|
32
|
+
context[:s3_express_endpoint] = true if s3_express_endpoint?(context)
|
|
40
33
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
end
|
|
34
|
+
# if s3 express auth, use new credentials and sign additional header
|
|
35
|
+
if context[:auth_scheme]['name'] == 'sigv4-s3express' &&
|
|
36
|
+
!context.config.disable_s3_express_session_auth
|
|
37
|
+
bucket = context.params[:bucket]
|
|
38
|
+
credentials_provider = context.config.express_credentials_provider
|
|
39
|
+
credentials = credentials_provider.express_credentials_for(bucket)
|
|
40
|
+
context[:sigv4_credentials] = credentials # Sign will use this
|
|
49
41
|
end
|
|
50
|
-
|
|
42
|
+
|
|
43
|
+
with_metric(credentials) { @handler.call(context) }
|
|
51
44
|
end
|
|
52
45
|
|
|
53
46
|
private
|
|
54
47
|
|
|
55
|
-
def
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
def with_metric(credentials, &block)
|
|
49
|
+
return block.call unless credentials
|
|
50
|
+
|
|
51
|
+
Aws::Plugins::UserAgent.metric('S3_EXPRESS_BUCKET', &block)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def s3_express_endpoint?(context)
|
|
55
|
+
context[:endpoint_properties]['backend'] == 'S3Express'
|
|
59
56
|
end
|
|
60
57
|
end
|
|
61
58
|
|
|
@@ -15,22 +15,67 @@ module Aws
|
|
|
15
15
|
|
|
16
16
|
def call(context)
|
|
17
17
|
@handler.call(context).on(200) do |response|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
return response if streaming_output?(context.operation.output)
|
|
19
|
+
|
|
20
|
+
error = check_for_error(context)
|
|
21
|
+
return response unless error
|
|
22
|
+
|
|
23
|
+
context.http_response.status_code = 500
|
|
24
|
+
response.data = nil
|
|
25
|
+
response.error = error
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
# Streaming outputs are not subject to 200 errors.
|
|
32
|
+
def streaming_output?(output)
|
|
33
|
+
if (payload = output[:payload_member])
|
|
34
|
+
# checking ref and shape
|
|
35
|
+
payload['streaming'] || payload.shape['streaming'] ||
|
|
36
|
+
payload.eventstream
|
|
37
|
+
else
|
|
38
|
+
false
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Checks if the output shape is a structure shape and has members that
|
|
43
|
+
# are in the body for the case of a payload and a normal structure. A
|
|
44
|
+
# non-structure shape will not have members in the body. In the case
|
|
45
|
+
# of a string or blob, the body contents would have been checked first
|
|
46
|
+
# before this method is called in incomplete_xml_body?.
|
|
47
|
+
def members_in_body?(output)
|
|
48
|
+
shape =
|
|
49
|
+
if output[:payload_member]
|
|
50
|
+
output[:payload_member].shape
|
|
51
|
+
else
|
|
52
|
+
output.shape
|
|
22
53
|
end
|
|
54
|
+
|
|
55
|
+
if structure_shape?(shape)
|
|
56
|
+
shape.members.any? { |_, k| k.location.nil? }
|
|
57
|
+
else
|
|
58
|
+
false
|
|
23
59
|
end
|
|
24
60
|
end
|
|
25
61
|
|
|
62
|
+
def structure_shape?(shape)
|
|
63
|
+
shape.is_a?(Seahorse::Model::Shapes::StructureShape)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Must have a member in the body and have the start of an XML Tag.
|
|
67
|
+
# Other incomplete xml bodies will result in an XML ParsingError.
|
|
68
|
+
def incomplete_xml_body?(xml, output)
|
|
69
|
+
members_in_body?(output) && !xml.match(/<\w/)
|
|
70
|
+
end
|
|
71
|
+
|
|
26
72
|
def check_for_error(context)
|
|
27
73
|
xml = context.http_response.body_contents
|
|
28
|
-
if xml.match(
|
|
29
|
-
error_code = xml.match(
|
|
30
|
-
error_message = xml.match(
|
|
74
|
+
if xml.match(/<\?xml\s[^>]*\?>\s*<Error>/)
|
|
75
|
+
error_code = xml.match(%r{<Code>(.+?)</Code>})[1]
|
|
76
|
+
error_message = xml.match(%r{<Message>(.+?)</Message>})[1]
|
|
31
77
|
S3::Errors.error_class(error_code).new(context, error_message)
|
|
32
|
-
elsif
|
|
33
|
-
# Other incomplete xml bodies will result in XML ParsingError
|
|
78
|
+
elsif incomplete_xml_body?(xml, context.operation.output)
|
|
34
79
|
Seahorse::Client::NetworkingError.new(
|
|
35
80
|
S3::Errors
|
|
36
81
|
.error_class('InternalError')
|
|
@@ -40,15 +85,7 @@ module Aws
|
|
|
40
85
|
end
|
|
41
86
|
end
|
|
42
87
|
|
|
43
|
-
handler(
|
|
44
|
-
Handler,
|
|
45
|
-
step: :sign,
|
|
46
|
-
operations: [
|
|
47
|
-
:complete_multipart_upload,
|
|
48
|
-
:copy_object,
|
|
49
|
-
:upload_part_copy,
|
|
50
|
-
]
|
|
51
|
-
)
|
|
88
|
+
handler(Handler, step: :sign)
|
|
52
89
|
end
|
|
53
90
|
end
|
|
54
91
|
end
|
|
@@ -6,81 +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
|
-
!context[:s3_express_endpoint] # s3 express endpoints do not support md5
|
|
27
|
-
body = context.http_request.body
|
|
28
|
-
if body.respond_to?(:size) && body.size > 0
|
|
29
|
-
context.http_request.headers['Content-Md5'] ||= md5(body)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
@handler.call(context)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
private
|
|
36
|
-
|
|
37
|
-
# @param [File, Tempfile, IO#read, String] value
|
|
38
|
-
# @return [String<MD5>]
|
|
39
|
-
def md5(value)
|
|
40
|
-
if (File === value || Tempfile === value) && !value.path.nil? && File.exist?(value.path)
|
|
41
|
-
OpenSSL::Digest::MD5.file(value).base64digest
|
|
42
|
-
elsif value.respond_to?(:read)
|
|
43
|
-
md5 = OpenSSL::Digest::MD5.new
|
|
44
|
-
update_in_chunks(md5, value)
|
|
45
|
-
md5.base64digest
|
|
46
|
-
else
|
|
47
|
-
OpenSSL::Digest::MD5.digest(value).base64digest
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def update_in_chunks(digest, io)
|
|
52
|
-
loop do
|
|
53
|
-
chunk = io.read(CHUNK_SIZE)
|
|
54
|
-
break unless chunk
|
|
55
|
-
digest.update(chunk)
|
|
56
|
-
end
|
|
57
|
-
io.rewind
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
end
|
|
61
|
-
|
|
62
12
|
option(:compute_checksums,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def add_handlers(handlers, config)
|
|
74
|
-
if config.compute_checksums
|
|
75
|
-
# priority set low to ensure md5 is computed AFTER the request is
|
|
76
|
-
# built but before it is signed
|
|
77
|
-
handlers.add(
|
|
78
|
-
Handler,
|
|
79
|
-
priority: 10, step: :build, operations: OPTIONAL_OPERATIONS
|
|
80
|
-
)
|
|
81
|
-
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
|
|
82
22
|
end
|
|
83
|
-
|
|
84
23
|
end
|
|
85
24
|
end
|
|
86
25
|
end
|
|
@@ -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
|
data/lib/aws-sdk-s3/presigner.rb
CHANGED
|
@@ -193,15 +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)
|
|
203
201
|
req.handlers.remove(Aws::Plugins::InvocationId::Handler)
|
|
204
|
-
|
|
202
|
+
req.handlers.remove(Aws::Plugins::Sign::Handler)
|
|
203
|
+
req.handlers.remove(Aws::S3::Plugins::S3Signer::LegacyHandler)
|
|
205
204
|
req.handle(step: :send) do |context|
|
|
206
205
|
# if an endpoint was not provided, force secure or insecure
|
|
207
206
|
if context.config.regional_endpoint
|
|
@@ -238,6 +237,7 @@ module Aws
|
|
|
238
237
|
credentials_provider: context[:sigv4_credentials] || context.config.credentials,
|
|
239
238
|
signing_algorithm: scheme_name.to_sym,
|
|
240
239
|
uri_escape_path: !!!auth_scheme['disableDoubleEncoding'],
|
|
240
|
+
normalize_path: !!!auth_scheme['disableNormalizePath'],
|
|
241
241
|
unsigned_headers: unsigned_headers,
|
|
242
242
|
apply_checksum_header: false
|
|
243
243
|
)
|
data/lib/aws-sdk-s3/resource.rb
CHANGED
|
@@ -41,15 +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-south-2, 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-south-2, 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
45
|
# location: {
|
|
46
|
-
# type: "AvailabilityZone", # accepts AvailabilityZone
|
|
46
|
+
# type: "AvailabilityZone", # accepts AvailabilityZone, LocalZone
|
|
47
47
|
# name: "LocationNameAsString",
|
|
48
48
|
# },
|
|
49
49
|
# bucket: {
|
|
50
|
-
# data_redundancy: "SingleAvailabilityZone", # accepts SingleAvailabilityZone
|
|
50
|
+
# data_redundancy: "SingleAvailabilityZone", # accepts SingleAvailabilityZone, SingleLocalZone
|
|
51
51
|
# type: "Directory", # accepts Directory
|
|
52
52
|
# },
|
|
53
|
+
# tags: [
|
|
54
|
+
# {
|
|
55
|
+
# key: "ObjectKey", # required
|
|
56
|
+
# value: "Value", # required
|
|
57
|
+
# },
|
|
58
|
+
# ],
|
|
53
59
|
# },
|
|
54
60
|
# grant_full_control: "GrantFullControl",
|
|
55
61
|
# grant_read: "GrantRead",
|
|
@@ -75,13 +81,14 @@ module Aws::S3
|
|
|
75
81
|
#
|
|
76
82
|
# <b>Directory buckets </b> - When you use this operation with a
|
|
77
83
|
# directory bucket, you must use path-style requests in the format
|
|
78
|
-
# `https://s3express-control.
|
|
84
|
+
# `https://s3express-control.region-code.amazonaws.com/bucket-name `.
|
|
79
85
|
# Virtual-hosted-style requests aren't supported. Directory bucket
|
|
80
|
-
# names must be unique in the chosen Availability Zone
|
|
81
|
-
# must also follow the format `
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
#
|
|
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*
|
|
85
92
|
#
|
|
86
93
|
#
|
|
87
94
|
#
|
|
@@ -166,7 +173,7 @@ module Aws::S3
|
|
|
166
173
|
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html
|
|
167
174
|
# @return [Bucket]
|
|
168
175
|
def create_bucket(options = {})
|
|
169
|
-
Aws::Plugins::UserAgent.
|
|
176
|
+
Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
|
170
177
|
@client.create_bucket(options)
|
|
171
178
|
end
|
|
172
179
|
Bucket.new(
|
|
@@ -188,23 +195,49 @@ module Aws::S3
|
|
|
188
195
|
|
|
189
196
|
# @example Request syntax with placeholder values
|
|
190
197
|
#
|
|
191
|
-
# s3.buckets(
|
|
198
|
+
# buckets = s3.buckets({
|
|
199
|
+
# prefix: "Prefix",
|
|
200
|
+
# bucket_region: "BucketRegion",
|
|
201
|
+
# })
|
|
192
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
|
|
193
224
|
# @return [Bucket::Collection]
|
|
194
225
|
def buckets(options = {})
|
|
195
226
|
batches = Enumerator.new do |y|
|
|
196
|
-
|
|
197
|
-
resp = Aws::Plugins::UserAgent.feature('resource') do
|
|
227
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
|
198
228
|
@client.list_buckets(options)
|
|
199
229
|
end
|
|
200
|
-
resp.
|
|
201
|
-
batch
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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)
|
|
206
240
|
end
|
|
207
|
-
y.yield(batch)
|
|
208
241
|
end
|
|
209
242
|
Bucket::Collection.new(batches)
|
|
210
243
|
end
|