aws-sdk-s3 1.220.0 → 1.232.2

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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +89 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-s3/bucket.rb +26 -2
  5. data/lib/aws-sdk-s3/bucket_notification.rb +3 -3
  6. data/lib/aws-sdk-s3/client.rb +869 -62
  7. data/lib/aws-sdk-s3/client_api.rb +301 -0
  8. data/lib/aws-sdk-s3/customizations/object.rb +55 -25
  9. data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +14 -1
  10. data/lib/aws-sdk-s3/encryptionV3/kms_cipher_provider.rb +13 -1
  11. data/lib/aws-sdk-s3/endpoint_provider.rb +6 -3
  12. data/lib/aws-sdk-s3/endpoints.rb +68 -0
  13. data/lib/aws-sdk-s3/errors.rb +66 -0
  14. data/lib/aws-sdk-s3/file_downloader.rb +3 -1
  15. data/lib/aws-sdk-s3/multipart_file_uploader.rb +1 -1
  16. data/lib/aws-sdk-s3/object.rb +150 -8
  17. data/lib/aws-sdk-s3/object_copier.rb +11 -22
  18. data/lib/aws-sdk-s3/object_multipart_copier.rb +177 -84
  19. data/lib/aws-sdk-s3/object_summary.rb +117 -8
  20. data/lib/aws-sdk-s3/plugins/http_200_errors.rb +1 -1
  21. data/lib/aws-sdk-s3/transfer_manager.rb +44 -31
  22. data/lib/aws-sdk-s3/types.rb +1162 -46
  23. data/lib/aws-sdk-s3.rb +1 -1
  24. data/sig/bucket.rbs +7 -4
  25. data/sig/bucket_acl.rbs +1 -1
  26. data/sig/bucket_cors.rbs +1 -1
  27. data/sig/bucket_lifecycle.rbs +1 -1
  28. data/sig/bucket_lifecycle_configuration.rbs +4 -4
  29. data/sig/bucket_logging.rbs +1 -1
  30. data/sig/bucket_notification.rbs +9 -9
  31. data/sig/bucket_tagging.rbs +1 -1
  32. data/sig/bucket_website.rbs +1 -1
  33. data/sig/client.rbs +246 -198
  34. data/sig/errors.rbs +12 -0
  35. data/sig/multipart_upload.rbs +2 -2
  36. data/sig/object.rbs +32 -13
  37. data/sig/object_acl.rbs +1 -1
  38. data/sig/object_summary.rbs +22 -12
  39. data/sig/params.rbs +78 -0
  40. data/sig/resource.rbs +1 -1
  41. data/sig/types.rbs +249 -39
  42. metadata +4 -3
@@ -600,6 +600,39 @@ module Aws::S3
600
600
  data[:object_lock_legal_hold_status]
601
601
  end
602
602
 
603
+ # The event hold status for this object. This header is only returned if
604
+ # the requester has the `s3:GetObjectRetention` permission.
605
+ #
606
+ # <note markdown="1"> This functionality is not supported for directory buckets.
607
+ #
608
+ # </note>
609
+ # @return [String]
610
+ def object_lock_event_hold
611
+ data[:object_lock_event_hold]
612
+ end
613
+
614
+ # The event hold duration in days for this object. Only returned when
615
+ # the event hold is enabled.
616
+ #
617
+ # <note markdown="1"> This functionality is not supported for directory buckets.
618
+ #
619
+ # </note>
620
+ # @return [Integer]
621
+ def object_lock_event_hold_duration_days
622
+ data[:object_lock_event_hold_duration_days]
623
+ end
624
+
625
+ # The event hold duration in years for this object. Only returned when
626
+ # the event hold is enabled.
627
+ #
628
+ # <note markdown="1"> This functionality is not supported for directory buckets.
629
+ #
630
+ # </note>
631
+ # @return [Integer]
632
+ def object_lock_event_hold_duration_years
633
+ data[:object_lock_event_hold_duration_years]
634
+ end
635
+
603
636
  # @!endgroup
604
637
 
605
638
  # @return [Client]
@@ -824,8 +857,9 @@ module Aws::S3
824
857
  # },
825
858
  # metadata_directive: "COPY", # accepts COPY, REPLACE
826
859
  # tagging_directive: "COPY", # accepts COPY, REPLACE
827
- # server_side_encryption: "AES256", # accepts AES256, aws:fsx, aws:kms, aws:kms:dsse
828
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW, EXPRESS_ONEZONE, FSX_OPENZFS, FSX_ONTAP
860
+ # annotation_directive: "COPY", # accepts COPY, EXCLUDE
861
+ # server_side_encryption: "AES256", # accepts AES256, aws:fsx, aws:backup, aws:kms, aws:kms:dsse
862
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW, EXPRESS_ONEZONE, FSX_OPENZFS, FSX_ONTAP, AWS_BACKUP_WARM, AWS_BACKUP_LOW_COST_WARM
829
863
  # website_redirect_location: "WebsiteRedirectLocation",
830
864
  # sse_customer_algorithm: "SSECustomerAlgorithm",
831
865
  # sse_customer_key: "SSECustomerKey",
@@ -841,6 +875,9 @@ module Aws::S3
841
875
  # object_lock_mode: "GOVERNANCE", # accepts GOVERNANCE, COMPLIANCE
842
876
  # object_lock_retain_until_date: Time.now,
843
877
  # object_lock_legal_hold_status: "ON", # accepts ON, OFF
878
+ # object_lock_event_hold: "ON", # accepts ON, OFF
879
+ # object_lock_event_hold_duration_days: 1,
880
+ # object_lock_event_hold_duration_years: 1,
844
881
  # expected_bucket_owner: "AccountId",
845
882
  # expected_source_bucket_owner: "AccountId",
846
883
  # })
@@ -1174,6 +1211,42 @@ module Aws::S3
1174
1211
  # value of `x-amz-tagging` is the empty value.
1175
1212
  #
1176
1213
  # </note>
1214
+ # @option options [String] :annotation_directive
1215
+ # Specifies whether you want to copy annotations from the source object
1216
+ # or exclude them. If this header isn't specified, `COPY` is the
1217
+ # default behavior.
1218
+ #
1219
+ # Valid Values: `COPY | EXCLUDE`
1220
+ #
1221
+ # You can specify this directive as either an HTTP header
1222
+ # (`x-amz-object-annotation-directive`) or as a query string parameter.
1223
+ # Use the query string form when generating presigned URLs that need to
1224
+ # control annotation copy behavior.
1225
+ #
1226
+ # When set to `COPY`, you must have `s3:GetObjectAnnotation` permission
1227
+ # on the source object and `s3:PutObjectAnnotation` permission on the
1228
+ # destination. Each annotation copied is billed as a separate PUT
1229
+ # request. If annotations on the source are modified during the copy,
1230
+ # Amazon S3 returns a retryable error.
1231
+ #
1232
+ # <note markdown="1"> For directory buckets, annotations are not supported. Use `EXCLUDE` to
1233
+ # copy objects to directory buckets without errors. If you specify
1234
+ # `COPY` for a directory bucket, the request returns HTTP 501 (Not
1235
+ # Implemented).
1236
+ #
1237
+ # </note>
1238
+ #
1239
+ # <note markdown="1"> When you copy objects using multipart upload (for example, when the
1240
+ # Amazon Web Services CLI or Amazon Web Services SDKs use Transfer
1241
+ # Manager for objects larger than approximately 8 MB), annotations are
1242
+ # not copied by default. To include annotations, specify `--copy-props
1243
+ # default` in the Amazon Web Services CLI or the equivalent SDK
1244
+ # configuration. With this opt-in, the SDK reads source annotations,
1245
+ # completes the multipart upload, and then writes each annotation to the
1246
+ # destination. Between the upload completion and the last annotation
1247
+ # write, the destination object exists without all its annotations.
1248
+ #
1249
+ # </note>
1177
1250
  # @option options [String] :server_side_encryption
1178
1251
  # The server-side encryption algorithm used when storing this object in
1179
1252
  # Amazon S3. Unrecognized or unsupported values won’t write a
@@ -1546,6 +1619,27 @@ module Aws::S3
1546
1619
  # <note markdown="1"> This functionality is not supported for directory buckets.
1547
1620
  #
1548
1621
  # </note>
1622
+ # @option options [String] :object_lock_event_hold
1623
+ # The event hold status to apply to the object copy. Set to `ON` to
1624
+ # enable or `OFF` to disable.
1625
+ #
1626
+ # <note markdown="1"> This functionality is not supported for directory buckets.
1627
+ #
1628
+ # </note>
1629
+ # @option options [Integer] :object_lock_event_hold_duration_days
1630
+ # The event hold duration in days to apply to the object copy. You
1631
+ # cannot specify a duration in both days and years.
1632
+ #
1633
+ # <note markdown="1"> This functionality is not supported for directory buckets.
1634
+ #
1635
+ # </note>
1636
+ # @option options [Integer] :object_lock_event_hold_duration_years
1637
+ # The event hold duration in years to apply to the object copy. You
1638
+ # cannot specify a duration in both days and years.
1639
+ #
1640
+ # <note markdown="1"> This functionality is not supported for directory buckets.
1641
+ #
1642
+ # </note>
1549
1643
  # @option options [String] :expected_bucket_owner
1550
1644
  # The account ID of the expected destination bucket owner. If the
1551
1645
  # account ID that you provide does not match the actual owner of the
@@ -1948,8 +2042,8 @@ module Aws::S3
1948
2042
  # metadata: {
1949
2043
  # "MetadataKey" => "MetadataValue",
1950
2044
  # },
1951
- # server_side_encryption: "AES256", # accepts AES256, aws:fsx, aws:kms, aws:kms:dsse
1952
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW, EXPRESS_ONEZONE, FSX_OPENZFS, FSX_ONTAP
2045
+ # server_side_encryption: "AES256", # accepts AES256, aws:fsx, aws:backup, aws:kms, aws:kms:dsse
2046
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW, EXPRESS_ONEZONE, FSX_OPENZFS, FSX_ONTAP, AWS_BACKUP_WARM, AWS_BACKUP_LOW_COST_WARM
1953
2047
  # website_redirect_location: "WebsiteRedirectLocation",
1954
2048
  # sse_customer_algorithm: "SSECustomerAlgorithm",
1955
2049
  # sse_customer_key: "SSECustomerKey",
@@ -1962,6 +2056,9 @@ module Aws::S3
1962
2056
  # object_lock_mode: "GOVERNANCE", # accepts GOVERNANCE, COMPLIANCE
1963
2057
  # object_lock_retain_until_date: Time.now,
1964
2058
  # object_lock_legal_hold_status: "ON", # accepts ON, OFF
2059
+ # object_lock_event_hold: "ON", # accepts ON, OFF
2060
+ # object_lock_event_hold_duration_days: 1,
2061
+ # object_lock_event_hold_duration_years: 1,
1965
2062
  # expected_bucket_owner: "AccountId",
1966
2063
  # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256, CRC64NVME, SHA512, MD5, XXHASH64, XXHASH3, XXHASH128
1967
2064
  # checksum_type: "COMPOSITE", # accepts COMPOSITE, FULL_OBJECT
@@ -2483,6 +2580,27 @@ module Aws::S3
2483
2580
  # <note markdown="1"> This functionality is not supported for directory buckets.
2484
2581
  #
2485
2582
  # </note>
2583
+ # @option options [String] :object_lock_event_hold
2584
+ # Specifies the event hold status to apply to the uploaded object. Set
2585
+ # to `ON` to enable or `OFF` to disable.
2586
+ #
2587
+ # <note markdown="1"> This functionality is not supported for directory buckets.
2588
+ #
2589
+ # </note>
2590
+ # @option options [Integer] :object_lock_event_hold_duration_days
2591
+ # Specifies the event hold duration in days to apply to the uploaded
2592
+ # object. You cannot specify a duration in both days and years.
2593
+ #
2594
+ # <note markdown="1"> This functionality is not supported for directory buckets.
2595
+ #
2596
+ # </note>
2597
+ # @option options [Integer] :object_lock_event_hold_duration_years
2598
+ # Specifies the event hold duration in years to apply to the uploaded
2599
+ # object. You cannot specify a duration in both days and years.
2600
+ #
2601
+ # <note markdown="1"> This functionality is not supported for directory buckets.
2602
+ #
2603
+ # </note>
2486
2604
  # @option options [String] :expected_bucket_owner
2487
2605
  # The account ID of the expected bucket owner. If the account ID that
2488
2606
  # you provide does not match the actual owner of the bucket, the request
@@ -2554,8 +2672,8 @@ module Aws::S3
2554
2672
  # metadata: {
2555
2673
  # "MetadataKey" => "MetadataValue",
2556
2674
  # },
2557
- # server_side_encryption: "AES256", # accepts AES256, aws:fsx, aws:kms, aws:kms:dsse
2558
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW, EXPRESS_ONEZONE, FSX_OPENZFS, FSX_ONTAP
2675
+ # server_side_encryption: "AES256", # accepts AES256, aws:fsx, aws:backup, aws:kms, aws:kms:dsse
2676
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW, EXPRESS_ONEZONE, FSX_OPENZFS, FSX_ONTAP, AWS_BACKUP_WARM, AWS_BACKUP_LOW_COST_WARM
2559
2677
  # website_redirect_location: "WebsiteRedirectLocation",
2560
2678
  # sse_customer_algorithm: "SSECustomerAlgorithm",
2561
2679
  # sse_customer_key: "SSECustomerKey",
@@ -2568,6 +2686,9 @@ module Aws::S3
2568
2686
  # object_lock_mode: "GOVERNANCE", # accepts GOVERNANCE, COMPLIANCE
2569
2687
  # object_lock_retain_until_date: Time.now,
2570
2688
  # object_lock_legal_hold_status: "ON", # accepts ON, OFF
2689
+ # object_lock_event_hold: "ON", # accepts ON, OFF
2690
+ # object_lock_event_hold_duration_days: 1,
2691
+ # object_lock_event_hold_duration_years: 1,
2571
2692
  # expected_bucket_owner: "AccountId",
2572
2693
  # })
2573
2694
  # @param [Hash] options ({})
@@ -3193,6 +3314,27 @@ module Aws::S3
3193
3314
  #
3194
3315
  #
3195
3316
  # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html
3317
+ # @option options [String] :object_lock_event_hold
3318
+ # Specifies the event hold status to apply to this object. Set to `ON`
3319
+ # to enable or `OFF` to disable.
3320
+ #
3321
+ # <note markdown="1"> This functionality is not supported for directory buckets.
3322
+ #
3323
+ # </note>
3324
+ # @option options [Integer] :object_lock_event_hold_duration_days
3325
+ # Specifies the event hold duration in days to apply to this object. You
3326
+ # cannot specify a duration in both days and years.
3327
+ #
3328
+ # <note markdown="1"> This functionality is not supported for directory buckets.
3329
+ #
3330
+ # </note>
3331
+ # @option options [Integer] :object_lock_event_hold_duration_years
3332
+ # Specifies the event hold duration in years to apply to this object.
3333
+ # You cannot specify a duration in both days and years.
3334
+ #
3335
+ # <note markdown="1"> This functionality is not supported for directory buckets.
3336
+ #
3337
+ # </note>
3196
3338
  # @option options [String] :expected_bucket_owner
3197
3339
  # The account ID of the expected bucket owner. If the account ID that
3198
3340
  # you provide does not match the actual owner of the bucket, the request
@@ -3259,7 +3401,7 @@ module Aws::S3
3259
3401
  # bucket_name: "BucketName", # required
3260
3402
  # prefix: "LocationPrefix", # required
3261
3403
  # encryption: {
3262
- # encryption_type: "AES256", # required, accepts AES256, aws:fsx, aws:kms, aws:kms:dsse
3404
+ # encryption_type: "AES256", # required, accepts AES256, aws:fsx, aws:backup, aws:kms, aws:kms:dsse
3263
3405
  # kms_key_id: "SSEKMSKeyId",
3264
3406
  # kms_context: "KMSContext",
3265
3407
  # },
@@ -3290,7 +3432,7 @@ module Aws::S3
3290
3432
  # value: "MetadataValue",
3291
3433
  # },
3292
3434
  # ],
3293
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW, EXPRESS_ONEZONE, FSX_OPENZFS, FSX_ONTAP
3435
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR, SNOW, EXPRESS_ONEZONE, FSX_OPENZFS, FSX_ONTAP, AWS_BACKUP_WARM, AWS_BACKUP_LOW_COST_WARM
3294
3436
  # },
3295
3437
  # },
3296
3438
  # },
@@ -1,12 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'thread'
4
-
5
3
  module Aws
6
4
  module S3
7
5
  # @api private
8
6
  class ObjectCopier
9
-
10
7
  # @param [S3::Object] object
11
8
  def initialize(object, options = {})
12
9
  @object = object
@@ -23,7 +20,7 @@ module Aws
23
20
 
24
21
  private
25
22
 
26
- def copy_object(source, target, options)
23
+ def copy_object(source, target, options) # rubocop:disable Metrics/MethodLength
27
24
  target_bucket, target_key = copy_target(target)
28
25
  options[:bucket] = target_bucket
29
26
  options[:key] = target_key
@@ -38,7 +35,7 @@ module Aws
38
35
  end
39
36
  end
40
37
 
41
- def copy_source(source)
38
+ def copy_source(source) # rubocop:disable Metrics/MethodLength
42
39
  case source
43
40
  when String then source
44
41
  when Hash
@@ -50,54 +47,46 @@ module Aws
50
47
  when S3::ObjectVersion
51
48
  "#{source.bucket_name}/#{escape(source.object_key)}?versionId=#{source.id}"
52
49
  else
53
- msg = "expected source to be an Aws::S3::Object, Hash, or String"
54
- raise ArgumentError, msg
50
+ raise ArgumentError, 'expected source to be an Aws::S3::Object, Hash, or String'
55
51
  end
56
52
  end
57
53
 
58
54
  def copy_target(target)
59
55
  case target
60
- when String then target.match(/([^\/]+?)\/(.+)/)[1,2]
56
+ when String then target.match(%r{([^/]+?)/(.+)})[1, 2]
61
57
  when Hash then target.values_at(:bucket, :key)
62
58
  when S3::Object then [target.bucket_name, target.key]
63
59
  else
64
- msg = "expected target to be an Aws::S3::Object, Hash, or String"
65
- raise ArgumentError, msg
60
+ raise ArgumentError, 'expected target to be an Aws::S3::Object, Hash, or String'
66
61
  end
67
62
  end
68
63
 
69
64
  def merge_options(source_or_target, options)
70
- if Hash === source_or_target
71
- source_or_target.inject(options.dup) do |opts, (key, value)|
72
- opts[key] = value unless [:bucket, :key, :version_id].include?(key)
73
- opts
65
+ if source_or_target.is_a?(Hash)
66
+ source_or_target.each_with_object(options.dup) do |(key, value), opts|
67
+ opts[key] = value unless %i[bucket key version_id].include?(key)
74
68
  end
75
69
  else
76
70
  options.dup
77
71
  end
78
72
  end
79
73
 
80
- def apply_source_client(source, options)
81
-
82
- if source.respond_to?(:client)
83
- options[:copy_source_client] ||= source.client
84
- end
74
+ def apply_source_client(source, options) # rubocop:disable Metrics/AbcSize
75
+ options[:copy_source_client] ||= source.client if source.respond_to?(:client)
85
76
 
86
77
  if options[:copy_source_region]
87
78
  config = @object.client.config
88
- config = config.each_pair.inject({}) { |h, (k,v)| h[k] = v; h }
79
+ config = config.each_pair.with_object({}) { |(k, v), h| h[k] = v unless v.nil? }
89
80
  config[:region] = options.delete(:copy_source_region)
90
81
  options[:copy_source_client] ||= S3::Client.new(config)
91
82
  end
92
83
 
93
84
  options[:copy_source_client] ||= @object.client
94
-
95
85
  end
96
86
 
97
87
  def escape(str)
98
88
  Seahorse::Util.uri_path_escape(str)
99
89
  end
100
-
101
90
  end
102
91
  end
103
92
  end