aws-sdk-s3 1.109.0 → 1.114.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +50 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-s3/bucket.rb +96 -17
  5. data/lib/aws-sdk-s3/bucket_acl.rb +18 -2
  6. data/lib/aws-sdk-s3/bucket_cors.rb +20 -4
  7. data/lib/aws-sdk-s3/bucket_lifecycle.rb +20 -4
  8. data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +20 -4
  9. data/lib/aws-sdk-s3/bucket_logging.rb +18 -2
  10. data/lib/aws-sdk-s3/bucket_notification.rb +2 -2
  11. data/lib/aws-sdk-s3/bucket_policy.rb +20 -4
  12. data/lib/aws-sdk-s3/bucket_request_payment.rb +18 -2
  13. data/lib/aws-sdk-s3/bucket_tagging.rb +20 -4
  14. data/lib/aws-sdk-s3/bucket_versioning.rb +54 -6
  15. data/lib/aws-sdk-s3/bucket_website.rb +20 -4
  16. data/lib/aws-sdk-s3/client.rb +1760 -638
  17. data/lib/aws-sdk-s3/client_api.rb +371 -21
  18. data/lib/aws-sdk-s3/customizations/object.rb +2 -2
  19. data/lib/aws-sdk-s3/file_downloader.rb +1 -1
  20. data/lib/aws-sdk-s3/file_uploader.rb +5 -0
  21. data/lib/aws-sdk-s3/multipart_file_uploader.rb +26 -7
  22. data/lib/aws-sdk-s3/multipart_upload.rb +126 -12
  23. data/lib/aws-sdk-s3/multipart_upload_part.rb +132 -13
  24. data/lib/aws-sdk-s3/object.rb +245 -73
  25. data/lib/aws-sdk-s3/object_acl.rb +20 -4
  26. data/lib/aws-sdk-s3/object_summary.rb +166 -42
  27. data/lib/aws-sdk-s3/object_version.rb +64 -38
  28. data/lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb +6 -0
  29. data/lib/aws-sdk-s3/plugins/md5s.rb +5 -3
  30. data/lib/aws-sdk-s3/plugins/s3_signer.rb +6 -1
  31. data/lib/aws-sdk-s3/plugins/skip_whole_multipart_get_checksums.rb +31 -0
  32. data/lib/aws-sdk-s3/plugins/streaming_retry.rb +23 -2
  33. data/lib/aws-sdk-s3/presigned_post.rb +38 -19
  34. data/lib/aws-sdk-s3/types.rb +2250 -484
  35. data/lib/aws-sdk-s3.rb +1 -1
  36. metadata +5 -4
@@ -66,12 +66,20 @@ module Aws::S3
66
66
  #
67
67
  # * If an object is created by either the Multipart Upload or Part Copy
68
68
  # operation, the ETag is not an MD5 digest, regardless of the method
69
- # of encryption.
69
+ # of encryption. If an object is larger than 16 MB, the Amazon Web
70
+ # Services Management Console will upload or copy that object as a
71
+ # Multipart Upload, and therefore the ETag will not be an MD5 digest.
70
72
  # @return [String]
71
73
  def etag
72
74
  data[:etag]
73
75
  end
74
76
 
77
+ # The algorithm that was used to create a checksum of the object.
78
+ # @return [Array<String>]
79
+ def checksum_algorithm
80
+ data[:checksum_algorithm]
81
+ end
82
+
75
83
  # Size in bytes of the object
76
84
  # @return [Integer]
77
85
  def size
@@ -276,6 +284,7 @@ module Aws::S3
276
284
  # object_summary.copy_from({
277
285
  # acl: "private", # accepts private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-owner-full-control
278
286
  # cache_control: "CacheControl",
287
+ # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
279
288
  # content_disposition: "ContentDisposition",
280
289
  # content_encoding: "ContentEncoding",
281
290
  # content_language: "ContentLanguage",
@@ -322,6 +331,14 @@ module Aws::S3
322
331
  # This action is not supported by Amazon S3 on Outposts.
323
332
  # @option options [String] :cache_control
324
333
  # Specifies caching behavior along the request/reply chain.
334
+ # @option options [String] :checksum_algorithm
335
+ # Indicates the algorithm you want Amazon S3 to use to create the
336
+ # checksum for the object. For more information, see [Checking object
337
+ # integrity][1] in the *Amazon S3 User Guide*.
338
+ #
339
+ #
340
+ #
341
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
325
342
  # @option options [String] :content_disposition
326
343
  # Specifies presentational information for the object.
327
344
  # @option options [String] :content_encoding
@@ -341,8 +358,8 @@ module Aws::S3
341
358
  # of the source bucket and the key of the source object, separated by
342
359
  # a slash (/). For example, to copy the object `reports/january.pdf`
343
360
  # from the bucket `awsexamplebucket`, use
344
- # `awsexamplebucket/reports/january.pdf`. The value must be URL
345
- # encoded.
361
+ # `awsexamplebucket/reports/january.pdf`. The value must be
362
+ # URL-encoded.
346
363
  #
347
364
  # * For objects accessed through access points, specify the Amazon
348
365
  # Resource Name (ARN) of the object as accessed through the access
@@ -367,7 +384,7 @@ module Aws::S3
367
384
  # outpost `my-outpost` owned by account `123456789012` in Region
368
385
  # `us-west-2`, use the URL encoding of
369
386
  # `arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/object/reports/january.pdf`.
370
- # The value must be URL encoded.
387
+ # The value must be URL-encoded.
371
388
  #
372
389
  # To copy a specific version of an object, append
373
390
  # `?versionId=<version-id>` to the value (for example,
@@ -484,8 +501,8 @@ module Aws::S3
484
501
  # @option options [String] :request_payer
485
502
  # Confirms that the requester knows that they will be charged for the
486
503
  # request. Bucket owners need not specify this parameter in their
487
- # requests. For information about downloading objects from requester
488
- # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
504
+ # requests. For information about downloading objects from Requester
505
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
489
506
  # in the *Amazon S3 User Guide*.
490
507
  #
491
508
  #
@@ -501,15 +518,15 @@ module Aws::S3
501
518
  # The date and time when you want the copied object's Object Lock to
502
519
  # expire.
503
520
  # @option options [String] :object_lock_legal_hold_status
504
- # Specifies whether you want to apply a Legal Hold to the copied object.
521
+ # Specifies whether you want to apply a legal hold to the copied object.
505
522
  # @option options [String] :expected_bucket_owner
506
523
  # The account ID of the expected destination bucket owner. If the
507
- # destination bucket is owned by a different account, the request will
508
- # fail with an HTTP `403 (Access Denied)` error.
524
+ # destination bucket is owned by a different account, the request fails
525
+ # with the HTTP status code `403 Forbidden` (access denied).
509
526
  # @option options [String] :expected_source_bucket_owner
510
527
  # The account ID of the expected source bucket owner. If the source
511
- # bucket is owned by a different account, the request will fail with an
512
- # HTTP `403 (Access Denied)` error.
528
+ # bucket is owned by a different account, the request fails with the
529
+ # HTTP status code `403 Forbidden` (access denied).
513
530
  # @return [Types::CopyObjectOutput]
514
531
  def copy_from(options = {})
515
532
  options = options.merge(
@@ -540,8 +557,8 @@ module Aws::S3
540
557
  # @option options [String] :request_payer
541
558
  # Confirms that the requester knows that they will be charged for the
542
559
  # request. Bucket owners need not specify this parameter in their
543
- # requests. For information about downloading objects from requester
544
- # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
560
+ # requests. For information about downloading objects from Requester
561
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
545
562
  # in the *Amazon S3 User Guide*.
546
563
  #
547
564
  #
@@ -550,11 +567,11 @@ module Aws::S3
550
567
  # @option options [Boolean] :bypass_governance_retention
551
568
  # Indicates whether S3 Object Lock should bypass Governance-mode
552
569
  # restrictions to process this operation. To use this header, you must
553
- # have the `s3:PutBucketPublicAccessBlock` permission.
570
+ # have the `s3:BypassGovernanceRetention` permission.
554
571
  # @option options [String] :expected_bucket_owner
555
572
  # The account ID of the expected bucket owner. If the bucket is owned by
556
- # a different account, the request will fail with an HTTP `403 (Access
557
- # Denied)` error.
573
+ # a different account, the request fails with the HTTP status code `403
574
+ # Forbidden` (access denied).
558
575
  # @return [Types::DeleteObjectOutput]
559
576
  def delete(options = {})
560
577
  options = options.merge(
@@ -586,20 +603,21 @@ module Aws::S3
586
603
  # request_payer: "requester", # accepts requester
587
604
  # part_number: 1,
588
605
  # expected_bucket_owner: "AccountId",
606
+ # checksum_mode: "ENABLED", # accepts ENABLED
589
607
  # })
590
608
  # @param [Hash] options ({})
591
609
  # @option options [String] :if_match
592
610
  # Return the object only if its entity tag (ETag) is the same as the one
593
- # specified, otherwise return a 412 (precondition failed).
611
+ # specified; otherwise, return a 412 (precondition failed) error.
594
612
  # @option options [Time,DateTime,Date,Integer,String] :if_modified_since
595
613
  # Return the object only if it has been modified since the specified
596
- # time, otherwise return a 304 (not modified).
614
+ # time; otherwise, return a 304 (not modified) error.
597
615
  # @option options [String] :if_none_match
598
616
  # Return the object only if its entity tag (ETag) is different from the
599
- # one specified, otherwise return a 304 (not modified).
617
+ # one specified; otherwise, return a 304 (not modified) error.
600
618
  # @option options [Time,DateTime,Date,Integer,String] :if_unmodified_since
601
619
  # Return the object only if it has not been modified since the specified
602
- # time, otherwise return a 412 (precondition failed).
620
+ # time; otherwise, return a 412 (precondition failed) error.
603
621
  # @option options [String] :range
604
622
  # Downloads the specified range bytes of an object. For more information
605
623
  # about the HTTP Range header, see
@@ -643,8 +661,8 @@ module Aws::S3
643
661
  # @option options [String] :request_payer
644
662
  # Confirms that the requester knows that they will be charged for the
645
663
  # request. Bucket owners need not specify this parameter in their
646
- # requests. For information about downloading objects from requester
647
- # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
664
+ # requests. For information about downloading objects from Requester
665
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
648
666
  # in the *Amazon S3 User Guide*.
649
667
  #
650
668
  #
@@ -657,8 +675,10 @@ module Aws::S3
657
675
  # object.
658
676
  # @option options [String] :expected_bucket_owner
659
677
  # The account ID of the expected bucket owner. If the bucket is owned by
660
- # a different account, the request will fail with an HTTP `403 (Access
661
- # Denied)` error.
678
+ # a different account, the request fails with the HTTP status code `403
679
+ # Forbidden` (access denied).
680
+ # @option options [String] :checksum_mode
681
+ # To retrieve the checksum, this mode must be enabled.
662
682
  # @return [Types::GetObjectOutput]
663
683
  def get(options = {}, &block)
664
684
  options = options.merge(
@@ -701,6 +721,7 @@ module Aws::S3
701
721
  # object_lock_retain_until_date: Time.now,
702
722
  # object_lock_legal_hold_status: "ON", # accepts ON, OFF
703
723
  # expected_bucket_owner: "AccountId",
724
+ # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
704
725
  # })
705
726
  # @param [Hash] options ({})
706
727
  # @option options [String] :acl
@@ -798,8 +819,8 @@ module Aws::S3
798
819
  # @option options [String] :request_payer
799
820
  # Confirms that the requester knows that they will be charged for the
800
821
  # request. Bucket owners need not specify this parameter in their
801
- # requests. For information about downloading objects from requester
802
- # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
822
+ # requests. For information about downloading objects from Requester
823
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
803
824
  # in the *Amazon S3 User Guide*.
804
825
  #
805
826
  #
@@ -814,12 +835,20 @@ module Aws::S3
814
835
  # @option options [Time,DateTime,Date,Integer,String] :object_lock_retain_until_date
815
836
  # Specifies the date and time when you want the Object Lock to expire.
816
837
  # @option options [String] :object_lock_legal_hold_status
817
- # Specifies whether you want to apply a Legal Hold to the uploaded
838
+ # Specifies whether you want to apply a legal hold to the uploaded
818
839
  # object.
819
840
  # @option options [String] :expected_bucket_owner
820
841
  # The account ID of the expected bucket owner. If the bucket is owned by
821
- # a different account, the request will fail with an HTTP `403 (Access
822
- # Denied)` error.
842
+ # a different account, the request fails with the HTTP status code `403
843
+ # Forbidden` (access denied).
844
+ # @option options [String] :checksum_algorithm
845
+ # Indicates the algorithm you want Amazon S3 to use to create the
846
+ # checksum for the object. For more information, see [Checking object
847
+ # integrity][1] in the *Amazon S3 User Guide*.
848
+ #
849
+ #
850
+ #
851
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
823
852
  # @return [MultipartUpload]
824
853
  def initiate_multipart_upload(options = {})
825
854
  options = options.merge(
@@ -847,6 +876,11 @@ module Aws::S3
847
876
  # content_length: 1,
848
877
  # content_md5: "ContentMD5",
849
878
  # content_type: "ContentType",
879
+ # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
880
+ # checksum_crc32: "ChecksumCRC32",
881
+ # checksum_crc32c: "ChecksumCRC32C",
882
+ # checksum_sha1: "ChecksumSHA1",
883
+ # checksum_sha256: "ChecksumSHA256",
850
884
  # expires: Time.now,
851
885
  # grant_full_control: "GrantFullControl",
852
886
  # grant_read: "GrantRead",
@@ -938,6 +972,61 @@ module Aws::S3
938
972
  #
939
973
  #
940
974
  # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17
975
+ # @option options [String] :checksum_algorithm
976
+ # Indicates the algorithm used to create the checksum for the object
977
+ # when using the SDK. This header will not provide any additional
978
+ # functionality if not using the SDK. When sending this header, there
979
+ # must be a corresponding `x-amz-checksum` or `x-amz-trailer` header
980
+ # sent. Otherwise, Amazon S3 fails the request with the HTTP status code
981
+ # `400 Bad Request`. For more information, see [Checking object
982
+ # integrity][1] in the *Amazon S3 User Guide*.
983
+ #
984
+ # If you provide an individual checksum, Amazon S3 ignores any provided
985
+ # `ChecksumAlgorithm` parameter.
986
+ #
987
+ #
988
+ #
989
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
990
+ # @option options [String] :checksum_crc32
991
+ # This header can be used as a data integrity check to verify that the
992
+ # data received is the same data that was originally sent. This header
993
+ # specifies the base64-encoded, 32-bit CRC32 checksum of the object. For
994
+ # more information, see [Checking object integrity][1] in the *Amazon S3
995
+ # User Guide*.
996
+ #
997
+ #
998
+ #
999
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
1000
+ # @option options [String] :checksum_crc32c
1001
+ # This header can be used as a data integrity check to verify that the
1002
+ # data received is the same data that was originally sent. This header
1003
+ # specifies the base64-encoded, 32-bit CRC32C checksum of the object.
1004
+ # For more information, see [Checking object integrity][1] in the
1005
+ # *Amazon S3 User Guide*.
1006
+ #
1007
+ #
1008
+ #
1009
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
1010
+ # @option options [String] :checksum_sha1
1011
+ # This header can be used as a data integrity check to verify that the
1012
+ # data received is the same data that was originally sent. This header
1013
+ # specifies the base64-encoded, 160-bit SHA-1 digest of the object. For
1014
+ # more information, see [Checking object integrity][1] in the *Amazon S3
1015
+ # User Guide*.
1016
+ #
1017
+ #
1018
+ #
1019
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
1020
+ # @option options [String] :checksum_sha256
1021
+ # This header can be used as a data integrity check to verify that the
1022
+ # data received is the same data that was originally sent. This header
1023
+ # specifies the base64-encoded, 256-bit SHA-256 digest of the object.
1024
+ # For more information, see [Checking object integrity][1] in the
1025
+ # *Amazon S3 User Guide*.
1026
+ #
1027
+ #
1028
+ #
1029
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
941
1030
  # @option options [Time,DateTime,Date,Integer,String] :expires
942
1031
  # The date and time at which the object is no longer cacheable. For more
943
1032
  # information, see
@@ -1042,8 +1131,8 @@ module Aws::S3
1042
1131
  # @option options [String] :request_payer
1043
1132
  # Confirms that the requester knows that they will be charged for the
1044
1133
  # request. Bucket owners need not specify this parameter in their
1045
- # requests. For information about downloading objects from requester
1046
- # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
1134
+ # requests. For information about downloading objects from Requester
1135
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
1047
1136
  # in the *Amazon S3 User Guide*.
1048
1137
  #
1049
1138
  #
@@ -1066,8 +1155,8 @@ module Aws::S3
1066
1155
  # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html
1067
1156
  # @option options [String] :expected_bucket_owner
1068
1157
  # The account ID of the expected bucket owner. If the bucket is owned by
1069
- # a different account, the request will fail with an HTTP `403 (Access
1070
- # Denied)` error.
1158
+ # a different account, the request fails with the HTTP status code `403
1159
+ # Forbidden` (access denied).
1071
1160
  # @return [Types::PutObjectOutput]
1072
1161
  def put(options = {})
1073
1162
  options = options.merge(
@@ -1164,6 +1253,7 @@ module Aws::S3
1164
1253
  # },
1165
1254
  # },
1166
1255
  # request_payer: "requester", # accepts requester
1256
+ # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
1167
1257
  # expected_bucket_owner: "AccountId",
1168
1258
  # })
1169
1259
  # @param [Hash] options ({})
@@ -1174,17 +1264,32 @@ module Aws::S3
1174
1264
  # @option options [String] :request_payer
1175
1265
  # Confirms that the requester knows that they will be charged for the
1176
1266
  # request. Bucket owners need not specify this parameter in their
1177
- # requests. For information about downloading objects from requester
1178
- # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
1267
+ # requests. For information about downloading objects from Requester
1268
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
1179
1269
  # in the *Amazon S3 User Guide*.
1180
1270
  #
1181
1271
  #
1182
1272
  #
1183
1273
  # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
1274
+ # @option options [String] :checksum_algorithm
1275
+ # Indicates the algorithm used to create the checksum for the object
1276
+ # when using the SDK. This header will not provide any additional
1277
+ # functionality if not using the SDK. When sending this header, there
1278
+ # must be a corresponding `x-amz-checksum` or `x-amz-trailer` header
1279
+ # sent. Otherwise, Amazon S3 fails the request with the HTTP status code
1280
+ # `400 Bad Request`. For more information, see [Checking object
1281
+ # integrity][1] in the *Amazon S3 User Guide*.
1282
+ #
1283
+ # If you provide an individual checksum, Amazon S3 ignores any provided
1284
+ # `ChecksumAlgorithm` parameter.
1285
+ #
1286
+ #
1287
+ #
1288
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
1184
1289
  # @option options [String] :expected_bucket_owner
1185
1290
  # The account ID of the expected bucket owner. If the bucket is owned by
1186
- # a different account, the request will fail with an HTTP `403 (Access
1187
- # Denied)` error.
1291
+ # a different account, the request fails with the HTTP status code `403
1292
+ # Forbidden` (access denied).
1188
1293
  # @return [Types::RestoreObjectOutput]
1189
1294
  def restore_object(options = {})
1190
1295
  options = options.merge(
@@ -1317,6 +1422,7 @@ module Aws::S3
1317
1422
  # request_payer: "requester", # accepts requester
1318
1423
  # bypass_governance_retention: false,
1319
1424
  # expected_bucket_owner: "AccountId",
1425
+ # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
1320
1426
  # })
1321
1427
  # @param options ({})
1322
1428
  # @option options [String] :mfa
@@ -1327,8 +1433,8 @@ module Aws::S3
1327
1433
  # @option options [String] :request_payer
1328
1434
  # Confirms that the requester knows that they will be charged for the
1329
1435
  # request. Bucket owners need not specify this parameter in their
1330
- # requests. For information about downloading objects from requester
1331
- # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
1436
+ # requests. For information about downloading objects from Requester
1437
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
1332
1438
  # in the *Amazon S3 User Guide*.
1333
1439
  #
1334
1440
  #
@@ -1337,11 +1443,29 @@ module Aws::S3
1337
1443
  # @option options [Boolean] :bypass_governance_retention
1338
1444
  # Specifies whether you want to delete this object even if it has a
1339
1445
  # Governance-type Object Lock in place. To use this header, you must
1340
- # have the `s3:PutBucketPublicAccessBlock` permission.
1446
+ # have the `s3:BypassGovernanceRetention` permission.
1341
1447
  # @option options [String] :expected_bucket_owner
1342
1448
  # The account ID of the expected bucket owner. If the bucket is owned by
1343
- # a different account, the request will fail with an HTTP `403 (Access
1344
- # Denied)` error.
1449
+ # a different account, the request fails with the HTTP status code `403
1450
+ # Forbidden` (access denied).
1451
+ # @option options [String] :checksum_algorithm
1452
+ # Indicates the algorithm used to create the checksum for the object
1453
+ # when using the SDK. This header will not provide any additional
1454
+ # functionality if not using the SDK. When sending this header, there
1455
+ # must be a corresponding `x-amz-checksum` or `x-amz-trailer` header
1456
+ # sent. Otherwise, Amazon S3 fails the request with the HTTP status code
1457
+ # `400 Bad Request`. For more information, see [Checking object
1458
+ # integrity][1] in the *Amazon S3 User Guide*.
1459
+ #
1460
+ # If you provide an individual checksum, Amazon S3 ignores any provided
1461
+ # `ChecksumAlgorithm` parameter.
1462
+ #
1463
+ # This checksum algorithm must be the same for all parts and it match
1464
+ # the checksum value supplied in the `CreateMultipartUpload` request.
1465
+ #
1466
+ #
1467
+ #
1468
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
1345
1469
  # @return [void]
1346
1470
  def batch_delete!(options = {})
1347
1471
  batch_enum.each do |batch|
@@ -56,6 +56,12 @@ module Aws::S3
56
56
  data[:etag]
57
57
  end
58
58
 
59
+ # The algorithm that was used to create a checksum of the object.
60
+ # @return [Array<String>]
61
+ def checksum_algorithm
62
+ data[:checksum_algorithm]
63
+ end
64
+
59
65
  # Size in bytes of the object.
60
66
  # @return [Integer]
61
67
  def size
@@ -245,8 +251,8 @@ module Aws::S3
245
251
  # @option options [String] :request_payer
246
252
  # Confirms that the requester knows that they will be charged for the
247
253
  # request. Bucket owners need not specify this parameter in their
248
- # requests. For information about downloading objects from requester
249
- # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
254
+ # requests. For information about downloading objects from Requester
255
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
250
256
  # in the *Amazon S3 User Guide*.
251
257
  #
252
258
  #
@@ -255,11 +261,11 @@ module Aws::S3
255
261
  # @option options [Boolean] :bypass_governance_retention
256
262
  # Indicates whether S3 Object Lock should bypass Governance-mode
257
263
  # restrictions to process this operation. To use this header, you must
258
- # have the `s3:PutBucketPublicAccessBlock` permission.
264
+ # have the `s3:BypassGovernanceRetention` permission.
259
265
  # @option options [String] :expected_bucket_owner
260
266
  # The account ID of the expected bucket owner. If the bucket is owned by
261
- # a different account, the request will fail with an HTTP `403 (Access
262
- # Denied)` error.
267
+ # a different account, the request fails with the HTTP status code `403
268
+ # Forbidden` (access denied).
263
269
  # @return [Types::DeleteObjectOutput]
264
270
  def delete(options = {})
265
271
  options = options.merge(
@@ -291,20 +297,21 @@ module Aws::S3
291
297
  # request_payer: "requester", # accepts requester
292
298
  # part_number: 1,
293
299
  # expected_bucket_owner: "AccountId",
300
+ # checksum_mode: "ENABLED", # accepts ENABLED
294
301
  # })
295
302
  # @param [Hash] options ({})
296
303
  # @option options [String] :if_match
297
304
  # Return the object only if its entity tag (ETag) is the same as the one
298
- # specified, otherwise return a 412 (precondition failed).
305
+ # specified; otherwise, return a 412 (precondition failed) error.
299
306
  # @option options [Time,DateTime,Date,Integer,String] :if_modified_since
300
307
  # Return the object only if it has been modified since the specified
301
- # time, otherwise return a 304 (not modified).
308
+ # time; otherwise, return a 304 (not modified) error.
302
309
  # @option options [String] :if_none_match
303
310
  # Return the object only if its entity tag (ETag) is different from the
304
- # one specified, otherwise return a 304 (not modified).
311
+ # one specified; otherwise, return a 304 (not modified) error.
305
312
  # @option options [Time,DateTime,Date,Integer,String] :if_unmodified_since
306
313
  # Return the object only if it has not been modified since the specified
307
- # time, otherwise return a 412 (precondition failed).
314
+ # time; otherwise, return a 412 (precondition failed) error.
308
315
  # @option options [String] :range
309
316
  # Downloads the specified range bytes of an object. For more information
310
317
  # about the HTTP Range header, see
@@ -346,8 +353,8 @@ module Aws::S3
346
353
  # @option options [String] :request_payer
347
354
  # Confirms that the requester knows that they will be charged for the
348
355
  # request. Bucket owners need not specify this parameter in their
349
- # requests. For information about downloading objects from requester
350
- # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
356
+ # requests. For information about downloading objects from Requester
357
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
351
358
  # in the *Amazon S3 User Guide*.
352
359
  #
353
360
  #
@@ -360,8 +367,10 @@ module Aws::S3
360
367
  # object.
361
368
  # @option options [String] :expected_bucket_owner
362
369
  # The account ID of the expected bucket owner. If the bucket is owned by
363
- # a different account, the request will fail with an HTTP `403 (Access
364
- # Denied)` error.
370
+ # a different account, the request fails with the HTTP status code `403
371
+ # Forbidden` (access denied).
372
+ # @option options [String] :checksum_mode
373
+ # To retrieve the checksum, this mode must be enabled.
365
374
  # @return [Types::GetObjectOutput]
366
375
  def get(options = {}, &block)
367
376
  options = options.merge(
@@ -387,33 +396,24 @@ module Aws::S3
387
396
  # request_payer: "requester", # accepts requester
388
397
  # part_number: 1,
389
398
  # expected_bucket_owner: "AccountId",
399
+ # checksum_mode: "ENABLED", # accepts ENABLED
390
400
  # })
391
401
  # @param [Hash] options ({})
392
402
  # @option options [String] :if_match
393
403
  # Return the object only if its entity tag (ETag) is the same as the one
394
- # specified, otherwise return a 412 (precondition failed).
404
+ # specified; otherwise, return a 412 (precondition failed) error.
395
405
  # @option options [Time,DateTime,Date,Integer,String] :if_modified_since
396
406
  # Return the object only if it has been modified since the specified
397
- # time, otherwise return a 304 (not modified).
407
+ # time; otherwise, return a 304 (not modified) error.
398
408
  # @option options [String] :if_none_match
399
409
  # Return the object only if its entity tag (ETag) is different from the
400
- # one specified, otherwise return a 304 (not modified).
410
+ # one specified; otherwise, return a 304 (not modified) error.
401
411
  # @option options [Time,DateTime,Date,Integer,String] :if_unmodified_since
402
412
  # Return the object only if it has not been modified since the specified
403
- # time, otherwise return a 412 (precondition failed).
413
+ # time; otherwise, return a 412 (precondition failed) error.
404
414
  # @option options [String] :range
405
- # Downloads the specified range bytes of an object. For more information
406
- # about the HTTP Range header, see
407
- # [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35][1].
408
- #
409
- # <note markdown="1"> Amazon S3 doesn't support retrieving multiple ranges of data per
410
- # `GET` request.
411
- #
412
- # </note>
413
- #
414
- #
415
- #
416
- # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
415
+ # Because `HeadObject` returns only the metadata for an object, this
416
+ # parameter has no effect.
417
417
  # @option options [String] :sse_customer_algorithm
418
418
  # Specifies the algorithm to use to when encrypting the object (for
419
419
  # example, AES256).
@@ -430,8 +430,8 @@ module Aws::S3
430
430
  # @option options [String] :request_payer
431
431
  # Confirms that the requester knows that they will be charged for the
432
432
  # request. Bucket owners need not specify this parameter in their
433
- # requests. For information about downloading objects from requester
434
- # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
433
+ # requests. For information about downloading objects from Requester
434
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
435
435
  # in the *Amazon S3 User Guide*.
436
436
  #
437
437
  #
@@ -444,8 +444,15 @@ module Aws::S3
444
444
  # the number of parts in this object.
445
445
  # @option options [String] :expected_bucket_owner
446
446
  # The account ID of the expected bucket owner. If the bucket is owned by
447
- # a different account, the request will fail with an HTTP `403 (Access
448
- # Denied)` error.
447
+ # a different account, the request fails with the HTTP status code `403
448
+ # Forbidden` (access denied).
449
+ # @option options [String] :checksum_mode
450
+ # To retrieve the checksum, this parameter must be enabled.
451
+ #
452
+ # In addition, if you enable `ChecksumMode` and the object is encrypted
453
+ # with Amazon Web Services Key Management Service (Amazon Web Services
454
+ # KMS), you must have permission to use the `kms:Decrypt` action for the
455
+ # request to succeed.
449
456
  # @return [Types::HeadObjectOutput]
450
457
  def head(options = {})
451
458
  options = options.merge(
@@ -525,6 +532,7 @@ module Aws::S3
525
532
  # request_payer: "requester", # accepts requester
526
533
  # bypass_governance_retention: false,
527
534
  # expected_bucket_owner: "AccountId",
535
+ # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
528
536
  # })
529
537
  # @param options ({})
530
538
  # @option options [String] :mfa
@@ -535,8 +543,8 @@ module Aws::S3
535
543
  # @option options [String] :request_payer
536
544
  # Confirms that the requester knows that they will be charged for the
537
545
  # request. Bucket owners need not specify this parameter in their
538
- # requests. For information about downloading objects from requester
539
- # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
546
+ # requests. For information about downloading objects from Requester
547
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
540
548
  # in the *Amazon S3 User Guide*.
541
549
  #
542
550
  #
@@ -545,11 +553,29 @@ module Aws::S3
545
553
  # @option options [Boolean] :bypass_governance_retention
546
554
  # Specifies whether you want to delete this object even if it has a
547
555
  # Governance-type Object Lock in place. To use this header, you must
548
- # have the `s3:PutBucketPublicAccessBlock` permission.
556
+ # have the `s3:BypassGovernanceRetention` permission.
549
557
  # @option options [String] :expected_bucket_owner
550
558
  # The account ID of the expected bucket owner. If the bucket is owned by
551
- # a different account, the request will fail with an HTTP `403 (Access
552
- # Denied)` error.
559
+ # a different account, the request fails with the HTTP status code `403
560
+ # Forbidden` (access denied).
561
+ # @option options [String] :checksum_algorithm
562
+ # Indicates the algorithm used to create the checksum for the object
563
+ # when using the SDK. This header will not provide any additional
564
+ # functionality if not using the SDK. When sending this header, there
565
+ # must be a corresponding `x-amz-checksum` or `x-amz-trailer` header
566
+ # sent. Otherwise, Amazon S3 fails the request with the HTTP status code
567
+ # `400 Bad Request`. For more information, see [Checking object
568
+ # integrity][1] in the *Amazon S3 User Guide*.
569
+ #
570
+ # If you provide an individual checksum, Amazon S3 ignores any provided
571
+ # `ChecksumAlgorithm` parameter.
572
+ #
573
+ # This checksum algorithm must be the same for all parts and it match
574
+ # the checksum value supplied in the `CreateMultipartUpload` request.
575
+ #
576
+ #
577
+ #
578
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
553
579
  # @return [void]
554
580
  def batch_delete!(options = {})
555
581
  batch_enum.each do |batch|
@@ -48,8 +48,14 @@ Defaults to `legacy` mode which uses the global endpoint.
48
48
  private
49
49
 
50
50
  def self.resolve_iad_regional_endpoint(cfg)
51
+ default_mode_value =
52
+ if cfg.respond_to?(:defaults_mode_config_resolver)
53
+ cfg.defaults_mode_config_resolver.resolve(:s3_us_east_1_regional_endpoint)
54
+ end
55
+
51
56
  mode = ENV['AWS_S3_US_EAST_1_REGIONAL_ENDPOINT'] ||
52
57
  Aws.shared_config.s3_us_east_1_regional_endpoint(profile: cfg.profile) ||
58
+ default_mode_value ||
53
59
  'legacy'
54
60
  mode = mode.downcase
55
61
  unless %w(legacy regional).include?(mode)
@@ -22,9 +22,11 @@ module Aws
22
22
  CHUNK_SIZE = 1 * 1024 * 1024 # one MB
23
23
 
24
24
  def call(context)
25
- body = context.http_request.body
26
- if body.respond_to?(:size) && body.size > 0
27
- context.http_request.headers['Content-Md5'] ||= md5(body)
25
+ if !context[:checksum_algorithms] # skip in favor of flexible checksum
26
+ body = context.http_request.body
27
+ if body.respond_to?(:size) && body.size > 0
28
+ context.http_request.headers['Content-Md5'] ||= md5(body)
29
+ end
28
30
  end
29
31
  @handler.call(context)
30
32
  end
@@ -138,7 +138,8 @@ module Aws
138
138
  def handle_region_errors(response)
139
139
  if wrong_sigv4_region?(response) &&
140
140
  !fips_region?(response) &&
141
- !custom_endpoint?(response)
141
+ !custom_endpoint?(response) &&
142
+ !expired_credentials?(response)
142
143
  get_region_and_retry(response.context)
143
144
  else
144
145
  response
@@ -162,6 +163,10 @@ module Aws
162
163
  resp.context.http_request.endpoint.host.include?('fips')
163
164
  end
164
165
 
166
+ def expired_credentials?(resp)
167
+ resp.context.http_response.body_contents.match(/<Code>ExpiredToken<\/Code>/)
168
+ end
169
+
165
170
  def custom_endpoint?(resp)
166
171
  resolved_suffix = Aws::Partitions::EndpointProvider.dns_suffix_for(
167
172
  resp.context.config.region,