aws-sdk-s3 1.156.0 → 1.190.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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +193 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-s3/access_grants_credentials_provider.rb +12 -3
  5. data/lib/aws-sdk-s3/bucket.rb +304 -94
  6. data/lib/aws-sdk-s3/bucket_acl.rb +6 -5
  7. data/lib/aws-sdk-s3/bucket_cors.rb +6 -5
  8. data/lib/aws-sdk-s3/bucket_lifecycle.rb +7 -2
  9. data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +60 -3
  10. data/lib/aws-sdk-s3/bucket_logging.rb +2 -2
  11. data/lib/aws-sdk-s3/bucket_policy.rb +10 -9
  12. data/lib/aws-sdk-s3/bucket_request_payment.rb +3 -3
  13. data/lib/aws-sdk-s3/bucket_tagging.rb +3 -3
  14. data/lib/aws-sdk-s3/bucket_versioning.rb +9 -9
  15. data/lib/aws-sdk-s3/bucket_website.rb +3 -3
  16. data/lib/aws-sdk-s3/client.rb +4081 -1812
  17. data/lib/aws-sdk-s3/client_api.rb +404 -162
  18. data/lib/aws-sdk-s3/customizations/object.rb +6 -0
  19. data/lib/aws-sdk-s3/customizations/object_summary.rb +5 -0
  20. data/lib/aws-sdk-s3/customizations/object_version.rb +13 -0
  21. data/lib/aws-sdk-s3/customizations.rb +24 -38
  22. data/lib/aws-sdk-s3/endpoint_parameters.rb +13 -18
  23. data/lib/aws-sdk-s3/endpoint_provider.rb +400 -276
  24. data/lib/aws-sdk-s3/endpoints.rb +465 -1706
  25. data/lib/aws-sdk-s3/errors.rb +58 -0
  26. data/lib/aws-sdk-s3/file_downloader.rb +14 -31
  27. data/lib/aws-sdk-s3/legacy_signer.rb +2 -1
  28. data/lib/aws-sdk-s3/multipart_file_uploader.rb +31 -13
  29. data/lib/aws-sdk-s3/multipart_upload.rb +108 -8
  30. data/lib/aws-sdk-s3/multipart_upload_part.rb +52 -36
  31. data/lib/aws-sdk-s3/object.rb +614 -203
  32. data/lib/aws-sdk-s3/object_acl.rb +11 -5
  33. data/lib/aws-sdk-s3/object_multipart_copier.rb +2 -1
  34. data/lib/aws-sdk-s3/object_summary.rb +518 -151
  35. data/lib/aws-sdk-s3/object_version.rb +81 -12
  36. data/lib/aws-sdk-s3/plugins/access_grants.rb +68 -4
  37. data/lib/aws-sdk-s3/plugins/checksum_algorithm.rb +31 -0
  38. data/lib/aws-sdk-s3/plugins/endpoints.rb +24 -212
  39. data/lib/aws-sdk-s3/plugins/express_session_auth.rb +11 -20
  40. data/lib/aws-sdk-s3/plugins/http_200_errors.rb +3 -3
  41. data/lib/aws-sdk-s3/plugins/md5s.rb +10 -71
  42. data/lib/aws-sdk-s3/plugins/streaming_retry.rb +5 -7
  43. data/lib/aws-sdk-s3/plugins/url_encoded_keys.rb +2 -1
  44. data/lib/aws-sdk-s3/presigner.rb +5 -5
  45. data/lib/aws-sdk-s3/resource.rb +45 -18
  46. data/lib/aws-sdk-s3/types.rb +3462 -1337
  47. data/lib/aws-sdk-s3.rb +35 -31
  48. data/sig/bucket.rbs +16 -6
  49. data/sig/bucket_acl.rbs +1 -1
  50. data/sig/bucket_cors.rbs +1 -1
  51. data/sig/bucket_lifecycle.rbs +1 -1
  52. data/sig/bucket_lifecycle_configuration.rbs +8 -4
  53. data/sig/bucket_logging.rbs +1 -1
  54. data/sig/bucket_policy.rbs +1 -1
  55. data/sig/bucket_request_payment.rbs +1 -1
  56. data/sig/bucket_tagging.rbs +1 -1
  57. data/sig/bucket_versioning.rbs +3 -3
  58. data/sig/bucket_website.rbs +1 -1
  59. data/sig/client.rbs +162 -45
  60. data/sig/errors.rbs +10 -0
  61. data/sig/multipart_upload.rbs +12 -2
  62. data/sig/multipart_upload_part.rbs +5 -1
  63. data/sig/object.rbs +26 -6
  64. data/sig/object_acl.rbs +1 -1
  65. data/sig/object_summary.rbs +18 -7
  66. data/sig/object_version.rbs +9 -3
  67. data/sig/resource.rbs +11 -4
  68. data/sig/types.rbs +210 -38
  69. metadata +8 -10
  70. data/lib/aws-sdk-s3/plugins/skip_whole_multipart_get_checksums.rb +0 -31
@@ -6,81 +6,20 @@ module Aws
6
6
  module S3
7
7
  module Plugins
8
8
  # @api private
9
- # This plugin is effectively deprecated in favor of modeled
9
+ # This plugin is deprecated in favor of modeled
10
10
  # httpChecksumRequired traits.
11
11
  class Md5s < Seahorse::Client::Plugin
12
- # These operations allow Content MD5 but are not required by
13
- # httpChecksumRequired. This list should not grow.
14
- OPTIONAL_OPERATIONS = [
15
- :put_object,
16
- :upload_part
17
- ]
18
-
19
- # @api private
20
- class Handler < Seahorse::Client::Handler
21
-
22
- CHUNK_SIZE = 1 * 1024 * 1024 # one MB
23
-
24
- def call(context)
25
- if !context[:checksum_algorithms] && # skip in favor of flexible checksum
26
- !context[:s3_express_endpoint] # s3 express endpoints do not support md5
27
- body = context.http_request.body
28
- if body.respond_to?(:size) && body.size > 0
29
- context.http_request.headers['Content-Md5'] ||= md5(body)
30
- end
31
- end
32
- @handler.call(context)
33
- end
34
-
35
- private
36
-
37
- # @param [File, Tempfile, IO#read, String] value
38
- # @return [String<MD5>]
39
- def md5(value)
40
- if (File === value || Tempfile === value) && !value.path.nil? && File.exist?(value.path)
41
- OpenSSL::Digest::MD5.file(value).base64digest
42
- elsif value.respond_to?(:read)
43
- md5 = OpenSSL::Digest::MD5.new
44
- update_in_chunks(md5, value)
45
- md5.base64digest
46
- else
47
- OpenSSL::Digest::MD5.digest(value).base64digest
48
- end
49
- end
50
-
51
- def update_in_chunks(digest, io)
52
- loop do
53
- chunk = io.read(CHUNK_SIZE)
54
- break unless chunk
55
- digest.update(chunk)
56
- end
57
- io.rewind
58
- end
59
-
60
- end
61
-
62
12
  option(:compute_checksums,
63
- default: true,
64
- doc_type: 'Boolean',
65
- docstring: <<-DOCS)
66
- When `true` a MD5 checksum will be computed and sent in the Content Md5
67
- header for :put_object and :upload_part. When `false`, MD5 checksums
68
- will not be computed for these operations. Checksums are still computed
69
- for operations requiring them. Checksum errors returned by Amazon S3 are
70
- automatically retried up to `:retry_limit` times.
71
- DOCS
72
-
73
- def add_handlers(handlers, config)
74
- if config.compute_checksums
75
- # priority set low to ensure md5 is computed AFTER the request is
76
- # built but before it is signed
77
- handlers.add(
78
- Handler,
79
- priority: 10, step: :build, operations: OPTIONAL_OPERATIONS
80
- )
81
- end
13
+ default: true,
14
+ doc_type: 'Boolean',
15
+ docstring: <<~DOCS)
16
+ This option is deprecated. Please use `:request_checksum_calculation` instead.
17
+ When `false`, `request_checksum_calculation` is overridden to `when_required`.
18
+ DOCS
19
+
20
+ def after_initialize(client)
21
+ client.config.request_checksum_calculation = 'when_required' unless client.config.compute_checksums
82
22
  end
83
-
84
23
  end
85
24
  end
86
25
  end
@@ -62,18 +62,16 @@ module Aws
62
62
  class Handler < Seahorse::Client::Handler
63
63
 
64
64
  def call(context)
65
- target = context.params[:response_target] || context[:response_target]
66
-
67
65
  # retry is only supported when range is NOT set on the initial request
68
- if supported_target?(target) && !context.params[:range]
69
- add_event_listeners(context, target)
66
+ if supported_target?(context) && !context.params[:range]
67
+ add_event_listeners(context)
70
68
  end
71
69
  @handler.call(context)
72
70
  end
73
71
 
74
72
  private
75
73
 
76
- def add_event_listeners(context, target)
74
+ def add_event_listeners(context)
77
75
  context.http_response.on_headers(200..299) do
78
76
  case context.http_response.body
79
77
  when Seahorse::Client::BlockIO then
@@ -123,8 +121,8 @@ module Aws
123
121
  context.http_response.body.is_a?(RetryableManagedFile)
124
122
  end
125
123
 
126
- def supported_target?(target)
127
- case target
124
+ def supported_target?(context)
125
+ case context[:response_target]
128
126
  when Proc, String, Pathname then true
129
127
  else false
130
128
  end
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'uri'
4
- require 'cgi'
4
+ require "cgi/escape"
5
+ require "cgi/util" if RUBY_VERSION < "3.5"
5
6
 
6
7
  module Aws
7
8
  module S3
@@ -193,15 +193,14 @@ module Aws
193
193
  req, expires_in, secure, time, unsigned_headers, hoist = true
194
194
  )
195
195
  x_amz_headers = {}
196
-
197
196
  http_req = req.context.http_request
198
-
199
- req.handlers.remove(Aws::S3::Plugins::S3Signer::LegacyHandler)
200
- req.handlers.remove(Aws::Plugins::Sign::Handler)
201
197
  req.handlers.remove(Seahorse::Client::Plugins::ContentLength::Handler)
202
198
  req.handlers.remove(Aws::Rest::ContentTypeHandler)
199
+ req.handlers.remove(Aws::Plugins::ChecksumAlgorithm::OptionHandler)
200
+ req.handlers.remove(Aws::Plugins::ChecksumAlgorithm::ChecksumHandler)
203
201
  req.handlers.remove(Aws::Plugins::InvocationId::Handler)
204
-
202
+ req.handlers.remove(Aws::Plugins::Sign::Handler)
203
+ req.handlers.remove(Aws::S3::Plugins::S3Signer::LegacyHandler)
205
204
  req.handle(step: :send) do |context|
206
205
  # if an endpoint was not provided, force secure or insecure
207
206
  if context.config.regional_endpoint
@@ -238,6 +237,7 @@ module Aws
238
237
  credentials_provider: context[:sigv4_credentials] || context.config.credentials,
239
238
  signing_algorithm: scheme_name.to_sym,
240
239
  uri_escape_path: !!!auth_scheme['disableDoubleEncoding'],
240
+ normalize_path: !!!auth_scheme['disableNormalizePath'],
241
241
  unsigned_headers: unsigned_headers,
242
242
  apply_checksum_header: false
243
243
  )
@@ -41,13 +41,13 @@ 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-south-2, 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-south-2, 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-south-2, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, ap-southeast-5, ca-central-1, cn-north-1, cn-northwest-1, EU, eu-central-1, eu-central-2, eu-north-1, eu-south-1, eu-south-2, eu-west-1, eu-west-2, eu-west-3, il-central-1, me-central-1, me-south-1, sa-east-1, us-east-2, us-gov-east-1, us-gov-west-1, us-west-1, us-west-2
45
45
  # location: {
46
- # type: "AvailabilityZone", # accepts AvailabilityZone
46
+ # type: "AvailabilityZone", # accepts AvailabilityZone, LocalZone
47
47
  # name: "LocationNameAsString",
48
48
  # },
49
49
  # bucket: {
50
- # data_redundancy: "SingleAvailabilityZone", # accepts SingleAvailabilityZone
50
+ # data_redundancy: "SingleAvailabilityZone", # accepts SingleAvailabilityZone, SingleLocalZone
51
51
  # type: "Directory", # accepts Directory
52
52
  # },
53
53
  # },
@@ -75,13 +75,14 @@ module Aws::S3
75
75
  #
76
76
  # <b>Directory buckets </b> - When you use this operation with a
77
77
  # directory bucket, you must use path-style requests in the format
78
- # `https://s3express-control.region_code.amazonaws.com/bucket-name `.
78
+ # `https://s3express-control.region-code.amazonaws.com/bucket-name `.
79
79
  # Virtual-hosted-style requests aren't supported. Directory bucket
80
- # names must be unique in the chosen Availability Zone. Bucket names
81
- # must also follow the format ` bucket_base_name--az_id--x-s3` (for
82
- # example, ` DOC-EXAMPLE-BUCKET--usw2-az1--x-s3`). For information about
83
- # bucket naming restrictions, see [Directory bucket naming rules][2] in
84
- # the *Amazon S3 User Guide*
80
+ # names must be unique in the chosen Zone (Availability Zone or Local
81
+ # Zone). Bucket names must also follow the format `
82
+ # bucket-base-name--zone-id--x-s3` (for example, `
83
+ # DOC-EXAMPLE-BUCKET--usw2-az1--x-s3`). For information about bucket
84
+ # naming restrictions, see [Directory bucket naming rules][2] in the
85
+ # *Amazon S3 User Guide*
85
86
  #
86
87
  #
87
88
  #
@@ -188,23 +189,49 @@ module Aws::S3
188
189
 
189
190
  # @example Request syntax with placeholder values
190
191
  #
191
- # s3.buckets()
192
+ # buckets = s3.buckets({
193
+ # prefix: "Prefix",
194
+ # bucket_region: "BucketRegion",
195
+ # })
192
196
  # @param [Hash] options ({})
197
+ # @option options [String] :prefix
198
+ # Limits the response to bucket names that begin with the specified
199
+ # bucket name prefix.
200
+ # @option options [String] :bucket_region
201
+ # Limits the response to buckets that are located in the specified
202
+ # Amazon Web Services Region. The Amazon Web Services Region must be
203
+ # expressed according to the Amazon Web Services Region code, such as
204
+ # `us-west-2` for the US West (Oregon) Region. For a list of the valid
205
+ # values for all of the Amazon Web Services Regions, see [Regions and
206
+ # Endpoints][1].
207
+ #
208
+ # <note markdown="1"> Requests made to a Regional endpoint that is different from the
209
+ # `bucket-region` parameter are not supported. For example, if you want
210
+ # to limit the response to your buckets in Region `us-west-2`, the
211
+ # request must be made to an endpoint in Region `us-west-2`.
212
+ #
213
+ # </note>
214
+ #
215
+ #
216
+ #
217
+ # [1]: https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
193
218
  # @return [Bucket::Collection]
194
219
  def buckets(options = {})
195
220
  batches = Enumerator.new do |y|
196
- batch = []
197
221
  resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
198
222
  @client.list_buckets(options)
199
223
  end
200
- resp.data.buckets.each do |b|
201
- batch << Bucket.new(
202
- name: b.name,
203
- data: b,
204
- client: @client
205
- )
224
+ resp.each_page do |page|
225
+ batch = []
226
+ page.data.buckets.each do |b|
227
+ batch << Bucket.new(
228
+ name: b.name,
229
+ data: b,
230
+ client: @client
231
+ )
232
+ end
233
+ y.yield(batch)
206
234
  end
207
- y.yield(batch)
208
235
  end
209
236
  Bucket::Collection.new(batches)
210
237
  end