aws-sdk-s3 1.176.1 → 1.180.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-s3/bucket.rb +50 -39
  5. data/lib/aws-sdk-s3/bucket_acl.rb +6 -5
  6. data/lib/aws-sdk-s3/bucket_cors.rb +6 -5
  7. data/lib/aws-sdk-s3/bucket_lifecycle.rb +2 -2
  8. data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +3 -3
  9. data/lib/aws-sdk-s3/bucket_logging.rb +2 -2
  10. data/lib/aws-sdk-s3/bucket_policy.rb +10 -9
  11. data/lib/aws-sdk-s3/bucket_request_payment.rb +3 -3
  12. data/lib/aws-sdk-s3/bucket_tagging.rb +3 -3
  13. data/lib/aws-sdk-s3/bucket_versioning.rb +9 -9
  14. data/lib/aws-sdk-s3/bucket_website.rb +3 -3
  15. data/lib/aws-sdk-s3/client.rb +698 -538
  16. data/lib/aws-sdk-s3/client_api.rb +34 -2
  17. data/lib/aws-sdk-s3/endpoint_provider.rb +260 -277
  18. data/lib/aws-sdk-s3/file_downloader.rb +4 -21
  19. data/lib/aws-sdk-s3/multipart_file_uploader.rb +31 -13
  20. data/lib/aws-sdk-s3/multipart_upload.rb +48 -6
  21. data/lib/aws-sdk-s3/multipart_upload_part.rb +52 -36
  22. data/lib/aws-sdk-s3/object.rb +142 -110
  23. data/lib/aws-sdk-s3/object_acl.rb +4 -4
  24. data/lib/aws-sdk-s3/object_summary.rb +97 -80
  25. data/lib/aws-sdk-s3/object_version.rb +22 -18
  26. data/lib/aws-sdk-s3/plugins/checksum_algorithm.rb +31 -0
  27. data/lib/aws-sdk-s3/plugins/express_session_auth.rb +11 -20
  28. data/lib/aws-sdk-s3/plugins/md5s.rb +10 -71
  29. data/lib/aws-sdk-s3/presigner.rb +4 -5
  30. data/lib/aws-sdk-s3/resource.rb +1 -1
  31. data/lib/aws-sdk-s3/types.rb +1017 -671
  32. data/lib/aws-sdk-s3.rb +1 -1
  33. data/sig/bucket.rbs +4 -3
  34. data/sig/bucket_acl.rbs +1 -1
  35. data/sig/bucket_cors.rbs +1 -1
  36. data/sig/bucket_lifecycle.rbs +1 -1
  37. data/sig/bucket_lifecycle_configuration.rbs +1 -1
  38. data/sig/bucket_logging.rbs +1 -1
  39. data/sig/bucket_policy.rbs +1 -1
  40. data/sig/bucket_request_payment.rbs +1 -1
  41. data/sig/bucket_tagging.rbs +1 -1
  42. data/sig/bucket_versioning.rbs +3 -3
  43. data/sig/bucket_website.rbs +1 -1
  44. data/sig/client.rbs +52 -31
  45. data/sig/multipart_upload.rbs +8 -1
  46. data/sig/multipart_upload_part.rbs +5 -1
  47. data/sig/object.rbs +13 -5
  48. data/sig/object_acl.rbs +1 -1
  49. data/sig/object_summary.rbs +11 -6
  50. data/sig/object_version.rbs +5 -2
  51. data/sig/resource.rbs +3 -1
  52. data/sig/types.rbs +63 -34
  53. metadata +5 -5
  54. data/lib/aws-sdk-s3/plugins/skip_whole_multipart_get_checksums.rb +0 -31
@@ -84,6 +84,18 @@ module Aws::S3
84
84
  data[:checksum_algorithm]
85
85
  end
86
86
 
87
+ # The checksum type that is used to calculate the object’s checksum
88
+ # value. For more information, see [Checking object integrity][1] in the
89
+ # *Amazon S3 User Guide*.
90
+ #
91
+ #
92
+ #
93
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
94
+ # @return [String]
95
+ def checksum_type
96
+ data[:checksum_type]
97
+ end
98
+
87
99
  # Size in bytes of the object
88
100
  # @return [Integer]
89
101
  def size
@@ -324,7 +336,7 @@ module Aws::S3
324
336
  # object_summary.copy_from({
325
337
  # acl: "private", # accepts private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-owner-full-control
326
338
  # cache_control: "CacheControl",
327
- # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
339
+ # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256, CRC64NVME
328
340
  # content_disposition: "ContentDisposition",
329
341
  # content_encoding: "ContentEncoding",
330
342
  # content_language: "ContentLanguage",
@@ -840,20 +852,17 @@ module Aws::S3
840
852
  # Signature Version in Request Authentication][1] in the *Amazon S3 User
841
853
  # Guide*.
842
854
  #
843
- # **Directory buckets** - If you specify `x-amz-server-side-encryption`
844
- # with `aws:kms`, the ` x-amz-server-side-encryption-aws-kms-key-id`
845
- # header is implicitly assigned the ID of the KMS symmetric encryption
846
- # customer managed key that's configured for your directory bucket's
847
- # default encryption setting. If you want to specify the `
848
- # x-amz-server-side-encryption-aws-kms-key-id` header explicitly, you
849
- # can only specify it with the ID (Key ID or Key ARN) of the KMS
850
- # customer managed key that's configured for your directory bucket's
851
- # default encryption setting. Otherwise, you get an HTTP `400 Bad
852
- # Request` error. Only use the key ID or key ARN. The key alias format
853
- # of the KMS key isn't supported. Your SSE-KMS configuration can only
854
- # support 1 [customer managed key][2] per directory bucket for the
855
- # lifetime of the bucket. The [Amazon Web Services managed key][3]
856
- # (`aws/s3`) isn't supported.
855
+ # **Directory buckets** - To encrypt data using SSE-KMS, it's
856
+ # recommended to specify the `x-amz-server-side-encryption` header to
857
+ # `aws:kms`. Then, the `x-amz-server-side-encryption-aws-kms-key-id`
858
+ # header implicitly uses the bucket's default KMS customer managed key
859
+ # ID. If you want to explicitly set the `
860
+ # x-amz-server-side-encryption-aws-kms-key-id` header, it must match the
861
+ # bucket's default customer managed key (using key ID or ARN, not
862
+ # alias). Your SSE-KMS configuration can only support 1 [customer
863
+ # managed key][2] per directory bucket's lifetime. The [Amazon Web
864
+ # Services managed key][3] (`aws/s3`) isn't supported. Incorrect key
865
+ # specification results in an HTTP `400 Bad Request` error.
857
866
  #
858
867
  #
859
868
  #
@@ -1124,7 +1133,7 @@ module Aws::S3
1124
1133
  #
1125
1134
  #
1126
1135
  #
1127
- # [1]: https://docs.aws.amazon.com/https:/tools.ietf.org/html/rfc7232
1136
+ # [1]: https://tools.ietf.org/html/rfc7232
1128
1137
  # @option options [Time,DateTime,Date,Integer,String] :if_match_last_modified_time
1129
1138
  # If present, the object is deleted only if its modification times
1130
1139
  # matches the provided `Timestamp`. If the `Timestamp` values do not
@@ -1405,15 +1414,6 @@ module Aws::S3
1405
1414
  # fails with the HTTP status code `403 Forbidden` (access denied).
1406
1415
  # @option options [String] :checksum_mode
1407
1416
  # To retrieve the checksum, this mode must be enabled.
1408
- #
1409
- # **General purpose buckets** - In addition, if you enable checksum mode
1410
- # and the object is uploaded with a [checksum][1] and encrypted with an
1411
- # Key Management Service (KMS) key, you must have permission to use the
1412
- # `kms:Decrypt` action to retrieve the checksum.
1413
- #
1414
- #
1415
- #
1416
- # [1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Checksum.html
1417
1417
  # @return [Types::GetObjectOutput]
1418
1418
  def get(options = {}, &block)
1419
1419
  options = options.merge(
@@ -1458,7 +1458,8 @@ module Aws::S3
1458
1458
  # object_lock_retain_until_date: Time.now,
1459
1459
  # object_lock_legal_hold_status: "ON", # accepts ON, OFF
1460
1460
  # expected_bucket_owner: "AccountId",
1461
- # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
1461
+ # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256, CRC64NVME
1462
+ # checksum_type: "COMPOSITE", # accepts COMPOSITE, FULL_OBJECT
1462
1463
  # })
1463
1464
  # @param [Hash] options ({})
1464
1465
  # @option options [String] :acl
@@ -1873,20 +1874,17 @@ module Aws::S3
1873
1874
  # `x-amz-server-side-encryption-aws-kms-key-id`, Amazon S3 uses the
1874
1875
  # Amazon Web Services managed key (`aws/s3`) to protect the data.
1875
1876
  #
1876
- # **Directory buckets** - If you specify `x-amz-server-side-encryption`
1877
- # with `aws:kms`, the ` x-amz-server-side-encryption-aws-kms-key-id`
1878
- # header is implicitly assigned the ID of the KMS symmetric encryption
1879
- # customer managed key that's configured for your directory bucket's
1880
- # default encryption setting. If you want to specify the `
1881
- # x-amz-server-side-encryption-aws-kms-key-id` header explicitly, you
1882
- # can only specify it with the ID (Key ID or Key ARN) of the KMS
1883
- # customer managed key that's configured for your directory bucket's
1884
- # default encryption setting. Otherwise, you get an HTTP `400 Bad
1885
- # Request` error. Only use the key ID or key ARN. The key alias format
1886
- # of the KMS key isn't supported. Your SSE-KMS configuration can only
1887
- # support 1 [customer managed key][1] per directory bucket for the
1888
- # lifetime of the bucket. The [Amazon Web Services managed key][2]
1889
- # (`aws/s3`) isn't supported.
1877
+ # **Directory buckets** - To encrypt data using SSE-KMS, it's
1878
+ # recommended to specify the `x-amz-server-side-encryption` header to
1879
+ # `aws:kms`. Then, the `x-amz-server-side-encryption-aws-kms-key-id`
1880
+ # header implicitly uses the bucket's default KMS customer managed key
1881
+ # ID. If you want to explicitly set the `
1882
+ # x-amz-server-side-encryption-aws-kms-key-id` header, it must match the
1883
+ # bucket's default customer managed key (using key ID or ARN, not
1884
+ # alias). Your SSE-KMS configuration can only support 1 [customer
1885
+ # managed key][1] per directory bucket's lifetime. The [Amazon Web
1886
+ # Services managed key][2] (`aws/s3`) isn't supported. Incorrect key
1887
+ # specification results in an HTTP `400 Bad Request` error.
1890
1888
  #
1891
1889
  #
1892
1890
  #
@@ -1894,7 +1892,7 @@ module Aws::S3
1894
1892
  # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk
1895
1893
  # @option options [String] :ssekms_encryption_context
1896
1894
  # Specifies the Amazon Web Services KMS Encryption Context to use for
1897
- # object encryption. The value of this header is a Base64-encoded string
1895
+ # object encryption. The value of this header is a Base64 encoded string
1898
1896
  # of a UTF-8 encoded JSON, which contains the encryption context as
1899
1897
  # key-value pairs.
1900
1898
  #
@@ -1983,6 +1981,14 @@ module Aws::S3
1983
1981
  #
1984
1982
  #
1985
1983
  # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
1984
+ # @option options [String] :checksum_type
1985
+ # Indicates the checksum type that you want Amazon S3 to use to
1986
+ # calculate the object’s checksum value. For more information, see
1987
+ # [Checking object integrity in the Amazon S3 User Guide][1].
1988
+ #
1989
+ #
1990
+ #
1991
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
1986
1992
  # @return [MultipartUpload]
1987
1993
  def initiate_multipart_upload(options = {})
1988
1994
  options = options.merge(
@@ -2012,9 +2018,10 @@ module Aws::S3
2012
2018
  # content_length: 1,
2013
2019
  # content_md5: "ContentMD5",
2014
2020
  # content_type: "ContentType",
2015
- # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
2021
+ # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256, CRC64NVME
2016
2022
  # checksum_crc32: "ChecksumCRC32",
2017
2023
  # checksum_crc32c: "ChecksumCRC32C",
2024
+ # checksum_crc64nvme: "ChecksumCRC64NVME",
2018
2025
  # checksum_sha1: "ChecksumSHA1",
2019
2026
  # checksum_sha256: "ChecksumSHA256",
2020
2027
  # expires: Time.now,
@@ -2120,7 +2127,7 @@ module Aws::S3
2120
2127
  #
2121
2128
  # [1]: https://www.rfc-editor.org/rfc/rfc9110.html#name-content-length
2122
2129
  # @option options [String] :content_md5
2123
- # The base64-encoded 128-bit MD5 digest of the message (without the
2130
+ # The Base64 encoded 128-bit `MD5` digest of the message (without the
2124
2131
  # headers) according to RFC 1864. This header can be used as a message
2125
2132
  # integrity check to verify that the data is the same data that was
2126
2133
  # originally sent. Although it is optional, we recommend using the
@@ -2163,22 +2170,23 @@ module Aws::S3
2163
2170
  # For the `x-amz-checksum-algorithm ` header, replace ` algorithm ` with
2164
2171
  # the supported algorithm from the following list:
2165
2172
  #
2166
- # * `CRC32`
2173
+ # * `CRC-32`
2167
2174
  #
2168
- # * `CRC32C`
2175
+ # * `CRC-32C`
2169
2176
  #
2170
- # * `SHA1`
2177
+ # * `CRC-64NVME`
2171
2178
  #
2172
- # * `SHA256`
2179
+ # * `SHA-1`
2180
+ #
2181
+ # * `SHA-256`
2173
2182
  #
2174
2183
  # For more information, see [Checking object integrity][1] in the
2175
2184
  # *Amazon S3 User Guide*.
2176
2185
  #
2177
2186
  # If the individual checksum value you provide through
2178
2187
  # `x-amz-checksum-algorithm ` doesn't match the checksum algorithm you
2179
- # set through `x-amz-sdk-checksum-algorithm`, Amazon S3 ignores any
2180
- # provided `ChecksumAlgorithm` parameter and uses the checksum algorithm
2181
- # that matches the provided value in `x-amz-checksum-algorithm `.
2188
+ # set through `x-amz-sdk-checksum-algorithm`, Amazon S3 fails the
2189
+ # request with a `BadDigest` error.
2182
2190
  #
2183
2191
  # <note markdown="1"> The `Content-MD5` or `x-amz-sdk-checksum-algorithm` header is required
2184
2192
  # for any request to upload an object with a retention period configured
@@ -2198,7 +2206,7 @@ module Aws::S3
2198
2206
  # @option options [String] :checksum_crc32
2199
2207
  # This header can be used as a data integrity check to verify that the
2200
2208
  # data received is the same data that was originally sent. This header
2201
- # specifies the base64-encoded, 32-bit CRC-32 checksum of the object.
2209
+ # specifies the Base64 encoded, 32-bit `CRC-32` checksum of the object.
2202
2210
  # For more information, see [Checking object integrity][1] in the
2203
2211
  # *Amazon S3 User Guide*.
2204
2212
  #
@@ -2208,19 +2216,30 @@ module Aws::S3
2208
2216
  # @option options [String] :checksum_crc32c
2209
2217
  # This header can be used as a data integrity check to verify that the
2210
2218
  # data received is the same data that was originally sent. This header
2211
- # specifies the base64-encoded, 32-bit CRC-32C checksum of the object.
2219
+ # specifies the Base64 encoded, 32-bit `CRC-32C` checksum of the object.
2212
2220
  # For more information, see [Checking object integrity][1] in the
2213
2221
  # *Amazon S3 User Guide*.
2214
2222
  #
2215
2223
  #
2216
2224
  #
2217
2225
  # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
2226
+ # @option options [String] :checksum_crc64nvme
2227
+ # This header can be used as a data integrity check to verify that the
2228
+ # data received is the same data that was originally sent. This header
2229
+ # specifies the Base64 encoded, 64-bit `CRC-64NVME` checksum of the
2230
+ # object. The `CRC-64NVME` checksum is always a full object checksum.
2231
+ # For more information, see [Checking object integrity in the Amazon S3
2232
+ # User Guide][1].
2233
+ #
2234
+ #
2235
+ #
2236
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
2218
2237
  # @option options [String] :checksum_sha1
2219
2238
  # This header can be used as a data integrity check to verify that the
2220
2239
  # data received is the same data that was originally sent. This header
2221
- # specifies the base64-encoded, 160-bit SHA-1 digest of the object. For
2222
- # more information, see [Checking object integrity][1] in the *Amazon S3
2223
- # User Guide*.
2240
+ # specifies the Base64 encoded, 160-bit `SHA-1` digest of the object.
2241
+ # For more information, see [Checking object integrity][1] in the
2242
+ # *Amazon S3 User Guide*.
2224
2243
  #
2225
2244
  #
2226
2245
  #
@@ -2228,7 +2247,7 @@ module Aws::S3
2228
2247
  # @option options [String] :checksum_sha256
2229
2248
  # This header can be used as a data integrity check to verify that the
2230
2249
  # data received is the same data that was originally sent. This header
2231
- # specifies the base64-encoded, 256-bit SHA-256 digest of the object.
2250
+ # specifies the Base64 encoded, 256-bit `SHA-256` digest of the object.
2232
2251
  # For more information, see [Checking object integrity][1] in the
2233
2252
  # *Amazon S3 User Guide*.
2234
2253
  #
@@ -2475,20 +2494,17 @@ module Aws::S3
2475
2494
  # `x-amz-server-side-encryption-aws-kms-key-id`, Amazon S3 uses the
2476
2495
  # Amazon Web Services managed key (`aws/s3`) to protect the data.
2477
2496
  #
2478
- # **Directory buckets** - If you specify `x-amz-server-side-encryption`
2479
- # with `aws:kms`, the ` x-amz-server-side-encryption-aws-kms-key-id`
2480
- # header is implicitly assigned the ID of the KMS symmetric encryption
2481
- # customer managed key that's configured for your directory bucket's
2482
- # default encryption setting. If you want to specify the `
2483
- # x-amz-server-side-encryption-aws-kms-key-id` header explicitly, you
2484
- # can only specify it with the ID (Key ID or Key ARN) of the KMS
2485
- # customer managed key that's configured for your directory bucket's
2486
- # default encryption setting. Otherwise, you get an HTTP `400 Bad
2487
- # Request` error. Only use the key ID or key ARN. The key alias format
2488
- # of the KMS key isn't supported. Your SSE-KMS configuration can only
2489
- # support 1 [customer managed key][1] per directory bucket for the
2490
- # lifetime of the bucket. The [Amazon Web Services managed key][2]
2491
- # (`aws/s3`) isn't supported.
2497
+ # **Directory buckets** - To encrypt data using SSE-KMS, it's
2498
+ # recommended to specify the `x-amz-server-side-encryption` header to
2499
+ # `aws:kms`. Then, the `x-amz-server-side-encryption-aws-kms-key-id`
2500
+ # header implicitly uses the bucket's default KMS customer managed key
2501
+ # ID. If you want to explicitly set the `
2502
+ # x-amz-server-side-encryption-aws-kms-key-id` header, it must match the
2503
+ # bucket's default customer managed key (using key ID or ARN, not
2504
+ # alias). Your SSE-KMS configuration can only support 1 [customer
2505
+ # managed key][1] per directory bucket's lifetime. The [Amazon Web
2506
+ # Services managed key][2] (`aws/s3`) isn't supported. Incorrect key
2507
+ # specification results in an HTTP `400 Bad Request` error.
2492
2508
  #
2493
2509
  #
2494
2510
  #
@@ -2497,7 +2513,7 @@ module Aws::S3
2497
2513
  # @option options [String] :ssekms_encryption_context
2498
2514
  # Specifies the Amazon Web Services KMS Encryption Context as an
2499
2515
  # additional encryption context to use for object encryption. The value
2500
- # of this header is a Base64-encoded string of a UTF-8 encoded JSON,
2516
+ # of this header is a Base64 encoded string of a UTF-8 encoded JSON,
2501
2517
  # which contains the encryption context as key-value pairs. This value
2502
2518
  # is stored as object metadata and automatically gets passed on to
2503
2519
  # Amazon Web Services KMS for future `GetObject` operations on this
@@ -2692,7 +2708,7 @@ module Aws::S3
2692
2708
  # },
2693
2709
  # },
2694
2710
  # request_payer: "requester", # accepts requester
2695
- # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
2711
+ # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256, CRC64NVME
2696
2712
  # expected_bucket_owner: "AccountId",
2697
2713
  # })
2698
2714
  # @param [Hash] options ({})
@@ -2869,7 +2885,7 @@ module Aws::S3
2869
2885
  # request_payer: "requester", # accepts requester
2870
2886
  # bypass_governance_retention: false,
2871
2887
  # expected_bucket_owner: "AccountId",
2872
- # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
2888
+ # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256, CRC64NVME
2873
2889
  # })
2874
2890
  # @param options ({})
2875
2891
  # @option options [String] :mfa
@@ -2933,22 +2949,23 @@ module Aws::S3
2933
2949
  # For the `x-amz-checksum-algorithm ` header, replace ` algorithm ` with
2934
2950
  # the supported algorithm from the following list:
2935
2951
  #
2936
- # * `CRC32`
2952
+ # * `CRC-32`
2953
+ #
2954
+ # * `CRC-32C`
2937
2955
  #
2938
- # * `CRC32C`
2956
+ # * `CRC-64NVME`
2939
2957
  #
2940
- # * `SHA1`
2958
+ # * `SHA-1`
2941
2959
  #
2942
- # * `SHA256`
2960
+ # * `SHA-256`
2943
2961
  #
2944
2962
  # For more information, see [Checking object integrity][1] in the
2945
2963
  # *Amazon S3 User Guide*.
2946
2964
  #
2947
2965
  # If the individual checksum value you provide through
2948
2966
  # `x-amz-checksum-algorithm ` doesn't match the checksum algorithm you
2949
- # set through `x-amz-sdk-checksum-algorithm`, Amazon S3 ignores any
2950
- # provided `ChecksumAlgorithm` parameter and uses the checksum algorithm
2951
- # that matches the provided value in `x-amz-checksum-algorithm `.
2967
+ # set through `x-amz-sdk-checksum-algorithm`, Amazon S3 fails the
2968
+ # request with a `BadDigest` error.
2952
2969
  #
2953
2970
  # If you provide an individual checksum, Amazon S3 ignores any provided
2954
2971
  # `ChecksumAlgorithm` parameter.
@@ -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
@@ -314,7 +326,7 @@ module Aws::S3
314
326
  #
315
327
  #
316
328
  #
317
- # [1]: https://docs.aws.amazon.com/https:/tools.ietf.org/html/rfc7232
329
+ # [1]: https://tools.ietf.org/html/rfc7232
318
330
  # @option options [Time,DateTime,Date,Integer,String] :if_match_last_modified_time
319
331
  # If present, the object is deleted only if its modification times
320
332
  # matches the provided `Timestamp`. If the `Timestamp` values do not
@@ -566,15 +578,6 @@ module Aws::S3
566
578
  # fails with the HTTP status code `403 Forbidden` (access denied).
567
579
  # @option options [String] :checksum_mode
568
580
  # To retrieve the checksum, this mode must be enabled.
569
- #
570
- # **General purpose buckets** - In addition, if you enable checksum mode
571
- # and the object is uploaded with a [checksum][1] and encrypted with an
572
- # Key Management Service (KMS) key, you must have permission to use the
573
- # `kms:Decrypt` action to retrieve the checksum.
574
- #
575
- #
576
- #
577
- # [1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Checksum.html
578
581
  # @return [Types::GetObjectOutput]
579
582
  def get(options = {}, &block)
580
583
  options = options.merge(
@@ -848,7 +851,7 @@ module Aws::S3
848
851
  # request_payer: "requester", # accepts requester
849
852
  # bypass_governance_retention: false,
850
853
  # expected_bucket_owner: "AccountId",
851
- # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
854
+ # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256, CRC64NVME
852
855
  # })
853
856
  # @param options ({})
854
857
  # @option options [String] :mfa
@@ -912,22 +915,23 @@ module Aws::S3
912
915
  # For the `x-amz-checksum-algorithm ` header, replace ` algorithm ` with
913
916
  # the supported algorithm from the following list:
914
917
  #
915
- # * `CRC32`
918
+ # * `CRC-32`
919
+ #
920
+ # * `CRC-32C`
916
921
  #
917
- # * `CRC32C`
922
+ # * `CRC-64NVME`
918
923
  #
919
- # * `SHA1`
924
+ # * `SHA-1`
920
925
  #
921
- # * `SHA256`
926
+ # * `SHA-256`
922
927
  #
923
928
  # For more information, see [Checking object integrity][1] in the
924
929
  # *Amazon S3 User Guide*.
925
930
  #
926
931
  # If the individual checksum value you provide through
927
932
  # `x-amz-checksum-algorithm ` doesn't match the checksum algorithm you
928
- # set through `x-amz-sdk-checksum-algorithm`, Amazon S3 ignores any
929
- # provided `ChecksumAlgorithm` parameter and uses the checksum algorithm
930
- # 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.
931
935
  #
932
936
  # If you provide an individual checksum, Amazon S3 ignores any provided
933
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
@@ -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 (props = context[:endpoint_properties])
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
- # if s3 express auth, use new credentials and sign additional header
42
- if context[:auth_scheme]['name'] == 'sigv4-s3express' &&
43
- !context.config.disable_s3_express_session_auth
44
- bucket = context.params[:bucket]
45
- credentials_provider = context.config.express_credentials_provider
46
- credentials = credentials_provider.express_credentials_for(bucket)
47
- context[:sigv4_credentials] = credentials # Sign will use this
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 checksum_required?(context)
62
- context.operation.http_checksum_required ||
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
 
@@ -6,81 +6,20 @@ module Aws
6
6
  module S3
7
7
  module Plugins
8
8
  # @api private
9
- # This plugin is effectively deprecated in favor of modeled
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
- default: true,
64
- doc_type: 'Boolean',
65
- docstring: <<-DOCS)
66
- When `true` a MD5 checksum will be computed and sent in the Content Md5
67
- header for :put_object and :upload_part. When `false`, MD5 checksums
68
- will not be computed for these operations. Checksums are still computed
69
- for operations requiring them. Checksum errors returned by Amazon S3 are
70
- automatically retried up to `:retry_limit` times.
71
- DOCS
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
@@ -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
@@ -41,7 +41,7 @@ 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
46
  # type: "AvailabilityZone", # accepts AvailabilityZone, LocalZone
47
47
  # name: "LocationNameAsString",