aws-sdk-s3 1.128.0 → 1.199.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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +450 -1
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-s3/access_grants_credentials.rb +57 -0
  5. data/lib/aws-sdk-s3/access_grants_credentials_provider.rb +250 -0
  6. data/lib/aws-sdk-s3/bucket.rb +720 -128
  7. data/lib/aws-sdk-s3/bucket_acl.rb +18 -17
  8. data/lib/aws-sdk-s3/bucket_cors.rb +22 -21
  9. data/lib/aws-sdk-s3/bucket_lifecycle.rb +23 -18
  10. data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +76 -19
  11. data/lib/aws-sdk-s3/bucket_logging.rb +21 -14
  12. data/lib/aws-sdk-s3/bucket_notification.rb +6 -6
  13. data/lib/aws-sdk-s3/bucket_policy.rb +65 -20
  14. data/lib/aws-sdk-s3/bucket_region_cache.rb +9 -5
  15. data/lib/aws-sdk-s3/bucket_request_payment.rb +15 -15
  16. data/lib/aws-sdk-s3/bucket_tagging.rb +19 -19
  17. data/lib/aws-sdk-s3/bucket_versioning.rb +41 -41
  18. data/lib/aws-sdk-s3/bucket_website.rb +19 -19
  19. data/lib/aws-sdk-s3/client.rb +9352 -3264
  20. data/lib/aws-sdk-s3/client_api.rb +697 -164
  21. data/lib/aws-sdk-s3/customizations/bucket.rb +1 -1
  22. data/lib/aws-sdk-s3/customizations/errors.rb +16 -3
  23. data/lib/aws-sdk-s3/customizations/object.rb +112 -56
  24. data/lib/aws-sdk-s3/customizations/object_summary.rb +5 -0
  25. data/lib/aws-sdk-s3/customizations/object_version.rb +13 -0
  26. data/lib/aws-sdk-s3/customizations.rb +26 -31
  27. data/lib/aws-sdk-s3/encryption/client.rb +2 -2
  28. data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +2 -2
  29. data/lib/aws-sdk-s3/encryptionV2/client.rb +2 -2
  30. data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +2 -2
  31. data/lib/aws-sdk-s3/endpoint_parameters.rb +54 -15
  32. data/lib/aws-sdk-s3/endpoint_provider.rb +439 -456
  33. data/lib/aws-sdk-s3/endpoints.rb +629 -1261
  34. data/lib/aws-sdk-s3/errors.rb +58 -0
  35. data/lib/aws-sdk-s3/express_credentials.rb +55 -0
  36. data/lib/aws-sdk-s3/express_credentials_provider.rb +59 -0
  37. data/lib/aws-sdk-s3/file_downloader.rb +156 -69
  38. data/lib/aws-sdk-s3/file_uploader.rb +4 -6
  39. data/lib/aws-sdk-s3/legacy_signer.rb +2 -1
  40. data/lib/aws-sdk-s3/multipart_download_error.rb +8 -0
  41. data/lib/aws-sdk-s3/multipart_file_uploader.rb +56 -69
  42. data/lib/aws-sdk-s3/multipart_stream_uploader.rb +84 -91
  43. data/lib/aws-sdk-s3/multipart_upload.rb +179 -26
  44. data/lib/aws-sdk-s3/multipart_upload_error.rb +3 -4
  45. data/lib/aws-sdk-s3/multipart_upload_part.rb +201 -60
  46. data/lib/aws-sdk-s3/object.rb +2007 -281
  47. data/lib/aws-sdk-s3/object_acl.rb +43 -23
  48. data/lib/aws-sdk-s3/object_copier.rb +1 -1
  49. data/lib/aws-sdk-s3/object_multipart_copier.rb +44 -25
  50. data/lib/aws-sdk-s3/object_summary.rb +1735 -232
  51. data/lib/aws-sdk-s3/object_version.rb +394 -52
  52. data/lib/aws-sdk-s3/plugins/access_grants.rb +178 -0
  53. data/lib/aws-sdk-s3/plugins/checksum_algorithm.rb +31 -0
  54. data/lib/aws-sdk-s3/plugins/endpoints.rb +32 -208
  55. data/lib/aws-sdk-s3/plugins/express_session_auth.rb +88 -0
  56. data/lib/aws-sdk-s3/plugins/http_200_errors.rb +55 -18
  57. data/lib/aws-sdk-s3/plugins/location_constraint.rb +3 -1
  58. data/lib/aws-sdk-s3/plugins/md5s.rb +10 -70
  59. data/lib/aws-sdk-s3/plugins/s3_signer.rb +7 -2
  60. data/lib/aws-sdk-s3/plugins/streaming_retry.rb +5 -7
  61. data/lib/aws-sdk-s3/plugins/url_encoded_keys.rb +2 -1
  62. data/lib/aws-sdk-s3/presigned_post.rb +52 -43
  63. data/lib/aws-sdk-s3/presigner.rb +9 -7
  64. data/lib/aws-sdk-s3/resource.rb +127 -22
  65. data/lib/aws-sdk-s3/transfer_manager.rb +252 -0
  66. data/lib/aws-sdk-s3/types.rb +8068 -1887
  67. data/lib/aws-sdk-s3.rb +35 -31
  68. data/sig/bucket.rbs +231 -0
  69. data/sig/bucket_acl.rbs +78 -0
  70. data/sig/bucket_cors.rbs +69 -0
  71. data/sig/bucket_lifecycle.rbs +88 -0
  72. data/sig/bucket_lifecycle_configuration.rbs +115 -0
  73. data/sig/bucket_logging.rbs +76 -0
  74. data/sig/bucket_notification.rbs +114 -0
  75. data/sig/bucket_policy.rbs +59 -0
  76. data/sig/bucket_request_payment.rbs +54 -0
  77. data/sig/bucket_tagging.rbs +65 -0
  78. data/sig/bucket_versioning.rbs +77 -0
  79. data/sig/bucket_website.rbs +93 -0
  80. data/sig/client.rbs +2584 -0
  81. data/sig/customizations/bucket.rbs +19 -0
  82. data/sig/customizations/object.rbs +38 -0
  83. data/sig/customizations/object_summary.rbs +35 -0
  84. data/sig/errors.rbs +44 -0
  85. data/sig/multipart_upload.rbs +120 -0
  86. data/sig/multipart_upload_part.rbs +109 -0
  87. data/sig/object.rbs +462 -0
  88. data/sig/object_acl.rbs +86 -0
  89. data/sig/object_summary.rbs +345 -0
  90. data/sig/object_version.rbs +143 -0
  91. data/sig/resource.rbs +141 -0
  92. data/sig/types.rbs +2866 -0
  93. data/sig/waiters.rbs +95 -0
  94. metadata +44 -12
  95. data/lib/aws-sdk-s3/plugins/skip_whole_multipart_get_checksums.rb +0 -31
@@ -134,7 +134,7 @@ module Aws
134
134
 
135
135
  # @api private
136
136
  def load
137
- @data = Aws::Plugins::UserAgent.feature('resource') do
137
+ @data = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
138
138
  client.list_buckets.buckets.find { |b| b.name == name }
139
139
  end
140
140
  raise "unable to load bucket #{name}" if @data.nil?
@@ -3,12 +3,12 @@
3
3
  module Aws
4
4
  module S3
5
5
  module Errors
6
- # Hijack PermanentRedirect dynamic error to also include endpoint
7
- # and bucket.
6
+ # Hijack PermanentRedirect dynamic error to include the bucket, region,
7
+ # and endpoint.
8
8
  class PermanentRedirect < ServiceError
9
9
  # @param [Seahorse::Client::RequestContext] context
10
10
  # @param [String] message
11
- # @param [Aws::S3::Types::PermanentRedirect] data
11
+ # @param [Aws::S3::Types::PermanentRedirect] _data
12
12
  def initialize(context, message, _data = Aws::EmptyStructure.new)
13
13
  data = Aws::S3::Types::PermanentRedirect.new(message: message)
14
14
  body = context.http_response.body_contents
@@ -22,6 +22,19 @@ module Aws
22
22
  super(context, message, data)
23
23
  end
24
24
  end
25
+
26
+ # Hijack PermanentRedirect (HeadBucket case - no body) dynamic error to
27
+ # include the region.
28
+ class Http301Error < ServiceError
29
+ # @param [Seahorse::Client::RequestContext] context
30
+ # @param [String] message
31
+ # @param [Aws::S3::Types::PermanentRedirect] _data
32
+ def initialize(context, message, _data = Aws::EmptyStructure.new)
33
+ data = Aws::S3::Types::PermanentRedirect.new(message: message)
34
+ data.region = context.http_response.headers['x-amz-bucket-region']
35
+ super(context, message, data)
36
+ end
37
+ end
25
38
  end
26
39
  end
27
40
  end
@@ -46,6 +46,14 @@ module Aws
46
46
  # different region. You do not need to specify this option
47
47
  # if you have provided a `:source_client` or a `:content_length`.
48
48
  #
49
+ # @option options [Boolean] :use_source_parts (false) Only used when
50
+ # `:multipart_copy` is `true`. Use part sizes defined on the source
51
+ # object if any exist. If copying or moving an object that
52
+ # is already multipart, this does not re-part the object, instead
53
+ # re-using the part definitions on the original. That means the etag
54
+ # and any checksums will not change. This is especially useful if the
55
+ # source object has parts with varied sizes.
56
+ #
49
57
  # @example Basic object copy
50
58
  #
51
59
  # bucket = Aws::S3::Bucket.new('target-bucket')
@@ -68,7 +76,7 @@ module Aws
68
76
  # @see #copy_to
69
77
  #
70
78
  def copy_from(source, options = {})
71
- Aws::Plugins::UserAgent.feature('resource') do
79
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
72
80
  if Hash === source && source[:copy_source]
73
81
  # for backwards compatibility
74
82
  @client.copy_object(source.merge(bucket: bucket_name, key: key))
@@ -111,7 +119,7 @@ module Aws
111
119
  # object.copy_to('src-bucket/src-key', multipart_copy: true)
112
120
  #
113
121
  def copy_to(target, options = {})
114
- Aws::Plugins::UserAgent.feature('resource') do
122
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
115
123
  ObjectCopier.new(self, options).copy_to(target, options)
116
124
  end
117
125
  end
@@ -345,6 +353,10 @@ module Aws
345
353
  # obj.upload_stream do |write_stream|
346
354
  # IO.copy_stream(STDIN, write_stream)
347
355
  # end
356
+ # @param [Hash] options
357
+ # Additional options for {Client#create_multipart_upload},
358
+ # {Client#complete_multipart_upload},
359
+ # and {Client#upload_part} can be provided.
348
360
  #
349
361
  # @option options [Integer] :thread_count (10) The number of parallel
350
362
  # multipart uploads
@@ -367,6 +379,9 @@ module Aws
367
379
  # @return [Boolean] Returns `true` when the object is uploaded
368
380
  # without any errors.
369
381
  #
382
+ # @see Client#create_multipart_upload
383
+ # @see Client#complete_multipart_upload
384
+ # @see Client#upload_part
370
385
  def upload_stream(options = {}, &block)
371
386
  uploading_options = options.dup
372
387
  uploader = MultipartStreamUploader.new(
@@ -375,7 +390,7 @@ module Aws
375
390
  tempfile: uploading_options.delete(:tempfile),
376
391
  part_size: uploading_options.delete(:part_size)
377
392
  )
378
- Aws::Plugins::UserAgent.feature('resource') do
393
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
379
394
  uploader.upload(
380
395
  uploading_options.merge(bucket: bucket_name, key: key),
381
396
  &block
@@ -383,14 +398,14 @@ module Aws
383
398
  end
384
399
  true
385
400
  end
401
+ deprecated(:upload_stream, use: 'Aws::S3::TransferManager#upload_stream', version: 'next major version')
386
402
 
387
403
  # Uploads a file from disk to the current object in S3.
388
404
  #
389
405
  # # small files are uploaded in a single API call
390
406
  # obj.upload_file('/path/to/file')
391
407
  #
392
- # Files larger than or equal to `:multipart_threshold` are uploaded
393
- # using the Amazon S3 multipart upload APIs.
408
+ # Files larger than or equal to `:multipart_threshold` are uploaded using the Amazon S3 multipart upload APIs.
394
409
  #
395
410
  # # large files are automatically split into parts
396
411
  # # and the parts are uploaded in parallel
@@ -406,96 +421,137 @@ module Aws
406
421
  # You can provide a callback to monitor progress of the upload:
407
422
  #
408
423
  # # bytes and totals are each an array with 1 entry per part
409
- # progress = Proc.new do |bytes, totals|
410
- # puts bytes.map.with_index { |b, i| "Part #{i+1}: #{b} / #{totals[i]}"}.join(' ') + "Total: #{100.0 * bytes.sum / totals.sum }%" }
424
+ # progress = proc do |bytes, totals|
425
+ # puts bytes.map.with_index { |b, i| "Part #{i+1}: #{b} / #{totals[i]}"}.join(' ') + "Total: #{100.0 * bytes.sum / totals.sum }%"
411
426
  # end
412
427
  # obj.upload_file('/path/to/file', progress_callback: progress)
413
428
  #
414
- # @param [String, Pathname, File, Tempfile] source A file on the local
415
- # file system that will be uploaded as this object. This can either be
416
- # a String or Pathname to the file, an open File object, or an open
417
- # Tempfile object. If you pass an open File or Tempfile object, then
418
- # you are responsible for closing it after the upload completes. When
419
- # using an open Tempfile, rewind it before uploading or else the object
429
+ # @param [String, Pathname, File, Tempfile] source A file on the local file system that will be uploaded as
430
+ # this object. This can either be a String or Pathname to the file, an open File object, or an open
431
+ # Tempfile object. If you pass an open File or Tempfile object, then you are responsible for closing it
432
+ # after the upload completes. When using an open Tempfile, rewind it before uploading or else the object
420
433
  # will be empty.
421
434
  #
422
- # @option options [Integer] :multipart_threshold (104857600) Files larger
423
- # than or equal to `:multipart_threshold` are uploaded using the S3
424
- # multipart APIs.
425
- # Default threshold is 100MB.
435
+ # @param [Hash] options
436
+ # Additional options for {Client#put_object} when file sizes below the multipart threshold.
437
+ # For files larger than the multipart threshold, options for {Client#create_multipart_upload},
438
+ # {Client#complete_multipart_upload}, and {Client#upload_part} can be provided.
426
439
  #
427
- # @option options [Integer] :thread_count (10) The number of parallel
428
- # multipart uploads. This option is not used if the file is smaller than
429
- # `:multipart_threshold`.
440
+ # @option options [Integer] :multipart_threshold (104857600) Files larger han or equal to
441
+ # `:multipart_threshold` are uploaded using the S3 multipart APIs. Default threshold is 100MB.
442
+ #
443
+ # @option options [Integer] :thread_count (10) The number of parallel multipart uploads.
444
+ # This option is not used if the file is smaller than `:multipart_threshold`.
430
445
  #
431
446
  # @option options [Proc] :progress_callback
432
447
  # A Proc that will be called when each chunk of the upload is sent.
433
448
  # It will be invoked with [bytes_read], [total_sizes]
434
449
  #
435
- # @raise [MultipartUploadError] If an object is being uploaded in
436
- # parts, and the upload can not be completed, then the upload is
437
- # aborted and this error is raised. The raised error has a `#errors`
438
- # method that returns the failures that caused the upload to be
439
- # aborted.
450
+ # @raise [MultipartUploadError] If an object is being uploaded in parts, and the upload can not be completed,
451
+ # then the upload is aborted and this error is raised. The raised error has a `#errors` method that
452
+ # returns the failures that caused the upload to be aborted.
440
453
  #
441
- # @return [Boolean] Returns `true` when the object is uploaded
442
- # without any errors.
454
+ # @return [Boolean] Returns `true` when the object is uploaded without any errors.
455
+ #
456
+ # @see Client#put_object
457
+ # @see Client#create_multipart_upload
458
+ # @see Client#complete_multipart_upload
459
+ # @see Client#upload_part
443
460
  def upload_file(source, options = {})
444
461
  uploading_options = options.dup
445
- uploader = FileUploader.new(
446
- multipart_threshold: uploading_options.delete(:multipart_threshold),
447
- client: client
448
- )
449
- response = Aws::Plugins::UserAgent.feature('resource') do
450
- uploader.upload(
451
- source,
452
- uploading_options.merge(bucket: bucket_name, key: key)
453
- )
462
+ uploader = FileUploader.new(multipart_threshold: uploading_options.delete(:multipart_threshold), client: client)
463
+ response = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
464
+ uploader.upload(source, uploading_options.merge(bucket: bucket_name, key: key))
454
465
  end
455
466
  yield response if block_given?
456
467
  true
457
468
  end
469
+ deprecated(:upload_file, use: 'Aws::S3::TransferManager#upload_file', version: 'next major version')
458
470
 
459
471
  # Downloads a file in S3 to a path on disk.
460
472
  #
461
473
  # # small files (< 5MB) are downloaded in a single API call
462
474
  # obj.download_file('/path/to/file')
463
475
  #
464
- # Files larger than 5MB are downloaded using multipart method
476
+ # Files larger than 5MB are downloaded using multipart method:
465
477
  #
466
478
  # # large files are split into parts
467
479
  # # and the parts are downloaded in parallel
468
480
  # obj.download_file('/path/to/very_large_file')
469
481
  #
470
- # @param [String] destination Where to download the file to.
482
+ # You can provide a callback to monitor progress of the download:
483
+ #
484
+ # # bytes and part_sizes are each an array with 1 entry per part
485
+ # # part_sizes may not be known until the first bytes are retrieved
486
+ # progress = proc do |bytes, part_sizes, file_size|
487
+ # puts bytes.map.with_index { |b, i| "Part #{i + 1}: #{b} / #{part_sizes[i]}" }.join(' ') + "Total: #{100.0 * bytes.sum / file_size}%"
488
+ # end
489
+ # obj.download_file('/path/to/file', progress_callback: progress)
490
+ #
491
+ # @param [String, Pathname, File, Tempfile] destination
492
+ # Where to download the file to. This can either be a String or Pathname to the file, an open File object,
493
+ # or an open Tempfile object. If you pass an open File or Tempfile object, then you are responsible for
494
+ # closing it after the download completes. Download behavior varies by destination type:
495
+ #
496
+ # * **String/Pathname paths**: Downloads to a temporary file first, then atomically moves to the final
497
+ # destination. This prevents corruption of any existing file if the download fails.
498
+ # * **File/Tempfile objects**: Downloads directly to the file object without using temporary files.
499
+ # You are responsible for managing the file object's state and closing it after the download completes.
500
+ # If the download fails, the file object may contain partial data.
501
+ #
502
+ # @param [Hash] options
503
+ # Additional options for {Client#get_object} and #{Client#head_object} may be provided.
504
+ #
505
+ # @option options [String] :mode ("auto") `"auto"`, `"single_request"` or `"get_range"`
506
+ #
507
+ # * `auto` mode is enabled by default, which performs `multipart_download`
508
+ # * `"single_request`" mode forces only 1 GET request is made in download
509
+ # * `"get_range"` mode requires `:chunk_size` parameter to configured in customizing each range size
510
+ #
511
+ # @option options [Integer] :chunk_size required in `"get_range"` mode.
512
+ #
513
+ # @option options [Integer] :thread_count (10) Customize threads used in the multipart download.
471
514
  #
472
- # @option options [String] mode `auto`, `single_request`, `get_range`
473
- # `single_request` mode forces only 1 GET request is made in download,
474
- # `get_range` mode allows `chunk_size` parameter to configured in
475
- # customizing each range size in multipart_download,
476
- # By default, `auto` mode is enabled, which performs multipart_download
515
+ # @option options [String] :version_id The object version id used to retrieve the object.
477
516
  #
478
- # @option options [Integer] chunk_size required in get_range mode.
517
+ # @see https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectVersioning.html ObjectVersioning
479
518
  #
480
- # @option options [Integer] thread_count (10) Customize threads used in
481
- # the multipart download.
519
+ # @option options [String] :checksum_mode ("ENABLED")
520
+ # When `"ENABLED"` and the object has a stored checksum, it will be used to validate the download and will
521
+ # raise an `Aws::Errors::ChecksumError` if checksum validation fails. You may provide a `on_checksum_validated`
522
+ # callback if you need to verify that validation occurred and which algorithm was used.
523
+ # To disable checksum validation, set `checksum_mode` to `"DISABLED"`.
482
524
  #
483
- # @option options [String] version_id The object version id used to
484
- # retrieve the object. For more about object versioning, see:
485
- # https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectVersioning.html
525
+ # @option options [Callable] :on_checksum_validated
526
+ # Called each time a request's checksum is validated with the checksum algorithm and the
527
+ # response. For multipart downloads, this will be called for each part that is downloaded and validated.
486
528
  #
487
- # @return [Boolean] Returns `true` when the file is downloaded without
488
- # any errors.
529
+ # @option options [Proc] :progress_callback
530
+ # A Proc that will be called when each chunk of the download is received. It will be invoked with
531
+ # `bytes_read`, `part_sizes`, `file_size`. When the object is downloaded as parts (rather than by ranges),
532
+ # the `part_sizes` will not be known ahead of time and will be `nil` in the callback until the first bytes
533
+ # in the part are received.
534
+ #
535
+ # @raise [MultipartDownloadError] Raised when an object validation fails outside of service errors.
536
+ #
537
+ # @return [Boolean] Returns `true` when the file is downloaded without any errors.
538
+ #
539
+ # @see Client#get_object
540
+ # @see Client#head_object
489
541
  def download_file(destination, options = {})
490
542
  downloader = FileDownloader.new(client: client)
491
- Aws::Plugins::UserAgent.feature('resource') do
492
- downloader.download(
493
- destination,
494
- options.merge(bucket: bucket_name, key: key)
495
- )
543
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
544
+ downloader.download(destination, options.merge(bucket: bucket_name, key: key))
496
545
  end
497
546
  true
498
547
  end
548
+ deprecated(:download_file, use: 'Aws::S3::TransferManager#download_file', version: 'next major version')
549
+
550
+ class Collection < Aws::Resources::Collection
551
+ alias_method :delete, :batch_delete!
552
+ extend Aws::Deprecations
553
+ deprecated :delete, use: :batch_delete!
554
+ end
499
555
  end
500
556
  end
501
557
  end
@@ -80,6 +80,11 @@ module Aws
80
80
  object.download_file(destination, options)
81
81
  end
82
82
 
83
+ class Collection < Aws::Resources::Collection
84
+ alias_method :delete, :batch_delete!
85
+ extend Aws::Deprecations
86
+ deprecated :delete, use: :batch_delete!
87
+ end
83
88
  end
84
89
  end
85
90
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aws
4
+ module S3
5
+ class ObjectVersion
6
+ class Collection < Aws::Resources::Collection
7
+ alias_method :delete, :batch_delete!
8
+ extend Aws::Deprecations
9
+ deprecated :delete, use: :batch_delete!
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,36 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # utility classes
4
- require 'aws-sdk-s3/bucket_region_cache'
5
- require 'aws-sdk-s3/encryption'
6
- require 'aws-sdk-s3/encryption_v2'
7
- require 'aws-sdk-s3/file_part'
8
- require 'aws-sdk-s3/file_uploader'
9
- require 'aws-sdk-s3/file_downloader'
10
- require 'aws-sdk-s3/legacy_signer'
11
- require 'aws-sdk-s3/multipart_file_uploader'
12
- require 'aws-sdk-s3/multipart_stream_uploader'
13
- require 'aws-sdk-s3/multipart_upload_error'
14
- require 'aws-sdk-s3/object_copier'
15
- require 'aws-sdk-s3/object_multipart_copier'
16
- require 'aws-sdk-s3/presigned_post'
17
- require 'aws-sdk-s3/presigner'
3
+ module Aws
4
+ module S3
5
+ # utility classes
6
+ autoload :BucketRegionCache, 'aws-sdk-s3/bucket_region_cache'
7
+ autoload :Encryption, 'aws-sdk-s3/encryption'
8
+ autoload :EncryptionV2, 'aws-sdk-s3/encryption_v2'
9
+ autoload :FilePart, 'aws-sdk-s3/file_part'
10
+ autoload :FileUploader, 'aws-sdk-s3/file_uploader'
11
+ autoload :FileDownloader, 'aws-sdk-s3/file_downloader'
12
+ autoload :LegacySigner, 'aws-sdk-s3/legacy_signer'
13
+ autoload :MultipartDownloadError, 'aws-sdk-s3/multipart_download_error'
14
+ autoload :MultipartFileUploader, 'aws-sdk-s3/multipart_file_uploader'
15
+ autoload :MultipartStreamUploader, 'aws-sdk-s3/multipart_stream_uploader'
16
+ autoload :MultipartUploadError, 'aws-sdk-s3/multipart_upload_error'
17
+ autoload :ObjectCopier, 'aws-sdk-s3/object_copier'
18
+ autoload :ObjectMultipartCopier, 'aws-sdk-s3/object_multipart_copier'
19
+ autoload :PresignedPost, 'aws-sdk-s3/presigned_post'
20
+ autoload :Presigner, 'aws-sdk-s3/presigner'
21
+ autoload :TransferManager, 'aws-sdk-s3/transfer_manager'
18
22
 
19
- # customizations to generated classes
20
- require 'aws-sdk-s3/customizations/bucket'
21
- require 'aws-sdk-s3/customizations/errors'
22
- require 'aws-sdk-s3/customizations/object'
23
- require 'aws-sdk-s3/customizations/object_summary'
24
- require 'aws-sdk-s3/customizations/multipart_upload'
25
- require 'aws-sdk-s3/customizations/types/list_object_versions_output'
26
- require 'aws-sdk-s3/customizations/types/permanent_redirect'
23
+ # s3 express session auth
24
+ autoload :ExpressCredentials, 'aws-sdk-s3/express_credentials'
25
+ autoload :ExpressCredentialsProvider, 'aws-sdk-s3/express_credentials_provider'
27
26
 
28
- [
29
- Aws::S3::Object::Collection,
30
- Aws::S3::ObjectSummary::Collection,
31
- Aws::S3::ObjectVersion::Collection,
32
- ].each do |klass|
33
- klass.send(:alias_method, :delete, :batch_delete!)
34
- klass.extend Aws::Deprecations
35
- klass.send(:deprecated, :delete, use: :batch_delete!)
27
+ # s3 access grants auth
28
+ autoload :AccessGrantsCredentials, 'aws-sdk-s3/access_grants_credentials'
29
+ autoload :AccessGrantsCredentialsProvider, 'aws-sdk-s3/access_grants_credentials_provider'
30
+ end
36
31
  end
@@ -270,7 +270,7 @@ module Aws
270
270
  envelope_location: @envelope_location,
271
271
  instruction_file_suffix: @instruction_file_suffix,
272
272
  }
273
- Aws::Plugins::UserAgent.feature('S3CryptoV1n') do
273
+ Aws::Plugins::UserAgent.metric('S3_CRYPTO_V1N') do
274
274
  req.send_request
275
275
  end
276
276
  end
@@ -300,7 +300,7 @@ module Aws
300
300
  envelope_location: envelope_location,
301
301
  instruction_file_suffix: instruction_file_suffix,
302
302
  }
303
- Aws::Plugins::UserAgent.feature('S3CryptoV1n') do
303
+ Aws::Plugins::UserAgent.metric('S3_CRYPTO_V1N') do
304
304
  req.send_request(target: block)
305
305
  end
306
306
  end
@@ -17,7 +17,7 @@ module Aws
17
17
  # envelope and encryption cipher.
18
18
  def encryption_cipher
19
19
  encryption_context = { "kms_cmk_id" => @kms_key_id }
20
- key_data = Aws::Plugins::UserAgent.feature('S3CryptoV1n') do
20
+ key_data = Aws::Plugins::UserAgent.metric('S3_CRYPTO_V1N') do
21
21
  @kms_client.generate_data_key(
22
22
  key_id: @kms_key_id,
23
23
  encryption_context: encryption_context,
@@ -60,7 +60,7 @@ module Aws
60
60
  "#{envelope['x-amz-wrap-alg']}"
61
61
  end
62
62
 
63
- key = Aws::Plugins::UserAgent.feature('S3CryptoV1n') do
63
+ key = Aws::Plugins::UserAgent.metric('S3_CRYPTO_V1N') do
64
64
  @kms_client.decrypt(
65
65
  ciphertext_blob: decode64(envelope['x-amz-key-v2']),
66
66
  encryption_context: encryption_context
@@ -361,7 +361,7 @@ module Aws
361
361
  instruction_file_suffix: @instruction_file_suffix,
362
362
  kms_encryption_context: kms_encryption_context
363
363
  }
364
- Aws::Plugins::UserAgent.feature('S3CryptoV2') do
364
+ Aws::Plugins::UserAgent.metric('S3_CRYPTO_V2') do
365
365
  req.send_request
366
366
  end
367
367
  end
@@ -416,7 +416,7 @@ module Aws
416
416
  kms_allow_decrypt_with_any_cmk: kms_any_cmk_mode,
417
417
  security_profile: security_profile
418
418
  }
419
- Aws::Plugins::UserAgent.feature('S3CryptoV2') do
419
+ Aws::Plugins::UserAgent.metric('S3_CRYPTO_V2') do
420
420
  req.send_request(target: block)
421
421
  end
422
422
  end
@@ -24,7 +24,7 @@ module Aws
24
24
  def encryption_cipher(options = {})
25
25
  validate_key_for_encryption
26
26
  encryption_context = build_encryption_context(@content_encryption_schema, options)
27
- key_data = Aws::Plugins::UserAgent.feature('S3CryptoV2') do
27
+ key_data = Aws::Plugins::UserAgent.metric('S3_CRYPTO_V2') do
28
28
  @kms_client.generate_data_key(
29
29
  key_id: @kms_key_id,
30
30
  encryption_context: encryption_context,
@@ -85,7 +85,7 @@ module Aws
85
85
  decrypt_options[:key_id] = @kms_key_id
86
86
  end
87
87
 
88
- key = Aws::Plugins::UserAgent.feature('S3CryptoV2') do
88
+ key = Aws::Plugins::UserAgent.metric('S3_CRYPTO_V2') do
89
89
  @kms_client.decrypt(decrypt_options).plaintext
90
90
  end
91
91
  iv = decode64(envelope['x-amz-iv'])
@@ -55,6 +55,21 @@ module Aws::S3
55
55
  #
56
56
  # @return [Boolean]
57
57
  #
58
+ # @!attribute key
59
+ # The S3 Key used to send the request. This is an optional parameter that will be set automatically for operations that are scoped to an S3 Key.
60
+ #
61
+ # @return [String]
62
+ #
63
+ # @!attribute prefix
64
+ # The S3 Prefix used to send the request. This is an optional parameter that will be set automatically for operations that are scoped to an S3 Prefix.
65
+ #
66
+ # @return [String]
67
+ #
68
+ # @!attribute copy_source
69
+ # The Copy Source used for Copy Object request. This is an optional parameter that will be set automatically for operations that are scoped to Copy Source.
70
+ #
71
+ # @return [String]
72
+ #
58
73
  # @!attribute disable_access_points
59
74
  # Internal parameter to disable Access Point Buckets
60
75
  #
@@ -70,6 +85,16 @@ module Aws::S3
70
85
  #
71
86
  # @return [Boolean]
72
87
  #
88
+ # @!attribute use_s3_express_control_endpoint
89
+ # Internal parameter to indicate whether S3Express operation should use control plane, (ex. CreateBucket)
90
+ #
91
+ # @return [Boolean]
92
+ #
93
+ # @!attribute disable_s3_express_session_auth
94
+ # Parameter to indicate whether S3Express session auth should be disabled
95
+ #
96
+ # @return [Boolean]
97
+ #
73
98
  EndpointParameters = Struct.new(
74
99
  :bucket,
75
100
  :region,
@@ -80,9 +105,14 @@ module Aws::S3
80
105
  :accelerate,
81
106
  :use_global_endpoint,
82
107
  :use_object_lambda_endpoint,
108
+ :key,
109
+ :prefix,
110
+ :copy_source,
83
111
  :disable_access_points,
84
112
  :disable_multi_region_access_points,
85
113
  :use_arn_region,
114
+ :use_s3_express_control_endpoint,
115
+ :disable_s3_express_session_auth,
86
116
  ) do
87
117
  include Aws::Structure
88
118
 
@@ -98,9 +128,14 @@ module Aws::S3
98
128
  'Accelerate' => :accelerate,
99
129
  'UseGlobalEndpoint' => :use_global_endpoint,
100
130
  'UseObjectLambdaEndpoint' => :use_object_lambda_endpoint,
131
+ 'Key' => :key,
132
+ 'Prefix' => :prefix,
133
+ 'CopySource' => :copy_source,
101
134
  'DisableAccessPoints' => :disable_access_points,
102
135
  'DisableMultiRegionAccessPoints' => :disable_multi_region_access_points,
103
136
  'UseArnRegion' => :use_arn_region,
137
+ 'UseS3ExpressControlEndpoint' => :use_s3_express_control_endpoint,
138
+ 'DisableS3ExpressSessionAuth' => :disable_s3_express_session_auth,
104
139
  }.freeze
105
140
  end
106
141
 
@@ -109,34 +144,38 @@ module Aws::S3
109
144
  self[:region] = options[:region]
110
145
  self[:use_fips] = options[:use_fips]
111
146
  self[:use_fips] = false if self[:use_fips].nil?
112
- if self[:use_fips].nil?
113
- raise ArgumentError, "Missing required EndpointParameter: :use_fips"
114
- end
115
147
  self[:use_dual_stack] = options[:use_dual_stack]
116
148
  self[:use_dual_stack] = false if self[:use_dual_stack].nil?
117
- if self[:use_dual_stack].nil?
118
- raise ArgumentError, "Missing required EndpointParameter: :use_dual_stack"
119
- end
120
149
  self[:endpoint] = options[:endpoint]
121
150
  self[:force_path_style] = options[:force_path_style]
151
+ self[:force_path_style] = false if self[:force_path_style].nil?
122
152
  self[:accelerate] = options[:accelerate]
123
153
  self[:accelerate] = false if self[:accelerate].nil?
124
- if self[:accelerate].nil?
125
- raise ArgumentError, "Missing required EndpointParameter: :accelerate"
126
- end
127
154
  self[:use_global_endpoint] = options[:use_global_endpoint]
128
155
  self[:use_global_endpoint] = false if self[:use_global_endpoint].nil?
129
- if self[:use_global_endpoint].nil?
130
- raise ArgumentError, "Missing required EndpointParameter: :use_global_endpoint"
131
- end
132
156
  self[:use_object_lambda_endpoint] = options[:use_object_lambda_endpoint]
157
+ self[:key] = options[:key]
158
+ self[:prefix] = options[:prefix]
159
+ self[:copy_source] = options[:copy_source]
133
160
  self[:disable_access_points] = options[:disable_access_points]
134
161
  self[:disable_multi_region_access_points] = options[:disable_multi_region_access_points]
135
162
  self[:disable_multi_region_access_points] = false if self[:disable_multi_region_access_points].nil?
136
- if self[:disable_multi_region_access_points].nil?
137
- raise ArgumentError, "Missing required EndpointParameter: :disable_multi_region_access_points"
138
- end
139
163
  self[:use_arn_region] = options[:use_arn_region]
164
+ self[:use_s3_express_control_endpoint] = options[:use_s3_express_control_endpoint]
165
+ self[:disable_s3_express_session_auth] = options[:disable_s3_express_session_auth]
166
+ end
167
+
168
+ def self.create(config, options={})
169
+ new({
170
+ region: config.region,
171
+ use_fips: config.use_fips_endpoint,
172
+ endpoint: (config.endpoint.to_s unless config.regional_endpoint),
173
+ force_path_style: config.force_path_style,
174
+ use_global_endpoint: config.s3_us_east_1_regional_endpoint == 'legacy',
175
+ disable_multi_region_access_points: config.s3_disable_multiregion_access_points,
176
+ use_arn_region: config.s3_use_arn_region,
177
+ disable_s3_express_session_auth: config.disable_s3_express_session_auth,
178
+ }.merge(options))
140
179
  end
141
180
  end
142
181
  end