aws-sdk-s3 1.122.0 → 1.136.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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +94 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-s3/bucket.rb +108 -49
  5. data/lib/aws-sdk-s3/bucket_acl.rb +9 -3
  6. data/lib/aws-sdk-s3/bucket_cors.rb +12 -4
  7. data/lib/aws-sdk-s3/bucket_lifecycle.rb +12 -4
  8. data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +12 -4
  9. data/lib/aws-sdk-s3/bucket_logging.rb +9 -3
  10. data/lib/aws-sdk-s3/bucket_notification.rb +9 -3
  11. data/lib/aws-sdk-s3/bucket_policy.rb +12 -4
  12. data/lib/aws-sdk-s3/bucket_request_payment.rb +9 -3
  13. data/lib/aws-sdk-s3/bucket_tagging.rb +12 -4
  14. data/lib/aws-sdk-s3/bucket_versioning.rb +15 -5
  15. data/lib/aws-sdk-s3/bucket_website.rb +12 -4
  16. data/lib/aws-sdk-s3/client.rb +727 -626
  17. data/lib/aws-sdk-s3/client_api.rb +24 -0
  18. data/lib/aws-sdk-s3/customizations/bucket.rb +3 -1
  19. data/lib/aws-sdk-s3/customizations/errors.rb +1 -1
  20. data/lib/aws-sdk-s3/customizations/object.rb +91 -18
  21. data/lib/aws-sdk-s3/encryption/client.rb +6 -2
  22. data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +13 -9
  23. data/lib/aws-sdk-s3/encryptionV2/client.rb +6 -2
  24. data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +1 -0
  25. data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +10 -6
  26. data/lib/aws-sdk-s3/endpoint_parameters.rb +4 -0
  27. data/lib/aws-sdk-s3/endpoint_provider.rb +22 -246
  28. data/lib/aws-sdk-s3/endpoints.rb +1 -0
  29. data/lib/aws-sdk-s3/file_downloader.rb +170 -44
  30. data/lib/aws-sdk-s3/file_uploader.rb +8 -6
  31. data/lib/aws-sdk-s3/multipart_stream_uploader.rb +5 -3
  32. data/lib/aws-sdk-s3/multipart_upload.rb +27 -13
  33. data/lib/aws-sdk-s3/multipart_upload_part.rb +19 -9
  34. data/lib/aws-sdk-s3/object.rb +125 -84
  35. data/lib/aws-sdk-s3/object_acl.rb +14 -6
  36. data/lib/aws-sdk-s3/object_copier.rb +7 -5
  37. data/lib/aws-sdk-s3/object_multipart_copier.rb +33 -17
  38. data/lib/aws-sdk-s3/object_summary.rb +123 -74
  39. data/lib/aws-sdk-s3/object_version.rb +49 -17
  40. data/lib/aws-sdk-s3/presigned_post.rb +52 -43
  41. data/lib/aws-sdk-s3/presigner.rb +4 -2
  42. data/lib/aws-sdk-s3/resource.rb +7 -3
  43. data/lib/aws-sdk-s3/types.rb +529 -299
  44. data/lib/aws-sdk-s3.rb +1 -1
  45. metadata +6 -6
@@ -240,7 +240,7 @@ module Aws::S3
240
240
  end
241
241
 
242
242
  # The server-side encryption algorithm used when storing this object in
243
- # Amazon S3 (for example, AES256, `aws:kms`).
243
+ # Amazon S3 (for example, `AES256`, `aws:kms`, `aws:kms:dsse`).
244
244
  # @return [String]
245
245
  def server_side_encryption
246
246
  data[:server_side_encryption]
@@ -269,16 +269,16 @@ module Aws::S3
269
269
  data[:sse_customer_key_md5]
270
270
  end
271
271
 
272
- # If present, specifies the ID of the Amazon Web Services Key Management
273
- # Service (Amazon Web Services KMS) symmetric encryption customer
274
- # managed key that was used for the object.
272
+ # If present, specifies the ID of the Key Management Service (KMS)
273
+ # symmetric encryption customer managed key that was used for the
274
+ # object.
275
275
  # @return [String]
276
276
  def ssekms_key_id
277
277
  data[:ssekms_key_id]
278
278
  end
279
279
 
280
280
  # Indicates whether the object uses an S3 Bucket Key for server-side
281
- # encryption with Amazon Web Services KMS (SSE-KMS).
281
+ # encryption with Key Management Service (KMS) keys (SSE-KMS).
282
282
  # @return [Boolean]
283
283
  def bucket_key_enabled
284
284
  data[:bucket_key_enabled]
@@ -407,10 +407,12 @@ module Aws::S3
407
407
  #
408
408
  # @return [self]
409
409
  def load
410
- resp = @client.head_object(
410
+ resp = Aws::Plugins::UserAgent.feature('resource') do
411
+ @client.head_object(
411
412
  bucket: @bucket_name,
412
413
  key: @key
413
414
  )
415
+ end
414
416
  @data = resp.data
415
417
  self
416
418
  end
@@ -455,8 +457,10 @@ module Aws::S3
455
457
  options, params = separate_params_and_options(options)
456
458
  waiter = Waiters::ObjectExists.new(options)
457
459
  yield_waiter_and_warn(waiter, &block) if block_given?
458
- waiter.wait(params.merge(bucket: @bucket_name,
460
+ Aws::Plugins::UserAgent.feature('resource') do
461
+ waiter.wait(params.merge(bucket: @bucket_name,
459
462
  key: @key))
463
+ end
460
464
  Object.new({
461
465
  bucket_name: @bucket_name,
462
466
  key: @key,
@@ -474,8 +478,10 @@ module Aws::S3
474
478
  options, params = separate_params_and_options(options)
475
479
  waiter = Waiters::ObjectNotExists.new(options)
476
480
  yield_waiter_and_warn(waiter, &block) if block_given?
477
- waiter.wait(params.merge(bucket: @bucket_name,
481
+ Aws::Plugins::UserAgent.feature('resource') do
482
+ waiter.wait(params.merge(bucket: @bucket_name,
478
483
  key: @key))
484
+ end
479
485
  Object.new({
480
486
  bucket_name: @bucket_name,
481
487
  key: @key,
@@ -577,7 +583,9 @@ module Aws::S3
577
583
  :retry
578
584
  end
579
585
  end
580
- Aws::Waiters::Waiter.new(options).wait({})
586
+ Aws::Plugins::UserAgent.feature('resource') do
587
+ Aws::Waiters::Waiter.new(options).wait({})
588
+ end
581
589
  end
582
590
 
583
591
  # @!group Actions
@@ -607,7 +615,7 @@ module Aws::S3
607
615
  # },
608
616
  # metadata_directive: "COPY", # accepts COPY, REPLACE
609
617
  # tagging_directive: "COPY", # accepts COPY, REPLACE
610
- # server_side_encryption: "AES256", # accepts AES256, aws:kms
618
+ # server_side_encryption: "AES256", # accepts AES256, aws:kms, aws:kms:dsse
611
619
  # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW
612
620
  # website_redirect_location: "WebsiteRedirectLocation",
613
621
  # sse_customer_algorithm: "SSECustomerAlgorithm",
@@ -737,14 +745,15 @@ module Aws::S3
737
745
  # or replaced with tag-set provided in the request.
738
746
  # @option options [String] :server_side_encryption
739
747
  # The server-side encryption algorithm used when storing this object in
740
- # Amazon S3 (for example, AES256, `aws:kms`).
748
+ # Amazon S3 (for example, `AES256`, `aws:kms`, `aws:kms:dsse`).
741
749
  # @option options [String] :storage_class
742
- # By default, Amazon S3 uses the STANDARD Storage Class to store newly
743
- # created objects. The STANDARD storage class provides high durability
744
- # and high availability. Depending on performance needs, you can specify
745
- # a different Storage Class. Amazon S3 on Outposts only uses the
746
- # OUTPOSTS Storage Class. For more information, see [Storage Classes][1]
747
- # in the *Amazon S3 User Guide*.
750
+ # If the `x-amz-storage-class` header is not used, the copied object
751
+ # will be stored in the STANDARD Storage Class by default. The STANDARD
752
+ # storage class provides high durability and high availability.
753
+ # Depending on performance needs, you can specify a different Storage
754
+ # Class. Amazon S3 on Outposts only uses the OUTPOSTS Storage Class. For
755
+ # more information, see [Storage Classes][1] in the *Amazon S3 User
756
+ # Guide*.
748
757
  #
749
758
  #
750
759
  #
@@ -770,13 +779,12 @@ module Aws::S3
770
779
  # RFC 1321. Amazon S3 uses this header for a message integrity check to
771
780
  # ensure that the encryption key was transmitted without error.
772
781
  # @option options [String] :ssekms_key_id
773
- # Specifies the Amazon Web Services KMS key ID to use for object
774
- # encryption. All GET and PUT requests for an object protected by Amazon
775
- # Web Services KMS will fail if not made via SSL or using SigV4. For
776
- # information about configuring using any of the officially supported
777
- # Amazon Web Services SDKs and Amazon Web Services CLI, see [Specifying
778
- # the Signature Version in Request Authentication][1] in the *Amazon S3
779
- # User Guide*.
782
+ # Specifies the KMS ID (Key ID, Key ARN, or Key Alias) to use for object
783
+ # encryption. All GET and PUT requests for an object protected by KMS
784
+ # will fail if they're not made via SSL or using SigV4. For information
785
+ # about configuring any of the officially supported Amazon Web Services
786
+ # SDKs and Amazon Web Services CLI, see [Specifying the Signature
787
+ # Version in Request Authentication][1] in the *Amazon S3 User Guide*.
780
788
  #
781
789
  #
782
790
  #
@@ -787,9 +795,9 @@ module Aws::S3
787
795
  # string holding JSON with the encryption context key-value pairs.
788
796
  # @option options [Boolean] :bucket_key_enabled
789
797
  # Specifies whether Amazon S3 should use an S3 Bucket Key for object
790
- # encryption with server-side encryption using AWS KMS (SSE-KMS).
791
- # Setting this header to `true` causes Amazon S3 to use an S3 Bucket Key
792
- # for object encryption with SSE-KMS.
798
+ # encryption with server-side encryption using Key Management Service
799
+ # (KMS) keys (SSE-KMS). Setting this header to `true` causes Amazon S3
800
+ # to use an S3 Bucket Key for object encryption with SSE-KMS.
793
801
  #
794
802
  # Specifying this header with a COPY action doesn’t affect bucket-level
795
803
  # settings for S3 Bucket Key.
@@ -807,9 +815,11 @@ module Aws::S3
807
815
  # @option options [String] :request_payer
808
816
  # Confirms that the requester knows that they will be charged for the
809
817
  # request. Bucket owners need not specify this parameter in their
810
- # requests. For information about downloading objects from Requester
811
- # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
812
- # in the *Amazon S3 User Guide*.
818
+ # requests. If either the source or destination Amazon S3 bucket has
819
+ # Requester Pays enabled, the requester will pay for corresponding
820
+ # charges to copy the object. For information about downloading objects
821
+ # from Requester Pays buckets, see [Downloading Objects in Requester
822
+ # Pays Buckets][1] in the *Amazon S3 User Guide*.
813
823
  #
814
824
  #
815
825
  #
@@ -839,7 +849,9 @@ module Aws::S3
839
849
  bucket: @bucket_name,
840
850
  key: @key
841
851
  )
842
- resp = @client.copy_object(options)
852
+ resp = Aws::Plugins::UserAgent.feature('resource') do
853
+ @client.copy_object(options)
854
+ end
843
855
  resp.data
844
856
  end
845
857
 
@@ -863,9 +875,11 @@ module Aws::S3
863
875
  # @option options [String] :request_payer
864
876
  # Confirms that the requester knows that they will be charged for the
865
877
  # request. Bucket owners need not specify this parameter in their
866
- # requests. For information about downloading objects from Requester
867
- # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
868
- # in the *Amazon S3 User Guide*.
878
+ # requests. If either the source or destination Amazon S3 bucket has
879
+ # Requester Pays enabled, the requester will pay for corresponding
880
+ # charges to copy the object. For information about downloading objects
881
+ # from Requester Pays buckets, see [Downloading Objects in Requester
882
+ # Pays Buckets][1] in the *Amazon S3 User Guide*.
869
883
  #
870
884
  #
871
885
  #
@@ -884,7 +898,9 @@ module Aws::S3
884
898
  bucket: @bucket_name,
885
899
  key: @key
886
900
  )
887
- resp = @client.delete_object(options)
901
+ resp = Aws::Plugins::UserAgent.feature('resource') do
902
+ @client.delete_object(options)
903
+ end
888
904
  resp.data
889
905
  end
890
906
 
@@ -967,9 +983,11 @@ module Aws::S3
967
983
  # @option options [String] :request_payer
968
984
  # Confirms that the requester knows that they will be charged for the
969
985
  # request. Bucket owners need not specify this parameter in their
970
- # requests. For information about downloading objects from Requester
971
- # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
972
- # in the *Amazon S3 User Guide*.
986
+ # requests. If either the source or destination Amazon S3 bucket has
987
+ # Requester Pays enabled, the requester will pay for corresponding
988
+ # charges to copy the object. For information about downloading objects
989
+ # from Requester Pays buckets, see [Downloading Objects in Requester
990
+ # Pays Buckets][1] in the *Amazon S3 User Guide*.
973
991
  #
974
992
  #
975
993
  #
@@ -991,7 +1009,9 @@ module Aws::S3
991
1009
  bucket: @bucket_name,
992
1010
  key: @key
993
1011
  )
994
- resp = @client.get_object(options, &block)
1012
+ resp = Aws::Plugins::UserAgent.feature('resource') do
1013
+ @client.get_object(options, &block)
1014
+ end
995
1015
  resp.data
996
1016
  end
997
1017
 
@@ -1012,7 +1032,7 @@ module Aws::S3
1012
1032
  # metadata: {
1013
1033
  # "MetadataKey" => "MetadataValue",
1014
1034
  # },
1015
- # server_side_encryption: "AES256", # accepts AES256, aws:kms
1035
+ # server_side_encryption: "AES256", # accepts AES256, aws:kms, aws:kms:dsse
1016
1036
  # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW
1017
1037
  # website_redirect_location: "WebsiteRedirectLocation",
1018
1038
  # sse_customer_algorithm: "SSECustomerAlgorithm",
@@ -1069,7 +1089,7 @@ module Aws::S3
1069
1089
  # A map of metadata to store with the object in S3.
1070
1090
  # @option options [String] :server_side_encryption
1071
1091
  # The server-side encryption algorithm used when storing this object in
1072
- # Amazon S3 (for example, AES256, `aws:kms`).
1092
+ # Amazon S3 (for example, `AES256`, `aws:kms`).
1073
1093
  # @option options [String] :storage_class
1074
1094
  # By default, Amazon S3 uses the STANDARD Storage Class to store newly
1075
1095
  # created objects. The STANDARD storage class provides high durability
@@ -1099,12 +1119,12 @@ module Aws::S3
1099
1119
  # RFC 1321. Amazon S3 uses this header for a message integrity check to
1100
1120
  # ensure that the encryption key was transmitted without error.
1101
1121
  # @option options [String] :ssekms_key_id
1102
- # Specifies the ID of the symmetric encryption customer managed key to
1103
- # use for object encryption. All GET and PUT requests for an object
1104
- # protected by Amazon Web Services KMS will fail if not made via SSL or
1105
- # using SigV4. For information about configuring using any of the
1106
- # officially supported Amazon Web Services SDKs and Amazon Web Services
1107
- # CLI, see [Specifying the Signature Version in Request
1122
+ # Specifies the ID (Key ID, Key ARN, or Key Alias) of the symmetric
1123
+ # encryption customer managed key to use for object encryption. All GET
1124
+ # and PUT requests for an object protected by KMS will fail if they're
1125
+ # not made via SSL or using SigV4. For information about configuring any
1126
+ # of the officially supported Amazon Web Services SDKs and Amazon Web
1127
+ # Services CLI, see [Specifying the Signature Version in Request
1108
1128
  # Authentication][1] in the *Amazon S3 User Guide*.
1109
1129
  #
1110
1130
  #
@@ -1116,18 +1136,20 @@ module Aws::S3
1116
1136
  # string holding JSON with the encryption context key-value pairs.
1117
1137
  # @option options [Boolean] :bucket_key_enabled
1118
1138
  # Specifies whether Amazon S3 should use an S3 Bucket Key for object
1119
- # encryption with server-side encryption using AWS KMS (SSE-KMS).
1120
- # Setting this header to `true` causes Amazon S3 to use an S3 Bucket Key
1121
- # for object encryption with SSE-KMS.
1139
+ # encryption with server-side encryption using Key Management Service
1140
+ # (KMS) keys (SSE-KMS). Setting this header to `true` causes Amazon S3
1141
+ # to use an S3 Bucket Key for object encryption with SSE-KMS.
1122
1142
  #
1123
1143
  # Specifying this header with an object action doesn’t affect
1124
1144
  # bucket-level settings for S3 Bucket Key.
1125
1145
  # @option options [String] :request_payer
1126
1146
  # Confirms that the requester knows that they will be charged for the
1127
1147
  # request. Bucket owners need not specify this parameter in their
1128
- # requests. For information about downloading objects from Requester
1129
- # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
1130
- # in the *Amazon S3 User Guide*.
1148
+ # requests. If either the source or destination Amazon S3 bucket has
1149
+ # Requester Pays enabled, the requester will pay for corresponding
1150
+ # charges to copy the object. For information about downloading objects
1151
+ # from Requester Pays buckets, see [Downloading Objects in Requester
1152
+ # Pays Buckets][1] in the *Amazon S3 User Guide*.
1131
1153
  #
1132
1154
  #
1133
1155
  #
@@ -1161,7 +1183,9 @@ module Aws::S3
1161
1183
  bucket: @bucket_name,
1162
1184
  key: @key
1163
1185
  )
1164
- resp = @client.create_multipart_upload(options)
1186
+ resp = Aws::Plugins::UserAgent.feature('resource') do
1187
+ @client.create_multipart_upload(options)
1188
+ end
1165
1189
  MultipartUpload.new(
1166
1190
  bucket_name: @bucket_name,
1167
1191
  object_key: @key,
@@ -1195,7 +1219,7 @@ module Aws::S3
1195
1219
  # metadata: {
1196
1220
  # "MetadataKey" => "MetadataValue",
1197
1221
  # },
1198
- # server_side_encryption: "AES256", # accepts AES256, aws:kms
1222
+ # server_side_encryption: "AES256", # accepts AES256, aws:kms, aws:kms:dsse
1199
1223
  # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW
1200
1224
  # website_redirect_location: "WebsiteRedirectLocation",
1201
1225
  # sse_customer_algorithm: "SSECustomerAlgorithm",
@@ -1362,7 +1386,7 @@ module Aws::S3
1362
1386
  # A map of metadata to store with the object in S3.
1363
1387
  # @option options [String] :server_side_encryption
1364
1388
  # The server-side encryption algorithm used when storing this object in
1365
- # Amazon S3 (for example, AES256, `aws:kms`).
1389
+ # Amazon S3 (for example, `AES256`, `aws:kms`, `aws:kms:dsse`).
1366
1390
  # @option options [String] :storage_class
1367
1391
  # By default, Amazon S3 uses the STANDARD Storage Class to store newly
1368
1392
  # created objects. The STANDARD storage class provides high durability
@@ -1413,15 +1437,16 @@ module Aws::S3
1413
1437
  # RFC 1321. Amazon S3 uses this header for a message integrity check to
1414
1438
  # ensure that the encryption key was transmitted without error.
1415
1439
  # @option options [String] :ssekms_key_id
1416
- # If `x-amz-server-side-encryption` has a valid value of `aws:kms`, this
1417
- # header specifies the ID of the Amazon Web Services Key Management
1418
- # Service (Amazon Web Services KMS) symmetric encryption customer
1419
- # managed key that was used for the object. If you specify
1420
- # `x-amz-server-side-encryption:aws:kms`, but do not provide`
1440
+ # If `x-amz-server-side-encryption` has a valid value of `aws:kms` or
1441
+ # `aws:kms:dsse`, this header specifies the ID (Key ID, Key ARN, or Key
1442
+ # Alias) of the Key Management Service (KMS) symmetric encryption
1443
+ # customer managed key that was used for the object. If you specify
1444
+ # `x-amz-server-side-encryption:aws:kms` or
1445
+ # `x-amz-server-side-encryption:aws:kms:dsse`, but do not provide`
1421
1446
  # x-amz-server-side-encryption-aws-kms-key-id`, Amazon S3 uses the
1422
- # Amazon Web Services managed key to protect the data. If the KMS key
1423
- # does not exist in the same account issuing the command, you must use
1424
- # the full ARN and not just the ID.
1447
+ # Amazon Web Services managed key (`aws/s3`) to protect the data. If the
1448
+ # KMS key does not exist in the same account that's issuing the
1449
+ # command, you must use the full ARN and not just the ID.
1425
1450
  # @option options [String] :ssekms_encryption_context
1426
1451
  # Specifies the Amazon Web Services KMS Encryption Context to use for
1427
1452
  # object encryption. The value of this header is a base64-encoded UTF-8
@@ -1431,18 +1456,20 @@ module Aws::S3
1431
1456
  # operations on this object.
1432
1457
  # @option options [Boolean] :bucket_key_enabled
1433
1458
  # Specifies whether Amazon S3 should use an S3 Bucket Key for object
1434
- # encryption with server-side encryption using AWS KMS (SSE-KMS).
1435
- # Setting this header to `true` causes Amazon S3 to use an S3 Bucket Key
1436
- # for object encryption with SSE-KMS.
1459
+ # encryption with server-side encryption using Key Management Service
1460
+ # (KMS) keys (SSE-KMS). Setting this header to `true` causes Amazon S3
1461
+ # to use an S3 Bucket Key for object encryption with SSE-KMS.
1437
1462
  #
1438
1463
  # Specifying this header with a PUT action doesn’t affect bucket-level
1439
1464
  # settings for S3 Bucket Key.
1440
1465
  # @option options [String] :request_payer
1441
1466
  # Confirms that the requester knows that they will be charged for the
1442
1467
  # request. Bucket owners need not specify this parameter in their
1443
- # requests. For information about downloading objects from Requester
1444
- # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
1445
- # in the *Amazon S3 User Guide*.
1468
+ # requests. If either the source or destination Amazon S3 bucket has
1469
+ # Requester Pays enabled, the requester will pay for corresponding
1470
+ # charges to copy the object. For information about downloading objects
1471
+ # from Requester Pays buckets, see [Downloading Objects in Requester
1472
+ # Pays Buckets][1] in the *Amazon S3 User Guide*.
1446
1473
  #
1447
1474
  #
1448
1475
  #
@@ -1472,7 +1499,9 @@ module Aws::S3
1472
1499
  bucket: @bucket_name,
1473
1500
  key: @key
1474
1501
  )
1475
- resp = @client.put_object(options)
1502
+ resp = Aws::Plugins::UserAgent.feature('resource') do
1503
+ @client.put_object(options)
1504
+ end
1476
1505
  resp.data
1477
1506
  end
1478
1507
 
@@ -1526,7 +1555,7 @@ module Aws::S3
1526
1555
  # bucket_name: "BucketName", # required
1527
1556
  # prefix: "LocationPrefix", # required
1528
1557
  # encryption: {
1529
- # encryption_type: "AES256", # required, accepts AES256, aws:kms
1558
+ # encryption_type: "AES256", # required, accepts AES256, aws:kms, aws:kms:dsse
1530
1559
  # kms_key_id: "SSEKMSKeyId",
1531
1560
  # kms_context: "KMSContext",
1532
1561
  # },
@@ -1573,9 +1602,11 @@ module Aws::S3
1573
1602
  # @option options [String] :request_payer
1574
1603
  # Confirms that the requester knows that they will be charged for the
1575
1604
  # request. Bucket owners need not specify this parameter in their
1576
- # requests. For information about downloading objects from Requester
1577
- # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
1578
- # in the *Amazon S3 User Guide*.
1605
+ # requests. If either the source or destination Amazon S3 bucket has
1606
+ # Requester Pays enabled, the requester will pay for corresponding
1607
+ # charges to copy the object. For information about downloading objects
1608
+ # from Requester Pays buckets, see [Downloading Objects in Requester
1609
+ # Pays Buckets][1] in the *Amazon S3 User Guide*.
1579
1610
  #
1580
1611
  #
1581
1612
  #
@@ -1605,7 +1636,9 @@ module Aws::S3
1605
1636
  bucket: @bucket_name,
1606
1637
  key: @key
1607
1638
  )
1608
- resp = @client.restore_object(options)
1639
+ resp = Aws::Plugins::UserAgent.feature('resource') do
1640
+ @client.restore_object(options)
1641
+ end
1609
1642
  resp.data
1610
1643
  end
1611
1644
 
@@ -1662,9 +1695,11 @@ module Aws::S3
1662
1695
  # @option options [String] :request_payer
1663
1696
  # Confirms that the requester knows that they will be charged for the
1664
1697
  # request. Bucket owners need not specify this parameter in their
1665
- # requests. For information about downloading objects from Requester
1666
- # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
1667
- # in the *Amazon S3 User Guide*.
1698
+ # requests. If either the source or destination Amazon S3 bucket has
1699
+ # Requester Pays enabled, the requester will pay for corresponding
1700
+ # charges to copy the object. For information about downloading objects
1701
+ # from Requester Pays buckets, see [Downloading Objects in Requester
1702
+ # Pays Buckets][1] in the *Amazon S3 User Guide*.
1668
1703
  #
1669
1704
  #
1670
1705
  #
@@ -1691,7 +1726,9 @@ module Aws::S3
1691
1726
  bucket: @bucket_name,
1692
1727
  key: @key
1693
1728
  )
1694
- resp = @client.head_object(options)
1729
+ resp = Aws::Plugins::UserAgent.feature('resource') do
1730
+ @client.head_object(options)
1731
+ end
1695
1732
  resp.data
1696
1733
  end
1697
1734
 
@@ -1819,9 +1856,11 @@ module Aws::S3
1819
1856
  # @option options [String] :request_payer
1820
1857
  # Confirms that the requester knows that they will be charged for the
1821
1858
  # request. Bucket owners need not specify this parameter in their
1822
- # requests. For information about downloading objects from Requester
1823
- # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
1824
- # in the *Amazon S3 User Guide*.
1859
+ # requests. If either the source or destination Amazon S3 bucket has
1860
+ # Requester Pays enabled, the requester will pay for corresponding
1861
+ # charges to copy the object. For information about downloading objects
1862
+ # from Requester Pays buckets, see [Downloading Objects in Requester
1863
+ # Pays Buckets][1] in the *Amazon S3 User Guide*.
1825
1864
  #
1826
1865
  #
1827
1866
  #
@@ -1864,7 +1903,9 @@ module Aws::S3
1864
1903
  key: item.key
1865
1904
  }
1866
1905
  end
1867
- batch[0].client.delete_objects(params)
1906
+ Aws::Plugins::UserAgent.feature('resource') do
1907
+ batch[0].client.delete_objects(params)
1908
+ end
1868
1909
  end
1869
1910
  nil
1870
1911
  end
@@ -75,10 +75,12 @@ module Aws::S3
75
75
  #
76
76
  # @return [self]
77
77
  def load
78
- resp = @client.get_object_acl(
78
+ resp = Aws::Plugins::UserAgent.feature('resource') do
79
+ @client.get_object_acl(
79
80
  bucket: @bucket_name,
80
81
  key: @object_key
81
82
  )
83
+ end
82
84
  @data = resp.data
83
85
  self
84
86
  end
@@ -193,7 +195,9 @@ module Aws::S3
193
195
  :retry
194
196
  end
195
197
  end
196
- Aws::Waiters::Waiter.new(options).wait({})
198
+ Aws::Plugins::UserAgent.feature('resource') do
199
+ Aws::Waiters::Waiter.new(options).wait({})
200
+ end
197
201
  end
198
202
 
199
203
  # @!group Actions
@@ -295,9 +299,11 @@ module Aws::S3
295
299
  # @option options [String] :request_payer
296
300
  # Confirms that the requester knows that they will be charged for the
297
301
  # request. Bucket owners need not specify this parameter in their
298
- # requests. For information about downloading objects from Requester
299
- # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
300
- # in the *Amazon S3 User Guide*.
302
+ # requests. If either the source or destination Amazon S3 bucket has
303
+ # Requester Pays enabled, the requester will pay for corresponding
304
+ # charges to copy the object. For information about downloading objects
305
+ # from Requester Pays buckets, see [Downloading Objects in Requester
306
+ # Pays Buckets][1] in the *Amazon S3 User Guide*.
301
307
  #
302
308
  #
303
309
  #
@@ -314,7 +320,9 @@ module Aws::S3
314
320
  bucket: @bucket_name,
315
321
  key: @object_key
316
322
  )
317
- resp = @client.put_object_acl(options)
323
+ resp = Aws::Plugins::UserAgent.feature('resource') do
324
+ @client.put_object_acl(options)
325
+ end
318
326
  resp.data
319
327
  end
320
328
 
@@ -28,11 +28,13 @@ module Aws
28
28
  options[:bucket] = target_bucket
29
29
  options[:key] = target_key
30
30
  options[:copy_source] = copy_source(source)
31
- if options.delete(:multipart_copy)
32
- apply_source_client(source, options)
33
- ObjectMultipartCopier.new(@options).copy(options)
34
- else
35
- @object.client.copy_object(options)
31
+ Aws::Plugins::UserAgent.feature('s3-transfer') do
32
+ if options.delete(:multipart_copy)
33
+ apply_source_client(source, options)
34
+ ObjectMultipartCopier.new(@options).copy(options)
35
+ else
36
+ @object.client.copy_object(options)
37
+ end
36
38
  end
37
39
  end
38
40
 
@@ -15,18 +15,21 @@ module Aws
15
15
  MAX_PARTS = 10_000
16
16
 
17
17
  # @option options [Client] :client
18
- # @option [Integer] :min_part_size (52428800) Size of copied parts.
19
- # Defaults to 50MB.
20
- # will be constructed from the given `options' hash.
21
- # @option [Integer] :thread_count (10) Number of concurrent threads to
22
- # use for copying parts.
18
+ # @option options [Integer] :min_part_size (52428800)
19
+ # Size of copied parts. Defaults to 50MB.
20
+ # @option options [Integer] :thread_count (10) Number of concurrent
21
+ # threads to use for copying parts.
22
+ # @option options [Boolean] :use_source_parts (false) Use part sizes
23
+ # defined on the source object if any exist. If copying or moving an
24
+ # object that is already multipart, this does not re-part the object,
25
+ # instead re-using the part definitions on the original. That means
26
+ # the etag and any checksums will not change. This is especially
27
+ # useful if the source object has parts with varied sizes.
23
28
  def initialize(options = {})
29
+ @use_source_parts = options.delete(:use_source_parts) || false
24
30
  @thread_count = options.delete(:thread_count) || 10
25
31
  @min_part_size = options.delete(:min_part_size) || (FIVE_MB * 10)
26
32
  @client = options[:client] || Client.new
27
- if options[:checksum_algorithm]
28
- raise ArgumentError, 'Multipart Copy does not support setting :checksum_algorithm'
29
- end
30
33
  end
31
34
 
32
35
  # @return [Client]
@@ -78,10 +81,9 @@ module Aws
78
81
  end
79
82
 
80
83
  def copy_part(part)
81
- {
82
- etag: @client.upload_part_copy(part).copy_part_result.etag,
83
- part_number: part[:part_number],
84
- }
84
+ @client.upload_part_copy(part).copy_part_result.to_h.merge({
85
+ part_number: part[:part_number]
86
+ }).tap { |result| result.delete(:last_modified) }
85
87
  end
86
88
 
87
89
  def complete_upload(parts, options)
@@ -104,24 +106,37 @@ module Aws
104
106
  parts = []
105
107
  options = options_for(:upload_part_copy, options)
106
108
  while offset < size
109
+ part_size = calculate_part_size(part_number, default_part_size, options)
107
110
  parts << options.merge({
108
111
  part_number: part_number,
109
- copy_source_range: byte_range(offset, default_part_size, size),
112
+ copy_source_range: byte_range(offset, part_size, size),
110
113
  })
111
114
  part_number += 1
112
- offset += default_part_size
115
+ offset += part_size
113
116
  end
114
117
  parts
115
118
  end
116
119
 
117
- def byte_range(offset, default_part_size, size)
118
- if offset + default_part_size < size
119
- "bytes=#{offset}-#{offset + default_part_size - 1}"
120
+ def byte_range(offset, part_size, size)
121
+ if offset + part_size < size
122
+ "bytes=#{offset}-#{offset + part_size - 1}"
120
123
  else
121
124
  "bytes=#{offset}-#{size - 1}"
122
125
  end
123
126
  end
124
127
 
128
+ def calculate_part_size(part_number, default_part_size, options)
129
+ if @use_source_parts && source_has_parts(options)
130
+ source_metadata(options.merge({ part_number: part_number }))[:content_length]
131
+ else
132
+ default_part_size
133
+ end
134
+ end
135
+
136
+ def source_has_parts(options)
137
+ @source_has_parts ||= source_metadata(options.merge({ part_number: 1 }))[:parts_count]
138
+ end
139
+
125
140
  def source_metadata(options)
126
141
  if options[:content_length]
127
142
  return { content_length: options.delete(:content_length) }
@@ -138,6 +153,7 @@ module Aws
138
153
  key = CGI.unescape(key)
139
154
  opts = { bucket: bucket, key: key }
140
155
  opts[:version_id] = version_id if version_id
156
+ opts[:part_number] = options[:part_number] if options[:part_number]
141
157
  client.head_object(opts).to_h
142
158
  end
143
159