aws-sdk-s3 1.75.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 (91) hide show
  1. checksums.yaml +7 -0
  2. data/lib/aws-sdk-s3.rb +73 -0
  3. data/lib/aws-sdk-s3/bucket.rb +861 -0
  4. data/lib/aws-sdk-s3/bucket_acl.rb +277 -0
  5. data/lib/aws-sdk-s3/bucket_cors.rb +262 -0
  6. data/lib/aws-sdk-s3/bucket_lifecycle.rb +264 -0
  7. data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +283 -0
  8. data/lib/aws-sdk-s3/bucket_logging.rb +251 -0
  9. data/lib/aws-sdk-s3/bucket_notification.rb +293 -0
  10. data/lib/aws-sdk-s3/bucket_policy.rb +242 -0
  11. data/lib/aws-sdk-s3/bucket_region_cache.rb +81 -0
  12. data/lib/aws-sdk-s3/bucket_request_payment.rb +236 -0
  13. data/lib/aws-sdk-s3/bucket_tagging.rb +251 -0
  14. data/lib/aws-sdk-s3/bucket_versioning.rb +312 -0
  15. data/lib/aws-sdk-s3/bucket_website.rb +292 -0
  16. data/lib/aws-sdk-s3/client.rb +11818 -0
  17. data/lib/aws-sdk-s3/client_api.rb +3014 -0
  18. data/lib/aws-sdk-s3/customizations.rb +34 -0
  19. data/lib/aws-sdk-s3/customizations/bucket.rb +162 -0
  20. data/lib/aws-sdk-s3/customizations/multipart_upload.rb +44 -0
  21. data/lib/aws-sdk-s3/customizations/object.rb +389 -0
  22. data/lib/aws-sdk-s3/customizations/object_summary.rb +85 -0
  23. data/lib/aws-sdk-s3/customizations/types/list_object_versions_output.rb +13 -0
  24. data/lib/aws-sdk-s3/encryption.rb +21 -0
  25. data/lib/aws-sdk-s3/encryption/client.rb +375 -0
  26. data/lib/aws-sdk-s3/encryption/decrypt_handler.rb +190 -0
  27. data/lib/aws-sdk-s3/encryption/default_cipher_provider.rb +65 -0
  28. data/lib/aws-sdk-s3/encryption/default_key_provider.rb +40 -0
  29. data/lib/aws-sdk-s3/encryption/encrypt_handler.rb +61 -0
  30. data/lib/aws-sdk-s3/encryption/errors.rb +15 -0
  31. data/lib/aws-sdk-s3/encryption/io_auth_decrypter.rb +58 -0
  32. data/lib/aws-sdk-s3/encryption/io_decrypter.rb +36 -0
  33. data/lib/aws-sdk-s3/encryption/io_encrypter.rb +71 -0
  34. data/lib/aws-sdk-s3/encryption/key_provider.rb +31 -0
  35. data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +75 -0
  36. data/lib/aws-sdk-s3/encryption/materials.rb +60 -0
  37. data/lib/aws-sdk-s3/encryption/utils.rb +81 -0
  38. data/lib/aws-sdk-s3/encryptionV2/client.rb +388 -0
  39. data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +198 -0
  40. data/lib/aws-sdk-s3/encryptionV2/default_cipher_provider.rb +103 -0
  41. data/lib/aws-sdk-s3/encryptionV2/default_key_provider.rb +38 -0
  42. data/lib/aws-sdk-s3/encryptionV2/encrypt_handler.rb +66 -0
  43. data/lib/aws-sdk-s3/encryptionV2/errors.rb +13 -0
  44. data/lib/aws-sdk-s3/encryptionV2/io_auth_decrypter.rb +56 -0
  45. data/lib/aws-sdk-s3/encryptionV2/io_decrypter.rb +35 -0
  46. data/lib/aws-sdk-s3/encryptionV2/io_encrypter.rb +71 -0
  47. data/lib/aws-sdk-s3/encryptionV2/key_provider.rb +29 -0
  48. data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +99 -0
  49. data/lib/aws-sdk-s3/encryptionV2/materials.rb +58 -0
  50. data/lib/aws-sdk-s3/encryptionV2/utils.rb +116 -0
  51. data/lib/aws-sdk-s3/encryption_v2.rb +20 -0
  52. data/lib/aws-sdk-s3/errors.rb +115 -0
  53. data/lib/aws-sdk-s3/event_streams.rb +69 -0
  54. data/lib/aws-sdk-s3/file_downloader.rb +142 -0
  55. data/lib/aws-sdk-s3/file_part.rb +78 -0
  56. data/lib/aws-sdk-s3/file_uploader.rb +70 -0
  57. data/lib/aws-sdk-s3/legacy_signer.rb +189 -0
  58. data/lib/aws-sdk-s3/multipart_file_uploader.rb +227 -0
  59. data/lib/aws-sdk-s3/multipart_stream_uploader.rb +173 -0
  60. data/lib/aws-sdk-s3/multipart_upload.rb +401 -0
  61. data/lib/aws-sdk-s3/multipart_upload_error.rb +18 -0
  62. data/lib/aws-sdk-s3/multipart_upload_part.rb +423 -0
  63. data/lib/aws-sdk-s3/object.rb +1422 -0
  64. data/lib/aws-sdk-s3/object_acl.rb +333 -0
  65. data/lib/aws-sdk-s3/object_copier.rb +101 -0
  66. data/lib/aws-sdk-s3/object_multipart_copier.rb +182 -0
  67. data/lib/aws-sdk-s3/object_summary.rb +1181 -0
  68. data/lib/aws-sdk-s3/object_version.rb +550 -0
  69. data/lib/aws-sdk-s3/plugins/accelerate.rb +87 -0
  70. data/lib/aws-sdk-s3/plugins/bucket_arn.rb +212 -0
  71. data/lib/aws-sdk-s3/plugins/bucket_dns.rb +91 -0
  72. data/lib/aws-sdk-s3/plugins/bucket_name_restrictions.rb +45 -0
  73. data/lib/aws-sdk-s3/plugins/dualstack.rb +74 -0
  74. data/lib/aws-sdk-s3/plugins/expect_100_continue.rb +28 -0
  75. data/lib/aws-sdk-s3/plugins/get_bucket_location_fix.rb +25 -0
  76. data/lib/aws-sdk-s3/plugins/http_200_errors.rb +55 -0
  77. data/lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb +62 -0
  78. data/lib/aws-sdk-s3/plugins/location_constraint.rb +35 -0
  79. data/lib/aws-sdk-s3/plugins/md5s.rb +84 -0
  80. data/lib/aws-sdk-s3/plugins/redirects.rb +45 -0
  81. data/lib/aws-sdk-s3/plugins/s3_host_id.rb +30 -0
  82. data/lib/aws-sdk-s3/plugins/s3_signer.rb +222 -0
  83. data/lib/aws-sdk-s3/plugins/sse_cpk.rb +70 -0
  84. data/lib/aws-sdk-s3/plugins/streaming_retry.rb +118 -0
  85. data/lib/aws-sdk-s3/plugins/url_encoded_keys.rb +97 -0
  86. data/lib/aws-sdk-s3/presigned_post.rb +686 -0
  87. data/lib/aws-sdk-s3/presigner.rb +253 -0
  88. data/lib/aws-sdk-s3/resource.rb +117 -0
  89. data/lib/aws-sdk-s3/types.rb +13154 -0
  90. data/lib/aws-sdk-s3/waiters.rb +243 -0
  91. metadata +184 -0
@@ -0,0 +1,1181 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::S3
11
+
12
+ class ObjectSummary
13
+
14
+ extend Aws::Deprecations
15
+
16
+ # @overload def initialize(bucket_name, key, options = {})
17
+ # @param [String] bucket_name
18
+ # @param [String] key
19
+ # @option options [Client] :client
20
+ # @overload def initialize(options = {})
21
+ # @option options [required, String] :bucket_name
22
+ # @option options [required, String] :key
23
+ # @option options [Client] :client
24
+ def initialize(*args)
25
+ options = Hash === args.last ? args.pop.dup : {}
26
+ @bucket_name = extract_bucket_name(args, options)
27
+ @key = extract_key(args, options)
28
+ @data = options.delete(:data)
29
+ @client = options.delete(:client) || Client.new(options)
30
+ @waiter_block_warned = false
31
+ end
32
+
33
+ # @!group Read-Only Attributes
34
+
35
+ # @return [String]
36
+ def bucket_name
37
+ @bucket_name
38
+ end
39
+
40
+ # @return [String]
41
+ def key
42
+ @key
43
+ end
44
+
45
+ # The date the Object was Last Modified
46
+ # @return [Time]
47
+ def last_modified
48
+ data[:last_modified]
49
+ end
50
+
51
+ # The entity tag is an MD5 hash of the object. ETag reflects only
52
+ # changes to the contents of an object, not its metadata.
53
+ # @return [String]
54
+ def etag
55
+ data[:etag]
56
+ end
57
+
58
+ # Size in bytes of the object
59
+ # @return [Integer]
60
+ def size
61
+ data[:size]
62
+ end
63
+
64
+ # The class of storage used to store the object.
65
+ # @return [String]
66
+ def storage_class
67
+ data[:storage_class]
68
+ end
69
+
70
+ # The owner of the object
71
+ # @return [Types::Owner]
72
+ def owner
73
+ data[:owner]
74
+ end
75
+
76
+ # @!endgroup
77
+
78
+ # @return [Client]
79
+ def client
80
+ @client
81
+ end
82
+
83
+ # @raise [NotImplementedError]
84
+ # @api private
85
+ def load
86
+ msg = "#load is not implemented, data only available via enumeration"
87
+ raise NotImplementedError, msg
88
+ end
89
+ alias :reload :load
90
+
91
+ # @raise [NotImplementedError] Raises when {#data_loaded?} is `false`.
92
+ # @return [Types::Object]
93
+ # Returns the data for this {ObjectSummary}.
94
+ def data
95
+ load unless @data
96
+ @data
97
+ end
98
+
99
+ # @return [Boolean]
100
+ # Returns `true` if this resource is loaded. Accessing attributes or
101
+ # {#data} on an unloaded resource will trigger a call to {#load}.
102
+ def data_loaded?
103
+ !!@data
104
+ end
105
+
106
+ # @param [Hash] options ({})
107
+ # @return [Boolean]
108
+ # Returns `true` if the ObjectSummary exists.
109
+ def exists?(options = {})
110
+ begin
111
+ wait_until_exists(options.merge(max_attempts: 1))
112
+ true
113
+ rescue Aws::Waiters::Errors::UnexpectedError => e
114
+ raise e.error
115
+ rescue Aws::Waiters::Errors::WaiterFailed
116
+ false
117
+ end
118
+ end
119
+
120
+ # @param [Hash] options ({})
121
+ # @option options [Integer] :max_attempts (20)
122
+ # @option options [Float] :delay (5)
123
+ # @option options [Proc] :before_attempt
124
+ # @option options [Proc] :before_wait
125
+ # @return [ObjectSummary]
126
+ def wait_until_exists(options = {}, &block)
127
+ options, params = separate_params_and_options(options)
128
+ waiter = Waiters::ObjectExists.new(options)
129
+ yield_waiter_and_warn(waiter, &block) if block_given?
130
+ waiter.wait(params.merge(bucket: @bucket_name,
131
+ key: @key))
132
+ ObjectSummary.new({
133
+ bucket_name: @bucket_name,
134
+ key: @key,
135
+ client: @client
136
+ })
137
+ end
138
+
139
+ # @param [Hash] options ({})
140
+ # @option options [Integer] :max_attempts (20)
141
+ # @option options [Float] :delay (5)
142
+ # @option options [Proc] :before_attempt
143
+ # @option options [Proc] :before_wait
144
+ # @return [ObjectSummary]
145
+ def wait_until_not_exists(options = {}, &block)
146
+ options, params = separate_params_and_options(options)
147
+ waiter = Waiters::ObjectNotExists.new(options)
148
+ yield_waiter_and_warn(waiter, &block) if block_given?
149
+ waiter.wait(params.merge(bucket: @bucket_name,
150
+ key: @key))
151
+ ObjectSummary.new({
152
+ bucket_name: @bucket_name,
153
+ key: @key,
154
+ client: @client
155
+ })
156
+ end
157
+
158
+ # @deprecated Use [Aws::S3::Client] #wait_until instead
159
+ #
160
+ # Waiter polls an API operation until a resource enters a desired
161
+ # state.
162
+ #
163
+ # @note The waiting operation is performed on a copy. The original resource
164
+ # remains unchanged.
165
+ #
166
+ # ## Basic Usage
167
+ #
168
+ # Waiter will polls until it is successful, it fails by
169
+ # entering a terminal state, or until a maximum number of attempts
170
+ # are made.
171
+ #
172
+ # # polls in a loop until condition is true
173
+ # resource.wait_until(options) {|resource| condition}
174
+ #
175
+ # ## Example
176
+ #
177
+ # instance.wait_until(max_attempts:10, delay:5) do |instance|
178
+ # instance.state.name == 'running'
179
+ # end
180
+ #
181
+ # ## Configuration
182
+ #
183
+ # You can configure the maximum number of polling attempts, and the
184
+ # delay (in seconds) between each polling attempt. The waiting condition is
185
+ # set by passing a block to {#wait_until}:
186
+ #
187
+ # # poll for ~25 seconds
188
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
189
+ #
190
+ # ## Callbacks
191
+ #
192
+ # You can be notified before each polling attempt and before each
193
+ # delay. If you throw `:success` or `:failure` from these callbacks,
194
+ # it will terminate the waiter.
195
+ #
196
+ # started_at = Time.now
197
+ # # poll for 1 hour, instead of a number of attempts
198
+ # proc = Proc.new do |attempts, response|
199
+ # throw :failure if Time.now - started_at > 3600
200
+ # end
201
+ #
202
+ # # disable max attempts
203
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
204
+ #
205
+ # ## Handling Errors
206
+ #
207
+ # When a waiter is successful, it returns the Resource. When a waiter
208
+ # fails, it raises an error.
209
+ #
210
+ # begin
211
+ # resource.wait_until(...)
212
+ # rescue Aws::Waiters::Errors::WaiterFailed
213
+ # # resource did not enter the desired state in time
214
+ # end
215
+ #
216
+ # @yieldparam [Resource] resource to be used in the waiting condition.
217
+ #
218
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter
219
+ # terminates because the waiter has entered a state that it will not
220
+ # transition out of, preventing success.
221
+ #
222
+ # yet successful.
223
+ #
224
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is
225
+ # encountered while polling for a resource that is not expected.
226
+ #
227
+ # @raise [NotImplementedError] Raised when the resource does not
228
+ #
229
+ # @option options [Integer] :max_attempts (10) Maximum number of
230
+ # attempts
231
+ # @option options [Integer] :delay (10) Delay between each
232
+ # attempt in seconds
233
+ # @option options [Proc] :before_attempt (nil) Callback
234
+ # invoked before each attempt
235
+ # @option options [Proc] :before_wait (nil) Callback
236
+ # invoked before each wait
237
+ # @return [Resource] if the waiter was successful
238
+ def wait_until(options = {}, &block)
239
+ self_copy = self.dup
240
+ attempts = 0
241
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
242
+ options[:delay] ||= 10
243
+ options[:poller] = Proc.new do
244
+ attempts += 1
245
+ if block.call(self_copy)
246
+ [:success, self_copy]
247
+ else
248
+ self_copy.reload unless attempts == options[:max_attempts]
249
+ :retry
250
+ end
251
+ end
252
+ Aws::Waiters::Waiter.new(options).wait({})
253
+ end
254
+
255
+ # @!group Actions
256
+
257
+ # @example Request syntax with placeholder values
258
+ #
259
+ # object_summary.copy_from({
260
+ # acl: "private", # accepts private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-owner-full-control
261
+ # cache_control: "CacheControl",
262
+ # content_disposition: "ContentDisposition",
263
+ # content_encoding: "ContentEncoding",
264
+ # content_language: "ContentLanguage",
265
+ # content_type: "ContentType",
266
+ # copy_source: "CopySource", # required
267
+ # copy_source_if_match: "CopySourceIfMatch",
268
+ # copy_source_if_modified_since: Time.now,
269
+ # copy_source_if_none_match: "CopySourceIfNoneMatch",
270
+ # copy_source_if_unmodified_since: Time.now,
271
+ # expires: Time.now,
272
+ # grant_full_control: "GrantFullControl",
273
+ # grant_read: "GrantRead",
274
+ # grant_read_acp: "GrantReadACP",
275
+ # grant_write_acp: "GrantWriteACP",
276
+ # metadata: {
277
+ # "MetadataKey" => "MetadataValue",
278
+ # },
279
+ # metadata_directive: "COPY", # accepts COPY, REPLACE
280
+ # tagging_directive: "COPY", # accepts COPY, REPLACE
281
+ # server_side_encryption: "AES256", # accepts AES256, aws:kms
282
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE
283
+ # website_redirect_location: "WebsiteRedirectLocation",
284
+ # sse_customer_algorithm: "SSECustomerAlgorithm",
285
+ # sse_customer_key: "SSECustomerKey",
286
+ # sse_customer_key_md5: "SSECustomerKeyMD5",
287
+ # ssekms_key_id: "SSEKMSKeyId",
288
+ # ssekms_encryption_context: "SSEKMSEncryptionContext",
289
+ # copy_source_sse_customer_algorithm: "CopySourceSSECustomerAlgorithm",
290
+ # copy_source_sse_customer_key: "CopySourceSSECustomerKey",
291
+ # copy_source_sse_customer_key_md5: "CopySourceSSECustomerKeyMD5",
292
+ # request_payer: "requester", # accepts requester
293
+ # tagging: "TaggingHeader",
294
+ # object_lock_mode: "GOVERNANCE", # accepts GOVERNANCE, COMPLIANCE
295
+ # object_lock_retain_until_date: Time.now,
296
+ # object_lock_legal_hold_status: "ON", # accepts ON, OFF
297
+ # })
298
+ # @param [Hash] options ({})
299
+ # @option options [String] :acl
300
+ # The canned ACL to apply to the object.
301
+ # @option options [String] :cache_control
302
+ # Specifies caching behavior along the request/reply chain.
303
+ # @option options [String] :content_disposition
304
+ # Specifies presentational information for the object.
305
+ # @option options [String] :content_encoding
306
+ # Specifies what content encodings have been applied to the object and
307
+ # thus what decoding mechanisms must be applied to obtain the media-type
308
+ # referenced by the Content-Type header field.
309
+ # @option options [String] :content_language
310
+ # The language the content is in.
311
+ # @option options [String] :content_type
312
+ # A standard MIME type describing the format of the object data.
313
+ # @option options [required, String] :copy_source
314
+ # The name of the source bucket and key name of the source object,
315
+ # separated by a slash (/). Must be URL-encoded.
316
+ # @option options [String] :copy_source_if_match
317
+ # Copies the object if its entity tag (ETag) matches the specified tag.
318
+ # @option options [Time,DateTime,Date,Integer,String] :copy_source_if_modified_since
319
+ # Copies the object if it has been modified since the specified time.
320
+ # @option options [String] :copy_source_if_none_match
321
+ # Copies the object if its entity tag (ETag) is different than the
322
+ # specified ETag.
323
+ # @option options [Time,DateTime,Date,Integer,String] :copy_source_if_unmodified_since
324
+ # Copies the object if it hasn't been modified since the specified
325
+ # time.
326
+ # @option options [Time,DateTime,Date,Integer,String] :expires
327
+ # The date and time at which the object is no longer cacheable.
328
+ # @option options [String] :grant_full_control
329
+ # Gives the grantee READ, READ\_ACP, and WRITE\_ACP permissions on the
330
+ # object.
331
+ # @option options [String] :grant_read
332
+ # Allows grantee to read the object data and its metadata.
333
+ # @option options [String] :grant_read_acp
334
+ # Allows grantee to read the object ACL.
335
+ # @option options [String] :grant_write_acp
336
+ # Allows grantee to write the ACL for the applicable object.
337
+ # @option options [Hash<String,String>] :metadata
338
+ # A map of metadata to store with the object in S3.
339
+ # @option options [String] :metadata_directive
340
+ # Specifies whether the metadata is copied from the source object or
341
+ # replaced with metadata provided in the request.
342
+ # @option options [String] :tagging_directive
343
+ # Specifies whether the object tag-set are copied from the source object
344
+ # or replaced with tag-set provided in the request.
345
+ # @option options [String] :server_side_encryption
346
+ # The server-side encryption algorithm used when storing this object in
347
+ # Amazon S3 (for example, AES256, aws:kms).
348
+ # @option options [String] :storage_class
349
+ # The type of storage to use for the object. Defaults to 'STANDARD'.
350
+ # @option options [String] :website_redirect_location
351
+ # If the bucket is configured as a website, redirects requests for this
352
+ # object to another object in the same bucket or to an external URL.
353
+ # Amazon S3 stores the value of this header in the object metadata.
354
+ # @option options [String] :sse_customer_algorithm
355
+ # Specifies the algorithm to use to when encrypting the object (for
356
+ # example, AES256).
357
+ # @option options [String] :sse_customer_key
358
+ # Specifies the customer-provided encryption key for Amazon S3 to use in
359
+ # encrypting data. This value is used to store the object and then it is
360
+ # discarded; Amazon S3 does not store the encryption key. The key must
361
+ # be appropriate for use with the algorithm specified in the
362
+ # `x-amz-server-side​-encryption​-customer-algorithm` header.
363
+ # @option options [String] :sse_customer_key_md5
364
+ # Specifies the 128-bit MD5 digest of the encryption key according to
365
+ # RFC 1321. Amazon S3 uses this header for a message integrity check to
366
+ # ensure that the encryption key was transmitted without error.
367
+ # @option options [String] :ssekms_key_id
368
+ # Specifies the AWS KMS key ID to use for object encryption. All GET and
369
+ # PUT requests for an object protected by AWS KMS will fail if not made
370
+ # via SSL or using SigV4. For information about configuring using any of
371
+ # the officially supported AWS SDKs and AWS CLI, see [Specifying the
372
+ # Signature Version in Request Authentication][1] in the *Amazon S3
373
+ # Developer Guide*.
374
+ #
375
+ #
376
+ #
377
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version
378
+ # @option options [String] :ssekms_encryption_context
379
+ # Specifies the AWS KMS Encryption Context to use for object encryption.
380
+ # The value of this header is a base64-encoded UTF-8 string holding JSON
381
+ # with the encryption context key-value pairs.
382
+ # @option options [String] :copy_source_sse_customer_algorithm
383
+ # Specifies the algorithm to use when decrypting the source object (for
384
+ # example, AES256).
385
+ # @option options [String] :copy_source_sse_customer_key
386
+ # Specifies the customer-provided encryption key for Amazon S3 to use to
387
+ # decrypt the source object. The encryption key provided in this header
388
+ # must be one that was used when the source object was created.
389
+ # @option options [String] :copy_source_sse_customer_key_md5
390
+ # Specifies the 128-bit MD5 digest of the encryption key according to
391
+ # RFC 1321. Amazon S3 uses this header for a message integrity check to
392
+ # ensure that the encryption key was transmitted without error.
393
+ # @option options [String] :request_payer
394
+ # Confirms that the requester knows that they will be charged for the
395
+ # request. Bucket owners need not specify this parameter in their
396
+ # requests. For information about downloading objects from requester
397
+ # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
398
+ # in the *Amazon S3 Developer Guide*.
399
+ #
400
+ #
401
+ #
402
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
403
+ # @option options [String] :tagging
404
+ # The tag-set for the object destination object this value must be used
405
+ # in conjunction with the `TaggingDirective`. The tag-set must be
406
+ # encoded as URL Query parameters.
407
+ # @option options [String] :object_lock_mode
408
+ # The Object Lock mode that you want to apply to the copied object.
409
+ # @option options [Time,DateTime,Date,Integer,String] :object_lock_retain_until_date
410
+ # The date and time when you want the copied object's Object Lock to
411
+ # expire.
412
+ # @option options [String] :object_lock_legal_hold_status
413
+ # Specifies whether you want to apply a Legal Hold to the copied object.
414
+ # @return [Types::CopyObjectOutput]
415
+ def copy_from(options = {})
416
+ options = options.merge(
417
+ bucket: @bucket_name,
418
+ key: @key
419
+ )
420
+ resp = @client.copy_object(options)
421
+ resp.data
422
+ end
423
+
424
+ # @example Request syntax with placeholder values
425
+ #
426
+ # object_summary.delete({
427
+ # mfa: "MFA",
428
+ # version_id: "ObjectVersionId",
429
+ # request_payer: "requester", # accepts requester
430
+ # bypass_governance_retention: false,
431
+ # })
432
+ # @param [Hash] options ({})
433
+ # @option options [String] :mfa
434
+ # The concatenation of the authentication device's serial number, a
435
+ # space, and the value that is displayed on your authentication device.
436
+ # Required to permanently delete a versioned object if versioning is
437
+ # configured with MFA delete enabled.
438
+ # @option options [String] :version_id
439
+ # VersionId used to reference a specific version of the object.
440
+ # @option options [String] :request_payer
441
+ # Confirms that the requester knows that they will be charged for the
442
+ # request. Bucket owners need not specify this parameter in their
443
+ # requests. For information about downloading objects from requester
444
+ # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
445
+ # in the *Amazon S3 Developer Guide*.
446
+ #
447
+ #
448
+ #
449
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
450
+ # @option options [Boolean] :bypass_governance_retention
451
+ # Indicates whether S3 Object Lock should bypass Governance-mode
452
+ # restrictions to process this operation.
453
+ # @return [Types::DeleteObjectOutput]
454
+ def delete(options = {})
455
+ options = options.merge(
456
+ bucket: @bucket_name,
457
+ key: @key
458
+ )
459
+ resp = @client.delete_object(options)
460
+ resp.data
461
+ end
462
+
463
+ # @example Request syntax with placeholder values
464
+ #
465
+ # object_summary.get({
466
+ # if_match: "IfMatch",
467
+ # if_modified_since: Time.now,
468
+ # if_none_match: "IfNoneMatch",
469
+ # if_unmodified_since: Time.now,
470
+ # range: "Range",
471
+ # response_cache_control: "ResponseCacheControl",
472
+ # response_content_disposition: "ResponseContentDisposition",
473
+ # response_content_encoding: "ResponseContentEncoding",
474
+ # response_content_language: "ResponseContentLanguage",
475
+ # response_content_type: "ResponseContentType",
476
+ # response_expires: Time.now,
477
+ # version_id: "ObjectVersionId",
478
+ # sse_customer_algorithm: "SSECustomerAlgorithm",
479
+ # sse_customer_key: "SSECustomerKey",
480
+ # sse_customer_key_md5: "SSECustomerKeyMD5",
481
+ # request_payer: "requester", # accepts requester
482
+ # part_number: 1,
483
+ # })
484
+ # @param [Hash] options ({})
485
+ # @option options [String] :if_match
486
+ # Return the object only if its entity tag (ETag) is the same as the one
487
+ # specified, otherwise return a 412 (precondition failed).
488
+ # @option options [Time,DateTime,Date,Integer,String] :if_modified_since
489
+ # Return the object only if it has been modified since the specified
490
+ # time, otherwise return a 304 (not modified).
491
+ # @option options [String] :if_none_match
492
+ # Return the object only if its entity tag (ETag) is different from the
493
+ # one specified, otherwise return a 304 (not modified).
494
+ # @option options [Time,DateTime,Date,Integer,String] :if_unmodified_since
495
+ # Return the object only if it has not been modified since the specified
496
+ # time, otherwise return a 412 (precondition failed).
497
+ # @option options [String] :range
498
+ # Downloads the specified range bytes of an object. For more information
499
+ # about the HTTP Range header, see
500
+ # [https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35][1].
501
+ #
502
+ # <note markdown="1"> Amazon S3 doesn't support retrieving multiple ranges of data per
503
+ # `GET` request.
504
+ #
505
+ # </note>
506
+ #
507
+ #
508
+ #
509
+ # [1]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
510
+ # @option options [String] :response_cache_control
511
+ # Sets the `Cache-Control` header of the response.
512
+ # @option options [String] :response_content_disposition
513
+ # Sets the `Content-Disposition` header of the response
514
+ # @option options [String] :response_content_encoding
515
+ # Sets the `Content-Encoding` header of the response.
516
+ # @option options [String] :response_content_language
517
+ # Sets the `Content-Language` header of the response.
518
+ # @option options [String] :response_content_type
519
+ # Sets the `Content-Type` header of the response.
520
+ # @option options [Time,DateTime,Date,Integer,String] :response_expires
521
+ # Sets the `Expires` header of the response.
522
+ # @option options [String] :version_id
523
+ # VersionId used to reference a specific version of the object.
524
+ # @option options [String] :sse_customer_algorithm
525
+ # Specifies the algorithm to use to when encrypting the object (for
526
+ # example, AES256).
527
+ # @option options [String] :sse_customer_key
528
+ # Specifies the customer-provided encryption key for Amazon S3 to use in
529
+ # encrypting data. This value is used to store the object and then it is
530
+ # discarded; Amazon S3 does not store the encryption key. The key must
531
+ # be appropriate for use with the algorithm specified in the
532
+ # `x-amz-server-side​-encryption​-customer-algorithm` header.
533
+ # @option options [String] :sse_customer_key_md5
534
+ # Specifies the 128-bit MD5 digest of the encryption key according to
535
+ # RFC 1321. Amazon S3 uses this header for a message integrity check to
536
+ # ensure that the encryption key was transmitted without error.
537
+ # @option options [String] :request_payer
538
+ # Confirms that the requester knows that they will be charged for the
539
+ # request. Bucket owners need not specify this parameter in their
540
+ # requests. For information about downloading objects from requester
541
+ # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
542
+ # in the *Amazon S3 Developer Guide*.
543
+ #
544
+ #
545
+ #
546
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
547
+ # @option options [Integer] :part_number
548
+ # Part number of the object being read. This is a positive integer
549
+ # between 1 and 10,000. Effectively performs a 'ranged' GET request
550
+ # for the part specified. Useful for downloading just a part of an
551
+ # object.
552
+ # @return [Types::GetObjectOutput]
553
+ def get(options = {}, &block)
554
+ options = options.merge(
555
+ bucket: @bucket_name,
556
+ key: @key
557
+ )
558
+ resp = @client.get_object(options, &block)
559
+ resp.data
560
+ end
561
+
562
+ # @example Request syntax with placeholder values
563
+ #
564
+ # multipartupload = object_summary.initiate_multipart_upload({
565
+ # acl: "private", # accepts private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-owner-full-control
566
+ # cache_control: "CacheControl",
567
+ # content_disposition: "ContentDisposition",
568
+ # content_encoding: "ContentEncoding",
569
+ # content_language: "ContentLanguage",
570
+ # content_type: "ContentType",
571
+ # expires: Time.now,
572
+ # grant_full_control: "GrantFullControl",
573
+ # grant_read: "GrantRead",
574
+ # grant_read_acp: "GrantReadACP",
575
+ # grant_write_acp: "GrantWriteACP",
576
+ # metadata: {
577
+ # "MetadataKey" => "MetadataValue",
578
+ # },
579
+ # server_side_encryption: "AES256", # accepts AES256, aws:kms
580
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE
581
+ # website_redirect_location: "WebsiteRedirectLocation",
582
+ # sse_customer_algorithm: "SSECustomerAlgorithm",
583
+ # sse_customer_key: "SSECustomerKey",
584
+ # sse_customer_key_md5: "SSECustomerKeyMD5",
585
+ # ssekms_key_id: "SSEKMSKeyId",
586
+ # ssekms_encryption_context: "SSEKMSEncryptionContext",
587
+ # request_payer: "requester", # accepts requester
588
+ # tagging: "TaggingHeader",
589
+ # object_lock_mode: "GOVERNANCE", # accepts GOVERNANCE, COMPLIANCE
590
+ # object_lock_retain_until_date: Time.now,
591
+ # object_lock_legal_hold_status: "ON", # accepts ON, OFF
592
+ # })
593
+ # @param [Hash] options ({})
594
+ # @option options [String] :acl
595
+ # The canned ACL to apply to the object.
596
+ # @option options [String] :cache_control
597
+ # Specifies caching behavior along the request/reply chain.
598
+ # @option options [String] :content_disposition
599
+ # Specifies presentational information for the object.
600
+ # @option options [String] :content_encoding
601
+ # Specifies what content encodings have been applied to the object and
602
+ # thus what decoding mechanisms must be applied to obtain the media-type
603
+ # referenced by the Content-Type header field.
604
+ # @option options [String] :content_language
605
+ # The language the content is in.
606
+ # @option options [String] :content_type
607
+ # A standard MIME type describing the format of the object data.
608
+ # @option options [Time,DateTime,Date,Integer,String] :expires
609
+ # The date and time at which the object is no longer cacheable.
610
+ # @option options [String] :grant_full_control
611
+ # Gives the grantee READ, READ\_ACP, and WRITE\_ACP permissions on the
612
+ # object.
613
+ # @option options [String] :grant_read
614
+ # Allows grantee to read the object data and its metadata.
615
+ # @option options [String] :grant_read_acp
616
+ # Allows grantee to read the object ACL.
617
+ # @option options [String] :grant_write_acp
618
+ # Allows grantee to write the ACL for the applicable object.
619
+ # @option options [Hash<String,String>] :metadata
620
+ # A map of metadata to store with the object in S3.
621
+ # @option options [String] :server_side_encryption
622
+ # The server-side encryption algorithm used when storing this object in
623
+ # Amazon S3 (for example, AES256, aws:kms).
624
+ # @option options [String] :storage_class
625
+ # The type of storage to use for the object. Defaults to 'STANDARD'.
626
+ # @option options [String] :website_redirect_location
627
+ # If the bucket is configured as a website, redirects requests for this
628
+ # object to another object in the same bucket or to an external URL.
629
+ # Amazon S3 stores the value of this header in the object metadata.
630
+ # @option options [String] :sse_customer_algorithm
631
+ # Specifies the algorithm to use to when encrypting the object (for
632
+ # example, AES256).
633
+ # @option options [String] :sse_customer_key
634
+ # Specifies the customer-provided encryption key for Amazon S3 to use in
635
+ # encrypting data. This value is used to store the object and then it is
636
+ # discarded; Amazon S3 does not store the encryption key. The key must
637
+ # be appropriate for use with the algorithm specified in the
638
+ # `x-amz-server-side​-encryption​-customer-algorithm` header.
639
+ # @option options [String] :sse_customer_key_md5
640
+ # Specifies the 128-bit MD5 digest of the encryption key according to
641
+ # RFC 1321. Amazon S3 uses this header for a message integrity check to
642
+ # ensure that the encryption key was transmitted without error.
643
+ # @option options [String] :ssekms_key_id
644
+ # Specifies the ID of the symmetric customer managed AWS KMS CMK to use
645
+ # for object encryption. All GET and PUT requests for an object
646
+ # protected by AWS KMS will fail if not made via SSL or using SigV4. For
647
+ # information about configuring using any of the officially supported
648
+ # AWS SDKs and AWS CLI, see [Specifying the Signature Version in Request
649
+ # Authentication][1] in the *Amazon S3 Developer Guide*.
650
+ #
651
+ #
652
+ #
653
+ # [1]: https://docs.aws.amazon.com/http:/docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version
654
+ # @option options [String] :ssekms_encryption_context
655
+ # Specifies the AWS KMS Encryption Context to use for object encryption.
656
+ # The value of this header is a base64-encoded UTF-8 string holding JSON
657
+ # with the encryption context key-value pairs.
658
+ # @option options [String] :request_payer
659
+ # Confirms that the requester knows that they will be charged for the
660
+ # request. Bucket owners need not specify this parameter in their
661
+ # requests. For information about downloading objects from requester
662
+ # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
663
+ # in the *Amazon S3 Developer Guide*.
664
+ #
665
+ #
666
+ #
667
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
668
+ # @option options [String] :tagging
669
+ # The tag-set for the object. The tag-set must be encoded as URL Query
670
+ # parameters.
671
+ # @option options [String] :object_lock_mode
672
+ # Specifies the Object Lock mode that you want to apply to the uploaded
673
+ # object.
674
+ # @option options [Time,DateTime,Date,Integer,String] :object_lock_retain_until_date
675
+ # Specifies the date and time when you want the Object Lock to expire.
676
+ # @option options [String] :object_lock_legal_hold_status
677
+ # Specifies whether you want to apply a Legal Hold to the uploaded
678
+ # object.
679
+ # @return [MultipartUpload]
680
+ def initiate_multipart_upload(options = {})
681
+ options = options.merge(
682
+ bucket: @bucket_name,
683
+ key: @key
684
+ )
685
+ resp = @client.create_multipart_upload(options)
686
+ MultipartUpload.new(
687
+ bucket_name: @bucket_name,
688
+ object_key: @key,
689
+ id: resp.data.upload_id,
690
+ client: @client
691
+ )
692
+ end
693
+
694
+ # @example Request syntax with placeholder values
695
+ #
696
+ # object_summary.put({
697
+ # acl: "private", # accepts private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-owner-full-control
698
+ # body: source_file,
699
+ # cache_control: "CacheControl",
700
+ # content_disposition: "ContentDisposition",
701
+ # content_encoding: "ContentEncoding",
702
+ # content_language: "ContentLanguage",
703
+ # content_length: 1,
704
+ # content_md5: "ContentMD5",
705
+ # content_type: "ContentType",
706
+ # expires: Time.now,
707
+ # grant_full_control: "GrantFullControl",
708
+ # grant_read: "GrantRead",
709
+ # grant_read_acp: "GrantReadACP",
710
+ # grant_write_acp: "GrantWriteACP",
711
+ # metadata: {
712
+ # "MetadataKey" => "MetadataValue",
713
+ # },
714
+ # server_side_encryption: "AES256", # accepts AES256, aws:kms
715
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE
716
+ # website_redirect_location: "WebsiteRedirectLocation",
717
+ # sse_customer_algorithm: "SSECustomerAlgorithm",
718
+ # sse_customer_key: "SSECustomerKey",
719
+ # sse_customer_key_md5: "SSECustomerKeyMD5",
720
+ # ssekms_key_id: "SSEKMSKeyId",
721
+ # ssekms_encryption_context: "SSEKMSEncryptionContext",
722
+ # request_payer: "requester", # accepts requester
723
+ # tagging: "TaggingHeader",
724
+ # object_lock_mode: "GOVERNANCE", # accepts GOVERNANCE, COMPLIANCE
725
+ # object_lock_retain_until_date: Time.now,
726
+ # object_lock_legal_hold_status: "ON", # accepts ON, OFF
727
+ # })
728
+ # @param [Hash] options ({})
729
+ # @option options [String] :acl
730
+ # The canned ACL to apply to the object. For more information, see
731
+ # [Canned ACL][1].
732
+ #
733
+ #
734
+ #
735
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL
736
+ # @option options [String, IO] :body
737
+ # Object data.
738
+ # @option options [String] :cache_control
739
+ # Can be used to specify caching behavior along the request/reply chain.
740
+ # For more information, see
741
+ # [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9][1].
742
+ #
743
+ #
744
+ #
745
+ # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
746
+ # @option options [String] :content_disposition
747
+ # Specifies presentational information for the object. For more
748
+ # information, see
749
+ # [http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1][1].
750
+ #
751
+ #
752
+ #
753
+ # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1
754
+ # @option options [String] :content_encoding
755
+ # Specifies what content encodings have been applied to the object and
756
+ # thus what decoding mechanisms must be applied to obtain the media-type
757
+ # referenced by the Content-Type header field. For more information, see
758
+ # [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11][1].
759
+ #
760
+ #
761
+ #
762
+ # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11
763
+ # @option options [String] :content_language
764
+ # The language the content is in.
765
+ # @option options [Integer] :content_length
766
+ # Size of the body in bytes. This parameter is useful when the size of
767
+ # the body cannot be determined automatically. For more information, see
768
+ # [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13][1].
769
+ #
770
+ #
771
+ #
772
+ # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13
773
+ # @option options [String] :content_md5
774
+ # The base64-encoded 128-bit MD5 digest of the message (without the
775
+ # headers) according to RFC 1864. This header can be used as a message
776
+ # integrity check to verify that the data is the same data that was
777
+ # originally sent. Although it is optional, we recommend using the
778
+ # Content-MD5 mechanism as an end-to-end integrity check. For more
779
+ # information about REST request authentication, see [REST
780
+ # Authentication][1].
781
+ #
782
+ #
783
+ #
784
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html
785
+ # @option options [String] :content_type
786
+ # A standard MIME type describing the format of the contents. For more
787
+ # information, see
788
+ # [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17][1].
789
+ #
790
+ #
791
+ #
792
+ # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17
793
+ # @option options [Time,DateTime,Date,Integer,String] :expires
794
+ # The date and time at which the object is no longer cacheable. For more
795
+ # information, see
796
+ # [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21][1].
797
+ #
798
+ #
799
+ #
800
+ # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21
801
+ # @option options [String] :grant_full_control
802
+ # Gives the grantee READ, READ\_ACP, and WRITE\_ACP permissions on the
803
+ # object.
804
+ # @option options [String] :grant_read
805
+ # Allows grantee to read the object data and its metadata.
806
+ # @option options [String] :grant_read_acp
807
+ # Allows grantee to read the object ACL.
808
+ # @option options [String] :grant_write_acp
809
+ # Allows grantee to write the ACL for the applicable object.
810
+ # @option options [Hash<String,String>] :metadata
811
+ # A map of metadata to store with the object in S3.
812
+ # @option options [String] :server_side_encryption
813
+ # The server-side encryption algorithm used when storing this object in
814
+ # Amazon S3 (for example, AES256, aws:kms).
815
+ # @option options [String] :storage_class
816
+ # If you don't specify, S3 Standard is the default storage class.
817
+ # Amazon S3 supports other storage classes.
818
+ # @option options [String] :website_redirect_location
819
+ # If the bucket is configured as a website, redirects requests for this
820
+ # object to another object in the same bucket or to an external URL.
821
+ # Amazon S3 stores the value of this header in the object metadata. For
822
+ # information about object metadata, see [Object Key and Metadata][1].
823
+ #
824
+ # In the following example, the request header sets the redirect to an
825
+ # object (anotherPage.html) in the same bucket:
826
+ #
827
+ # `x-amz-website-redirect-location: /anotherPage.html`
828
+ #
829
+ # In the following example, the request header sets the object redirect
830
+ # to another website:
831
+ #
832
+ # `x-amz-website-redirect-location: http://www.example.com/`
833
+ #
834
+ # For more information about website hosting in Amazon S3, see [Hosting
835
+ # Websites on Amazon S3][2] and [How to Configure Website Page
836
+ # Redirects][3].
837
+ #
838
+ #
839
+ #
840
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html
841
+ # [2]: https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html
842
+ # [3]: https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html
843
+ # @option options [String] :sse_customer_algorithm
844
+ # Specifies the algorithm to use to when encrypting the object (for
845
+ # example, AES256).
846
+ # @option options [String] :sse_customer_key
847
+ # Specifies the customer-provided encryption key for Amazon S3 to use in
848
+ # encrypting data. This value is used to store the object and then it is
849
+ # discarded; Amazon S3 does not store the encryption key. The key must
850
+ # be appropriate for use with the algorithm specified in the
851
+ # `x-amz-server-side​-encryption​-customer-algorithm` header.
852
+ # @option options [String] :sse_customer_key_md5
853
+ # Specifies the 128-bit MD5 digest of the encryption key according to
854
+ # RFC 1321. Amazon S3 uses this header for a message integrity check to
855
+ # ensure that the encryption key was transmitted without error.
856
+ # @option options [String] :ssekms_key_id
857
+ # If `x-amz-server-side-encryption` is present and has the value of
858
+ # `aws:kms`, this header specifies the ID of the AWS Key Management
859
+ # Service (AWS KMS) symmetrical customer managed customer master key
860
+ # (CMK) that was used for the object.
861
+ #
862
+ # If the value of `x-amz-server-side-encryption` is `aws:kms`, this
863
+ # header specifies the ID of the symmetric customer managed AWS KMS CMK
864
+ # that will be used for the object. If you specify
865
+ # `x-amz-server-side-encryption:aws:kms`, but do not provide`
866
+ # x-amz-server-side-encryption-aws-kms-key-id`, Amazon S3 uses the AWS
867
+ # managed CMK in AWS to protect the data.
868
+ # @option options [String] :ssekms_encryption_context
869
+ # Specifies the AWS KMS Encryption Context to use for object encryption.
870
+ # The value of this header is a base64-encoded UTF-8 string holding JSON
871
+ # with the encryption context key-value pairs.
872
+ # @option options [String] :request_payer
873
+ # Confirms that the requester knows that they will be charged for the
874
+ # request. Bucket owners need not specify this parameter in their
875
+ # requests. For information about downloading objects from requester
876
+ # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
877
+ # in the *Amazon S3 Developer Guide*.
878
+ #
879
+ #
880
+ #
881
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
882
+ # @option options [String] :tagging
883
+ # The tag-set for the object. The tag-set must be encoded as URL Query
884
+ # parameters. (For example, "Key1=Value1")
885
+ # @option options [String] :object_lock_mode
886
+ # The Object Lock mode that you want to apply to this object.
887
+ # @option options [Time,DateTime,Date,Integer,String] :object_lock_retain_until_date
888
+ # The date and time when you want this object's Object Lock to expire.
889
+ # @option options [String] :object_lock_legal_hold_status
890
+ # Specifies whether a legal hold will be applied to this object. For
891
+ # more information about S3 Object Lock, see [Object Lock][1].
892
+ #
893
+ #
894
+ #
895
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html
896
+ # @return [Types::PutObjectOutput]
897
+ def put(options = {})
898
+ options = options.merge(
899
+ bucket: @bucket_name,
900
+ key: @key
901
+ )
902
+ resp = @client.put_object(options)
903
+ resp.data
904
+ end
905
+
906
+ # @example Request syntax with placeholder values
907
+ #
908
+ # object_summary.restore_object({
909
+ # version_id: "ObjectVersionId",
910
+ # restore_request: {
911
+ # days: 1,
912
+ # glacier_job_parameters: {
913
+ # tier: "Standard", # required, accepts Standard, Bulk, Expedited
914
+ # },
915
+ # type: "SELECT", # accepts SELECT
916
+ # tier: "Standard", # accepts Standard, Bulk, Expedited
917
+ # description: "Description",
918
+ # select_parameters: {
919
+ # input_serialization: { # required
920
+ # csv: {
921
+ # file_header_info: "USE", # accepts USE, IGNORE, NONE
922
+ # comments: "Comments",
923
+ # quote_escape_character: "QuoteEscapeCharacter",
924
+ # record_delimiter: "RecordDelimiter",
925
+ # field_delimiter: "FieldDelimiter",
926
+ # quote_character: "QuoteCharacter",
927
+ # allow_quoted_record_delimiter: false,
928
+ # },
929
+ # compression_type: "NONE", # accepts NONE, GZIP, BZIP2
930
+ # json: {
931
+ # type: "DOCUMENT", # accepts DOCUMENT, LINES
932
+ # },
933
+ # parquet: {
934
+ # },
935
+ # },
936
+ # expression_type: "SQL", # required, accepts SQL
937
+ # expression: "Expression", # required
938
+ # output_serialization: { # required
939
+ # csv: {
940
+ # quote_fields: "ALWAYS", # accepts ALWAYS, ASNEEDED
941
+ # quote_escape_character: "QuoteEscapeCharacter",
942
+ # record_delimiter: "RecordDelimiter",
943
+ # field_delimiter: "FieldDelimiter",
944
+ # quote_character: "QuoteCharacter",
945
+ # },
946
+ # json: {
947
+ # record_delimiter: "RecordDelimiter",
948
+ # },
949
+ # },
950
+ # },
951
+ # output_location: {
952
+ # s3: {
953
+ # bucket_name: "BucketName", # required
954
+ # prefix: "LocationPrefix", # required
955
+ # encryption: {
956
+ # encryption_type: "AES256", # required, accepts AES256, aws:kms
957
+ # kms_key_id: "SSEKMSKeyId",
958
+ # kms_context: "KMSContext",
959
+ # },
960
+ # canned_acl: "private", # accepts private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-owner-full-control
961
+ # access_control_list: [
962
+ # {
963
+ # grantee: {
964
+ # display_name: "DisplayName",
965
+ # email_address: "EmailAddress",
966
+ # id: "ID",
967
+ # type: "CanonicalUser", # required, accepts CanonicalUser, AmazonCustomerByEmail, Group
968
+ # uri: "URI",
969
+ # },
970
+ # permission: "FULL_CONTROL", # accepts FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP
971
+ # },
972
+ # ],
973
+ # tagging: {
974
+ # tag_set: [ # required
975
+ # {
976
+ # key: "ObjectKey", # required
977
+ # value: "Value", # required
978
+ # },
979
+ # ],
980
+ # },
981
+ # user_metadata: [
982
+ # {
983
+ # name: "MetadataKey",
984
+ # value: "MetadataValue",
985
+ # },
986
+ # ],
987
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE
988
+ # },
989
+ # },
990
+ # },
991
+ # request_payer: "requester", # accepts requester
992
+ # })
993
+ # @param [Hash] options ({})
994
+ # @option options [String] :version_id
995
+ # VersionId used to reference a specific version of the object.
996
+ # @option options [Types::RestoreRequest] :restore_request
997
+ # Container for restore job parameters.
998
+ # @option options [String] :request_payer
999
+ # Confirms that the requester knows that they will be charged for the
1000
+ # request. Bucket owners need not specify this parameter in their
1001
+ # requests. For information about downloading objects from requester
1002
+ # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
1003
+ # in the *Amazon S3 Developer Guide*.
1004
+ #
1005
+ #
1006
+ #
1007
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
1008
+ # @return [Types::RestoreObjectOutput]
1009
+ def restore_object(options = {})
1010
+ options = options.merge(
1011
+ bucket: @bucket_name,
1012
+ key: @key
1013
+ )
1014
+ resp = @client.restore_object(options)
1015
+ resp.data
1016
+ end
1017
+
1018
+ # @!group Associations
1019
+
1020
+ # @return [ObjectAcl]
1021
+ def acl
1022
+ ObjectAcl.new(
1023
+ bucket_name: @bucket_name,
1024
+ object_key: @key,
1025
+ client: @client
1026
+ )
1027
+ end
1028
+
1029
+ # @return [Bucket]
1030
+ def bucket
1031
+ Bucket.new(
1032
+ name: @bucket_name,
1033
+ client: @client
1034
+ )
1035
+ end
1036
+
1037
+ # @param [String] id
1038
+ # @return [MultipartUpload]
1039
+ def multipart_upload(id)
1040
+ MultipartUpload.new(
1041
+ bucket_name: @bucket_name,
1042
+ object_key: @key,
1043
+ id: id,
1044
+ client: @client
1045
+ )
1046
+ end
1047
+
1048
+ # @return [Object]
1049
+ def object
1050
+ Object.new(
1051
+ bucket_name: @bucket_name,
1052
+ key: @key,
1053
+ client: @client
1054
+ )
1055
+ end
1056
+
1057
+ # @param [String] id
1058
+ # @return [ObjectVersion]
1059
+ def version(id)
1060
+ ObjectVersion.new(
1061
+ bucket_name: @bucket_name,
1062
+ object_key: @key,
1063
+ id: id,
1064
+ client: @client
1065
+ )
1066
+ end
1067
+
1068
+ # @deprecated
1069
+ # @api private
1070
+ def identifiers
1071
+ {
1072
+ bucket_name: @bucket_name,
1073
+ key: @key
1074
+ }
1075
+ end
1076
+ deprecated(:identifiers)
1077
+
1078
+ private
1079
+
1080
+ def extract_bucket_name(args, options)
1081
+ value = args[0] || options.delete(:bucket_name)
1082
+ case value
1083
+ when String then value
1084
+ when nil then raise ArgumentError, "missing required option :bucket_name"
1085
+ else
1086
+ msg = "expected :bucket_name to be a String, got #{value.class}"
1087
+ raise ArgumentError, msg
1088
+ end
1089
+ end
1090
+
1091
+ def extract_key(args, options)
1092
+ value = args[1] || options.delete(:key)
1093
+ case value
1094
+ when String then value
1095
+ when nil then raise ArgumentError, "missing required option :key"
1096
+ else
1097
+ msg = "expected :key to be a String, got #{value.class}"
1098
+ raise ArgumentError, msg
1099
+ end
1100
+ end
1101
+
1102
+ def yield_waiter_and_warn(waiter, &block)
1103
+ if !@waiter_block_warned
1104
+ msg = "pass options to configure the waiter; "\
1105
+ "yielding the waiter is deprecated"
1106
+ warn(msg)
1107
+ @waiter_block_warned = true
1108
+ end
1109
+ yield(waiter.waiter)
1110
+ end
1111
+
1112
+ def separate_params_and_options(options)
1113
+ opts = Set.new(
1114
+ [:client, :max_attempts, :delay, :before_attempt, :before_wait]
1115
+ )
1116
+ waiter_opts = {}
1117
+ waiter_params = {}
1118
+ options.each_pair do |key, value|
1119
+ if opts.include?(key)
1120
+ waiter_opts[key] = value
1121
+ else
1122
+ waiter_params[key] = value
1123
+ end
1124
+ end
1125
+ waiter_opts[:client] ||= @client
1126
+ [waiter_opts, waiter_params]
1127
+ end
1128
+
1129
+ class Collection < Aws::Resources::Collection
1130
+
1131
+ # @!group Batch Actions
1132
+
1133
+ # @example Request syntax with placeholder values
1134
+ #
1135
+ # object_summary.batch_delete!({
1136
+ # mfa: "MFA",
1137
+ # request_payer: "requester", # accepts requester
1138
+ # bypass_governance_retention: false,
1139
+ # })
1140
+ # @param options ({})
1141
+ # @option options [String] :mfa
1142
+ # The concatenation of the authentication device's serial number, a
1143
+ # space, and the value that is displayed on your authentication device.
1144
+ # Required to permanently delete a versioned object if versioning is
1145
+ # configured with MFA delete enabled.
1146
+ # @option options [String] :request_payer
1147
+ # Confirms that the requester knows that they will be charged for the
1148
+ # request. Bucket owners need not specify this parameter in their
1149
+ # requests. For information about downloading objects from requester
1150
+ # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
1151
+ # in the *Amazon S3 Developer Guide*.
1152
+ #
1153
+ #
1154
+ #
1155
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
1156
+ # @option options [Boolean] :bypass_governance_retention
1157
+ # Specifies whether you want to delete this object even if it has a
1158
+ # Governance-type Object Lock in place. You must have sufficient
1159
+ # permissions to perform this operation.
1160
+ # @return [void]
1161
+ def batch_delete!(options = {})
1162
+ batch_enum.each do |batch|
1163
+ params = Aws::Util.copy_hash(options)
1164
+ params[:bucket] = batch[0].bucket_name
1165
+ params[:delete] ||= {}
1166
+ params[:delete][:objects] ||= []
1167
+ batch.each do |item|
1168
+ params[:delete][:objects] << {
1169
+ key: item.key
1170
+ }
1171
+ end
1172
+ batch[0].client.delete_objects(params)
1173
+ end
1174
+ nil
1175
+ end
1176
+
1177
+ # @!endgroup
1178
+
1179
+ end
1180
+ end
1181
+ end