aws-sdk-s3 1.119.1 → 1.132.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +97 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-s3/bucket.rb +108 -55
  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 +1740 -1441
  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 +27 -0
  20. data/lib/aws-sdk-s3/customizations/object.rb +49 -18
  21. data/lib/aws-sdk-s3/customizations/types/permanent_redirect.rb +26 -0
  22. data/lib/aws-sdk-s3/customizations.rb +2 -0
  23. data/lib/aws-sdk-s3/encryption/client.rb +6 -2
  24. data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +13 -9
  25. data/lib/aws-sdk-s3/encryptionV2/client.rb +6 -2
  26. data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +1 -0
  27. data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +10 -6
  28. data/lib/aws-sdk-s3/endpoint_parameters.rb +4 -0
  29. data/lib/aws-sdk-s3/endpoint_provider.rb +103 -327
  30. data/lib/aws-sdk-s3/endpoints.rb +1 -0
  31. data/lib/aws-sdk-s3/file_downloader.rb +61 -25
  32. data/lib/aws-sdk-s3/file_uploader.rb +8 -6
  33. data/lib/aws-sdk-s3/multipart_stream_uploader.rb +5 -3
  34. data/lib/aws-sdk-s3/multipart_upload.rb +12 -4
  35. data/lib/aws-sdk-s3/multipart_upload_part.rb +10 -4
  36. data/lib/aws-sdk-s3/object.rb +105 -77
  37. data/lib/aws-sdk-s3/object_acl.rb +9 -3
  38. data/lib/aws-sdk-s3/object_copier.rb +7 -5
  39. data/lib/aws-sdk-s3/object_multipart_copier.rb +33 -17
  40. data/lib/aws-sdk-s3/object_summary.rb +103 -64
  41. data/lib/aws-sdk-s3/object_version.rb +35 -9
  42. data/lib/aws-sdk-s3/plugins/s3_signer.rb +13 -11
  43. data/lib/aws-sdk-s3/presigned_post.rb +52 -43
  44. data/lib/aws-sdk-s3/presigner.rb +4 -2
  45. data/lib/aws-sdk-s3/resource.rb +7 -3
  46. data/lib/aws-sdk-s3/types.rb +711 -405
  47. data/lib/aws-sdk-s3.rb +1 -1
  48. metadata +8 -6
@@ -239,11 +239,8 @@ module Aws::S3
239
239
  data[:website_redirect_location]
240
240
  end
241
241
 
242
- # If the object is stored using server-side encryption either with an
243
- # Amazon Web Services KMS key or an Amazon S3-managed encryption key,
244
- # the response includes this header with the value of the server-side
245
- # encryption algorithm used when storing this object in Amazon S3 (for
246
- # example, AES256, aws:kms).
242
+ # The server-side encryption algorithm used when storing this object in
243
+ # Amazon S3 (for example, `AES256`, `aws:kms`, `aws:kms:dsse`).
247
244
  # @return [String]
248
245
  def server_side_encryption
249
246
  data[:server_side_encryption]
@@ -272,16 +269,16 @@ module Aws::S3
272
269
  data[:sse_customer_key_md5]
273
270
  end
274
271
 
275
- # If present, specifies the ID of the Amazon Web Services Key Management
276
- # Service (Amazon Web Services KMS) symmetric customer managed key that
277
- # 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.
278
275
  # @return [String]
279
276
  def ssekms_key_id
280
277
  data[:ssekms_key_id]
281
278
  end
282
279
 
283
280
  # Indicates whether the object uses an S3 Bucket Key for server-side
284
- # encryption with Amazon Web Services KMS (SSE-KMS).
281
+ # encryption with Key Management Service (KMS) keys (SSE-KMS).
285
282
  # @return [Boolean]
286
283
  def bucket_key_enabled
287
284
  data[:bucket_key_enabled]
@@ -410,10 +407,12 @@ module Aws::S3
410
407
  #
411
408
  # @return [self]
412
409
  def load
413
- resp = @client.head_object(
410
+ resp = Aws::Plugins::UserAgent.feature('resource') do
411
+ @client.head_object(
414
412
  bucket: @bucket_name,
415
413
  key: @key
416
414
  )
415
+ end
417
416
  @data = resp.data
418
417
  self
419
418
  end
@@ -458,8 +457,10 @@ module Aws::S3
458
457
  options, params = separate_params_and_options(options)
459
458
  waiter = Waiters::ObjectExists.new(options)
460
459
  yield_waiter_and_warn(waiter, &block) if block_given?
461
- waiter.wait(params.merge(bucket: @bucket_name,
460
+ Aws::Plugins::UserAgent.feature('resource') do
461
+ waiter.wait(params.merge(bucket: @bucket_name,
462
462
  key: @key))
463
+ end
463
464
  Object.new({
464
465
  bucket_name: @bucket_name,
465
466
  key: @key,
@@ -477,8 +478,10 @@ module Aws::S3
477
478
  options, params = separate_params_and_options(options)
478
479
  waiter = Waiters::ObjectNotExists.new(options)
479
480
  yield_waiter_and_warn(waiter, &block) if block_given?
480
- waiter.wait(params.merge(bucket: @bucket_name,
481
+ Aws::Plugins::UserAgent.feature('resource') do
482
+ waiter.wait(params.merge(bucket: @bucket_name,
481
483
  key: @key))
484
+ end
482
485
  Object.new({
483
486
  bucket_name: @bucket_name,
484
487
  key: @key,
@@ -580,7 +583,9 @@ module Aws::S3
580
583
  :retry
581
584
  end
582
585
  end
583
- Aws::Waiters::Waiter.new(options).wait({})
586
+ Aws::Plugins::UserAgent.feature('resource') do
587
+ Aws::Waiters::Waiter.new(options).wait({})
588
+ end
584
589
  end
585
590
 
586
591
  # @!group Actions
@@ -610,8 +615,8 @@ module Aws::S3
610
615
  # },
611
616
  # metadata_directive: "COPY", # accepts COPY, REPLACE
612
617
  # tagging_directive: "COPY", # accepts COPY, REPLACE
613
- # server_side_encryption: "AES256", # accepts AES256, aws:kms
614
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR
618
+ # server_side_encryption: "AES256", # accepts AES256, aws:kms, aws:kms:dsse
619
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW
615
620
  # website_redirect_location: "WebsiteRedirectLocation",
616
621
  # sse_customer_algorithm: "SSECustomerAlgorithm",
617
622
  # sse_customer_key: "SSECustomerKey",
@@ -658,7 +663,7 @@ module Aws::S3
658
663
  # @option options [required, String] :copy_source
659
664
  # Specifies the source object for the copy operation. You specify the
660
665
  # value in one of two formats, depending on whether you want to access
661
- # the source object through an [access point][1]\:
666
+ # the source object through an [access point][1]:
662
667
  #
663
668
  # * For objects not accessed through an access point, specify the name
664
669
  # of the source bucket and the key of the source object, separated by
@@ -740,7 +745,7 @@ module Aws::S3
740
745
  # or replaced with tag-set provided in the request.
741
746
  # @option options [String] :server_side_encryption
742
747
  # The server-side encryption algorithm used when storing this object in
743
- # Amazon S3 (for example, AES256, aws:kms).
748
+ # Amazon S3 (for example, `AES256`, `aws:kms`, `aws:kms:dsse`).
744
749
  # @option options [String] :storage_class
745
750
  # By default, Amazon S3 uses the STANDARD Storage Class to store newly
746
751
  # created objects. The STANDARD storage class provides high durability
@@ -755,7 +760,10 @@ module Aws::S3
755
760
  # @option options [String] :website_redirect_location
756
761
  # If the bucket is configured as a website, redirects requests for this
757
762
  # object to another object in the same bucket or to an external URL.
758
- # Amazon S3 stores the value of this header in the object metadata.
763
+ # Amazon S3 stores the value of this header in the object metadata. This
764
+ # value is unique to each object and is not copied when using the
765
+ # `x-amz-metadata-directive` header. Instead, you may opt to provide
766
+ # this header in combination with the directive.
759
767
  # @option options [String] :sse_customer_algorithm
760
768
  # Specifies the algorithm to use to when encrypting the object (for
761
769
  # example, AES256).
@@ -770,13 +778,12 @@ module Aws::S3
770
778
  # RFC 1321. Amazon S3 uses this header for a message integrity check to
771
779
  # ensure that the encryption key was transmitted without error.
772
780
  # @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*.
781
+ # Specifies the KMS key ID to use for object encryption. All GET and PUT
782
+ # requests for an object protected by KMS will fail if they're not made
783
+ # via SSL or using SigV4. For information about configuring any of the
784
+ # officially supported Amazon Web Services SDKs and Amazon Web Services
785
+ # CLI, see [Specifying the Signature Version in Request
786
+ # Authentication][1] in the *Amazon S3 User Guide*.
780
787
  #
781
788
  #
782
789
  #
@@ -787,9 +794,9 @@ module Aws::S3
787
794
  # string holding JSON with the encryption context key-value pairs.
788
795
  # @option options [Boolean] :bucket_key_enabled
789
796
  # 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.
797
+ # encryption with server-side encryption using Key Management Service
798
+ # (KMS) keys (SSE-KMS). Setting this header to `true` causes Amazon S3
799
+ # to use an S3 Bucket Key for object encryption with SSE-KMS.
793
800
  #
794
801
  # Specifying this header with a COPY action doesn’t affect bucket-level
795
802
  # settings for S3 Bucket Key.
@@ -839,7 +846,9 @@ module Aws::S3
839
846
  bucket: @bucket_name,
840
847
  key: @key
841
848
  )
842
- resp = @client.copy_object(options)
849
+ resp = Aws::Plugins::UserAgent.feature('resource') do
850
+ @client.copy_object(options)
851
+ end
843
852
  resp.data
844
853
  end
845
854
 
@@ -884,7 +893,9 @@ module Aws::S3
884
893
  bucket: @bucket_name,
885
894
  key: @key
886
895
  )
887
- resp = @client.delete_object(options)
896
+ resp = Aws::Plugins::UserAgent.feature('resource') do
897
+ @client.delete_object(options)
898
+ end
888
899
  resp.data
889
900
  end
890
901
 
@@ -927,7 +938,7 @@ module Aws::S3
927
938
  # @option options [String] :range
928
939
  # Downloads the specified range bytes of an object. For more information
929
940
  # about the HTTP Range header, see
930
- # [https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35][1].
941
+ # [https://www.rfc-editor.org/rfc/rfc9110.html#name-range][1].
931
942
  #
932
943
  # <note markdown="1"> Amazon S3 doesn't support retrieving multiple ranges of data per
933
944
  # `GET` request.
@@ -936,7 +947,7 @@ module Aws::S3
936
947
  #
937
948
  #
938
949
  #
939
- # [1]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
950
+ # [1]: https://www.rfc-editor.org/rfc/rfc9110.html#name-range
940
951
  # @option options [String] :response_cache_control
941
952
  # Sets the `Cache-Control` header of the response.
942
953
  # @option options [String] :response_content_disposition
@@ -991,7 +1002,9 @@ module Aws::S3
991
1002
  bucket: @bucket_name,
992
1003
  key: @key
993
1004
  )
994
- resp = @client.get_object(options, &block)
1005
+ resp = Aws::Plugins::UserAgent.feature('resource') do
1006
+ @client.get_object(options, &block)
1007
+ end
995
1008
  resp.data
996
1009
  end
997
1010
 
@@ -1012,8 +1025,8 @@ module Aws::S3
1012
1025
  # metadata: {
1013
1026
  # "MetadataKey" => "MetadataValue",
1014
1027
  # },
1015
- # server_side_encryption: "AES256", # accepts AES256, aws:kms
1016
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR
1028
+ # server_side_encryption: "AES256", # accepts AES256, aws:kms, aws:kms:dsse
1029
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW
1017
1030
  # website_redirect_location: "WebsiteRedirectLocation",
1018
1031
  # sse_customer_algorithm: "SSECustomerAlgorithm",
1019
1032
  # sse_customer_key: "SSECustomerKey",
@@ -1069,7 +1082,7 @@ module Aws::S3
1069
1082
  # A map of metadata to store with the object in S3.
1070
1083
  # @option options [String] :server_side_encryption
1071
1084
  # The server-side encryption algorithm used when storing this object in
1072
- # Amazon S3 (for example, AES256, aws:kms).
1085
+ # Amazon S3 (for example, `AES256`, `aws:kms`).
1073
1086
  # @option options [String] :storage_class
1074
1087
  # By default, Amazon S3 uses the STANDARD Storage Class to store newly
1075
1088
  # created objects. The STANDARD storage class provides high durability
@@ -1099,10 +1112,10 @@ module Aws::S3
1099
1112
  # RFC 1321. Amazon S3 uses this header for a message integrity check to
1100
1113
  # ensure that the encryption key was transmitted without error.
1101
1114
  # @option options [String] :ssekms_key_id
1102
- # Specifies the ID of the symmetric customer managed key to use for
1103
- # object encryption. All GET and PUT requests for an object protected by
1104
- # Amazon Web Services KMS will fail if not made via SSL or using SigV4.
1105
- # For information about configuring using any of the officially
1115
+ # Specifies the ID of the symmetric encryption customer managed key to
1116
+ # use for object encryption. All GET and PUT requests for an object
1117
+ # protected by KMS will fail if they're not made via SSL or using
1118
+ # SigV4. For information about configuring any of the officially
1106
1119
  # supported Amazon Web Services SDKs and Amazon Web Services CLI, see
1107
1120
  # [Specifying the Signature Version in Request Authentication][1] in the
1108
1121
  # *Amazon S3 User Guide*.
@@ -1116,9 +1129,9 @@ module Aws::S3
1116
1129
  # string holding JSON with the encryption context key-value pairs.
1117
1130
  # @option options [Boolean] :bucket_key_enabled
1118
1131
  # 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.
1132
+ # encryption with server-side encryption using Key Management Service
1133
+ # (KMS) keys (SSE-KMS). Setting this header to `true` causes Amazon S3
1134
+ # to use an S3 Bucket Key for object encryption with SSE-KMS.
1122
1135
  #
1123
1136
  # Specifying this header with an object action doesn’t affect
1124
1137
  # bucket-level settings for S3 Bucket Key.
@@ -1161,7 +1174,9 @@ module Aws::S3
1161
1174
  bucket: @bucket_name,
1162
1175
  key: @key
1163
1176
  )
1164
- resp = @client.create_multipart_upload(options)
1177
+ resp = Aws::Plugins::UserAgent.feature('resource') do
1178
+ @client.create_multipart_upload(options)
1179
+ end
1165
1180
  MultipartUpload.new(
1166
1181
  bucket_name: @bucket_name,
1167
1182
  object_key: @key,
@@ -1195,8 +1210,8 @@ module Aws::S3
1195
1210
  # metadata: {
1196
1211
  # "MetadataKey" => "MetadataValue",
1197
1212
  # },
1198
- # server_side_encryption: "AES256", # accepts AES256, aws:kms
1199
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR
1213
+ # server_side_encryption: "AES256", # accepts AES256, aws:kms, aws:kms:dsse
1214
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW
1200
1215
  # website_redirect_location: "WebsiteRedirectLocation",
1201
1216
  # sse_customer_algorithm: "SSECustomerAlgorithm",
1202
1217
  # sse_customer_key: "SSECustomerKey",
@@ -1234,30 +1249,30 @@ module Aws::S3
1234
1249
  # @option options [String] :content_disposition
1235
1250
  # Specifies presentational information for the object. For more
1236
1251
  # information, see
1237
- # [http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1][1].
1252
+ # [https://www.rfc-editor.org/rfc/rfc6266#section-4][1].
1238
1253
  #
1239
1254
  #
1240
1255
  #
1241
- # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1
1256
+ # [1]: https://www.rfc-editor.org/rfc/rfc6266#section-4
1242
1257
  # @option options [String] :content_encoding
1243
1258
  # Specifies what content encodings have been applied to the object and
1244
1259
  # thus what decoding mechanisms must be applied to obtain the media-type
1245
1260
  # referenced by the Content-Type header field. For more information, see
1246
- # [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11][1].
1261
+ # [https://www.rfc-editor.org/rfc/rfc9110.html#field.content-encoding][1].
1247
1262
  #
1248
1263
  #
1249
1264
  #
1250
- # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11
1265
+ # [1]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-encoding
1251
1266
  # @option options [String] :content_language
1252
1267
  # The language the content is in.
1253
1268
  # @option options [Integer] :content_length
1254
1269
  # Size of the body in bytes. This parameter is useful when the size of
1255
1270
  # the body cannot be determined automatically. For more information, see
1256
- # [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13][1].
1271
+ # [https://www.rfc-editor.org/rfc/rfc9110.html#name-content-length][1].
1257
1272
  #
1258
1273
  #
1259
1274
  #
1260
- # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13
1275
+ # [1]: https://www.rfc-editor.org/rfc/rfc9110.html#name-content-length
1261
1276
  # @option options [String] :content_md5
1262
1277
  # The base64-encoded 128-bit MD5 digest of the message (without the
1263
1278
  # headers) according to RFC 1864. This header can be used as a message
@@ -1273,11 +1288,11 @@ module Aws::S3
1273
1288
  # @option options [String] :content_type
1274
1289
  # A standard MIME type describing the format of the contents. For more
1275
1290
  # information, see
1276
- # [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17][1].
1291
+ # [https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type][1].
1277
1292
  #
1278
1293
  #
1279
1294
  #
1280
- # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17
1295
+ # [1]: https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type
1281
1296
  # @option options [String] :checksum_algorithm
1282
1297
  # Indicates the algorithm used to create the checksum for the object
1283
1298
  # when using the SDK. This header will not provide any additional
@@ -1336,11 +1351,11 @@ module Aws::S3
1336
1351
  # @option options [Time,DateTime,Date,Integer,String] :expires
1337
1352
  # The date and time at which the object is no longer cacheable. For more
1338
1353
  # information, see
1339
- # [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21][1].
1354
+ # [https://www.rfc-editor.org/rfc/rfc7234#section-5.3][1].
1340
1355
  #
1341
1356
  #
1342
1357
  #
1343
- # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21
1358
+ # [1]: https://www.rfc-editor.org/rfc/rfc7234#section-5.3
1344
1359
  # @option options [String] :grant_full_control
1345
1360
  # Gives the grantee READ, READ\_ACP, and WRITE\_ACP permissions on the
1346
1361
  # object.
@@ -1362,7 +1377,7 @@ module Aws::S3
1362
1377
  # A map of metadata to store with the object in S3.
1363
1378
  # @option options [String] :server_side_encryption
1364
1379
  # The server-side encryption algorithm used when storing this object in
1365
- # Amazon S3 (for example, AES256, aws:kms).
1380
+ # Amazon S3 (for example, `AES256`, `aws:kms`, `aws:kms:dsse`).
1366
1381
  # @option options [String] :storage_class
1367
1382
  # By default, Amazon S3 uses the STANDARD Storage Class to store newly
1368
1383
  # created objects. The STANDARD storage class provides high durability
@@ -1413,24 +1428,27 @@ module Aws::S3
1413
1428
  # RFC 1321. Amazon S3 uses this header for a message integrity check to
1414
1429
  # ensure that the encryption key was transmitted without error.
1415
1430
  # @option options [String] :ssekms_key_id
1416
- # If `x-amz-server-side-encryption` is present and has the value of
1417
- # `aws:kms`, this header specifies the ID of the Amazon Web Services Key
1418
- # Management Service (Amazon Web Services KMS) symmetrical 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`
1431
+ # If `x-amz-server-side-encryption` has a valid value of `aws:kms` or
1432
+ # `aws:kms:dsse`, this header specifies the ID of the Key Management
1433
+ # Service (KMS) symmetric encryption customer managed key that was used
1434
+ # for the object. If you specify `x-amz-server-side-encryption:aws:kms`
1435
+ # or `x-amz-server-side-encryption:aws:kms:dsse`, but do not provide`
1421
1436
  # 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.
1437
+ # Amazon Web Services managed key (`aws/s3`) to protect the data. If the
1438
+ # KMS key does not exist in the same account that's issuing the
1439
+ # command, you must use the full ARN and not just the ID.
1425
1440
  # @option options [String] :ssekms_encryption_context
1426
1441
  # Specifies the Amazon Web Services KMS Encryption Context to use for
1427
1442
  # object encryption. The value of this header is a base64-encoded UTF-8
1428
- # string holding JSON with the encryption context key-value pairs.
1443
+ # string holding JSON with the encryption context key-value pairs. This
1444
+ # value is stored as object metadata and automatically gets passed on to
1445
+ # Amazon Web Services KMS for future `GetObject` or `CopyObject`
1446
+ # operations on this object.
1429
1447
  # @option options [Boolean] :bucket_key_enabled
1430
1448
  # Specifies whether Amazon S3 should use an S3 Bucket Key for object
1431
- # encryption with server-side encryption using AWS KMS (SSE-KMS).
1432
- # Setting this header to `true` causes Amazon S3 to use an S3 Bucket Key
1433
- # for object encryption with SSE-KMS.
1449
+ # encryption with server-side encryption using Key Management Service
1450
+ # (KMS) keys (SSE-KMS). Setting this header to `true` causes Amazon S3
1451
+ # to use an S3 Bucket Key for object encryption with SSE-KMS.
1434
1452
  #
1435
1453
  # Specifying this header with a PUT action doesn’t affect bucket-level
1436
1454
  # settings for S3 Bucket Key.
@@ -1469,7 +1487,9 @@ module Aws::S3
1469
1487
  bucket: @bucket_name,
1470
1488
  key: @key
1471
1489
  )
1472
- resp = @client.put_object(options)
1490
+ resp = Aws::Plugins::UserAgent.feature('resource') do
1491
+ @client.put_object(options)
1492
+ end
1473
1493
  resp.data
1474
1494
  end
1475
1495
 
@@ -1523,7 +1543,7 @@ module Aws::S3
1523
1543
  # bucket_name: "BucketName", # required
1524
1544
  # prefix: "LocationPrefix", # required
1525
1545
  # encryption: {
1526
- # encryption_type: "AES256", # required, accepts AES256, aws:kms
1546
+ # encryption_type: "AES256", # required, accepts AES256, aws:kms, aws:kms:dsse
1527
1547
  # kms_key_id: "SSEKMSKeyId",
1528
1548
  # kms_context: "KMSContext",
1529
1549
  # },
@@ -1554,7 +1574,7 @@ module Aws::S3
1554
1574
  # value: "MetadataValue",
1555
1575
  # },
1556
1576
  # ],
1557
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR
1577
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW
1558
1578
  # },
1559
1579
  # },
1560
1580
  # },
@@ -1602,7 +1622,9 @@ module Aws::S3
1602
1622
  bucket: @bucket_name,
1603
1623
  key: @key
1604
1624
  )
1605
- resp = @client.restore_object(options)
1625
+ resp = Aws::Plugins::UserAgent.feature('resource') do
1626
+ @client.restore_object(options)
1627
+ end
1606
1628
  resp.data
1607
1629
  end
1608
1630
 
@@ -1637,8 +1659,10 @@ module Aws::S3
1637
1659
  # Return the object only if it has not been modified since the specified
1638
1660
  # time; otherwise, return a 412 (precondition failed) error.
1639
1661
  # @option options [String] :range
1640
- # Because `HeadObject` returns only the metadata for an object, this
1641
- # parameter has no effect.
1662
+ # HeadObject returns only the metadata for an object. If the Range is
1663
+ # satisfiable, only the `ContentLength` is affected in the response. If
1664
+ # the Range is not satisfiable, S3 returns a `416 - Requested Range Not
1665
+ # Satisfiable` error.
1642
1666
  # @option options [String] :version_id
1643
1667
  # VersionId used to reference a specific version of the object.
1644
1668
  # @option options [String] :sse_customer_algorithm
@@ -1686,7 +1710,9 @@ module Aws::S3
1686
1710
  bucket: @bucket_name,
1687
1711
  key: @key
1688
1712
  )
1689
- resp = @client.head_object(options)
1713
+ resp = Aws::Plugins::UserAgent.feature('resource') do
1714
+ @client.head_object(options)
1715
+ end
1690
1716
  resp.data
1691
1717
  end
1692
1718
 
@@ -1859,7 +1885,9 @@ module Aws::S3
1859
1885
  key: item.key
1860
1886
  }
1861
1887
  end
1862
- batch[0].client.delete_objects(params)
1888
+ Aws::Plugins::UserAgent.feature('resource') do
1889
+ batch[0].client.delete_objects(params)
1890
+ end
1863
1891
  end
1864
1892
  nil
1865
1893
  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
@@ -314,7 +318,9 @@ module Aws::S3
314
318
  bucket: @bucket_name,
315
319
  key: @object_key
316
320
  )
317
- resp = @client.put_object_acl(options)
321
+ resp = Aws::Plugins::UserAgent.feature('resource') do
322
+ @client.put_object_acl(options)
323
+ end
318
324
  resp.data
319
325
  end
320
326
 
@@ -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