aws-sdk-s3 1.136.0 → 1.176.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +250 -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 +671 -139
  7. data/lib/aws-sdk-s3/bucket_acl.rb +12 -12
  8. data/lib/aws-sdk-s3/bucket_cors.rb +16 -16
  9. data/lib/aws-sdk-s3/bucket_lifecycle.rb +21 -16
  10. data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +74 -17
  11. data/lib/aws-sdk-s3/bucket_logging.rb +19 -12
  12. data/lib/aws-sdk-s3/bucket_notification.rb +6 -6
  13. data/lib/aws-sdk-s3/bucket_policy.rb +62 -18
  14. data/lib/aws-sdk-s3/bucket_region_cache.rb +9 -5
  15. data/lib/aws-sdk-s3/bucket_request_payment.rb +12 -12
  16. data/lib/aws-sdk-s3/bucket_tagging.rb +16 -16
  17. data/lib/aws-sdk-s3/bucket_versioning.rb +32 -32
  18. data/lib/aws-sdk-s3/bucket_website.rb +16 -16
  19. data/lib/aws-sdk-s3/client.rb +7597 -2823
  20. data/lib/aws-sdk-s3/client_api.rb +288 -22
  21. data/lib/aws-sdk-s3/customizations/bucket.rb +1 -1
  22. data/lib/aws-sdk-s3/customizations/errors.rb +15 -2
  23. data/lib/aws-sdk-s3/customizations/object.rb +11 -5
  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 +25 -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 +53 -18
  32. data/lib/aws-sdk-s3/endpoint_provider.rb +125 -6
  33. data/lib/aws-sdk-s3/endpoints.rb +545 -1261
  34. data/lib/aws-sdk-s3/errors.rb +47 -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 +1 -2
  38. data/lib/aws-sdk-s3/file_uploader.rb +1 -1
  39. data/lib/aws-sdk-s3/multipart_file_uploader.rb +4 -4
  40. data/lib/aws-sdk-s3/multipart_stream_uploader.rb +6 -5
  41. data/lib/aws-sdk-s3/multipart_upload.rb +139 -36
  42. data/lib/aws-sdk-s3/multipart_upload_part.rb +175 -54
  43. data/lib/aws-sdk-s3/object.rb +1923 -313
  44. data/lib/aws-sdk-s3/object_acl.rb +34 -22
  45. data/lib/aws-sdk-s3/object_copier.rb +1 -1
  46. data/lib/aws-sdk-s3/object_multipart_copier.rb +10 -8
  47. data/lib/aws-sdk-s3/object_summary.rb +1690 -250
  48. data/lib/aws-sdk-s3/object_version.rb +397 -67
  49. data/lib/aws-sdk-s3/plugins/access_grants.rb +178 -0
  50. data/lib/aws-sdk-s3/plugins/endpoints.rb +32 -208
  51. data/lib/aws-sdk-s3/plugins/express_session_auth.rb +97 -0
  52. data/lib/aws-sdk-s3/plugins/http_200_errors.rb +55 -18
  53. data/lib/aws-sdk-s3/plugins/location_constraint.rb +3 -1
  54. data/lib/aws-sdk-s3/plugins/md5s.rb +2 -1
  55. data/lib/aws-sdk-s3/plugins/s3_signer.rb +7 -2
  56. data/lib/aws-sdk-s3/presigner.rb +5 -2
  57. data/lib/aws-sdk-s3/resource.rb +121 -22
  58. data/lib/aws-sdk-s3/types.rb +5960 -1526
  59. data/lib/aws-sdk-s3.rb +35 -31
  60. data/sig/bucket.rbs +221 -0
  61. data/sig/bucket_acl.rbs +78 -0
  62. data/sig/bucket_cors.rbs +69 -0
  63. data/sig/bucket_lifecycle.rbs +88 -0
  64. data/sig/bucket_lifecycle_configuration.rbs +115 -0
  65. data/sig/bucket_logging.rbs +76 -0
  66. data/sig/bucket_notification.rbs +114 -0
  67. data/sig/bucket_policy.rbs +59 -0
  68. data/sig/bucket_request_payment.rbs +54 -0
  69. data/sig/bucket_tagging.rbs +65 -0
  70. data/sig/bucket_versioning.rbs +77 -0
  71. data/sig/bucket_website.rbs +93 -0
  72. data/sig/client.rbs +2450 -0
  73. data/sig/customizations/bucket.rbs +19 -0
  74. data/sig/customizations/object.rbs +38 -0
  75. data/sig/customizations/object_summary.rbs +35 -0
  76. data/sig/errors.rbs +42 -0
  77. data/sig/multipart_upload.rbs +113 -0
  78. data/sig/multipart_upload_part.rbs +105 -0
  79. data/sig/object.rbs +448 -0
  80. data/sig/object_acl.rbs +86 -0
  81. data/sig/object_summary.rbs +340 -0
  82. data/sig/object_version.rbs +140 -0
  83. data/sig/resource.rbs +132 -0
  84. data/sig/types.rbs +2682 -0
  85. data/sig/waiters.rbs +95 -0
  86. metadata +44 -11
@@ -4,6 +4,11 @@ require 'aws-sigv4'
4
4
 
5
5
  module Aws
6
6
  module S3
7
+ # @api private
8
+ def self.bucket_region_cache
9
+ @bucket_region_cache ||= BucketRegionCache.new
10
+ end
11
+
7
12
  module Plugins
8
13
  # This plugin used to have a V4 signer but it was removed in favor of
9
14
  # generic Sign plugin that uses endpoint auth scheme.
@@ -51,7 +56,7 @@ module Aws
51
56
  private
52
57
 
53
58
  def check_for_cached_region(context, bucket)
54
- cached_region = S3::BUCKET_REGIONS[bucket]
59
+ cached_region = Aws::S3.bucket_region_cache[bucket]
55
60
  if cached_region &&
56
61
  cached_region != context.config.region &&
57
62
  !S3Signer.custom_endpoint?(context)
@@ -97,7 +102,7 @@ module Aws
97
102
  end
98
103
 
99
104
  def update_bucket_cache(context, actual_region)
100
- S3::BUCKET_REGIONS[context.params[:bucket]] = actual_region
105
+ Aws::S3.bucket_region_cache[context.params[:bucket]] = actual_region
101
106
  end
102
107
 
103
108
  def fips_region?(resp)
@@ -199,6 +199,8 @@ module Aws
199
199
  req.handlers.remove(Aws::S3::Plugins::S3Signer::LegacyHandler)
200
200
  req.handlers.remove(Aws::Plugins::Sign::Handler)
201
201
  req.handlers.remove(Seahorse::Client::Plugins::ContentLength::Handler)
202
+ req.handlers.remove(Aws::Rest::ContentTypeHandler)
203
+ req.handlers.remove(Aws::Plugins::InvocationId::Handler)
202
204
 
203
205
  req.handle(step: :send) do |context|
204
206
  # if an endpoint was not provided, force secure or insecure
@@ -232,10 +234,11 @@ module Aws
232
234
  end
233
235
  signer = Aws::Sigv4::Signer.new(
234
236
  service: auth_scheme['signingName'] || 's3',
235
- region: region || context.config.region,
236
- credentials_provider: context.config.credentials,
237
+ region: context[:sigv4_region] || region || context.config.region,
238
+ credentials_provider: context[:sigv4_credentials] || context.config.credentials,
237
239
  signing_algorithm: scheme_name.to_sym,
238
240
  uri_escape_path: !!!auth_scheme['disableDoubleEncoding'],
241
+ normalize_path: !!!auth_scheme['disableNormalizePath'],
239
242
  unsigned_headers: unsigned_headers,
240
243
  apply_checksum_header: false
241
244
  )
@@ -41,7 +41,15 @@ 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, ap-south-2, eu-south-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, 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
45
+ # location: {
46
+ # type: "AvailabilityZone", # accepts AvailabilityZone, LocalZone
47
+ # name: "LocationNameAsString",
48
+ # },
49
+ # bucket: {
50
+ # data_redundancy: "SingleAvailabilityZone", # accepts SingleAvailabilityZone, SingleLocalZone
51
+ # type: "Directory", # accepts Directory
52
+ # },
45
53
  # },
46
54
  # grant_full_control: "GrantFullControl",
47
55
  # grant_read: "GrantRead",
@@ -54,47 +62,112 @@ module Aws::S3
54
62
  # @param [Hash] options ({})
55
63
  # @option options [String] :acl
56
64
  # The canned ACL to apply to the bucket.
65
+ #
66
+ # <note markdown="1"> This functionality is not supported for directory buckets.
67
+ #
68
+ # </note>
57
69
  # @option options [required, String] :bucket
58
70
  # The name of the bucket to create.
71
+ #
72
+ # **General purpose buckets** - For information about bucket naming
73
+ # restrictions, see [Bucket naming rules][1] in the *Amazon S3 User
74
+ # Guide*.
75
+ #
76
+ # <b>Directory buckets </b> - When you use this operation with a
77
+ # directory bucket, you must use path-style requests in the format
78
+ # `https://s3express-control.region-code.amazonaws.com/bucket-name `.
79
+ # Virtual-hosted-style requests aren't supported. Directory bucket
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*
86
+ #
87
+ #
88
+ #
89
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html
90
+ # [2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-bucket-naming-rules.html
59
91
  # @option options [Types::CreateBucketConfiguration] :create_bucket_configuration
60
92
  # The configuration information for the bucket.
61
93
  # @option options [String] :grant_full_control
62
94
  # Allows grantee the read, write, read ACP, and write ACP permissions on
63
95
  # the bucket.
96
+ #
97
+ # <note markdown="1"> This functionality is not supported for directory buckets.
98
+ #
99
+ # </note>
64
100
  # @option options [String] :grant_read
65
101
  # Allows grantee to list the objects in the bucket.
102
+ #
103
+ # <note markdown="1"> This functionality is not supported for directory buckets.
104
+ #
105
+ # </note>
66
106
  # @option options [String] :grant_read_acp
67
107
  # Allows grantee to read the bucket ACL.
108
+ #
109
+ # <note markdown="1"> This functionality is not supported for directory buckets.
110
+ #
111
+ # </note>
68
112
  # @option options [String] :grant_write
69
113
  # Allows grantee to create new objects in the bucket.
70
114
  #
71
115
  # For the bucket and object owners of existing objects, also allows
72
116
  # deletions and overwrites of those objects.
117
+ #
118
+ # <note markdown="1"> This functionality is not supported for directory buckets.
119
+ #
120
+ # </note>
73
121
  # @option options [String] :grant_write_acp
74
122
  # Allows grantee to write the ACL for the applicable bucket.
123
+ #
124
+ # <note markdown="1"> This functionality is not supported for directory buckets.
125
+ #
126
+ # </note>
75
127
  # @option options [Boolean] :object_lock_enabled_for_bucket
76
128
  # Specifies whether you want S3 Object Lock to be enabled for the new
77
129
  # bucket.
130
+ #
131
+ # <note markdown="1"> This functionality is not supported for directory buckets.
132
+ #
133
+ # </note>
78
134
  # @option options [String] :object_ownership
79
135
  # The container element for object ownership for a bucket's ownership
80
136
  # controls.
81
137
  #
82
- # BucketOwnerPreferred - Objects uploaded to the bucket change ownership
83
- # to the bucket owner if the objects are uploaded with the
138
+ # `BucketOwnerPreferred` - Objects uploaded to the bucket change
139
+ # ownership to the bucket owner if the objects are uploaded with the
84
140
  # `bucket-owner-full-control` canned ACL.
85
141
  #
86
- # ObjectWriter - The uploading account will own the object if the object
87
- # is uploaded with the `bucket-owner-full-control` canned ACL.
142
+ # `ObjectWriter` - The uploading account will own the object if the
143
+ # object is uploaded with the `bucket-owner-full-control` canned ACL.
144
+ #
145
+ # `BucketOwnerEnforced` - Access control lists (ACLs) are disabled and
146
+ # no longer affect permissions. The bucket owner automatically owns and
147
+ # has full control over every object in the bucket. The bucket only
148
+ # accepts PUT requests that don't specify an ACL or specify bucket
149
+ # owner full control ACLs (such as the predefined
150
+ # `bucket-owner-full-control` canned ACL or a custom ACL in XML format
151
+ # that grants the same permissions).
152
+ #
153
+ # By default, `ObjectOwnership` is set to `BucketOwnerEnforced` and ACLs
154
+ # are disabled. We recommend keeping ACLs disabled, except in uncommon
155
+ # use cases where you must control access for each object individually.
156
+ # For more information about S3 Object Ownership, see [Controlling
157
+ # ownership of objects and disabling ACLs for your bucket][1] in the
158
+ # *Amazon S3 User Guide*.
159
+ #
160
+ # <note markdown="1"> This functionality is not supported for directory buckets. Directory
161
+ # buckets use the bucket owner enforced setting for S3 Object Ownership.
162
+ #
163
+ # </note>
164
+ #
88
165
  #
89
- # BucketOwnerEnforced - Access control lists (ACLs) are disabled and no
90
- # longer affect permissions. The bucket owner automatically owns and has
91
- # full control over every object in the bucket. The bucket only accepts
92
- # PUT requests that don't specify an ACL or bucket owner full control
93
- # ACLs, such as the `bucket-owner-full-control` canned ACL or an
94
- # equivalent form of this ACL expressed in the XML format.
166
+ #
167
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html
95
168
  # @return [Bucket]
96
169
  def create_bucket(options = {})
97
- Aws::Plugins::UserAgent.feature('resource') do
170
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
98
171
  @client.create_bucket(options)
99
172
  end
100
173
  Bucket.new(
@@ -116,23 +189,49 @@ module Aws::S3
116
189
 
117
190
  # @example Request syntax with placeholder values
118
191
  #
119
- # s3.buckets()
192
+ # buckets = s3.buckets({
193
+ # prefix: "Prefix",
194
+ # bucket_region: "BucketRegion",
195
+ # })
120
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
121
218
  # @return [Bucket::Collection]
122
219
  def buckets(options = {})
123
220
  batches = Enumerator.new do |y|
124
- batch = []
125
- resp = Aws::Plugins::UserAgent.feature('resource') do
221
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
126
222
  @client.list_buckets(options)
127
223
  end
128
- resp.data.buckets.each do |b|
129
- batch << Bucket.new(
130
- name: b.name,
131
- data: b,
132
- client: @client
133
- )
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)
134
234
  end
135
- y.yield(batch)
136
235
  end
137
236
  Bucket::Collection.new(batches)
138
237
  end