aws-sdk-s3 1.220.0 → 1.232.1

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +84 -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 +21 -0
  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/types.rb +1162 -46
  22. data/lib/aws-sdk-s3.rb +1 -1
  23. data/sig/bucket.rbs +7 -4
  24. data/sig/bucket_acl.rbs +1 -1
  25. data/sig/bucket_cors.rbs +1 -1
  26. data/sig/bucket_lifecycle.rbs +1 -1
  27. data/sig/bucket_lifecycle_configuration.rbs +4 -4
  28. data/sig/bucket_logging.rbs +1 -1
  29. data/sig/bucket_notification.rbs +9 -9
  30. data/sig/bucket_tagging.rbs +1 -1
  31. data/sig/bucket_website.rbs +1 -1
  32. data/sig/client.rbs +246 -198
  33. data/sig/errors.rbs +12 -0
  34. data/sig/multipart_upload.rbs +2 -2
  35. data/sig/object.rbs +32 -13
  36. data/sig/object_acl.rbs +1 -1
  37. data/sig/object_summary.rbs +22 -12
  38. data/sig/params.rbs +78 -0
  39. data/sig/resource.rbs +1 -1
  40. data/sig/types.rbs +249 -39
  41. metadata +4 -3
@@ -54,7 +54,7 @@ module Aws
54
54
  cek_alg = envelope['x-amz-c']
55
55
  encryption_context =
56
56
  if !envelope['x-amz-t'].nil?
57
- Json.load(envelope['x-amz-t'])
57
+ extract_encryption_context(envelope['x-amz-t'])
58
58
  else
59
59
  ##= ../specification/s3-encryption/data-format/content-metadata.md#v3-only
60
60
  ##% If the mapkey x-amz-t is not present, the default Material Description value MUST be set to an empty map (`{}`).
@@ -102,6 +102,18 @@ module Aws
102
102
 
103
103
  private
104
104
 
105
+ # Raise a decryption error for a malformed material description.
106
+ def extract_encryption_context(matdesc)
107
+ context = Json.load(matdesc) if matdesc.is_a?(String)
108
+ unless context.is_a?(Hash)
109
+ raise Errors::DecryptionError, 'Malformed material description'
110
+ end
111
+
112
+ context
113
+ rescue Aws::Json::ParseError, EncodingError
114
+ raise Errors::DecryptionError, 'Malformed material description'
115
+ end
116
+
105
117
  def validate_key_wrap(key_wrap_schema)
106
118
  case key_wrap_schema
107
119
  when :kms_context then '12'
@@ -710,10 +710,13 @@ module Aws::S3
710
710
  if (outpost_type = Aws::Endpoints::Matchers.attr(bucket_arn, "resourceId[2]"))
711
711
  if (access_point_name = Aws::Endpoints::Matchers.attr(bucket_arn, "resourceId[3]"))
712
712
  if Aws::Endpoints::Matchers.string_equals?(outpost_type, "accesspoint")
713
- if Aws::Endpoints::Matchers.set?(parameters.endpoint) && (url = Aws::Endpoints::Matchers.parse_url(parameters.endpoint))
714
- return Aws::Endpoints::Endpoint.new(url: "https://#{access_point_name}-#{bucket_arn['accountId']}.#{outpost_id}.#{url['authority']}", headers: {}, properties: {"authSchemes" => [{"disableDoubleEncoding" => true, "name" => "sigv4a", "signingName" => "s3-outposts", "signingRegionSet" => ["*"]}, {"disableDoubleEncoding" => true, "name" => "sigv4", "signingName" => "s3-outposts", "signingRegion" => "#{bucket_arn['region']}"}]})
713
+ if Aws::Endpoints::Matchers.valid_host_label?(access_point_name, false)
714
+ if Aws::Endpoints::Matchers.set?(parameters.endpoint) && (url = Aws::Endpoints::Matchers.parse_url(parameters.endpoint))
715
+ return Aws::Endpoints::Endpoint.new(url: "https://#{access_point_name}-#{bucket_arn['accountId']}.#{outpost_id}.#{url['authority']}", headers: {}, properties: {"authSchemes" => [{"disableDoubleEncoding" => true, "name" => "sigv4a", "signingName" => "s3-outposts", "signingRegionSet" => ["*"]}, {"disableDoubleEncoding" => true, "name" => "sigv4", "signingName" => "s3-outposts", "signingRegion" => "#{bucket_arn['region']}"}]})
716
+ end
717
+ return Aws::Endpoints::Endpoint.new(url: "https://#{access_point_name}-#{bucket_arn['accountId']}.#{outpost_id}.s3-outposts.#{bucket_arn['region']}.#{bucket_partition['dnsSuffix']}", headers: {}, properties: {"authSchemes" => [{"disableDoubleEncoding" => true, "name" => "sigv4a", "signingName" => "s3-outposts", "signingRegionSet" => ["*"]}, {"disableDoubleEncoding" => true, "name" => "sigv4", "signingName" => "s3-outposts", "signingRegion" => "#{bucket_arn['region']}"}]})
715
718
  end
716
- return Aws::Endpoints::Endpoint.new(url: "https://#{access_point_name}-#{bucket_arn['accountId']}.#{outpost_id}.s3-outposts.#{bucket_arn['region']}.#{bucket_partition['dnsSuffix']}", headers: {}, properties: {"authSchemes" => [{"disableDoubleEncoding" => true, "name" => "sigv4a", "signingName" => "s3-outposts", "signingRegionSet" => ["*"]}, {"disableDoubleEncoding" => true, "name" => "sigv4", "signingName" => "s3-outposts", "signingRegion" => "#{bucket_arn['region']}"}]})
719
+ raise ArgumentError, "Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `#{access_point_name}`"
717
720
  end
718
721
  raise ArgumentError, "Expected an outpost type `accesspoint`, found #{outpost_type}"
719
722
  end
@@ -303,6 +303,17 @@ module Aws::S3
303
303
  end
304
304
  end
305
305
 
306
+ class DeleteObjectAnnotation
307
+ def self.build(context)
308
+ Aws::S3::EndpointParameters.create(
309
+ context.config,
310
+ bucket: context.params[:bucket],
311
+ use_dual_stack: context[:use_dualstack_endpoint],
312
+ accelerate: context[:use_accelerate_endpoint],
313
+ )
314
+ end
315
+ end
316
+
306
317
  class DeleteObjectTagging
307
318
  def self.build(context)
308
319
  Aws::S3::EndpointParameters.create(
@@ -660,6 +671,18 @@ module Aws::S3
660
671
  end
661
672
  end
662
673
 
674
+ class GetObjectAnnotation
675
+ def self.build(context)
676
+ Aws::S3::EndpointParameters.create(
677
+ context.config,
678
+ bucket: context.params[:bucket],
679
+ use_dual_stack: context[:use_dualstack_endpoint],
680
+ accelerate: context[:use_accelerate_endpoint],
681
+ key: context.params[:key],
682
+ )
683
+ end
684
+ end
685
+
663
686
  class GetObjectAttributes
664
687
  def self.build(context)
665
688
  Aws::S3::EndpointParameters.create(
@@ -842,6 +865,17 @@ module Aws::S3
842
865
  end
843
866
  end
844
867
 
868
+ class ListObjectAnnotations
869
+ def self.build(context)
870
+ Aws::S3::EndpointParameters.create(
871
+ context.config,
872
+ bucket: context.params[:bucket],
873
+ use_dual_stack: context[:use_dualstack_endpoint],
874
+ accelerate: context[:use_accelerate_endpoint],
875
+ )
876
+ end
877
+ end
878
+
845
879
  class ListObjectVersions
846
880
  def self.build(context)
847
881
  Aws::S3::EndpointParameters.create(
@@ -1165,6 +1199,18 @@ module Aws::S3
1165
1199
  end
1166
1200
  end
1167
1201
 
1202
+ class PutObjectAnnotation
1203
+ def self.build(context)
1204
+ Aws::S3::EndpointParameters.create(
1205
+ context.config,
1206
+ bucket: context.params[:bucket],
1207
+ use_dual_stack: context[:use_dualstack_endpoint],
1208
+ accelerate: context[:use_accelerate_endpoint],
1209
+ key: context.params[:key],
1210
+ )
1211
+ end
1212
+ end
1213
+
1168
1214
  class PutObjectLegalHold
1169
1215
  def self.build(context)
1170
1216
  Aws::S3::EndpointParameters.create(
@@ -1255,6 +1301,18 @@ module Aws::S3
1255
1301
  end
1256
1302
  end
1257
1303
 
1304
+ class UpdateBucketMetadataAnnotationTableConfiguration
1305
+ def self.build(context)
1306
+ Aws::S3::EndpointParameters.create(
1307
+ context.config,
1308
+ bucket: context.params[:bucket],
1309
+ use_dual_stack: context[:use_dualstack_endpoint],
1310
+ accelerate: context[:use_accelerate_endpoint],
1311
+ use_s3_express_control_endpoint: true,
1312
+ )
1313
+ end
1314
+ end
1315
+
1258
1316
  class UpdateBucketMetadataInventoryTableConfiguration
1259
1317
  def self.build(context)
1260
1318
  Aws::S3::EndpointParameters.create(
@@ -1376,6 +1434,8 @@ module Aws::S3
1376
1434
  DeleteBucketWebsite.build(context)
1377
1435
  when :delete_object
1378
1436
  DeleteObject.build(context)
1437
+ when :delete_object_annotation
1438
+ DeleteObjectAnnotation.build(context)
1379
1439
  when :delete_object_tagging
1380
1440
  DeleteObjectTagging.build(context)
1381
1441
  when :delete_objects
@@ -1436,6 +1496,8 @@ module Aws::S3
1436
1496
  GetObject.build(context)
1437
1497
  when :get_object_acl
1438
1498
  GetObjectAcl.build(context)
1499
+ when :get_object_annotation
1500
+ GetObjectAnnotation.build(context)
1439
1501
  when :get_object_attributes
1440
1502
  GetObjectAttributes.build(context)
1441
1503
  when :get_object_legal_hold
@@ -1468,6 +1530,8 @@ module Aws::S3
1468
1530
  ListDirectoryBuckets.build(context)
1469
1531
  when :list_multipart_uploads
1470
1532
  ListMultipartUploads.build(context)
1533
+ when :list_object_annotations
1534
+ ListObjectAnnotations.build(context)
1471
1535
  when :list_object_versions
1472
1536
  ListObjectVersions.build(context)
1473
1537
  when :list_objects
@@ -1522,6 +1586,8 @@ module Aws::S3
1522
1586
  PutObject.build(context)
1523
1587
  when :put_object_acl
1524
1588
  PutObjectAcl.build(context)
1589
+ when :put_object_annotation
1590
+ PutObjectAnnotation.build(context)
1525
1591
  when :put_object_legal_hold
1526
1592
  PutObjectLegalHold.build(context)
1527
1593
  when :put_object_lock_configuration
@@ -1538,6 +1604,8 @@ module Aws::S3
1538
1604
  RestoreObject.build(context)
1539
1605
  when :select_object_content
1540
1606
  SelectObjectContent.build(context)
1607
+ when :update_bucket_metadata_annotation_table_configuration
1608
+ UpdateBucketMetadataAnnotationTableConfiguration.build(context)
1541
1609
  when :update_bucket_metadata_inventory_table_configuration
1542
1610
  UpdateBucketMetadataInventoryTableConfiguration.build(context)
1543
1611
  when :update_bucket_metadata_journal_table_configuration
@@ -28,19 +28,25 @@ module Aws::S3
28
28
  #
29
29
  # ## Error Classes
30
30
  # * {AccessDenied}
31
+ # * {AnnotationLimitExceeded}
32
+ # * {AnnotationNameTooLong}
31
33
  # * {BucketAlreadyExists}
32
34
  # * {BucketAlreadyOwnedByYou}
33
35
  # * {EncryptionTypeMismatch}
34
36
  # * {IdempotencyParameterMismatch}
37
+ # * {InvalidAnnotationName}
35
38
  # * {InvalidObjectState}
39
+ # * {InvalidPrefix}
36
40
  # * {InvalidRequest}
37
41
  # * {InvalidWriteOffset}
42
+ # * {NoSuchAnnotation}
38
43
  # * {NoSuchBucket}
39
44
  # * {NoSuchKey}
40
45
  # * {NoSuchUpload}
41
46
  # * {ObjectAlreadyInActiveTierError}
42
47
  # * {ObjectNotInActiveTierError}
43
48
  # * {TooManyParts}
49
+ # * {UnsupportedMediaType}
44
50
  #
45
51
  # Additionally, error classes are dynamically generated for service errors based on the error code
46
52
  # if they are not defined above.
@@ -58,6 +64,26 @@ module Aws::S3
58
64
  end
59
65
  end
60
66
 
67
+ class AnnotationLimitExceeded < ServiceError
68
+
69
+ # @param [Seahorse::Client::RequestContext] context
70
+ # @param [String] message
71
+ # @param [Aws::S3::Types::AnnotationLimitExceeded] data
72
+ def initialize(context, message, data = Aws::EmptyStructure.new)
73
+ super(context, message, data)
74
+ end
75
+ end
76
+
77
+ class AnnotationNameTooLong < ServiceError
78
+
79
+ # @param [Seahorse::Client::RequestContext] context
80
+ # @param [String] message
81
+ # @param [Aws::S3::Types::AnnotationNameTooLong] data
82
+ def initialize(context, message, data = Aws::EmptyStructure.new)
83
+ super(context, message, data)
84
+ end
85
+ end
86
+
61
87
  class BucketAlreadyExists < ServiceError
62
88
 
63
89
  # @param [Seahorse::Client::RequestContext] context
@@ -98,6 +124,16 @@ module Aws::S3
98
124
  end
99
125
  end
100
126
 
127
+ class InvalidAnnotationName < ServiceError
128
+
129
+ # @param [Seahorse::Client::RequestContext] context
130
+ # @param [String] message
131
+ # @param [Aws::S3::Types::InvalidAnnotationName] data
132
+ def initialize(context, message, data = Aws::EmptyStructure.new)
133
+ super(context, message, data)
134
+ end
135
+ end
136
+
101
137
  class InvalidObjectState < ServiceError
102
138
 
103
139
  # @param [Seahorse::Client::RequestContext] context
@@ -118,6 +154,16 @@ module Aws::S3
118
154
  end
119
155
  end
120
156
 
157
+ class InvalidPrefix < ServiceError
158
+
159
+ # @param [Seahorse::Client::RequestContext] context
160
+ # @param [String] message
161
+ # @param [Aws::S3::Types::InvalidPrefix] data
162
+ def initialize(context, message, data = Aws::EmptyStructure.new)
163
+ super(context, message, data)
164
+ end
165
+ end
166
+
121
167
  class InvalidRequest < ServiceError
122
168
 
123
169
  # @param [Seahorse::Client::RequestContext] context
@@ -138,6 +184,16 @@ module Aws::S3
138
184
  end
139
185
  end
140
186
 
187
+ class NoSuchAnnotation < ServiceError
188
+
189
+ # @param [Seahorse::Client::RequestContext] context
190
+ # @param [String] message
191
+ # @param [Aws::S3::Types::NoSuchAnnotation] data
192
+ def initialize(context, message, data = Aws::EmptyStructure.new)
193
+ super(context, message, data)
194
+ end
195
+ end
196
+
141
197
  class NoSuchBucket < ServiceError
142
198
 
143
199
  # @param [Seahorse::Client::RequestContext] context
@@ -198,6 +254,16 @@ module Aws::S3
198
254
  end
199
255
  end
200
256
 
257
+ class UnsupportedMediaType < ServiceError
258
+
259
+ # @param [Seahorse::Client::RequestContext] context
260
+ # @param [String] message
261
+ # @param [Aws::S3::Types::UnsupportedMediaType] data
262
+ def initialize(context, message, data = Aws::EmptyStructure.new)
263
+ super(context, message, data)
264
+ end
265
+ end
266
+
201
267
  end
202
268
  end
203
269
 
@@ -196,7 +196,9 @@ module Aws
196
196
  end
197
197
 
198
198
  def single_request(opts)
199
- params = get_opts(opts[:params]).merge(response_target: opts[:destination])
199
+ resolve_temp_path(opts)
200
+ target = opts[:temp_path] || opts[:destination]
201
+ params = get_opts(opts[:params]).merge(response_target: target)
200
202
  params[:on_chunk_received] = single_part_progress(opts) if opts[:progress_callback]
201
203
  resp = @client.get_object(params)
202
204
  return resp unless opts[:on_checksum_validated]
@@ -154,7 +154,6 @@ module Aws
154
154
  Thread.current[:net_http_override_body_stream_chunk] = @http_chunk_size if @http_chunk_size
155
155
  update_progress(progress, p)
156
156
  resp = @client.upload_part(p)
157
- p[:body].close
158
157
  completed_part = { etag: resp.etag, part_number: p[:part_number] }
159
158
  apply_part_checksum(resp, completed_part)
160
159
  completed.push(completed_part)
@@ -162,6 +161,7 @@ module Aws
162
161
  abort_upload = true
163
162
  errors << e
164
163
  ensure
164
+ p[:body].close
165
165
  Thread.current[:net_http_override_body_stream_chunk] = nil if @http_chunk_size
166
166
  completion_queue << :done
167
167
  end
@@ -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