aws-sdk-s3 1.176.1 → 1.182.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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +32 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-s3/bucket.rb +40 -29
  5. data/lib/aws-sdk-s3/bucket_acl.rb +6 -5
  6. data/lib/aws-sdk-s3/bucket_cors.rb +6 -5
  7. data/lib/aws-sdk-s3/bucket_lifecycle.rb +2 -2
  8. data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +3 -3
  9. data/lib/aws-sdk-s3/bucket_logging.rb +2 -2
  10. data/lib/aws-sdk-s3/bucket_policy.rb +6 -5
  11. data/lib/aws-sdk-s3/bucket_request_payment.rb +3 -3
  12. data/lib/aws-sdk-s3/bucket_tagging.rb +3 -3
  13. data/lib/aws-sdk-s3/bucket_versioning.rb +9 -9
  14. data/lib/aws-sdk-s3/bucket_website.rb +3 -3
  15. data/lib/aws-sdk-s3/client.rb +764 -602
  16. data/lib/aws-sdk-s3/client_api.rb +35 -2
  17. data/lib/aws-sdk-s3/endpoint_provider.rb +260 -277
  18. data/lib/aws-sdk-s3/file_downloader.rb +4 -21
  19. data/lib/aws-sdk-s3/multipart_file_uploader.rb +31 -13
  20. data/lib/aws-sdk-s3/multipart_upload.rb +46 -4
  21. data/lib/aws-sdk-s3/multipart_upload_part.rb +50 -34
  22. data/lib/aws-sdk-s3/object.rb +139 -100
  23. data/lib/aws-sdk-s3/object_acl.rb +4 -4
  24. data/lib/aws-sdk-s3/object_summary.rb +87 -70
  25. data/lib/aws-sdk-s3/object_version.rb +18 -14
  26. data/lib/aws-sdk-s3/plugins/checksum_algorithm.rb +31 -0
  27. data/lib/aws-sdk-s3/plugins/express_session_auth.rb +11 -20
  28. data/lib/aws-sdk-s3/plugins/md5s.rb +10 -71
  29. data/lib/aws-sdk-s3/presigner.rb +4 -5
  30. data/lib/aws-sdk-s3/resource.rb +1 -1
  31. data/lib/aws-sdk-s3/types.rb +962 -610
  32. data/lib/aws-sdk-s3.rb +1 -1
  33. data/sig/bucket.rbs +4 -3
  34. data/sig/bucket_acl.rbs +1 -1
  35. data/sig/bucket_cors.rbs +1 -1
  36. data/sig/bucket_lifecycle.rbs +1 -1
  37. data/sig/bucket_lifecycle_configuration.rbs +1 -1
  38. data/sig/bucket_logging.rbs +1 -1
  39. data/sig/bucket_policy.rbs +1 -1
  40. data/sig/bucket_request_payment.rbs +1 -1
  41. data/sig/bucket_tagging.rbs +1 -1
  42. data/sig/bucket_versioning.rbs +3 -3
  43. data/sig/bucket_website.rbs +1 -1
  44. data/sig/client.rbs +53 -31
  45. data/sig/multipart_upload.rbs +8 -1
  46. data/sig/multipart_upload_part.rbs +5 -1
  47. data/sig/object.rbs +16 -5
  48. data/sig/object_acl.rbs +1 -1
  49. data/sig/object_summary.rbs +11 -6
  50. data/sig/object_version.rbs +5 -2
  51. data/sig/resource.rbs +3 -1
  52. data/sig/types.rbs +64 -34
  53. metadata +5 -5
  54. data/lib/aws-sdk-s3/plugins/skip_whole_multipart_get_checksums.rb +0 -31
@@ -28,18 +28,10 @@ module Aws
28
28
  @chunk_size = options[:chunk_size]
29
29
  @params = {
30
30
  bucket: options[:bucket],
31
- key: options[:key],
31
+ key: options[:key]
32
32
  }
33
33
  @params[:version_id] = options[:version_id] if options[:version_id]
34
-
35
- # checksum_mode only supports the value "ENABLED"
36
- # falsey values (false/nil) or "DISABLED" should be considered
37
- # disabled and the api parameter should be unset.
38
- if (checksum_mode = options.fetch(:checksum_mode, 'ENABLED'))
39
- @params[:checksum_mode] = checksum_mode unless checksum_mode.upcase == 'DISABLED'
40
- end
41
34
  @on_checksum_validated = options[:on_checksum_validated]
42
-
43
35
  @progress_callback = options[:progress_callback]
44
36
 
45
37
  validate!
@@ -67,11 +59,6 @@ module Aws
67
59
  private
68
60
 
69
61
  def validate!
70
- if @on_checksum_validated && @params[:checksum_mode] != 'ENABLED'
71
- raise ArgumentError, "You must set checksum_mode: 'ENABLED' " +
72
- "when providing a on_checksum_validated callback"
73
- end
74
-
75
62
  if @on_checksum_validated && !@on_checksum_validated.respond_to?(:call)
76
63
  raise ArgumentError, 'on_checksum_validated must be callable'
77
64
  end
@@ -164,9 +151,7 @@ module Aws
164
151
 
165
152
  def download_in_threads(pending, total_size)
166
153
  threads = []
167
- if @progress_callback
168
- progress = MultipartProgress.new(pending, total_size, @progress_callback)
169
- end
154
+ progress = MultipartProgress.new(pending, total_size, @progress_callback) if @progress_callback
170
155
  @thread_count.times do
171
156
  thread = Thread.new do
172
157
  begin
@@ -208,9 +193,7 @@ module Aws
208
193
 
209
194
  return resp unless @on_checksum_validated
210
195
 
211
- if resp.checksum_validated
212
- @on_checksum_validated.call(resp.checksum_validated, resp)
213
- end
196
+ @on_checksum_validated.call(resp.checksum_validated, resp) if resp.checksum_validated
214
197
 
215
198
  resp
216
199
  end
@@ -251,7 +234,7 @@ module Aws
251
234
  end
252
235
 
253
236
  # @api private
254
- class MultipartProgress
237
+ class MultipartProgress
255
238
  def initialize(parts, total_size, progress_callback)
256
239
  @bytes_received = Array.new(parts.size, 0)
257
240
  @part_sizes = parts.map(&:size)
@@ -16,7 +16,6 @@ module Aws
16
16
 
17
17
  THREAD_COUNT = 10
18
18
 
19
- # @api private
20
19
  CREATE_OPTIONS = Set.new(
21
20
  Client.api.operation(:create_multipart_upload).input.shape.member_names
22
21
  )
@@ -25,11 +24,16 @@ module Aws
25
24
  Client.api.operation(:complete_multipart_upload).input.shape.member_names
26
25
  )
27
26
 
28
- # @api private
29
27
  UPLOAD_PART_OPTIONS = Set.new(
30
28
  Client.api.operation(:upload_part).input.shape.member_names
31
29
  )
32
30
 
31
+ CHECKSUM_KEYS = Set.new(
32
+ Client.api.operation(:upload_part).input.shape.members.map do |n, s|
33
+ n if s.location == 'header' && s.location_name.start_with?('x-amz-checksum-')
34
+ end.compact
35
+ )
36
+
33
37
  # @option options [Client] :client
34
38
  # @option options [Integer] :thread_count (THREAD_COUNT)
35
39
  def initialize(options = {})
@@ -121,15 +125,27 @@ module Aws
121
125
  parts
122
126
  end
123
127
 
128
+ def checksum_key?(key)
129
+ CHECKSUM_KEYS.include?(key)
130
+ end
131
+
132
+ def has_checksum_key?(keys)
133
+ keys.any? { |key| checksum_key?(key) }
134
+ end
135
+
124
136
  def create_opts(options)
125
- CREATE_OPTIONS.inject({}) do |hash, key|
137
+ opts = { checksum_algorithm: Aws::Plugins::ChecksumAlgorithm::DEFAULT_CHECKSUM }
138
+ opts[:checksum_type] = 'FULL_OBJECT' if has_checksum_key?(options.keys)
139
+ CREATE_OPTIONS.inject(opts) do |hash, key|
126
140
  hash[key] = options[key] if options.key?(key)
127
141
  hash
128
142
  end
129
143
  end
130
144
 
131
145
  def complete_opts(options)
132
- COMPLETE_OPTIONS.inject({}) do |hash, key|
146
+ opts = {}
147
+ opts[:checksum_type] = 'FULL_OBJECT' if has_checksum_key?(options.keys)
148
+ COMPLETE_OPTIONS.inject(opts) do |hash, key|
133
149
  hash[key] = options[key] if options.key?(key)
134
150
  hash
135
151
  end
@@ -137,7 +153,10 @@ module Aws
137
153
 
138
154
  def upload_part_opts(options)
139
155
  UPLOAD_PART_OPTIONS.inject({}) do |hash, key|
140
- hash[key] = options[key] if options.key?(key)
156
+ if options.key?(key)
157
+ # don't pass through checksum calculations
158
+ hash[key] = options[key] unless checksum_key?(key)
159
+ end
141
160
  hash
142
161
  end
143
162
  end
@@ -159,14 +178,13 @@ module Aws
159
178
  end
160
179
  resp = @client.upload_part(part)
161
180
  part[:body].close
162
- completed_part = {etag: resp.etag, part_number: part[:part_number]}
163
-
164
- # get the requested checksum from the response
165
- if part[:checksum_algorithm]
166
- k = "checksum_#{part[:checksum_algorithm].downcase}".to_sym
167
- completed_part[k] = resp[k]
168
- end
169
-
181
+ completed_part = {
182
+ etag: resp.etag,
183
+ part_number: part[:part_number]
184
+ }
185
+ algorithm = resp.context.params[:checksum_algorithm]
186
+ k = "checksum_#{algorithm.downcase}".to_sym
187
+ completed_part[k] = resp.send(k)
170
188
  completed.push(completed_part)
171
189
  end
172
190
  nil
@@ -103,6 +103,18 @@ module Aws::S3
103
103
  data[:checksum_algorithm]
104
104
  end
105
105
 
106
+ # The checksum type that is used to calculate the object’s checksum
107
+ # value. For more information, see [Checking object integrity][1] in the
108
+ # *Amazon S3 User Guide*.
109
+ #
110
+ #
111
+ #
112
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
113
+ # @return [String]
114
+ def checksum_type
115
+ data[:checksum_type]
116
+ end
117
+
106
118
  # @!endgroup
107
119
 
108
120
  # @return [Client]
@@ -295,6 +307,7 @@ module Aws::S3
295
307
  # etag: "ETag",
296
308
  # checksum_crc32: "ChecksumCRC32",
297
309
  # checksum_crc32c: "ChecksumCRC32C",
310
+ # checksum_crc64nvme: "ChecksumCRC64NVME",
298
311
  # checksum_sha1: "ChecksumSHA1",
299
312
  # checksum_sha256: "ChecksumSHA256",
300
313
  # part_number: 1,
@@ -303,8 +316,11 @@ module Aws::S3
303
316
  # },
304
317
  # checksum_crc32: "ChecksumCRC32",
305
318
  # checksum_crc32c: "ChecksumCRC32C",
319
+ # checksum_crc64nvme: "ChecksumCRC64NVME",
306
320
  # checksum_sha1: "ChecksumSHA1",
307
321
  # checksum_sha256: "ChecksumSHA256",
322
+ # checksum_type: "COMPOSITE", # accepts COMPOSITE, FULL_OBJECT
323
+ # mpu_object_size: 1,
308
324
  # request_payer: "requester", # accepts requester
309
325
  # expected_bucket_owner: "AccountId",
310
326
  # if_match: "IfMatch",
@@ -319,7 +335,7 @@ module Aws::S3
319
335
  # @option options [String] :checksum_crc32
320
336
  # This header can be used as a data integrity check to verify that the
321
337
  # data received is the same data that was originally sent. This header
322
- # specifies the base64-encoded, 32-bit CRC-32 checksum of the object.
338
+ # specifies the Base64 encoded, 32-bit `CRC32` checksum of the object.
323
339
  # For more information, see [Checking object integrity][1] in the
324
340
  # *Amazon S3 User Guide*.
325
341
  #
@@ -329,17 +345,28 @@ module Aws::S3
329
345
  # @option options [String] :checksum_crc32c
330
346
  # This header can be used as a data integrity check to verify that the
331
347
  # data received is the same data that was originally sent. This header
332
- # specifies the base64-encoded, 32-bit CRC-32C checksum of the object.
348
+ # specifies the Base64 encoded, 32-bit `CRC32C` checksum of the object.
333
349
  # For more information, see [Checking object integrity][1] in the
334
350
  # *Amazon S3 User Guide*.
335
351
  #
336
352
  #
337
353
  #
338
354
  # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
355
+ # @option options [String] :checksum_crc64nvme
356
+ # This header can be used as a data integrity check to verify that the
357
+ # data received is the same data that was originally sent. This header
358
+ # specifies the Base64 encoded, 64-bit `CRC64NVME` checksum of the
359
+ # object. The `CRC64NVME` checksum is always a full object checksum. For
360
+ # more information, see [Checking object integrity in the Amazon S3 User
361
+ # Guide][1].
362
+ #
363
+ #
364
+ #
365
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
339
366
  # @option options [String] :checksum_sha1
340
367
  # This header can be used as a data integrity check to verify that the
341
368
  # data received is the same data that was originally sent. This header
342
- # specifies the base64-encoded, 160-bit SHA-1 digest of the object. For
369
+ # specifies the Base64 encoded, 160-bit `SHA1` digest of the object. For
343
370
  # more information, see [Checking object integrity][1] in the *Amazon S3
344
371
  # User Guide*.
345
372
  #
@@ -349,13 +376,28 @@ module Aws::S3
349
376
  # @option options [String] :checksum_sha256
350
377
  # This header can be used as a data integrity check to verify that the
351
378
  # data received is the same data that was originally sent. This header
352
- # specifies the base64-encoded, 256-bit SHA-256 digest of the object.
379
+ # specifies the Base64 encoded, 256-bit `SHA256` digest of the object.
353
380
  # For more information, see [Checking object integrity][1] in the
354
381
  # *Amazon S3 User Guide*.
355
382
  #
356
383
  #
357
384
  #
358
385
  # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
386
+ # @option options [String] :checksum_type
387
+ # This header specifies the checksum type of the object, which
388
+ # determines how part-level checksums are combined to create an
389
+ # object-level checksum for multipart objects. You can use this header
390
+ # as a data integrity check to verify that the checksum type that is
391
+ # received is the same checksum that was specified. If the checksum type
392
+ # doesn’t match the checksum type that was specified for the object
393
+ # during the `CreateMultipartUpload` request, it’ll result in a
394
+ # `BadDigest` error. For more information, see Checking object integrity
395
+ # in the Amazon S3 User Guide.
396
+ # @option options [Integer] :mpu_object_size
397
+ # The expected total object size of the multipart upload request. If
398
+ # there’s a mismatch between the specified object size value and the
399
+ # actual object size value, it results in an `HTTP 400 InvalidRequest`
400
+ # error.
359
401
  # @option options [String] :request_payer
360
402
  # Confirms that the requester knows that they will be charged for the
361
403
  # request. Bucket owners need not specify this parameter in their
@@ -76,11 +76,10 @@ module Aws::S3
76
76
  data[:size]
77
77
  end
78
78
 
79
- # This header can be used as a data integrity check to verify that the
80
- # data received is the same data that was originally sent. This header
81
- # specifies the base64-encoded, 32-bit CRC-32 checksum of the object.
82
- # For more information, see [Checking object integrity][1] in the
83
- # *Amazon S3 User Guide*.
79
+ # The Base64 encoded, 32-bit `CRC32` checksum of the part. This checksum
80
+ # is present if the object was uploaded with the `CRC32` checksum
81
+ # algorithm. For more information, see [Checking object integrity][1] in
82
+ # the *Amazon S3 User Guide*.
84
83
  #
85
84
  #
86
85
  #
@@ -90,45 +89,51 @@ module Aws::S3
90
89
  data[:checksum_crc32]
91
90
  end
92
91
 
93
- # The base64-encoded, 32-bit CRC-32C checksum of the object. This will
94
- # only be present if it was uploaded with the object. When you use an
95
- # API operation on an object that was uploaded using multipart uploads,
96
- # this value may not be a direct checksum value of the full object.
97
- # Instead, it's a calculation based on the checksum values of each
98
- # individual part. For more information about how checksums are
99
- # calculated with multipart uploads, see [ Checking object integrity][1]
100
- # in the *Amazon S3 User Guide*.
92
+ # The Base64 encoded, 32-bit `CRC32C` checksum of the part. This
93
+ # checksum is present if the object was uploaded with the `CRC32C`
94
+ # checksum algorithm. For more information, see [Checking object
95
+ # integrity][1] in the *Amazon S3 User Guide*.
101
96
  #
102
97
  #
103
98
  #
104
- # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums
99
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
105
100
  # @return [String]
106
101
  def checksum_crc32c
107
102
  data[:checksum_crc32c]
108
103
  end
109
104
 
110
- # The base64-encoded, 160-bit SHA-1 digest of the object. This will only
111
- # be present if it was uploaded with the object. When you use the API
112
- # operation on an object that was uploaded using multipart uploads, this
113
- # value may not be a direct checksum value of the full object. Instead,
114
- # it's a calculation based on the checksum values of each individual
115
- # part. For more information about how checksums are calculated with
116
- # multipart uploads, see [ Checking object integrity][1] in the *Amazon
117
- # S3 User Guide*.
105
+ # The Base64 encoded, 64-bit `CRC64NVME` checksum of the part. This
106
+ # checksum is present if the multipart upload request was created with
107
+ # the `CRC64NVME` checksum algorithm, or if the object was uploaded
108
+ # without a checksum (and Amazon S3 added the default checksum,
109
+ # `CRC64NVME`, to the uploaded object). For more information, see
110
+ # [Checking object integrity][1] in the *Amazon S3 User Guide*.
118
111
  #
119
112
  #
120
113
  #
121
- # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums
114
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
115
+ # @return [String]
116
+ def checksum_crc64nvme
117
+ data[:checksum_crc64nvme]
118
+ end
119
+
120
+ # The Base64 encoded, 160-bit `SHA1` checksum of the part. This checksum
121
+ # is present if the object was uploaded with the `SHA1` checksum
122
+ # algorithm. For more information, see [Checking object integrity][1] in
123
+ # the *Amazon S3 User Guide*.
124
+ #
125
+ #
126
+ #
127
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
122
128
  # @return [String]
123
129
  def checksum_sha1
124
130
  data[:checksum_sha1]
125
131
  end
126
132
 
127
- # This header can be used as a data integrity check to verify that the
128
- # data received is the same data that was originally sent. This header
129
- # specifies the base64-encoded, 256-bit SHA-256 digest of the object.
130
- # For more information, see [Checking object integrity][1] in the
131
- # *Amazon S3 User Guide*.
133
+ # The Base64 encoded, 256-bit `SHA256` checksum of the part. This
134
+ # checksum is present if the object was uploaded with the `SHA256`
135
+ # checksum algorithm. For more information, see [Checking object
136
+ # integrity][1] in the *Amazon S3 User Guide*.
132
137
  #
133
138
  #
134
139
  #
@@ -512,9 +517,10 @@ module Aws::S3
512
517
  # body: source_file,
513
518
  # content_length: 1,
514
519
  # content_md5: "ContentMD5",
515
- # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256
520
+ # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256, CRC64NVME
516
521
  # checksum_crc32: "ChecksumCRC32",
517
522
  # checksum_crc32c: "ChecksumCRC32C",
523
+ # checksum_crc64nvme: "ChecksumCRC64NVME",
518
524
  # checksum_sha1: "ChecksumSHA1",
519
525
  # checksum_sha256: "ChecksumSHA256",
520
526
  # sse_customer_algorithm: "SSECustomerAlgorithm",
@@ -530,7 +536,7 @@ module Aws::S3
530
536
  # Size of the body in bytes. This parameter is useful when the size of
531
537
  # the body cannot be determined automatically.
532
538
  # @option options [String] :content_md5
533
- # The base64-encoded 128-bit MD5 digest of the part data. This parameter
539
+ # The Base64 encoded 128-bit MD5 digest of the part data. This parameter
534
540
  # is auto-populated when using the command from the CLI. This parameter
535
541
  # is required if object lock parameters are specified.
536
542
  #
@@ -558,7 +564,7 @@ module Aws::S3
558
564
  # @option options [String] :checksum_crc32
559
565
  # This header can be used as a data integrity check to verify that the
560
566
  # data received is the same data that was originally sent. This header
561
- # specifies the base64-encoded, 32-bit CRC-32 checksum of the object.
567
+ # specifies the Base64 encoded, 32-bit `CRC32` checksum of the object.
562
568
  # For more information, see [Checking object integrity][1] in the
563
569
  # *Amazon S3 User Guide*.
564
570
  #
@@ -568,7 +574,17 @@ module Aws::S3
568
574
  # @option options [String] :checksum_crc32c
569
575
  # This header can be used as a data integrity check to verify that the
570
576
  # data received is the same data that was originally sent. This header
571
- # specifies the base64-encoded, 32-bit CRC-32C checksum of the object.
577
+ # specifies the Base64 encoded, 32-bit `CRC32C` checksum of the object.
578
+ # For more information, see [Checking object integrity][1] in the
579
+ # *Amazon S3 User Guide*.
580
+ #
581
+ #
582
+ #
583
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
584
+ # @option options [String] :checksum_crc64nvme
585
+ # This header can be used as a data integrity check to verify that the
586
+ # data received is the same data that was originally sent. This header
587
+ # specifies the Base64 encoded, 64-bit `CRC64NVME` checksum of the part.
572
588
  # For more information, see [Checking object integrity][1] in the
573
589
  # *Amazon S3 User Guide*.
574
590
  #
@@ -578,7 +594,7 @@ module Aws::S3
578
594
  # @option options [String] :checksum_sha1
579
595
  # This header can be used as a data integrity check to verify that the
580
596
  # data received is the same data that was originally sent. This header
581
- # specifies the base64-encoded, 160-bit SHA-1 digest of the object. For
597
+ # specifies the Base64 encoded, 160-bit `SHA1` digest of the object. For
582
598
  # more information, see [Checking object integrity][1] in the *Amazon S3
583
599
  # User Guide*.
584
600
  #
@@ -588,7 +604,7 @@ module Aws::S3
588
604
  # @option options [String] :checksum_sha256
589
605
  # This header can be used as a data integrity check to verify that the
590
606
  # data received is the same data that was originally sent. This header
591
- # specifies the base64-encoded, 256-bit SHA-256 digest of the object.
607
+ # specifies the Base64 encoded, 256-bit `SHA256` digest of the object.
592
608
  # For more information, see [Checking object integrity][1] in the
593
609
  # *Amazon S3 User Guide*.
594
610
  #