aws-sdk-s3 1.156.0 → 1.159.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 +15 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-s3/access_grants_credentials_provider.rb +12 -3
- data/lib/aws-sdk-s3/bucket.rb +79 -16
- data/lib/aws-sdk-s3/client.rb +541 -312
- data/lib/aws-sdk-s3/client_api.rb +16 -1
- data/lib/aws-sdk-s3/multipart_upload.rb +20 -0
- data/lib/aws-sdk-s3/object.rb +36 -4
- data/lib/aws-sdk-s3/object_summary.rb +28 -0
- data/lib/aws-sdk-s3/object_version.rb +17 -4
- data/lib/aws-sdk-s3/plugins/access_grants.rb +68 -4
- data/lib/aws-sdk-s3/resource.rb +10 -8
- data/lib/aws-sdk-s3/types.rb +294 -47
- data/lib/aws-sdk-s3.rb +1 -1
- data/sig/bucket.rbs +1 -0
- data/sig/client.rbs +7 -1
- data/sig/multipart_upload.rbs +1 -0
- data/sig/object.rbs +1 -0
- data/sig/object_summary.rbs +1 -0
- data/sig/resource.rbs +2 -1
- data/sig/types.rbs +9 -0
- metadata +2 -2
@@ -334,6 +334,7 @@ module Aws::S3
|
|
334
334
|
ListBucketMetricsConfigurationsOutput = Shapes::StructureShape.new(name: 'ListBucketMetricsConfigurationsOutput')
|
335
335
|
ListBucketMetricsConfigurationsRequest = Shapes::StructureShape.new(name: 'ListBucketMetricsConfigurationsRequest')
|
336
336
|
ListBucketsOutput = Shapes::StructureShape.new(name: 'ListBucketsOutput')
|
337
|
+
ListBucketsRequest = Shapes::StructureShape.new(name: 'ListBucketsRequest')
|
337
338
|
ListDirectoryBucketsOutput = Shapes::StructureShape.new(name: 'ListDirectoryBucketsOutput')
|
338
339
|
ListDirectoryBucketsRequest = Shapes::StructureShape.new(name: 'ListDirectoryBucketsRequest')
|
339
340
|
ListMultipartUploadsOutput = Shapes::StructureShape.new(name: 'ListMultipartUploadsOutput')
|
@@ -357,6 +358,7 @@ module Aws::S3
|
|
357
358
|
MFADeleteStatus = Shapes::StringShape.new(name: 'MFADeleteStatus')
|
358
359
|
Marker = Shapes::StringShape.new(name: 'Marker')
|
359
360
|
MaxAgeSeconds = Shapes::IntegerShape.new(name: 'MaxAgeSeconds')
|
361
|
+
MaxBuckets = Shapes::IntegerShape.new(name: 'MaxBuckets')
|
360
362
|
MaxDirectoryBuckets = Shapes::IntegerShape.new(name: 'MaxDirectoryBuckets')
|
361
363
|
MaxKeys = Shapes::IntegerShape.new(name: 'MaxKeys')
|
362
364
|
MaxParts = Shapes::IntegerShape.new(name: 'MaxParts')
|
@@ -768,6 +770,7 @@ module Aws::S3
|
|
768
770
|
CompleteMultipartUploadRequest.add_member(:checksum_sha256, Shapes::ShapeRef.new(shape: ChecksumSHA256, location: "header", location_name: "x-amz-checksum-sha256"))
|
769
771
|
CompleteMultipartUploadRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
|
770
772
|
CompleteMultipartUploadRequest.add_member(:expected_bucket_owner, Shapes::ShapeRef.new(shape: AccountId, location: "header", location_name: "x-amz-expected-bucket-owner"))
|
773
|
+
CompleteMultipartUploadRequest.add_member(:if_none_match, Shapes::ShapeRef.new(shape: IfNoneMatch, location: "header", location_name: "If-None-Match"))
|
771
774
|
CompleteMultipartUploadRequest.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
|
772
775
|
CompleteMultipartUploadRequest.add_member(:sse_customer_key, Shapes::ShapeRef.new(shape: SSECustomerKey, location: "header", location_name: "x-amz-server-side-encryption-customer-key"))
|
773
776
|
CompleteMultipartUploadRequest.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
|
@@ -1707,8 +1710,13 @@ module Aws::S3
|
|
1707
1710
|
|
1708
1711
|
ListBucketsOutput.add_member(:buckets, Shapes::ShapeRef.new(shape: Buckets, location_name: "Buckets"))
|
1709
1712
|
ListBucketsOutput.add_member(:owner, Shapes::ShapeRef.new(shape: Owner, location_name: "Owner"))
|
1713
|
+
ListBucketsOutput.add_member(:continuation_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "ContinuationToken"))
|
1710
1714
|
ListBucketsOutput.struct_class = Types::ListBucketsOutput
|
1711
1715
|
|
1716
|
+
ListBucketsRequest.add_member(:max_buckets, Shapes::ShapeRef.new(shape: MaxBuckets, location: "querystring", location_name: "max-buckets"))
|
1717
|
+
ListBucketsRequest.add_member(:continuation_token, Shapes::ShapeRef.new(shape: Token, location: "querystring", location_name: "continuation-token"))
|
1718
|
+
ListBucketsRequest.struct_class = Types::ListBucketsRequest
|
1719
|
+
|
1712
1720
|
ListDirectoryBucketsOutput.add_member(:buckets, Shapes::ShapeRef.new(shape: Buckets, location_name: "Buckets"))
|
1713
1721
|
ListDirectoryBucketsOutput.add_member(:continuation_token, Shapes::ShapeRef.new(shape: DirectoryBucketToken, location_name: "ContinuationToken"))
|
1714
1722
|
ListDirectoryBucketsOutput.struct_class = Types::ListDirectoryBucketsOutput
|
@@ -2311,6 +2319,7 @@ module Aws::S3
|
|
2311
2319
|
PutObjectRequest.add_member(:checksum_sha1, Shapes::ShapeRef.new(shape: ChecksumSHA1, location: "header", location_name: "x-amz-checksum-sha1"))
|
2312
2320
|
PutObjectRequest.add_member(:checksum_sha256, Shapes::ShapeRef.new(shape: ChecksumSHA256, location: "header", location_name: "x-amz-checksum-sha256"))
|
2313
2321
|
PutObjectRequest.add_member(:expires, Shapes::ShapeRef.new(shape: Expires, location: "header", location_name: "Expires"))
|
2322
|
+
PutObjectRequest.add_member(:if_none_match, Shapes::ShapeRef.new(shape: IfNoneMatch, location: "header", location_name: "If-None-Match"))
|
2314
2323
|
PutObjectRequest.add_member(:grant_full_control, Shapes::ShapeRef.new(shape: GrantFullControl, location: "header", location_name: "x-amz-grant-full-control"))
|
2315
2324
|
PutObjectRequest.add_member(:grant_read, Shapes::ShapeRef.new(shape: GrantRead, location: "header", location_name: "x-amz-grant-read"))
|
2316
2325
|
PutObjectRequest.add_member(:grant_read_acp, Shapes::ShapeRef.new(shape: GrantReadACP, location: "header", location_name: "x-amz-grant-read-acp"))
|
@@ -3291,8 +3300,14 @@ module Aws::S3
|
|
3291
3300
|
o.name = "ListBuckets"
|
3292
3301
|
o.http_method = "GET"
|
3293
3302
|
o.http_request_uri = "/"
|
3294
|
-
o.input = Shapes::ShapeRef.new(shape:
|
3303
|
+
o.input = Shapes::ShapeRef.new(shape: ListBucketsRequest)
|
3295
3304
|
o.output = Shapes::ShapeRef.new(shape: ListBucketsOutput)
|
3305
|
+
o[:pager] = Aws::Pager.new(
|
3306
|
+
limit_key: "max_buckets",
|
3307
|
+
tokens: {
|
3308
|
+
"continuation_token" => "continuation_token"
|
3309
|
+
}
|
3310
|
+
)
|
3296
3311
|
end)
|
3297
3312
|
|
3298
3313
|
api.add_operation(:list_directory_buckets, Seahorse::Model::Operation.new.tap do |o|
|
@@ -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
|
data/lib/aws-sdk-s3/object.rb
CHANGED
@@ -1662,6 +1662,15 @@ module Aws::S3
|
|
1662
1662
|
# fails with the HTTP status code `403 Forbidden` (access denied).
|
1663
1663
|
# @option options [String] :checksum_mode
|
1664
1664
|
# To retrieve the checksum, this mode must be enabled.
|
1665
|
+
#
|
1666
|
+
# In addition, if you enable checksum mode and the object is uploaded
|
1667
|
+
# with a [checksum][1] and encrypted with an Key Management Service
|
1668
|
+
# (KMS) key, you must have permission to use the `kms:Decrypt` action to
|
1669
|
+
# retrieve the checksum.
|
1670
|
+
#
|
1671
|
+
#
|
1672
|
+
#
|
1673
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Checksum.html
|
1665
1674
|
# @return [Types::GetObjectOutput]
|
1666
1675
|
def get(options = {}, &block)
|
1667
1676
|
options = options.merge(
|
@@ -2182,6 +2191,7 @@ module Aws::S3
|
|
2182
2191
|
# checksum_sha1: "ChecksumSHA1",
|
2183
2192
|
# checksum_sha256: "ChecksumSHA256",
|
2184
2193
|
# expires: Time.now,
|
2194
|
+
# if_none_match: "IfNoneMatch",
|
2185
2195
|
# grant_full_control: "GrantFullControl",
|
2186
2196
|
# grant_read: "GrantRead",
|
2187
2197
|
# grant_read_acp: "GrantReadACP",
|
@@ -2396,6 +2406,24 @@ module Aws::S3
|
|
2396
2406
|
#
|
2397
2407
|
#
|
2398
2408
|
# [1]: https://www.rfc-editor.org/rfc/rfc7234#section-5.3
|
2409
|
+
# @option options [String] :if_none_match
|
2410
|
+
# Uploads the object only if the object key name does not already exist
|
2411
|
+
# in the bucket specified. Otherwise, Amazon S3 returns a `412
|
2412
|
+
# Precondition Failed` error.
|
2413
|
+
#
|
2414
|
+
# If a conflicting operation occurs during the upload S3 returns a `409
|
2415
|
+
# ConditionalRequestConflict` response. On a 409 failure you should
|
2416
|
+
# retry the upload.
|
2417
|
+
#
|
2418
|
+
# Expects the '*' (asterisk) character.
|
2419
|
+
#
|
2420
|
+
# For more information about conditional requests, see [RFC 7232][1], or
|
2421
|
+
# [Conditional requests][2] in the *Amazon S3 User Guide*.
|
2422
|
+
#
|
2423
|
+
#
|
2424
|
+
#
|
2425
|
+
# [1]: https://tools.ietf.org/html/rfc7232
|
2426
|
+
# [2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/conditional-requests.html
|
2399
2427
|
# @option options [String] :grant_full_control
|
2400
2428
|
# Gives the grantee READ, READ\_ACP, and WRITE\_ACP permissions on the
|
2401
2429
|
# object.
|
@@ -2944,10 +2972,14 @@ module Aws::S3
|
|
2944
2972
|
# @option options [String] :checksum_mode
|
2945
2973
|
# To retrieve the checksum, this parameter must be enabled.
|
2946
2974
|
#
|
2947
|
-
# In addition, if you enable
|
2948
|
-
# with
|
2949
|
-
# KMS), you must have permission to use the `kms:Decrypt` action
|
2950
|
-
#
|
2975
|
+
# In addition, if you enable checksum mode and the object is uploaded
|
2976
|
+
# with a [checksum][1] and encrypted with an Key Management Service
|
2977
|
+
# (KMS) key, you must have permission to use the `kms:Decrypt` action to
|
2978
|
+
# retrieve the checksum.
|
2979
|
+
#
|
2980
|
+
#
|
2981
|
+
#
|
2982
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Checksum.html
|
2951
2983
|
# @return [Types::HeadObjectOutput]
|
2952
2984
|
def head(options = {})
|
2953
2985
|
options = options.merge(
|
@@ -1298,6 +1298,15 @@ module Aws::S3
|
|
1298
1298
|
# fails with the HTTP status code `403 Forbidden` (access denied).
|
1299
1299
|
# @option options [String] :checksum_mode
|
1300
1300
|
# To retrieve the checksum, this mode must be enabled.
|
1301
|
+
#
|
1302
|
+
# In addition, if you enable checksum mode and the object is uploaded
|
1303
|
+
# with a [checksum][1] and encrypted with an Key Management Service
|
1304
|
+
# (KMS) key, you must have permission to use the `kms:Decrypt` action to
|
1305
|
+
# retrieve the checksum.
|
1306
|
+
#
|
1307
|
+
#
|
1308
|
+
#
|
1309
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Checksum.html
|
1301
1310
|
# @return [Types::GetObjectOutput]
|
1302
1311
|
def get(options = {}, &block)
|
1303
1312
|
options = options.merge(
|
@@ -1818,6 +1827,7 @@ module Aws::S3
|
|
1818
1827
|
# checksum_sha1: "ChecksumSHA1",
|
1819
1828
|
# checksum_sha256: "ChecksumSHA256",
|
1820
1829
|
# expires: Time.now,
|
1830
|
+
# if_none_match: "IfNoneMatch",
|
1821
1831
|
# grant_full_control: "GrantFullControl",
|
1822
1832
|
# grant_read: "GrantRead",
|
1823
1833
|
# grant_read_acp: "GrantReadACP",
|
@@ -2032,6 +2042,24 @@ module Aws::S3
|
|
2032
2042
|
#
|
2033
2043
|
#
|
2034
2044
|
# [1]: https://www.rfc-editor.org/rfc/rfc7234#section-5.3
|
2045
|
+
# @option options [String] :if_none_match
|
2046
|
+
# Uploads the object only if the object key name does not already exist
|
2047
|
+
# in the bucket specified. Otherwise, Amazon S3 returns a `412
|
2048
|
+
# Precondition Failed` error.
|
2049
|
+
#
|
2050
|
+
# If a conflicting operation occurs during the upload S3 returns a `409
|
2051
|
+
# ConditionalRequestConflict` response. On a 409 failure you should
|
2052
|
+
# retry the upload.
|
2053
|
+
#
|
2054
|
+
# Expects the '*' (asterisk) character.
|
2055
|
+
#
|
2056
|
+
# For more information about conditional requests, see [RFC 7232][1], or
|
2057
|
+
# [Conditional requests][2] in the *Amazon S3 User Guide*.
|
2058
|
+
#
|
2059
|
+
#
|
2060
|
+
#
|
2061
|
+
# [1]: https://tools.ietf.org/html/rfc7232
|
2062
|
+
# [2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/conditional-requests.html
|
2035
2063
|
# @option options [String] :grant_full_control
|
2036
2064
|
# Gives the grantee READ, READ\_ACP, and WRITE\_ACP permissions on the
|
2037
2065
|
# object.
|
@@ -523,6 +523,15 @@ module Aws::S3
|
|
523
523
|
# fails with the HTTP status code `403 Forbidden` (access denied).
|
524
524
|
# @option options [String] :checksum_mode
|
525
525
|
# To retrieve the checksum, this mode must be enabled.
|
526
|
+
#
|
527
|
+
# In addition, if you enable checksum mode and the object is uploaded
|
528
|
+
# with a [checksum][1] and encrypted with an Key Management Service
|
529
|
+
# (KMS) key, you must have permission to use the `kms:Decrypt` action to
|
530
|
+
# retrieve the checksum.
|
531
|
+
#
|
532
|
+
#
|
533
|
+
#
|
534
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Checksum.html
|
526
535
|
# @return [Types::GetObjectOutput]
|
527
536
|
def get(options = {}, &block)
|
528
537
|
options = options.merge(
|
@@ -701,10 +710,14 @@ module Aws::S3
|
|
701
710
|
# @option options [String] :checksum_mode
|
702
711
|
# To retrieve the checksum, this parameter must be enabled.
|
703
712
|
#
|
704
|
-
# In addition, if you enable
|
705
|
-
# with
|
706
|
-
# KMS), you must have permission to use the `kms:Decrypt` action
|
707
|
-
#
|
713
|
+
# In addition, if you enable checksum mode and the object is uploaded
|
714
|
+
# with a [checksum][1] and encrypted with an Key Management Service
|
715
|
+
# (KMS) key, you must have permission to use the `kms:Decrypt` action to
|
716
|
+
# retrieve the checksum.
|
717
|
+
#
|
718
|
+
#
|
719
|
+
#
|
720
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Checksum.html
|
708
721
|
# @return [Types::HeadObjectOutput]
|
709
722
|
def head(options = {})
|
710
723
|
options = options.merge(
|
@@ -44,25 +44,47 @@ setting, caching, and fallback behavior.
|
|
44
44
|
list_objects_v2: 'READ',
|
45
45
|
list_object_versions: 'READ',
|
46
46
|
list_parts: 'READ',
|
47
|
+
head_bucket: 'READ',
|
48
|
+
get_object_attributes: 'READ',
|
47
49
|
put_object: 'WRITE',
|
48
50
|
put_object_acl: 'WRITE',
|
49
51
|
delete_object: 'WRITE',
|
50
52
|
abort_multipart_upload: 'WRITE',
|
51
53
|
create_multipart_upload: 'WRITE',
|
52
54
|
upload_part: 'WRITE',
|
53
|
-
complete_multipart_upload: 'WRITE'
|
55
|
+
complete_multipart_upload: 'WRITE',
|
56
|
+
delete_objects: 'WRITE',
|
57
|
+
copy_object: 'READWRITE'
|
54
58
|
}.freeze
|
55
59
|
|
56
60
|
def call(context)
|
61
|
+
provider = context.config.access_grants_credentials_provider
|
62
|
+
|
57
63
|
if access_grants_operation?(context) &&
|
58
|
-
!s3_express_endpoint?(context)
|
64
|
+
!s3_express_endpoint?(context) &&
|
65
|
+
!credentials_head_bucket_call?(provider)
|
59
66
|
params = context[:endpoint_params]
|
60
67
|
permission = PERMISSION_MAP[context.operation_name]
|
61
68
|
|
62
|
-
|
69
|
+
key =
|
70
|
+
case context.operation_name
|
71
|
+
when :delete_objects
|
72
|
+
delete_params = context.params[:delete]
|
73
|
+
common_prefixes(delete_params[:objects].map { |o| o[:key] })
|
74
|
+
when :copy_object
|
75
|
+
source_bucket, source_key = params[:copy_source].split('/', 2)
|
76
|
+
if params[:bucket] != source_bucket
|
77
|
+
raise ArgumentError,
|
78
|
+
'source and destination bucket must be the same'
|
79
|
+
end
|
80
|
+
common_prefixes([params[:key], source_key])
|
81
|
+
else
|
82
|
+
params[:key]
|
83
|
+
end
|
84
|
+
|
63
85
|
credentials = provider.access_grants_credentials_for(
|
64
86
|
bucket: params[:bucket],
|
65
|
-
key:
|
87
|
+
key: key,
|
66
88
|
prefix: params[:prefix],
|
67
89
|
permission: permission
|
68
90
|
)
|
@@ -80,6 +102,12 @@ setting, caching, and fallback behavior.
|
|
80
102
|
Aws::Plugins::UserAgent.metric('S3_ACCESS_GRANTS', &block)
|
81
103
|
end
|
82
104
|
|
105
|
+
# HeadBucket is a supported call. When fetching credentials,
|
106
|
+
# this plugin is executed again, and becomes recursive.
|
107
|
+
def credentials_head_bucket_call?(provider)
|
108
|
+
provider.instance_variable_get(:@head_bucket_call)
|
109
|
+
end
|
110
|
+
|
83
111
|
def access_grants_operation?(context)
|
84
112
|
params = context[:endpoint_params]
|
85
113
|
params[:bucket] && PERMISSION_MAP[context.operation_name]
|
@@ -88,6 +116,42 @@ setting, caching, and fallback behavior.
|
|
88
116
|
def s3_express_endpoint?(context)
|
89
117
|
context[:endpoint_properties]['backend'] == 'S3Express'
|
90
118
|
end
|
119
|
+
|
120
|
+
# Return the common prefix of the keys, regardless of the delimiter.
|
121
|
+
# For example, given keys ['foo/bar', 'foo/baz'], the common prefix
|
122
|
+
# is 'foo/ba'.
|
123
|
+
def common_prefixes(keys)
|
124
|
+
return '' if keys.empty?
|
125
|
+
|
126
|
+
first_key = keys[0]
|
127
|
+
common_ancestor = first_key
|
128
|
+
last_prefix = ''
|
129
|
+
keys.each do |k|
|
130
|
+
until common_ancestor.empty?
|
131
|
+
break if k.start_with?(common_ancestor)
|
132
|
+
|
133
|
+
last_index = common_ancestor.rindex('/')
|
134
|
+
return '' if last_index.nil?
|
135
|
+
|
136
|
+
last_prefix = common_ancestor[(last_index + 1)..-1]
|
137
|
+
common_ancestor = common_ancestor[0...last_index]
|
138
|
+
end
|
139
|
+
end
|
140
|
+
new_common_ancestor = "#{common_ancestor}/#{last_prefix}"
|
141
|
+
keys.each do |k|
|
142
|
+
until last_prefix.empty?
|
143
|
+
break if k.start_with?(new_common_ancestor)
|
144
|
+
|
145
|
+
last_prefix = last_prefix[0...-1]
|
146
|
+
new_common_ancestor = "#{common_ancestor}/#{last_prefix}"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
if new_common_ancestor == "#{first_key}/"
|
150
|
+
first_key
|
151
|
+
else
|
152
|
+
new_common_ancestor
|
153
|
+
end
|
154
|
+
end
|
91
155
|
end
|
92
156
|
|
93
157
|
def add_handlers(handlers, config)
|
data/lib/aws-sdk-s3/resource.rb
CHANGED
@@ -193,18 +193,20 @@ module Aws::S3
|
|
193
193
|
# @return [Bucket::Collection]
|
194
194
|
def buckets(options = {})
|
195
195
|
batches = Enumerator.new do |y|
|
196
|
-
batch = []
|
197
196
|
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
198
197
|
@client.list_buckets(options)
|
199
198
|
end
|
200
|
-
resp.
|
201
|
-
batch
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
199
|
+
resp.each_page do |page|
|
200
|
+
batch = []
|
201
|
+
page.data.buckets.each do |b|
|
202
|
+
batch << Bucket.new(
|
203
|
+
name: b.name,
|
204
|
+
data: b,
|
205
|
+
client: @client
|
206
|
+
)
|
207
|
+
end
|
208
|
+
y.yield(batch)
|
206
209
|
end
|
207
|
-
y.yield(batch)
|
208
210
|
end
|
209
211
|
Bucket::Collection.new(batches)
|
210
212
|
end
|