aws-sdk-s3 1.121.0 → 1.136.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +99 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-s3/bucket.rb +122 -60
  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 +2017 -1674
  17. data/lib/aws-sdk-s3/client_api.rb +24 -0
  18. data/lib/aws-sdk-s3/customizations/bucket.rb +3 -1
  19. data/lib/aws-sdk-s3/customizations/errors.rb +1 -1
  20. data/lib/aws-sdk-s3/customizations/object.rb +91 -18
  21. data/lib/aws-sdk-s3/encryption/client.rb +6 -2
  22. data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +13 -9
  23. data/lib/aws-sdk-s3/encryptionV2/client.rb +6 -2
  24. data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +1 -0
  25. data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +10 -6
  26. data/lib/aws-sdk-s3/endpoint_parameters.rb +4 -0
  27. data/lib/aws-sdk-s3/endpoint_provider.rb +22 -246
  28. data/lib/aws-sdk-s3/endpoints.rb +1 -0
  29. data/lib/aws-sdk-s3/file_downloader.rb +170 -44
  30. data/lib/aws-sdk-s3/file_uploader.rb +8 -6
  31. data/lib/aws-sdk-s3/multipart_stream_uploader.rb +5 -3
  32. data/lib/aws-sdk-s3/multipart_upload.rb +27 -13
  33. data/lib/aws-sdk-s3/multipart_upload_part.rb +19 -9
  34. data/lib/aws-sdk-s3/object.rb +151 -105
  35. data/lib/aws-sdk-s3/object_acl.rb +14 -6
  36. data/lib/aws-sdk-s3/object_copier.rb +7 -5
  37. data/lib/aws-sdk-s3/object_multipart_copier.rb +33 -17
  38. data/lib/aws-sdk-s3/object_summary.rb +144 -89
  39. data/lib/aws-sdk-s3/object_version.rb +55 -21
  40. data/lib/aws-sdk-s3/presigned_post.rb +52 -43
  41. data/lib/aws-sdk-s3/presigner.rb +4 -2
  42. data/lib/aws-sdk-s3/resource.rb +7 -3
  43. data/lib/aws-sdk-s3/types.rb +854 -484
  44. data/lib/aws-sdk-s3.rb +1 -1
  45. metadata +6 -6
@@ -105,6 +105,20 @@ module Aws::S3
105
105
  data[:owner]
106
106
  end
107
107
 
108
+ # Specifies the restoration status of an object. Objects in certain
109
+ # storage classes must be restored before they can be retrieved. For
110
+ # more information about these storage classes and how to work with
111
+ # archived objects, see [ Working with archived objects][1] in the
112
+ # *Amazon S3 User Guide*.
113
+ #
114
+ #
115
+ #
116
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/archived-objects.html
117
+ # @return [Types::RestoreStatus]
118
+ def restore_status
119
+ data[:restore_status]
120
+ end
121
+
108
122
  # @!endgroup
109
123
 
110
124
  # @return [Client]
@@ -229,7 +243,9 @@ module Aws::S3
229
243
  :retry
230
244
  end
231
245
  end
232
- Aws::Waiters::Waiter.new(options).wait({})
246
+ Aws::Plugins::UserAgent.feature('resource') do
247
+ Aws::Waiters::Waiter.new(options).wait({})
248
+ end
233
249
  end
234
250
 
235
251
  # @!group Actions
@@ -251,9 +267,11 @@ module Aws::S3
251
267
  # @option options [String] :request_payer
252
268
  # Confirms that the requester knows that they will be charged for the
253
269
  # request. Bucket owners need not specify this parameter in their
254
- # requests. For information about downloading objects from Requester
255
- # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
256
- # in the *Amazon S3 User Guide*.
270
+ # requests. If either the source or destination Amazon S3 bucket has
271
+ # Requester Pays enabled, the requester will pay for corresponding
272
+ # charges to copy the object. For information about downloading objects
273
+ # from Requester Pays buckets, see [Downloading Objects in Requester
274
+ # Pays Buckets][1] in the *Amazon S3 User Guide*.
257
275
  #
258
276
  #
259
277
  #
@@ -273,7 +291,9 @@ module Aws::S3
273
291
  key: @object_key,
274
292
  version_id: @id
275
293
  )
276
- resp = @client.delete_object(options)
294
+ resp = Aws::Plugins::UserAgent.feature('resource') do
295
+ @client.delete_object(options)
296
+ end
277
297
  resp.data
278
298
  end
279
299
 
@@ -315,7 +335,7 @@ module Aws::S3
315
335
  # @option options [String] :range
316
336
  # Downloads the specified range bytes of an object. For more information
317
337
  # about the HTTP Range header, see
318
- # [https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35][1].
338
+ # [https://www.rfc-editor.org/rfc/rfc9110.html#name-range][1].
319
339
  #
320
340
  # <note markdown="1"> Amazon S3 doesn't support retrieving multiple ranges of data per
321
341
  # `GET` request.
@@ -324,7 +344,7 @@ module Aws::S3
324
344
  #
325
345
  #
326
346
  #
327
- # [1]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
347
+ # [1]: https://www.rfc-editor.org/rfc/rfc9110.html#name-range
328
348
  # @option options [String] :response_cache_control
329
349
  # Sets the `Cache-Control` header of the response.
330
350
  # @option options [String] :response_content_disposition
@@ -353,9 +373,11 @@ module Aws::S3
353
373
  # @option options [String] :request_payer
354
374
  # Confirms that the requester knows that they will be charged for the
355
375
  # request. Bucket owners need not specify this parameter in their
356
- # requests. For information about downloading objects from Requester
357
- # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
358
- # in the *Amazon S3 User Guide*.
376
+ # requests. If either the source or destination Amazon S3 bucket has
377
+ # Requester Pays enabled, the requester will pay for corresponding
378
+ # charges to copy the object. For information about downloading objects
379
+ # from Requester Pays buckets, see [Downloading Objects in Requester
380
+ # Pays Buckets][1] in the *Amazon S3 User Guide*.
359
381
  #
360
382
  #
361
383
  #
@@ -378,7 +400,9 @@ module Aws::S3
378
400
  key: @object_key,
379
401
  version_id: @id
380
402
  )
381
- resp = @client.get_object(options, &block)
403
+ resp = Aws::Plugins::UserAgent.feature('resource') do
404
+ @client.get_object(options, &block)
405
+ end
382
406
  resp.data
383
407
  end
384
408
 
@@ -412,8 +436,10 @@ module Aws::S3
412
436
  # Return the object only if it has not been modified since the specified
413
437
  # time; otherwise, return a 412 (precondition failed) error.
414
438
  # @option options [String] :range
415
- # Because `HeadObject` returns only the metadata for an object, this
416
- # parameter has no effect.
439
+ # HeadObject returns only the metadata for an object. If the Range is
440
+ # satisfiable, only the `ContentLength` is affected in the response. If
441
+ # the Range is not satisfiable, S3 returns a `416 - Requested Range Not
442
+ # Satisfiable` error.
417
443
  # @option options [String] :sse_customer_algorithm
418
444
  # Specifies the algorithm to use to when encrypting the object (for
419
445
  # example, AES256).
@@ -430,9 +456,11 @@ module Aws::S3
430
456
  # @option options [String] :request_payer
431
457
  # Confirms that the requester knows that they will be charged for the
432
458
  # request. Bucket owners need not specify this parameter in their
433
- # requests. For information about downloading objects from Requester
434
- # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
435
- # in the *Amazon S3 User Guide*.
459
+ # requests. If either the source or destination Amazon S3 bucket has
460
+ # Requester Pays enabled, the requester will pay for corresponding
461
+ # charges to copy the object. For information about downloading objects
462
+ # from Requester Pays buckets, see [Downloading Objects in Requester
463
+ # Pays Buckets][1] in the *Amazon S3 User Guide*.
436
464
  #
437
465
  #
438
466
  #
@@ -460,7 +488,9 @@ module Aws::S3
460
488
  key: @object_key,
461
489
  version_id: @id
462
490
  )
463
- resp = @client.head_object(options)
491
+ resp = Aws::Plugins::UserAgent.feature('resource') do
492
+ @client.head_object(options)
493
+ end
464
494
  resp.data
465
495
  end
466
496
 
@@ -543,9 +573,11 @@ module Aws::S3
543
573
  # @option options [String] :request_payer
544
574
  # Confirms that the requester knows that they will be charged for the
545
575
  # request. Bucket owners need not specify this parameter in their
546
- # requests. For information about downloading objects from Requester
547
- # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
548
- # in the *Amazon S3 User Guide*.
576
+ # requests. If either the source or destination Amazon S3 bucket has
577
+ # Requester Pays enabled, the requester will pay for corresponding
578
+ # charges to copy the object. For information about downloading objects
579
+ # from Requester Pays buckets, see [Downloading Objects in Requester
580
+ # Pays Buckets][1] in the *Amazon S3 User Guide*.
549
581
  #
550
582
  #
551
583
  #
@@ -589,7 +621,9 @@ module Aws::S3
589
621
  version_id: item.id
590
622
  }
591
623
  end
592
- batch[0].client.delete_objects(params)
624
+ Aws::Plugins::UserAgent.feature('resource') do
625
+ batch[0].client.delete_objects(params)
626
+ end
593
627
  end
594
628
  nil
595
629
  end
@@ -315,26 +315,28 @@ module Aws
315
315
 
316
316
  # @!group Fields
317
317
 
318
- # The key to use for the uploaded object. You can use `${filename}`
319
- # as a variable in the key. This will be replaced with the name
320
- # of the file as provided by the user.
318
+ # @!method key(key)
319
+ # The key to use for the uploaded object. You can use `${filename}`
320
+ # as a variable in the key. This will be replaced with the name
321
+ # of the file as provided by the user.
321
322
  #
322
- # For example, if the key is given as `/user/betty/${filename}` and
323
- # the file uploaded is named `lolcatz.jpg`, the resultant key will
324
- # be `/user/betty/lolcatz.jpg`.
323
+ # For example, if the key is given as `/user/betty/${filename}` and
324
+ # the file uploaded is named `lolcatz.jpg`, the resultant key will
325
+ # be `/user/betty/lolcatz.jpg`.
325
326
  #
326
- # @param [String] key
327
- # @see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html)
328
- # @return [self]
327
+ # @param [String] key
328
+ # @see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html)
329
+ # @return [self]
329
330
  define_field(:key) do |key|
330
331
  @key_set = true
331
332
  with('key', key)
332
333
  end
333
334
 
334
- # Specify a prefix the uploaded
335
- # @param [String] prefix
336
- # @see #key
337
- # @return [self]
335
+ # @!method key_starts_with(prefix)
336
+ # Specify a prefix the uploaded
337
+ # @param [String] prefix
338
+ # @see #key
339
+ # @return [self]
338
340
  define_field(:key_starts_with) do |prefix|
339
341
  @key_set = true
340
342
  starts_with('key', prefix)
@@ -412,26 +414,29 @@ module Aws
412
414
  # @return [self]
413
415
  define_field(:content_encoding, 'Content-Encoding', starts_with: true)
414
416
 
415
- # The date and time at which the object is no longer cacheable.
416
- # @note This does not affect the expiration of the presigned post
417
- # signature.
418
- # @param [Time] time
419
- # @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21
420
- # @return [self]
417
+ # @!method expires(time)
418
+ # The date and time at which the object is no longer cacheable.
419
+ # @note This does not affect the expiration of the presigned post
420
+ # signature.
421
+ # @param [Time] time
422
+ # @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21
423
+ # @return [self]
421
424
  define_field(:expires) do |time|
422
425
  with('Expires', time.httpdate)
423
426
  end
424
427
 
425
- # @param [String] prefix
426
- # @see #expires
427
- # @return [self]
428
+ # @!method expires_starts_with(prefix)
429
+ # @param [String] prefix
430
+ # @see #expires
431
+ # @return [self]
428
432
  define_field(:expires_starts_with) do |prefix|
429
433
  starts_with('Expires', prefix)
430
434
  end
431
435
 
432
- # The minimum and maximum allowable size for the uploaded content.
433
- # @param [Range<Integer>] byte_range
434
- # @return [self]
436
+ # @!method content_length_range(byte_range)
437
+ # The minimum and maximum allowable size for the uploaded content.
438
+ # @param [Range<Integer>] byte_range
439
+ # @return [self]
435
440
  define_field(:content_length_range) do |byte_range|
436
441
  min = byte_range.begin
437
442
  max = byte_range.end
@@ -507,10 +512,11 @@ module Aws
507
512
  # @return [self]
508
513
  define_field(:website_redirect_location, 'x-amz-website-redirect-location')
509
514
 
510
- # Metadata hash to store with the uploaded object. Hash keys will be
511
- # prefixed with "x-amz-meta-".
512
- # @param [Hash<String,String>] hash
513
- # @return [self]
515
+ # @!method metadata(hash)
516
+ # Metadata hash to store with the uploaded object. Hash keys will be
517
+ # prefixed with "x-amz-meta-".
518
+ # @param [Hash<String,String>] hash
519
+ # @return [self]
514
520
  define_field(:metadata) do |hash|
515
521
  hash.each do |key, value|
516
522
  with("x-amz-meta-#{key}", value)
@@ -518,10 +524,11 @@ module Aws
518
524
  self
519
525
  end
520
526
 
521
- # Specify allowable prefix for each key in the metadata hash.
522
- # @param [Hash<String,String>] hash
523
- # @see #metadata
524
- # @return [self]
527
+ # @!method metadata_starts_with(hash)
528
+ # Specify allowable prefix for each key in the metadata hash.
529
+ # @param [Hash<String,String>] hash
530
+ # @see #metadata
531
+ # @return [self]
525
532
  define_field(:metadata_starts_with) do |hash|
526
533
  hash.each do |key, value|
527
534
  starts_with("x-amz-meta-#{key}", value)
@@ -571,24 +578,26 @@ module Aws
571
578
  'x-amz-server-side-encryption-customer-algorithm'
572
579
  )
573
580
 
574
- # Specifies the customer-provided encryption key for Amazon S3 to use
575
- # in encrypting data. This value is used to store the object and then
576
- # it is discarded; Amazon does not store the encryption key.
581
+ # @!method server_side_encryption_customer_key(value)
582
+ # Specifies the customer-provided encryption key for Amazon S3 to use
583
+ # in encrypting data. This value is used to store the object and then
584
+ # it is discarded; Amazon does not store the encryption key.
577
585
  #
578
- # You must also call {#server_side_encryption_customer_algorithm}.
586
+ # You must also call {#server_side_encryption_customer_algorithm}.
579
587
  #
580
- # @param [String] value
581
- # @see #server_side_encryption_customer_algorithm
582
- # @return [self]
588
+ # @param [String] value
589
+ # @see #server_side_encryption_customer_algorithm
590
+ # @return [self]
583
591
  define_field(:server_side_encryption_customer_key) do |value|
584
592
  field_name = 'x-amz-server-side-encryption-customer-key'
585
593
  with(field_name, base64(value))
586
594
  with(field_name + '-MD5', base64(OpenSSL::Digest::MD5.digest(value)))
587
595
  end
588
596
 
589
- # @param [String] prefix
590
- # @see #server_side_encryption_customer_key
591
- # @return [self]
597
+ # @!method server_side_encryption_customer_key_starts_with(prefix)
598
+ # @param [String] prefix
599
+ # @see #server_side_encryption_customer_key
600
+ # @return [self]
592
601
  define_field(:server_side_encryption_customer_key_starts_with) do |prefix|
593
602
  field_name = 'x-amz-server-side-encryption-customer-key'
594
603
  starts_with(field_name, prefix)
@@ -49,7 +49,8 @@ module Aws
49
49
  # before the presigned URL expires. Defaults to 15 minutes. As signature
50
50
  # version 4 has a maximum expiry time of one week for presigned URLs,
51
51
  # attempts to set this value to greater than one week (604800) will
52
- # raise an exception.
52
+ # raise an exception. The min value of this option and the credentials
53
+ # expiration time is used in the presigned URL.
53
54
  #
54
55
  # @option params [Time] :time (Time.now) The starting time for when the
55
56
  # presigned url becomes active.
@@ -96,7 +97,8 @@ module Aws
96
97
  # before the presigned URL expires. Defaults to 15 minutes. As signature
97
98
  # version 4 has a maximum expiry time of one week for presigned URLs,
98
99
  # attempts to set this value to greater than one week (604800) will
99
- # raise an exception.
100
+ # raise an exception. The min value of this option and the credentials
101
+ # expiration time is used in the presigned URL.
100
102
  #
101
103
  # @option params [Time] :time (Time.now) The starting time for when the
102
104
  # presigned url becomes active.
@@ -41,7 +41,7 @@ module Aws::S3
41
41
  # acl: "private", # accepts private, public-read, public-read-write, authenticated-read
42
42
  # bucket: "BucketName", # required
43
43
  # create_bucket_configuration: {
44
- # location_constraint: "af-south-1", # accepts af-south-1, ap-east-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ca-central-1, cn-north-1, cn-northwest-1, EU, eu-central-1, eu-north-1, eu-south-1, eu-west-1, eu-west-2, eu-west-3, me-south-1, sa-east-1, us-east-2, us-gov-east-1, us-gov-west-1, us-west-1, us-west-2
44
+ # location_constraint: "af-south-1", # accepts af-south-1, ap-east-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ca-central-1, cn-north-1, cn-northwest-1, EU, eu-central-1, eu-north-1, eu-south-1, eu-west-1, eu-west-2, eu-west-3, me-south-1, sa-east-1, us-east-2, us-gov-east-1, us-gov-west-1, us-west-1, us-west-2, ap-south-2, eu-south-2
45
45
  # },
46
46
  # grant_full_control: "GrantFullControl",
47
47
  # grant_read: "GrantRead",
@@ -94,7 +94,9 @@ module Aws::S3
94
94
  # equivalent form of this ACL expressed in the XML format.
95
95
  # @return [Bucket]
96
96
  def create_bucket(options = {})
97
- @client.create_bucket(options)
97
+ Aws::Plugins::UserAgent.feature('resource') do
98
+ @client.create_bucket(options)
99
+ end
98
100
  Bucket.new(
99
101
  name: options[:bucket],
100
102
  client: @client
@@ -120,7 +122,9 @@ module Aws::S3
120
122
  def buckets(options = {})
121
123
  batches = Enumerator.new do |y|
122
124
  batch = []
123
- resp = @client.list_buckets(options)
125
+ resp = Aws::Plugins::UserAgent.feature('resource') do
126
+ @client.list_buckets(options)
127
+ end
124
128
  resp.data.buckets.each do |b|
125
129
  batch << Bucket.new(
126
130
  name: b.name,