aws-sdk-s3 1.48.0 → 1.183.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 (134) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +1352 -0
  3. data/LICENSE.txt +202 -0
  4. data/VERSION +1 -0
  5. data/lib/aws-sdk-s3/access_grants_credentials.rb +57 -0
  6. data/lib/aws-sdk-s3/access_grants_credentials_provider.rb +250 -0
  7. data/lib/aws-sdk-s3/bucket.rb +1005 -106
  8. data/lib/aws-sdk-s3/bucket_acl.rb +65 -18
  9. data/lib/aws-sdk-s3/bucket_cors.rb +80 -18
  10. data/lib/aws-sdk-s3/bucket_lifecycle.rb +71 -20
  11. data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +126 -21
  12. data/lib/aws-sdk-s3/bucket_logging.rb +68 -16
  13. data/lib/aws-sdk-s3/bucket_notification.rb +52 -20
  14. data/lib/aws-sdk-s3/bucket_policy.rb +108 -17
  15. data/lib/aws-sdk-s3/bucket_region_cache.rb +11 -5
  16. data/lib/aws-sdk-s3/bucket_request_payment.rb +60 -15
  17. data/lib/aws-sdk-s3/bucket_tagging.rb +71 -18
  18. data/lib/aws-sdk-s3/bucket_versioning.rb +133 -17
  19. data/lib/aws-sdk-s3/bucket_website.rb +78 -21
  20. data/lib/aws-sdk-s3/client.rb +14517 -941
  21. data/lib/aws-sdk-s3/client_api.rb +1296 -197
  22. data/lib/aws-sdk-s3/customizations/bucket.rb +56 -37
  23. data/lib/aws-sdk-s3/customizations/errors.rb +40 -0
  24. data/lib/aws-sdk-s3/customizations/multipart_upload.rb +2 -0
  25. data/lib/aws-sdk-s3/customizations/object.rb +288 -68
  26. data/lib/aws-sdk-s3/customizations/object_summary.rb +10 -0
  27. data/lib/aws-sdk-s3/customizations/object_version.rb +13 -0
  28. data/lib/aws-sdk-s3/customizations/types/list_object_versions_output.rb +2 -0
  29. data/lib/aws-sdk-s3/customizations/types/permanent_redirect.rb +26 -0
  30. data/lib/aws-sdk-s3/customizations.rb +27 -28
  31. data/lib/aws-sdk-s3/encryption/client.rb +28 -7
  32. data/lib/aws-sdk-s3/encryption/decrypt_handler.rb +71 -29
  33. data/lib/aws-sdk-s3/encryption/default_cipher_provider.rb +43 -5
  34. data/lib/aws-sdk-s3/encryption/default_key_provider.rb +2 -0
  35. data/lib/aws-sdk-s3/encryption/encrypt_handler.rb +13 -2
  36. data/lib/aws-sdk-s3/encryption/errors.rb +2 -0
  37. data/lib/aws-sdk-s3/encryption/io_auth_decrypter.rb +2 -0
  38. data/lib/aws-sdk-s3/encryption/io_decrypter.rb +11 -3
  39. data/lib/aws-sdk-s3/encryption/io_encrypter.rb +2 -0
  40. data/lib/aws-sdk-s3/encryption/key_provider.rb +2 -0
  41. data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +46 -11
  42. data/lib/aws-sdk-s3/encryption/materials.rb +8 -6
  43. data/lib/aws-sdk-s3/encryption/utils.rb +25 -0
  44. data/lib/aws-sdk-s3/encryption.rb +4 -0
  45. data/lib/aws-sdk-s3/encryptionV2/client.rb +570 -0
  46. data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +223 -0
  47. data/lib/aws-sdk-s3/encryptionV2/default_cipher_provider.rb +170 -0
  48. data/lib/aws-sdk-s3/encryptionV2/default_key_provider.rb +40 -0
  49. data/lib/aws-sdk-s3/encryptionV2/encrypt_handler.rb +65 -0
  50. data/lib/aws-sdk-s3/encryptionV2/errors.rb +37 -0
  51. data/lib/aws-sdk-s3/encryptionV2/io_auth_decrypter.rb +58 -0
  52. data/lib/aws-sdk-s3/encryptionV2/io_decrypter.rb +37 -0
  53. data/lib/aws-sdk-s3/encryptionV2/io_encrypter.rb +73 -0
  54. data/lib/aws-sdk-s3/encryptionV2/key_provider.rb +31 -0
  55. data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +173 -0
  56. data/lib/aws-sdk-s3/encryptionV2/materials.rb +60 -0
  57. data/lib/aws-sdk-s3/encryptionV2/utils.rb +103 -0
  58. data/lib/aws-sdk-s3/encryption_v2.rb +23 -0
  59. data/lib/aws-sdk-s3/endpoint_parameters.rb +181 -0
  60. data/lib/aws-sdk-s3/endpoint_provider.rb +716 -0
  61. data/lib/aws-sdk-s3/endpoints.rb +1434 -0
  62. data/lib/aws-sdk-s3/errors.rb +170 -1
  63. data/lib/aws-sdk-s3/event_streams.rb +8 -1
  64. data/lib/aws-sdk-s3/express_credentials.rb +55 -0
  65. data/lib/aws-sdk-s3/express_credentials_provider.rb +59 -0
  66. data/lib/aws-sdk-s3/file_downloader.rb +161 -46
  67. data/lib/aws-sdk-s3/file_part.rb +11 -6
  68. data/lib/aws-sdk-s3/file_uploader.rb +39 -18
  69. data/lib/aws-sdk-s3/legacy_signer.rb +17 -25
  70. data/lib/aws-sdk-s3/multipart_file_uploader.rb +104 -27
  71. data/lib/aws-sdk-s3/multipart_stream_uploader.rb +61 -21
  72. data/lib/aws-sdk-s3/multipart_upload.rb +342 -32
  73. data/lib/aws-sdk-s3/multipart_upload_error.rb +2 -0
  74. data/lib/aws-sdk-s3/multipart_upload_part.rb +384 -46
  75. data/lib/aws-sdk-s3/object.rb +2600 -231
  76. data/lib/aws-sdk-s3/object_acl.rb +103 -25
  77. data/lib/aws-sdk-s3/object_copier.rb +9 -5
  78. data/lib/aws-sdk-s3/object_multipart_copier.rb +48 -22
  79. data/lib/aws-sdk-s3/object_summary.rb +2174 -204
  80. data/lib/aws-sdk-s3/object_version.rb +539 -80
  81. data/lib/aws-sdk-s3/plugins/accelerate.rb +17 -64
  82. data/lib/aws-sdk-s3/plugins/access_grants.rb +178 -0
  83. data/lib/aws-sdk-s3/plugins/arn.rb +70 -0
  84. data/lib/aws-sdk-s3/plugins/bucket_dns.rb +7 -43
  85. data/lib/aws-sdk-s3/plugins/bucket_name_restrictions.rb +20 -3
  86. data/lib/aws-sdk-s3/plugins/checksum_algorithm.rb +31 -0
  87. data/lib/aws-sdk-s3/plugins/dualstack.rb +7 -50
  88. data/lib/aws-sdk-s3/plugins/endpoints.rb +86 -0
  89. data/lib/aws-sdk-s3/plugins/expect_100_continue.rb +5 -4
  90. data/lib/aws-sdk-s3/plugins/express_session_auth.rb +88 -0
  91. data/lib/aws-sdk-s3/plugins/get_bucket_location_fix.rb +3 -1
  92. data/lib/aws-sdk-s3/plugins/http_200_errors.rb +62 -17
  93. data/lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb +44 -0
  94. data/lib/aws-sdk-s3/plugins/location_constraint.rb +5 -1
  95. data/lib/aws-sdk-s3/plugins/md5s.rb +14 -70
  96. data/lib/aws-sdk-s3/plugins/redirects.rb +2 -0
  97. data/lib/aws-sdk-s3/plugins/s3_host_id.rb +2 -0
  98. data/lib/aws-sdk-s3/plugins/s3_signer.rb +63 -94
  99. data/lib/aws-sdk-s3/plugins/sse_cpk.rb +3 -1
  100. data/lib/aws-sdk-s3/plugins/streaming_retry.rb +139 -0
  101. data/lib/aws-sdk-s3/plugins/url_encoded_keys.rb +2 -0
  102. data/lib/aws-sdk-s3/presigned_post.rb +160 -99
  103. data/lib/aws-sdk-s3/presigner.rb +141 -62
  104. data/lib/aws-sdk-s3/resource.rb +156 -17
  105. data/lib/aws-sdk-s3/types.rb +13021 -4106
  106. data/lib/aws-sdk-s3/waiters.rb +67 -1
  107. data/lib/aws-sdk-s3.rb +46 -32
  108. data/sig/bucket.rbs +222 -0
  109. data/sig/bucket_acl.rbs +78 -0
  110. data/sig/bucket_cors.rbs +69 -0
  111. data/sig/bucket_lifecycle.rbs +88 -0
  112. data/sig/bucket_lifecycle_configuration.rbs +115 -0
  113. data/sig/bucket_logging.rbs +76 -0
  114. data/sig/bucket_notification.rbs +114 -0
  115. data/sig/bucket_policy.rbs +59 -0
  116. data/sig/bucket_request_payment.rbs +54 -0
  117. data/sig/bucket_tagging.rbs +65 -0
  118. data/sig/bucket_versioning.rbs +77 -0
  119. data/sig/bucket_website.rbs +93 -0
  120. data/sig/client.rbs +2472 -0
  121. data/sig/customizations/bucket.rbs +19 -0
  122. data/sig/customizations/object.rbs +38 -0
  123. data/sig/customizations/object_summary.rbs +35 -0
  124. data/sig/errors.rbs +42 -0
  125. data/sig/multipart_upload.rbs +120 -0
  126. data/sig/multipart_upload_part.rbs +109 -0
  127. data/sig/object.rbs +459 -0
  128. data/sig/object_acl.rbs +86 -0
  129. data/sig/object_summary.rbs +345 -0
  130. data/sig/object_version.rbs +143 -0
  131. data/sig/resource.rbs +134 -0
  132. data/sig/types.rbs +2712 -0
  133. data/sig/waiters.rbs +95 -0
  134. metadata +74 -15
@@ -1,11 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # WARNING ABOUT GENERATED CODE
2
4
  #
3
5
  # This file is generated. See the contributing guide for more information:
4
- # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
5
7
  #
6
8
  # WARNING ABOUT GENERATED CODE
7
9
 
8
10
  module Aws::S3
11
+
9
12
  class ObjectVersion
10
13
 
11
14
  extend Aws::Deprecations
@@ -27,6 +30,7 @@ module Aws::S3
27
30
  @id = extract_id(args, options)
28
31
  @data = options.delete(:data)
29
32
  @client = options.delete(:client) || Client.new(options)
33
+ @waiter_block_warned = false
30
34
  end
31
35
 
32
36
  # @!group Read-Only Attributes
@@ -46,12 +50,30 @@ module Aws::S3
46
50
  @id
47
51
  end
48
52
 
49
-
53
+ # The entity tag is an MD5 hash of that version of the object.
50
54
  # @return [String]
51
55
  def etag
52
56
  data[:etag]
53
57
  end
54
58
 
59
+ # The algorithm that was used to create a checksum of the object.
60
+ # @return [Array<String>]
61
+ def checksum_algorithm
62
+ data[:checksum_algorithm]
63
+ end
64
+
65
+ # The checksum type that is used to calculate the object’s checksum
66
+ # value. For more information, see [Checking object integrity][1] in the
67
+ # *Amazon S3 User Guide*.
68
+ #
69
+ #
70
+ #
71
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
72
+ # @return [String]
73
+ def checksum_type
74
+ data[:checksum_type]
75
+ end
76
+
55
77
  # Size in bytes of the object.
56
78
  # @return [Integer]
57
79
  def size
@@ -83,18 +105,32 @@ module Aws::S3
83
105
  data[:is_latest]
84
106
  end
85
107
 
86
- # Date and time the object was last modified.
108
+ # Date and time when the object was last modified.
87
109
  # @return [Time]
88
110
  def last_modified
89
111
  data[:last_modified]
90
112
  end
91
113
 
92
-
114
+ # Specifies the owner of the object.
93
115
  # @return [Types::Owner]
94
116
  def owner
95
117
  data[:owner]
96
118
  end
97
119
 
120
+ # Specifies the restoration status of an object. Objects in certain
121
+ # storage classes must be restored before they can be retrieved. For
122
+ # more information about these storage classes and how to work with
123
+ # archived objects, see [ Working with archived objects][1] in the
124
+ # *Amazon S3 User Guide*.
125
+ #
126
+ #
127
+ #
128
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/archived-objects.html
129
+ # @return [Types::RestoreStatus]
130
+ def restore_status
131
+ data[:restore_status]
132
+ end
133
+
98
134
  # @!endgroup
99
135
 
100
136
  # @return [Client]
@@ -130,7 +166,8 @@ module Aws::S3
130
166
  # Waiter polls an API operation until a resource enters a desired
131
167
  # state.
132
168
  #
133
- # @note The waiting operation is performed on a copy. The original resource remains unchanged
169
+ # @note The waiting operation is performed on a copy. The original resource
170
+ # remains unchanged.
134
171
  #
135
172
  # ## Basic Usage
136
173
  #
@@ -143,13 +180,15 @@ module Aws::S3
143
180
  #
144
181
  # ## Example
145
182
  #
146
- # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
183
+ # instance.wait_until(max_attempts:10, delay:5) do |instance|
184
+ # instance.state.name == 'running'
185
+ # end
147
186
  #
148
187
  # ## Configuration
149
188
  #
150
189
  # You can configure the maximum number of polling attempts, and the
151
- # delay (in seconds) between each polling attempt. The waiting condition is set
152
- # by passing a block to {#wait_until}:
190
+ # delay (in seconds) between each polling attempt. The waiting condition is
191
+ # set by passing a block to {#wait_until}:
153
192
  #
154
193
  # # poll for ~25 seconds
155
194
  # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
@@ -180,17 +219,16 @@ module Aws::S3
180
219
  # # resource did not enter the desired state in time
181
220
  # end
182
221
  #
222
+ # @yieldparam [Resource] resource to be used in the waiting condition.
183
223
  #
184
- # @yield param [Resource] resource to be used in the waiting condition
185
- #
186
- # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
187
- # because the waiter has entered a state that it will not transition
188
- # out of, preventing success.
224
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter
225
+ # terminates because the waiter has entered a state that it will not
226
+ # transition out of, preventing success.
189
227
  #
190
228
  # yet successful.
191
229
  #
192
- # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
193
- # while polling for a resource that is not expected.
230
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is
231
+ # encountered while polling for a resource that is not expected.
194
232
  #
195
233
  # @raise [NotImplementedError] Raised when the resource does not
196
234
  #
@@ -217,7 +255,9 @@ module Aws::S3
217
255
  :retry
218
256
  end
219
257
  end
220
- Aws::Waiters::Waiter.new(options).wait({})
258
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
259
+ Aws::Waiters::Waiter.new(options).wait({})
260
+ end
221
261
  end
222
262
 
223
263
  # @!group Actions
@@ -228,20 +268,89 @@ module Aws::S3
228
268
  # mfa: "MFA",
229
269
  # request_payer: "requester", # accepts requester
230
270
  # bypass_governance_retention: false,
271
+ # expected_bucket_owner: "AccountId",
272
+ # if_match: "IfMatch",
273
+ # if_match_last_modified_time: Time.now,
274
+ # if_match_size: 1,
231
275
  # })
232
276
  # @param [Hash] options ({})
233
277
  # @option options [String] :mfa
234
278
  # The concatenation of the authentication device's serial number, a
235
279
  # space, and the value that is displayed on your authentication device.
280
+ # Required to permanently delete a versioned object if versioning is
281
+ # configured with MFA delete enabled.
282
+ #
283
+ # <note markdown="1"> This functionality is not supported for directory buckets.
284
+ #
285
+ # </note>
236
286
  # @option options [String] :request_payer
237
- # Confirms that the requester knows that she or he will be charged for
238
- # the request. Bucket owners need not specify this parameter in their
239
- # requests. Documentation on downloading objects from requester pays
240
- # buckets can be found at
241
- # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
287
+ # Confirms that the requester knows that they will be charged for the
288
+ # request. Bucket owners need not specify this parameter in their
289
+ # requests. If either the source or destination S3 bucket has Requester
290
+ # Pays enabled, the requester will pay for corresponding charges to copy
291
+ # the object. For information about downloading objects from Requester
292
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
293
+ # in the *Amazon S3 User Guide*.
294
+ #
295
+ # <note markdown="1"> This functionality is not supported for directory buckets.
296
+ #
297
+ # </note>
298
+ #
299
+ #
300
+ #
301
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
242
302
  # @option options [Boolean] :bypass_governance_retention
243
- # Indicates whether Amazon S3 object lock should bypass governance-mode
244
- # restrictions to process this operation.
303
+ # Indicates whether S3 Object Lock should bypass Governance-mode
304
+ # restrictions to process this operation. To use this header, you must
305
+ # have the `s3:BypassGovernanceRetention` permission.
306
+ #
307
+ # <note markdown="1"> This functionality is not supported for directory buckets.
308
+ #
309
+ # </note>
310
+ # @option options [String] :expected_bucket_owner
311
+ # The account ID of the expected bucket owner. If the account ID that
312
+ # you provide does not match the actual owner of the bucket, the request
313
+ # fails with the HTTP status code `403 Forbidden` (access denied).
314
+ # @option options [String] :if_match
315
+ # The `If-Match` header field makes the request method conditional on
316
+ # ETags. If the ETag value does not match, the operation returns a `412
317
+ # Precondition Failed` error. If the ETag matches or if the object
318
+ # doesn't exist, the operation will return a `204 Success (No Content)
319
+ # response`.
320
+ #
321
+ # For more information about conditional requests, see [RFC 7232][1].
322
+ #
323
+ # <note markdown="1"> This functionality is only supported for directory buckets.
324
+ #
325
+ # </note>
326
+ #
327
+ #
328
+ #
329
+ # [1]: https://tools.ietf.org/html/rfc7232
330
+ # @option options [Time,DateTime,Date,Integer,String] :if_match_last_modified_time
331
+ # If present, the object is deleted only if its modification times
332
+ # matches the provided `Timestamp`. If the `Timestamp` values do not
333
+ # match, the operation returns a `412 Precondition Failed` error. If the
334
+ # `Timestamp` matches or if the object doesn’t exist, the operation
335
+ # returns a `204 Success (No Content)` response.
336
+ #
337
+ # <note markdown="1"> This functionality is only supported for directory buckets.
338
+ #
339
+ # </note>
340
+ # @option options [Integer] :if_match_size
341
+ # If present, the object is deleted only if its size matches the
342
+ # provided size in bytes. If the `Size` value does not match, the
343
+ # operation returns a `412 Precondition Failed` error. If the `Size`
344
+ # matches or if the object doesn’t exist, the operation returns a `204
345
+ # Success (No Content)` response.
346
+ #
347
+ # <note markdown="1"> This functionality is only supported for directory buckets.
348
+ #
349
+ # </note>
350
+ #
351
+ # You can use the `If-Match`, `x-amz-if-match-last-modified-time` and
352
+ # `x-amz-if-match-size` conditional headers in conjunction with
353
+ # each-other or individually.
245
354
  # @return [Types::DeleteObjectOutput]
246
355
  def delete(options = {})
247
356
  options = options.merge(
@@ -249,7 +358,9 @@ module Aws::S3
249
358
  key: @object_key,
250
359
  version_id: @id
251
360
  )
252
- resp = @client.delete_object(options)
361
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
362
+ @client.delete_object(options)
363
+ end
253
364
  resp.data
254
365
  end
255
366
 
@@ -272,60 +383,201 @@ module Aws::S3
272
383
  # sse_customer_key_md5: "SSECustomerKeyMD5",
273
384
  # request_payer: "requester", # accepts requester
274
385
  # part_number: 1,
386
+ # expected_bucket_owner: "AccountId",
387
+ # checksum_mode: "ENABLED", # accepts ENABLED
275
388
  # })
276
389
  # @param [Hash] options ({})
277
390
  # @option options [String] :if_match
278
391
  # Return the object only if its entity tag (ETag) is the same as the one
279
- # specified, otherwise return a 412 (precondition failed).
392
+ # specified in this header; otherwise, return a `412 Precondition
393
+ # Failed` error.
394
+ #
395
+ # If both of the `If-Match` and `If-Unmodified-Since` headers are
396
+ # present in the request as follows: `If-Match` condition evaluates to
397
+ # `true`, and; `If-Unmodified-Since` condition evaluates to `false`;
398
+ # then, S3 returns `200 OK` and the data requested.
399
+ #
400
+ # For more information about conditional requests, see [RFC 7232][1].
401
+ #
402
+ #
403
+ #
404
+ # [1]: https://tools.ietf.org/html/rfc7232
280
405
  # @option options [Time,DateTime,Date,Integer,String] :if_modified_since
281
406
  # Return the object only if it has been modified since the specified
282
- # time, otherwise return a 304 (not modified).
407
+ # time; otherwise, return a `304 Not Modified` error.
408
+ #
409
+ # If both of the `If-None-Match` and `If-Modified-Since` headers are
410
+ # present in the request as follows:` If-None-Match` condition evaluates
411
+ # to `false`, and; `If-Modified-Since` condition evaluates to `true`;
412
+ # then, S3 returns `304 Not Modified` status code.
413
+ #
414
+ # For more information about conditional requests, see [RFC 7232][1].
415
+ #
416
+ #
417
+ #
418
+ # [1]: https://tools.ietf.org/html/rfc7232
283
419
  # @option options [String] :if_none_match
284
420
  # Return the object only if its entity tag (ETag) is different from the
285
- # one specified, otherwise return a 304 (not modified).
421
+ # one specified in this header; otherwise, return a `304 Not Modified`
422
+ # error.
423
+ #
424
+ # If both of the `If-None-Match` and `If-Modified-Since` headers are
425
+ # present in the request as follows:` If-None-Match` condition evaluates
426
+ # to `false`, and; `If-Modified-Since` condition evaluates to `true`;
427
+ # then, S3 returns `304 Not Modified` HTTP status code.
428
+ #
429
+ # For more information about conditional requests, see [RFC 7232][1].
430
+ #
431
+ #
432
+ #
433
+ # [1]: https://tools.ietf.org/html/rfc7232
286
434
  # @option options [Time,DateTime,Date,Integer,String] :if_unmodified_since
287
435
  # Return the object only if it has not been modified since the specified
288
- # time, otherwise return a 412 (precondition failed).
436
+ # time; otherwise, return a `412 Precondition Failed` error.
437
+ #
438
+ # If both of the `If-Match` and `If-Unmodified-Since` headers are
439
+ # present in the request as follows: `If-Match` condition evaluates to
440
+ # `true`, and; `If-Unmodified-Since` condition evaluates to `false`;
441
+ # then, S3 returns `200 OK` and the data requested.
442
+ #
443
+ # For more information about conditional requests, see [RFC 7232][1].
444
+ #
445
+ #
446
+ #
447
+ # [1]: https://tools.ietf.org/html/rfc7232
289
448
  # @option options [String] :range
290
- # Downloads the specified range bytes of an object. For more information
291
- # about the HTTP Range header, go to
292
- # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
449
+ # Downloads the specified byte range of an object. For more information
450
+ # about the HTTP Range header, see
451
+ # [https://www.rfc-editor.org/rfc/rfc9110.html#name-range][1].
452
+ #
453
+ # <note markdown="1"> Amazon S3 doesn't support retrieving multiple ranges of data per
454
+ # `GET` request.
455
+ #
456
+ # </note>
457
+ #
458
+ #
459
+ #
460
+ # [1]: https://www.rfc-editor.org/rfc/rfc9110.html#name-range
293
461
  # @option options [String] :response_cache_control
294
- # Sets the Cache-Control header of the response.
462
+ # Sets the `Cache-Control` header of the response.
295
463
  # @option options [String] :response_content_disposition
296
- # Sets the Content-Disposition header of the response
464
+ # Sets the `Content-Disposition` header of the response.
297
465
  # @option options [String] :response_content_encoding
298
- # Sets the Content-Encoding header of the response.
466
+ # Sets the `Content-Encoding` header of the response.
299
467
  # @option options [String] :response_content_language
300
- # Sets the Content-Language header of the response.
468
+ # Sets the `Content-Language` header of the response.
301
469
  # @option options [String] :response_content_type
302
- # Sets the Content-Type header of the response.
470
+ # Sets the `Content-Type` header of the response.
303
471
  # @option options [Time,DateTime,Date,Integer,String] :response_expires
304
- # Sets the Expires header of the response.
472
+ # Sets the `Expires` header of the response.
305
473
  # @option options [String] :sse_customer_algorithm
306
- # Specifies the algorithm to use to when encrypting the object (e.g.,
307
- # AES256).
474
+ # Specifies the algorithm to use when decrypting the object (for
475
+ # example, `AES256`).
476
+ #
477
+ # If you encrypt an object by using server-side encryption with
478
+ # customer-provided encryption keys (SSE-C) when you store the object in
479
+ # Amazon S3, then when you GET the object, you must use the following
480
+ # headers:
481
+ #
482
+ # * `x-amz-server-side-encryption-customer-algorithm`
483
+ #
484
+ # * `x-amz-server-side-encryption-customer-key`
485
+ #
486
+ # * `x-amz-server-side-encryption-customer-key-MD5`
487
+ #
488
+ # For more information about SSE-C, see [Server-Side Encryption (Using
489
+ # Customer-Provided Encryption Keys)][1] in the *Amazon S3 User Guide*.
490
+ #
491
+ # <note markdown="1"> This functionality is not supported for directory buckets.
492
+ #
493
+ # </note>
494
+ #
495
+ #
496
+ #
497
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html
308
498
  # @option options [String] :sse_customer_key
309
- # Specifies the customer-provided encryption key for Amazon S3 to use in
310
- # encrypting data. This value is used to store the object and then it is
311
- # discarded; Amazon does not store the encryption key. The key must be
312
- # appropriate for use with the algorithm specified in the
313
- # x-amz-server-side​-encryption​-customer-algorithm header.
499
+ # Specifies the customer-provided encryption key that you originally
500
+ # provided for Amazon S3 to encrypt the data before storing it. This
501
+ # value is used to decrypt the object when recovering it and must match
502
+ # the one used when storing the data. The key must be appropriate for
503
+ # use with the algorithm specified in the
504
+ # `x-amz-server-side-encryption-customer-algorithm` header.
505
+ #
506
+ # If you encrypt an object by using server-side encryption with
507
+ # customer-provided encryption keys (SSE-C) when you store the object in
508
+ # Amazon S3, then when you GET the object, you must use the following
509
+ # headers:
510
+ #
511
+ # * `x-amz-server-side-encryption-customer-algorithm`
512
+ #
513
+ # * `x-amz-server-side-encryption-customer-key`
514
+ #
515
+ # * `x-amz-server-side-encryption-customer-key-MD5`
516
+ #
517
+ # For more information about SSE-C, see [Server-Side Encryption (Using
518
+ # Customer-Provided Encryption Keys)][1] in the *Amazon S3 User Guide*.
519
+ #
520
+ # <note markdown="1"> This functionality is not supported for directory buckets.
521
+ #
522
+ # </note>
523
+ #
524
+ #
525
+ #
526
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html
314
527
  # @option options [String] :sse_customer_key_md5
315
- # Specifies the 128-bit MD5 digest of the encryption key according to
316
- # RFC 1321. Amazon S3 uses this header for a message integrity check to
317
- # ensure the encryption key was transmitted without error.
528
+ # Specifies the 128-bit MD5 digest of the customer-provided encryption
529
+ # key according to RFC 1321. Amazon S3 uses this header for a message
530
+ # integrity check to ensure that the encryption key was transmitted
531
+ # without error.
532
+ #
533
+ # If you encrypt an object by using server-side encryption with
534
+ # customer-provided encryption keys (SSE-C) when you store the object in
535
+ # Amazon S3, then when you GET the object, you must use the following
536
+ # headers:
537
+ #
538
+ # * `x-amz-server-side-encryption-customer-algorithm`
539
+ #
540
+ # * `x-amz-server-side-encryption-customer-key`
541
+ #
542
+ # * `x-amz-server-side-encryption-customer-key-MD5`
543
+ #
544
+ # For more information about SSE-C, see [Server-Side Encryption (Using
545
+ # Customer-Provided Encryption Keys)][1] in the *Amazon S3 User Guide*.
546
+ #
547
+ # <note markdown="1"> This functionality is not supported for directory buckets.
548
+ #
549
+ # </note>
550
+ #
551
+ #
552
+ #
553
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html
318
554
  # @option options [String] :request_payer
319
- # Confirms that the requester knows that she or he will be charged for
320
- # the request. Bucket owners need not specify this parameter in their
321
- # requests. Documentation on downloading objects from requester pays
322
- # buckets can be found at
323
- # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
555
+ # Confirms that the requester knows that they will be charged for the
556
+ # request. Bucket owners need not specify this parameter in their
557
+ # requests. If either the source or destination S3 bucket has Requester
558
+ # Pays enabled, the requester will pay for corresponding charges to copy
559
+ # the object. For information about downloading objects from Requester
560
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
561
+ # in the *Amazon S3 User Guide*.
562
+ #
563
+ # <note markdown="1"> This functionality is not supported for directory buckets.
564
+ #
565
+ # </note>
566
+ #
567
+ #
568
+ #
569
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
324
570
  # @option options [Integer] :part_number
325
571
  # Part number of the object being read. This is a positive integer
326
572
  # between 1 and 10,000. Effectively performs a 'ranged' GET request
327
573
  # for the part specified. Useful for downloading just a part of an
328
574
  # object.
575
+ # @option options [String] :expected_bucket_owner
576
+ # The account ID of the expected bucket owner. If the account ID that
577
+ # you provide does not match the actual owner of the bucket, the request
578
+ # fails with the HTTP status code `403 Forbidden` (access denied).
579
+ # @option options [String] :checksum_mode
580
+ # To retrieve the checksum, this mode must be enabled.
329
581
  # @return [Types::GetObjectOutput]
330
582
  def get(options = {}, &block)
331
583
  options = options.merge(
@@ -333,7 +585,9 @@ module Aws::S3
333
585
  key: @object_key,
334
586
  version_id: @id
335
587
  )
336
- resp = @client.get_object(options, &block)
588
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
589
+ @client.get_object(options, &block)
590
+ end
337
591
  resp.data
338
592
  end
339
593
 
@@ -345,53 +599,177 @@ module Aws::S3
345
599
  # if_none_match: "IfNoneMatch",
346
600
  # if_unmodified_since: Time.now,
347
601
  # range: "Range",
602
+ # response_cache_control: "ResponseCacheControl",
603
+ # response_content_disposition: "ResponseContentDisposition",
604
+ # response_content_encoding: "ResponseContentEncoding",
605
+ # response_content_language: "ResponseContentLanguage",
606
+ # response_content_type: "ResponseContentType",
607
+ # response_expires: Time.now,
348
608
  # sse_customer_algorithm: "SSECustomerAlgorithm",
349
609
  # sse_customer_key: "SSECustomerKey",
350
610
  # sse_customer_key_md5: "SSECustomerKeyMD5",
351
611
  # request_payer: "requester", # accepts requester
352
612
  # part_number: 1,
613
+ # expected_bucket_owner: "AccountId",
614
+ # checksum_mode: "ENABLED", # accepts ENABLED
353
615
  # })
354
616
  # @param [Hash] options ({})
355
617
  # @option options [String] :if_match
356
618
  # Return the object only if its entity tag (ETag) is the same as the one
357
- # specified, otherwise return a 412 (precondition failed).
619
+ # specified; otherwise, return a 412 (precondition failed) error.
620
+ #
621
+ # If both of the `If-Match` and `If-Unmodified-Since` headers are
622
+ # present in the request as follows:
623
+ #
624
+ # * `If-Match` condition evaluates to `true`, and;
625
+ #
626
+ # * `If-Unmodified-Since` condition evaluates to `false`;
627
+ #
628
+ # Then Amazon S3 returns `200 OK` and the data requested.
629
+ #
630
+ # For more information about conditional requests, see [RFC 7232][1].
631
+ #
632
+ #
633
+ #
634
+ # [1]: https://tools.ietf.org/html/rfc7232
358
635
  # @option options [Time,DateTime,Date,Integer,String] :if_modified_since
359
636
  # Return the object only if it has been modified since the specified
360
- # time, otherwise return a 304 (not modified).
637
+ # time; otherwise, return a 304 (not modified) error.
638
+ #
639
+ # If both of the `If-None-Match` and `If-Modified-Since` headers are
640
+ # present in the request as follows:
641
+ #
642
+ # * `If-None-Match` condition evaluates to `false`, and;
643
+ #
644
+ # * `If-Modified-Since` condition evaluates to `true`;
645
+ #
646
+ # Then Amazon S3 returns the `304 Not Modified` response code.
647
+ #
648
+ # For more information about conditional requests, see [RFC 7232][1].
649
+ #
650
+ #
651
+ #
652
+ # [1]: https://tools.ietf.org/html/rfc7232
361
653
  # @option options [String] :if_none_match
362
654
  # Return the object only if its entity tag (ETag) is different from the
363
- # one specified, otherwise return a 304 (not modified).
655
+ # one specified; otherwise, return a 304 (not modified) error.
656
+ #
657
+ # If both of the `If-None-Match` and `If-Modified-Since` headers are
658
+ # present in the request as follows:
659
+ #
660
+ # * `If-None-Match` condition evaluates to `false`, and;
661
+ #
662
+ # * `If-Modified-Since` condition evaluates to `true`;
663
+ #
664
+ # Then Amazon S3 returns the `304 Not Modified` response code.
665
+ #
666
+ # For more information about conditional requests, see [RFC 7232][1].
667
+ #
668
+ #
669
+ #
670
+ # [1]: https://tools.ietf.org/html/rfc7232
364
671
  # @option options [Time,DateTime,Date,Integer,String] :if_unmodified_since
365
672
  # Return the object only if it has not been modified since the specified
366
- # time, otherwise return a 412 (precondition failed).
673
+ # time; otherwise, return a 412 (precondition failed) error.
674
+ #
675
+ # If both of the `If-Match` and `If-Unmodified-Since` headers are
676
+ # present in the request as follows:
677
+ #
678
+ # * `If-Match` condition evaluates to `true`, and;
679
+ #
680
+ # * `If-Unmodified-Since` condition evaluates to `false`;
681
+ #
682
+ # Then Amazon S3 returns `200 OK` and the data requested.
683
+ #
684
+ # For more information about conditional requests, see [RFC 7232][1].
685
+ #
686
+ #
687
+ #
688
+ # [1]: https://tools.ietf.org/html/rfc7232
367
689
  # @option options [String] :range
368
- # Downloads the specified range bytes of an object. For more information
369
- # about the HTTP Range header, go to
370
- # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
690
+ # HeadObject returns only the metadata for an object. If the Range is
691
+ # satisfiable, only the `ContentLength` is affected in the response. If
692
+ # the Range is not satisfiable, S3 returns a `416 - Requested Range Not
693
+ # Satisfiable` error.
694
+ # @option options [String] :response_cache_control
695
+ # Sets the `Cache-Control` header of the response.
696
+ # @option options [String] :response_content_disposition
697
+ # Sets the `Content-Disposition` header of the response.
698
+ # @option options [String] :response_content_encoding
699
+ # Sets the `Content-Encoding` header of the response.
700
+ # @option options [String] :response_content_language
701
+ # Sets the `Content-Language` header of the response.
702
+ # @option options [String] :response_content_type
703
+ # Sets the `Content-Type` header of the response.
704
+ # @option options [Time,DateTime,Date,Integer,String] :response_expires
705
+ # Sets the `Expires` header of the response.
371
706
  # @option options [String] :sse_customer_algorithm
372
- # Specifies the algorithm to use to when encrypting the object (e.g.,
373
- # AES256).
707
+ # Specifies the algorithm to use when encrypting the object (for
708
+ # example, AES256).
709
+ #
710
+ # <note markdown="1"> This functionality is not supported for directory buckets.
711
+ #
712
+ # </note>
374
713
  # @option options [String] :sse_customer_key
375
714
  # Specifies the customer-provided encryption key for Amazon S3 to use in
376
715
  # encrypting data. This value is used to store the object and then it is
377
- # discarded; Amazon does not store the encryption key. The key must be
378
- # appropriate for use with the algorithm specified in the
379
- # x-amz-server-side​-encryption​-customer-algorithm header.
716
+ # discarded; Amazon S3 does not store the encryption key. The key must
717
+ # be appropriate for use with the algorithm specified in the
718
+ # `x-amz-server-side-encryption-customer-algorithm` header.
719
+ #
720
+ # <note markdown="1"> This functionality is not supported for directory buckets.
721
+ #
722
+ # </note>
380
723
  # @option options [String] :sse_customer_key_md5
381
724
  # Specifies the 128-bit MD5 digest of the encryption key according to
382
725
  # RFC 1321. Amazon S3 uses this header for a message integrity check to
383
- # ensure the encryption key was transmitted without error.
726
+ # ensure that the encryption key was transmitted without error.
727
+ #
728
+ # <note markdown="1"> This functionality is not supported for directory buckets.
729
+ #
730
+ # </note>
384
731
  # @option options [String] :request_payer
385
- # Confirms that the requester knows that she or he will be charged for
386
- # the request. Bucket owners need not specify this parameter in their
387
- # requests. Documentation on downloading objects from requester pays
388
- # buckets can be found at
389
- # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
732
+ # Confirms that the requester knows that they will be charged for the
733
+ # request. Bucket owners need not specify this parameter in their
734
+ # requests. If either the source or destination S3 bucket has Requester
735
+ # Pays enabled, the requester will pay for corresponding charges to copy
736
+ # the object. For information about downloading objects from Requester
737
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
738
+ # in the *Amazon S3 User Guide*.
739
+ #
740
+ # <note markdown="1"> This functionality is not supported for directory buckets.
741
+ #
742
+ # </note>
743
+ #
744
+ #
745
+ #
746
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
390
747
  # @option options [Integer] :part_number
391
748
  # Part number of the object being read. This is a positive integer
392
749
  # between 1 and 10,000. Effectively performs a 'ranged' HEAD request
393
750
  # for the part specified. Useful querying about the size of the part and
394
751
  # the number of parts in this object.
752
+ # @option options [String] :expected_bucket_owner
753
+ # The account ID of the expected bucket owner. If the account ID that
754
+ # you provide does not match the actual owner of the bucket, the request
755
+ # fails with the HTTP status code `403 Forbidden` (access denied).
756
+ # @option options [String] :checksum_mode
757
+ # To retrieve the checksum, this parameter must be enabled.
758
+ #
759
+ # **General purpose buckets** - If you enable checksum mode and the
760
+ # object is uploaded with a [checksum][1] and encrypted with an Key
761
+ # Management Service (KMS) key, you must have permission to use the
762
+ # `kms:Decrypt` action to retrieve the checksum.
763
+ #
764
+ # **Directory buckets** - If you enable `ChecksumMode` and the object is
765
+ # encrypted with Amazon Web Services Key Management Service (Amazon Web
766
+ # Services KMS), you must also have the `kms:GenerateDataKey` and
767
+ # `kms:Decrypt` permissions in IAM identity-based policies and KMS key
768
+ # policies for the KMS key to retrieve the checksum of the object.
769
+ #
770
+ #
771
+ #
772
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Checksum.html
395
773
  # @return [Types::HeadObjectOutput]
396
774
  def head(options = {})
397
775
  options = options.merge(
@@ -399,7 +777,9 @@ module Aws::S3
399
777
  key: @object_key,
400
778
  version_id: @id
401
779
  )
402
- resp = @client.head_object(options)
780
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
781
+ @client.head_object(options)
782
+ end
403
783
  resp.data
404
784
  end
405
785
 
@@ -470,21 +850,95 @@ module Aws::S3
470
850
  # mfa: "MFA",
471
851
  # request_payer: "requester", # accepts requester
472
852
  # bypass_governance_retention: false,
853
+ # expected_bucket_owner: "AccountId",
854
+ # checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256, CRC64NVME
473
855
  # })
474
856
  # @param options ({})
475
857
  # @option options [String] :mfa
476
858
  # The concatenation of the authentication device's serial number, a
477
859
  # space, and the value that is displayed on your authentication device.
860
+ # Required to permanently delete a versioned object if versioning is
861
+ # configured with MFA delete enabled.
862
+ #
863
+ # When performing the `DeleteObjects` operation on an MFA delete enabled
864
+ # bucket, which attempts to delete the specified versioned objects, you
865
+ # must include an MFA token. If you don't provide an MFA token, the
866
+ # entire request will fail, even if there are non-versioned objects that
867
+ # you are trying to delete. If you provide an invalid token, whether
868
+ # there are versioned object keys in the request or not, the entire
869
+ # Multi-Object Delete request will fail. For information about MFA
870
+ # Delete, see [ MFA Delete][1] in the *Amazon S3 User Guide*.
871
+ #
872
+ # <note markdown="1"> This functionality is not supported for directory buckets.
873
+ #
874
+ # </note>
875
+ #
876
+ #
877
+ #
878
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html#MultiFactorAuthenticationDelete
478
879
  # @option options [String] :request_payer
479
- # Confirms that the requester knows that she or he will be charged for
480
- # the request. Bucket owners need not specify this parameter in their
481
- # requests. Documentation on downloading objects from requester pays
482
- # buckets can be found at
483
- # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
880
+ # Confirms that the requester knows that they will be charged for the
881
+ # request. Bucket owners need not specify this parameter in their
882
+ # requests. If either the source or destination S3 bucket has Requester
883
+ # Pays enabled, the requester will pay for corresponding charges to copy
884
+ # the object. For information about downloading objects from Requester
885
+ # Pays buckets, see [Downloading Objects in Requester Pays Buckets][1]
886
+ # in the *Amazon S3 User Guide*.
887
+ #
888
+ # <note markdown="1"> This functionality is not supported for directory buckets.
889
+ #
890
+ # </note>
891
+ #
892
+ #
893
+ #
894
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
484
895
  # @option options [Boolean] :bypass_governance_retention
485
896
  # Specifies whether you want to delete this object even if it has a
486
- # Governance-type object lock in place. You must have sufficient
487
- # permissions to perform this operation.
897
+ # Governance-type Object Lock in place. To use this header, you must
898
+ # have the `s3:BypassGovernanceRetention` permission.
899
+ #
900
+ # <note markdown="1"> This functionality is not supported for directory buckets.
901
+ #
902
+ # </note>
903
+ # @option options [String] :expected_bucket_owner
904
+ # The account ID of the expected bucket owner. If the account ID that
905
+ # you provide does not match the actual owner of the bucket, the request
906
+ # fails with the HTTP status code `403 Forbidden` (access denied).
907
+ # @option options [String] :checksum_algorithm
908
+ # Indicates the algorithm used to create the checksum for the object
909
+ # when you use the SDK. This header will not provide any additional
910
+ # functionality if you don't use the SDK. When you send this header,
911
+ # there must be a corresponding `x-amz-checksum-algorithm ` or
912
+ # `x-amz-trailer` header sent. Otherwise, Amazon S3 fails the request
913
+ # with the HTTP status code `400 Bad Request`.
914
+ #
915
+ # For the `x-amz-checksum-algorithm ` header, replace ` algorithm ` with
916
+ # the supported algorithm from the following list:
917
+ #
918
+ # * `CRC32`
919
+ #
920
+ # * `CRC32C`
921
+ #
922
+ # * `CRC64NVME`
923
+ #
924
+ # * `SHA1`
925
+ #
926
+ # * `SHA256`
927
+ #
928
+ # For more information, see [Checking object integrity][1] in the
929
+ # *Amazon S3 User Guide*.
930
+ #
931
+ # If the individual checksum value you provide through
932
+ # `x-amz-checksum-algorithm ` doesn't match the checksum algorithm you
933
+ # set through `x-amz-sdk-checksum-algorithm`, Amazon S3 fails the
934
+ # request with a `BadDigest` error.
935
+ #
936
+ # If you provide an individual checksum, Amazon S3 ignores any provided
937
+ # `ChecksumAlgorithm` parameter.
938
+ #
939
+ #
940
+ #
941
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
488
942
  # @return [void]
489
943
  def batch_delete!(options = {})
490
944
  batch_enum.each do |batch|
@@ -498,7 +952,9 @@ module Aws::S3
498
952
  version_id: item.id
499
953
  }
500
954
  end
501
- batch[0].client.delete_objects(params)
955
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
956
+ batch[0].client.delete_objects(params)
957
+ end
502
958
  end
503
959
  nil
504
960
  end
@@ -508,3 +964,6 @@ module Aws::S3
508
964
  end
509
965
  end
510
966
  end
967
+
968
+ # Load customizations if they exist
969
+ require 'aws-sdk-s3/customizations/object_version'