aws-sdk-s3 1.167.0 → 1.194.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 +158 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-s3/bucket.rb +145 -39
- data/lib/aws-sdk-s3/bucket_acl.rb +6 -5
- data/lib/aws-sdk-s3/bucket_cors.rb +6 -5
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +7 -2
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +22 -2
- data/lib/aws-sdk-s3/bucket_logging.rb +2 -2
- data/lib/aws-sdk-s3/bucket_policy.rb +6 -5
- data/lib/aws-sdk-s3/bucket_request_payment.rb +3 -3
- data/lib/aws-sdk-s3/bucket_tagging.rb +3 -3
- data/lib/aws-sdk-s3/bucket_versioning.rb +9 -9
- data/lib/aws-sdk-s3/bucket_website.rb +3 -3
- data/lib/aws-sdk-s3/client.rb +3670 -1773
- data/lib/aws-sdk-s3/client_api.rb +558 -160
- data/lib/aws-sdk-s3/endpoint_parameters.rb +13 -18
- data/lib/aws-sdk-s3/endpoint_provider.rb +400 -276
- data/lib/aws-sdk-s3/endpoints.rb +529 -1403
- data/lib/aws-sdk-s3/errors.rb +55 -0
- data/lib/aws-sdk-s3/file_downloader.rb +14 -31
- data/lib/aws-sdk-s3/legacy_signer.rb +2 -1
- data/lib/aws-sdk-s3/multipart_file_uploader.rb +31 -13
- data/lib/aws-sdk-s3/multipart_upload.rb +83 -6
- data/lib/aws-sdk-s3/multipart_upload_part.rb +50 -34
- data/lib/aws-sdk-s3/object.rb +326 -129
- data/lib/aws-sdk-s3/object_acl.rb +11 -5
- data/lib/aws-sdk-s3/object_multipart_copier.rb +2 -1
- data/lib/aws-sdk-s3/object_summary.rb +240 -96
- data/lib/aws-sdk-s3/object_version.rb +60 -13
- data/lib/aws-sdk-s3/plugins/checksum_algorithm.rb +31 -0
- data/lib/aws-sdk-s3/plugins/endpoints.rb +1 -204
- data/lib/aws-sdk-s3/plugins/express_session_auth.rb +11 -20
- data/lib/aws-sdk-s3/plugins/http_200_errors.rb +3 -3
- 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 +41 -10
- data/lib/aws-sdk-s3/types.rb +3423 -1093
- data/lib/aws-sdk-s3.rb +1 -1
- data/sig/bucket.rbs +27 -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 +1 -1
- 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 +249 -68
- data/sig/errors.rbs +10 -0
- data/sig/multipart_upload.rbs +12 -3
- data/sig/multipart_upload_part.rbs +5 -1
- data/sig/object.rbs +35 -16
- data/sig/object_acl.rbs +1 -1
- data/sig/object_summary.rbs +26 -16
- data/sig/object_version.rbs +9 -3
- data/sig/resource.rbs +15 -4
- data/sig/types.rbs +339 -65
- metadata +7 -10
- data/lib/aws-sdk-s3/plugins/skip_whole_multipart_get_checksums.rb +0 -31
@@ -62,6 +62,18 @@ module Aws::S3
|
|
62
62
|
data[:checksum_algorithm]
|
63
63
|
end
|
64
64
|
|
65
|
+
# The checksum type that is used to calculate the object’s checksum
|
66
|
+
# value. For more information, see [Checking object integrity][1] in the
|
67
|
+
# *Amazon S3 User Guide*.
|
68
|
+
#
|
69
|
+
#
|
70
|
+
#
|
71
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
|
72
|
+
# @return [String]
|
73
|
+
def checksum_type
|
74
|
+
data[:checksum_type]
|
75
|
+
end
|
76
|
+
|
65
77
|
# Size in bytes of the object.
|
66
78
|
# @return [Integer]
|
67
79
|
def size
|
@@ -257,6 +269,9 @@ module Aws::S3
|
|
257
269
|
# request_payer: "requester", # accepts requester
|
258
270
|
# bypass_governance_retention: false,
|
259
271
|
# expected_bucket_owner: "AccountId",
|
272
|
+
# if_match: "IfMatch",
|
273
|
+
# if_match_last_modified_time: Time.now,
|
274
|
+
# if_match_size: 1,
|
260
275
|
# })
|
261
276
|
# @param [Hash] options ({})
|
262
277
|
# @option options [String] :mfa
|
@@ -296,6 +311,46 @@ module Aws::S3
|
|
296
311
|
# The account ID of the expected bucket owner. If the account ID that
|
297
312
|
# you provide does not match the actual owner of the bucket, the request
|
298
313
|
# fails with the HTTP status code `403 Forbidden` (access denied).
|
314
|
+
# @option options [String] :if_match
|
315
|
+
# The `If-Match` header field makes the request method conditional on
|
316
|
+
# ETags. If the ETag value does not match, the operation returns a `412
|
317
|
+
# Precondition Failed` error. If the ETag matches or if the object
|
318
|
+
# doesn't exist, the operation will return a `204 Success (No Content)
|
319
|
+
# response`.
|
320
|
+
#
|
321
|
+
# For more information about conditional requests, see [RFC 7232][1].
|
322
|
+
#
|
323
|
+
# <note markdown="1"> This functionality is only supported for directory buckets.
|
324
|
+
#
|
325
|
+
# </note>
|
326
|
+
#
|
327
|
+
#
|
328
|
+
#
|
329
|
+
# [1]: https://tools.ietf.org/html/rfc7232
|
330
|
+
# @option options [Time,DateTime,Date,Integer,String] :if_match_last_modified_time
|
331
|
+
# If present, the object is deleted only if its modification times
|
332
|
+
# matches the provided `Timestamp`. If the `Timestamp` values do not
|
333
|
+
# match, the operation returns a `412 Precondition Failed` error. If the
|
334
|
+
# `Timestamp` matches or if the object doesn’t exist, the operation
|
335
|
+
# returns a `204 Success (No Content)` response.
|
336
|
+
#
|
337
|
+
# <note markdown="1"> This functionality is only supported for directory buckets.
|
338
|
+
#
|
339
|
+
# </note>
|
340
|
+
# @option options [Integer] :if_match_size
|
341
|
+
# If present, the object is deleted only if its size matches the
|
342
|
+
# provided size in bytes. If the `Size` value does not match, the
|
343
|
+
# operation returns a `412 Precondition Failed` error. If the `Size`
|
344
|
+
# matches or if the object doesn’t exist, the operation returns a `204
|
345
|
+
# Success (No Content)` response.
|
346
|
+
#
|
347
|
+
# <note markdown="1"> This functionality is only supported for directory buckets.
|
348
|
+
#
|
349
|
+
# </note>
|
350
|
+
#
|
351
|
+
# You can use the `If-Match`, `x-amz-if-match-last-modified-time` and
|
352
|
+
# `x-amz-if-match-size` conditional headers in conjunction with
|
353
|
+
# each-other or individually.
|
299
354
|
# @return [Types::DeleteObjectOutput]
|
300
355
|
def delete(options = {})
|
301
356
|
options = options.merge(
|
@@ -523,15 +578,6 @@ module Aws::S3
|
|
523
578
|
# fails with the HTTP status code `403 Forbidden` (access denied).
|
524
579
|
# @option options [String] :checksum_mode
|
525
580
|
# To retrieve the checksum, this mode must be enabled.
|
526
|
-
#
|
527
|
-
# **General purpose buckets** - In addition, if you enable checksum mode
|
528
|
-
# and the object is uploaded with a [checksum][1] and encrypted with an
|
529
|
-
# Key Management Service (KMS) key, you must have permission to use the
|
530
|
-
# `kms:Decrypt` action to retrieve the checksum.
|
531
|
-
#
|
532
|
-
#
|
533
|
-
#
|
534
|
-
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Checksum.html
|
535
581
|
# @return [Types::GetObjectOutput]
|
536
582
|
def get(options = {}, &block)
|
537
583
|
options = options.merge(
|
@@ -805,7 +851,7 @@ module Aws::S3
|
|
805
851
|
# request_payer: "requester", # accepts requester
|
806
852
|
# bypass_governance_retention: false,
|
807
853
|
# expected_bucket_owner: "AccountId",
|
808
|
-
# checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
|
854
|
+
# checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256, CRC64NVME
|
809
855
|
# })
|
810
856
|
# @param options ({})
|
811
857
|
# @option options [String] :mfa
|
@@ -873,6 +919,8 @@ module Aws::S3
|
|
873
919
|
#
|
874
920
|
# * `CRC32C`
|
875
921
|
#
|
922
|
+
# * `CRC64NVME`
|
923
|
+
#
|
876
924
|
# * `SHA1`
|
877
925
|
#
|
878
926
|
# * `SHA256`
|
@@ -882,9 +930,8 @@ module Aws::S3
|
|
882
930
|
#
|
883
931
|
# If the individual checksum value you provide through
|
884
932
|
# `x-amz-checksum-algorithm ` doesn't match the checksum algorithm you
|
885
|
-
# set through `x-amz-sdk-checksum-algorithm`, Amazon S3
|
886
|
-
#
|
887
|
-
# that matches the provided value in `x-amz-checksum-algorithm `.
|
933
|
+
# set through `x-amz-sdk-checksum-algorithm`, Amazon S3 fails the
|
934
|
+
# request with a `BadDigest` error.
|
888
935
|
#
|
889
936
|
# If you provide an individual checksum, Amazon S3 ignores any provided
|
890
937
|
# `ChecksumAlgorithm` parameter.
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module S3
|
5
|
+
module Plugins
|
6
|
+
# @api private
|
7
|
+
class ChecksumAlgorithm < Seahorse::Client::Plugin
|
8
|
+
|
9
|
+
# S3 GetObject results for whole Multipart Objects contain a checksum
|
10
|
+
# that cannot be validated. These should be skipped by the
|
11
|
+
# ChecksumAlgorithm plugin.
|
12
|
+
class SkipWholeMultipartGetChecksumsHandler < Seahorse::Client::Handler
|
13
|
+
def call(context)
|
14
|
+
context[:http_checksum] ||= {}
|
15
|
+
context[:http_checksum][:skip_on_suffix] = true
|
16
|
+
|
17
|
+
@handler.call(context)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_handlers(handlers, _config)
|
22
|
+
handlers.add(
|
23
|
+
SkipWholeMultipartGetChecksumsHandler,
|
24
|
+
step: :initialize,
|
25
|
+
operations: [:get_object]
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -36,7 +36,7 @@ Parameter to indicate whether S3Express session auth should be disabled
|
|
36
36
|
class Handler < Seahorse::Client::Handler
|
37
37
|
def call(context)
|
38
38
|
unless context[:discovered_endpoint]
|
39
|
-
params = parameters_for_operation(context)
|
39
|
+
params = Aws::S3::Endpoints.parameters_for_operation(context)
|
40
40
|
endpoint = context.config.endpoint_provider.resolve_endpoint(params)
|
41
41
|
|
42
42
|
context.http_request.endpoint = endpoint.url
|
@@ -76,209 +76,6 @@ Parameter to indicate whether S3Express session auth should be disabled
|
|
76
76
|
context.http_request.headers[key] = value
|
77
77
|
end
|
78
78
|
end
|
79
|
-
|
80
|
-
def parameters_for_operation(context)
|
81
|
-
case context.operation_name
|
82
|
-
when :abort_multipart_upload
|
83
|
-
Aws::S3::Endpoints::AbortMultipartUpload.build(context)
|
84
|
-
when :complete_multipart_upload
|
85
|
-
Aws::S3::Endpoints::CompleteMultipartUpload.build(context)
|
86
|
-
when :copy_object
|
87
|
-
Aws::S3::Endpoints::CopyObject.build(context)
|
88
|
-
when :create_bucket
|
89
|
-
Aws::S3::Endpoints::CreateBucket.build(context)
|
90
|
-
when :create_multipart_upload
|
91
|
-
Aws::S3::Endpoints::CreateMultipartUpload.build(context)
|
92
|
-
when :create_session
|
93
|
-
Aws::S3::Endpoints::CreateSession.build(context)
|
94
|
-
when :delete_bucket
|
95
|
-
Aws::S3::Endpoints::DeleteBucket.build(context)
|
96
|
-
when :delete_bucket_analytics_configuration
|
97
|
-
Aws::S3::Endpoints::DeleteBucketAnalyticsConfiguration.build(context)
|
98
|
-
when :delete_bucket_cors
|
99
|
-
Aws::S3::Endpoints::DeleteBucketCors.build(context)
|
100
|
-
when :delete_bucket_encryption
|
101
|
-
Aws::S3::Endpoints::DeleteBucketEncryption.build(context)
|
102
|
-
when :delete_bucket_intelligent_tiering_configuration
|
103
|
-
Aws::S3::Endpoints::DeleteBucketIntelligentTieringConfiguration.build(context)
|
104
|
-
when :delete_bucket_inventory_configuration
|
105
|
-
Aws::S3::Endpoints::DeleteBucketInventoryConfiguration.build(context)
|
106
|
-
when :delete_bucket_lifecycle
|
107
|
-
Aws::S3::Endpoints::DeleteBucketLifecycle.build(context)
|
108
|
-
when :delete_bucket_metrics_configuration
|
109
|
-
Aws::S3::Endpoints::DeleteBucketMetricsConfiguration.build(context)
|
110
|
-
when :delete_bucket_ownership_controls
|
111
|
-
Aws::S3::Endpoints::DeleteBucketOwnershipControls.build(context)
|
112
|
-
when :delete_bucket_policy
|
113
|
-
Aws::S3::Endpoints::DeleteBucketPolicy.build(context)
|
114
|
-
when :delete_bucket_replication
|
115
|
-
Aws::S3::Endpoints::DeleteBucketReplication.build(context)
|
116
|
-
when :delete_bucket_tagging
|
117
|
-
Aws::S3::Endpoints::DeleteBucketTagging.build(context)
|
118
|
-
when :delete_bucket_website
|
119
|
-
Aws::S3::Endpoints::DeleteBucketWebsite.build(context)
|
120
|
-
when :delete_object
|
121
|
-
Aws::S3::Endpoints::DeleteObject.build(context)
|
122
|
-
when :delete_object_tagging
|
123
|
-
Aws::S3::Endpoints::DeleteObjectTagging.build(context)
|
124
|
-
when :delete_objects
|
125
|
-
Aws::S3::Endpoints::DeleteObjects.build(context)
|
126
|
-
when :delete_public_access_block
|
127
|
-
Aws::S3::Endpoints::DeletePublicAccessBlock.build(context)
|
128
|
-
when :get_bucket_accelerate_configuration
|
129
|
-
Aws::S3::Endpoints::GetBucketAccelerateConfiguration.build(context)
|
130
|
-
when :get_bucket_acl
|
131
|
-
Aws::S3::Endpoints::GetBucketAcl.build(context)
|
132
|
-
when :get_bucket_analytics_configuration
|
133
|
-
Aws::S3::Endpoints::GetBucketAnalyticsConfiguration.build(context)
|
134
|
-
when :get_bucket_cors
|
135
|
-
Aws::S3::Endpoints::GetBucketCors.build(context)
|
136
|
-
when :get_bucket_encryption
|
137
|
-
Aws::S3::Endpoints::GetBucketEncryption.build(context)
|
138
|
-
when :get_bucket_intelligent_tiering_configuration
|
139
|
-
Aws::S3::Endpoints::GetBucketIntelligentTieringConfiguration.build(context)
|
140
|
-
when :get_bucket_inventory_configuration
|
141
|
-
Aws::S3::Endpoints::GetBucketInventoryConfiguration.build(context)
|
142
|
-
when :get_bucket_lifecycle
|
143
|
-
Aws::S3::Endpoints::GetBucketLifecycle.build(context)
|
144
|
-
when :get_bucket_lifecycle_configuration
|
145
|
-
Aws::S3::Endpoints::GetBucketLifecycleConfiguration.build(context)
|
146
|
-
when :get_bucket_location
|
147
|
-
Aws::S3::Endpoints::GetBucketLocation.build(context)
|
148
|
-
when :get_bucket_logging
|
149
|
-
Aws::S3::Endpoints::GetBucketLogging.build(context)
|
150
|
-
when :get_bucket_metrics_configuration
|
151
|
-
Aws::S3::Endpoints::GetBucketMetricsConfiguration.build(context)
|
152
|
-
when :get_bucket_notification
|
153
|
-
Aws::S3::Endpoints::GetBucketNotification.build(context)
|
154
|
-
when :get_bucket_notification_configuration
|
155
|
-
Aws::S3::Endpoints::GetBucketNotificationConfiguration.build(context)
|
156
|
-
when :get_bucket_ownership_controls
|
157
|
-
Aws::S3::Endpoints::GetBucketOwnershipControls.build(context)
|
158
|
-
when :get_bucket_policy
|
159
|
-
Aws::S3::Endpoints::GetBucketPolicy.build(context)
|
160
|
-
when :get_bucket_policy_status
|
161
|
-
Aws::S3::Endpoints::GetBucketPolicyStatus.build(context)
|
162
|
-
when :get_bucket_replication
|
163
|
-
Aws::S3::Endpoints::GetBucketReplication.build(context)
|
164
|
-
when :get_bucket_request_payment
|
165
|
-
Aws::S3::Endpoints::GetBucketRequestPayment.build(context)
|
166
|
-
when :get_bucket_tagging
|
167
|
-
Aws::S3::Endpoints::GetBucketTagging.build(context)
|
168
|
-
when :get_bucket_versioning
|
169
|
-
Aws::S3::Endpoints::GetBucketVersioning.build(context)
|
170
|
-
when :get_bucket_website
|
171
|
-
Aws::S3::Endpoints::GetBucketWebsite.build(context)
|
172
|
-
when :get_object
|
173
|
-
Aws::S3::Endpoints::GetObject.build(context)
|
174
|
-
when :get_object_acl
|
175
|
-
Aws::S3::Endpoints::GetObjectAcl.build(context)
|
176
|
-
when :get_object_attributes
|
177
|
-
Aws::S3::Endpoints::GetObjectAttributes.build(context)
|
178
|
-
when :get_object_legal_hold
|
179
|
-
Aws::S3::Endpoints::GetObjectLegalHold.build(context)
|
180
|
-
when :get_object_lock_configuration
|
181
|
-
Aws::S3::Endpoints::GetObjectLockConfiguration.build(context)
|
182
|
-
when :get_object_retention
|
183
|
-
Aws::S3::Endpoints::GetObjectRetention.build(context)
|
184
|
-
when :get_object_tagging
|
185
|
-
Aws::S3::Endpoints::GetObjectTagging.build(context)
|
186
|
-
when :get_object_torrent
|
187
|
-
Aws::S3::Endpoints::GetObjectTorrent.build(context)
|
188
|
-
when :get_public_access_block
|
189
|
-
Aws::S3::Endpoints::GetPublicAccessBlock.build(context)
|
190
|
-
when :head_bucket
|
191
|
-
Aws::S3::Endpoints::HeadBucket.build(context)
|
192
|
-
when :head_object
|
193
|
-
Aws::S3::Endpoints::HeadObject.build(context)
|
194
|
-
when :list_bucket_analytics_configurations
|
195
|
-
Aws::S3::Endpoints::ListBucketAnalyticsConfigurations.build(context)
|
196
|
-
when :list_bucket_intelligent_tiering_configurations
|
197
|
-
Aws::S3::Endpoints::ListBucketIntelligentTieringConfigurations.build(context)
|
198
|
-
when :list_bucket_inventory_configurations
|
199
|
-
Aws::S3::Endpoints::ListBucketInventoryConfigurations.build(context)
|
200
|
-
when :list_bucket_metrics_configurations
|
201
|
-
Aws::S3::Endpoints::ListBucketMetricsConfigurations.build(context)
|
202
|
-
when :list_buckets
|
203
|
-
Aws::S3::Endpoints::ListBuckets.build(context)
|
204
|
-
when :list_directory_buckets
|
205
|
-
Aws::S3::Endpoints::ListDirectoryBuckets.build(context)
|
206
|
-
when :list_multipart_uploads
|
207
|
-
Aws::S3::Endpoints::ListMultipartUploads.build(context)
|
208
|
-
when :list_object_versions
|
209
|
-
Aws::S3::Endpoints::ListObjectVersions.build(context)
|
210
|
-
when :list_objects
|
211
|
-
Aws::S3::Endpoints::ListObjects.build(context)
|
212
|
-
when :list_objects_v2
|
213
|
-
Aws::S3::Endpoints::ListObjectsV2.build(context)
|
214
|
-
when :list_parts
|
215
|
-
Aws::S3::Endpoints::ListParts.build(context)
|
216
|
-
when :put_bucket_accelerate_configuration
|
217
|
-
Aws::S3::Endpoints::PutBucketAccelerateConfiguration.build(context)
|
218
|
-
when :put_bucket_acl
|
219
|
-
Aws::S3::Endpoints::PutBucketAcl.build(context)
|
220
|
-
when :put_bucket_analytics_configuration
|
221
|
-
Aws::S3::Endpoints::PutBucketAnalyticsConfiguration.build(context)
|
222
|
-
when :put_bucket_cors
|
223
|
-
Aws::S3::Endpoints::PutBucketCors.build(context)
|
224
|
-
when :put_bucket_encryption
|
225
|
-
Aws::S3::Endpoints::PutBucketEncryption.build(context)
|
226
|
-
when :put_bucket_intelligent_tiering_configuration
|
227
|
-
Aws::S3::Endpoints::PutBucketIntelligentTieringConfiguration.build(context)
|
228
|
-
when :put_bucket_inventory_configuration
|
229
|
-
Aws::S3::Endpoints::PutBucketInventoryConfiguration.build(context)
|
230
|
-
when :put_bucket_lifecycle
|
231
|
-
Aws::S3::Endpoints::PutBucketLifecycle.build(context)
|
232
|
-
when :put_bucket_lifecycle_configuration
|
233
|
-
Aws::S3::Endpoints::PutBucketLifecycleConfiguration.build(context)
|
234
|
-
when :put_bucket_logging
|
235
|
-
Aws::S3::Endpoints::PutBucketLogging.build(context)
|
236
|
-
when :put_bucket_metrics_configuration
|
237
|
-
Aws::S3::Endpoints::PutBucketMetricsConfiguration.build(context)
|
238
|
-
when :put_bucket_notification
|
239
|
-
Aws::S3::Endpoints::PutBucketNotification.build(context)
|
240
|
-
when :put_bucket_notification_configuration
|
241
|
-
Aws::S3::Endpoints::PutBucketNotificationConfiguration.build(context)
|
242
|
-
when :put_bucket_ownership_controls
|
243
|
-
Aws::S3::Endpoints::PutBucketOwnershipControls.build(context)
|
244
|
-
when :put_bucket_policy
|
245
|
-
Aws::S3::Endpoints::PutBucketPolicy.build(context)
|
246
|
-
when :put_bucket_replication
|
247
|
-
Aws::S3::Endpoints::PutBucketReplication.build(context)
|
248
|
-
when :put_bucket_request_payment
|
249
|
-
Aws::S3::Endpoints::PutBucketRequestPayment.build(context)
|
250
|
-
when :put_bucket_tagging
|
251
|
-
Aws::S3::Endpoints::PutBucketTagging.build(context)
|
252
|
-
when :put_bucket_versioning
|
253
|
-
Aws::S3::Endpoints::PutBucketVersioning.build(context)
|
254
|
-
when :put_bucket_website
|
255
|
-
Aws::S3::Endpoints::PutBucketWebsite.build(context)
|
256
|
-
when :put_object
|
257
|
-
Aws::S3::Endpoints::PutObject.build(context)
|
258
|
-
when :put_object_acl
|
259
|
-
Aws::S3::Endpoints::PutObjectAcl.build(context)
|
260
|
-
when :put_object_legal_hold
|
261
|
-
Aws::S3::Endpoints::PutObjectLegalHold.build(context)
|
262
|
-
when :put_object_lock_configuration
|
263
|
-
Aws::S3::Endpoints::PutObjectLockConfiguration.build(context)
|
264
|
-
when :put_object_retention
|
265
|
-
Aws::S3::Endpoints::PutObjectRetention.build(context)
|
266
|
-
when :put_object_tagging
|
267
|
-
Aws::S3::Endpoints::PutObjectTagging.build(context)
|
268
|
-
when :put_public_access_block
|
269
|
-
Aws::S3::Endpoints::PutPublicAccessBlock.build(context)
|
270
|
-
when :restore_object
|
271
|
-
Aws::S3::Endpoints::RestoreObject.build(context)
|
272
|
-
when :select_object_content
|
273
|
-
Aws::S3::Endpoints::SelectObjectContent.build(context)
|
274
|
-
when :upload_part
|
275
|
-
Aws::S3::Endpoints::UploadPart.build(context)
|
276
|
-
when :upload_part_copy
|
277
|
-
Aws::S3::Endpoints::UploadPartCopy.build(context)
|
278
|
-
when :write_get_object_response
|
279
|
-
Aws::S3::Endpoints::WriteGetObjectResponse.build(context)
|
280
|
-
end
|
281
|
-
end
|
282
79
|
end
|
283
80
|
|
284
81
|
def add_handlers(handlers, _config)
|
@@ -29,24 +29,17 @@ 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
|
42
|
+
|
50
43
|
with_metric(credentials) { @handler.call(context) }
|
51
44
|
end
|
52
45
|
|
@@ -58,10 +51,8 @@ for different buckets.
|
|
58
51
|
Aws::Plugins::UserAgent.metric('S3_EXPRESS_BUCKET', &block)
|
59
52
|
end
|
60
53
|
|
61
|
-
def
|
62
|
-
context
|
63
|
-
(context.operation.http_checksum &&
|
64
|
-
context.operation.http_checksum['requestChecksumRequired'])
|
54
|
+
def s3_express_endpoint?(context)
|
55
|
+
context[:endpoint_properties]['backend'] == 'S3Express'
|
65
56
|
end
|
66
57
|
end
|
67
58
|
|
@@ -71,9 +71,9 @@ module Aws
|
|
71
71
|
|
72
72
|
def check_for_error(context)
|
73
73
|
xml = context.http_response.body_contents
|
74
|
-
if xml.match(
|
75
|
-
error_code = xml.match(
|
76
|
-
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]
|
77
77
|
S3::Errors.error_class(error_code).new(context, error_message)
|
78
78
|
elsif incomplete_xml_body?(xml, context.operation.output)
|
79
79
|
Seahorse::Client::NetworkingError.new(
|
@@ -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
|
)
|