aws-sdk-s3 1.0.0.rc2 → 1.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,138 +1,375 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
3
+ # This file is generated. See the contributing guide for more information:
4
4
  # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
5
  #
6
6
  # WARNING ABOUT GENERATED CODE
7
7
 
8
- module Aws
9
- module S3
10
- class ObjectVersion
11
-
12
- extend Aws::Deprecations
13
-
14
- # @overload def initialize(bucket_name, object_key, id, options = {})
15
- # @param [String] bucket_name
16
- # @param [String] object_key
17
- # @param [String] id
18
- # @option options [Client] :client
19
- # @overload def initialize(options = {})
20
- # @option options [required, String] :bucket_name
21
- # @option options [required, String] :object_key
22
- # @option options [required, String] :id
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
- @object_key = extract_object_key(args, options)
28
- @id = extract_id(args, options)
29
- @data = options.delete(:data)
30
- @client = options.delete(:client) || Client.new(options)
31
- end
8
+ module Aws::S3
9
+ class ObjectVersion
10
+
11
+ extend Aws::Deprecations
12
+
13
+ # @overload def initialize(bucket_name, object_key, id, options = {})
14
+ # @param [String] bucket_name
15
+ # @param [String] object_key
16
+ # @param [String] id
17
+ # @option options [Client] :client
18
+ # @overload def initialize(options = {})
19
+ # @option options [required, String] :bucket_name
20
+ # @option options [required, String] :object_key
21
+ # @option options [required, String] :id
22
+ # @option options [Client] :client
23
+ def initialize(*args)
24
+ options = Hash === args.last ? args.pop.dup : {}
25
+ @bucket_name = extract_bucket_name(args, options)
26
+ @object_key = extract_object_key(args, options)
27
+ @id = extract_id(args, options)
28
+ @data = options.delete(:data)
29
+ @client = options.delete(:client) || Client.new(options)
30
+ end
32
31
 
33
- # @!group Read-Only Attributes
32
+ # @!group Read-Only Attributes
34
33
 
35
- # @return [String]
36
- def bucket_name
37
- @bucket_name
38
- end
34
+ # @return [String]
35
+ def bucket_name
36
+ @bucket_name
37
+ end
39
38
 
40
- # @return [String]
41
- def object_key
42
- @object_key
43
- end
39
+ # @return [String]
40
+ def object_key
41
+ @object_key
42
+ end
44
43
 
45
- # @return [String]
46
- def id
47
- @id
48
- end
44
+ # @return [String]
45
+ def id
46
+ @id
47
+ end
49
48
 
50
- # @return [String]
51
- def etag
52
- data.etag
53
- end
49
+ # @return [String]
50
+ def etag
51
+ data.etag
52
+ end
54
53
 
55
- # Size in bytes of the object.
56
- # @return [Integer]
57
- def size
58
- data.size
59
- end
54
+ # Size in bytes of the object.
55
+ # @return [Integer]
56
+ def size
57
+ data.size
58
+ end
60
59
 
61
- # The class of storage used to store the object.
62
- # @return [String]
63
- def storage_class
64
- data.storage_class
65
- end
60
+ # The class of storage used to store the object.
61
+ # @return [String]
62
+ def storage_class
63
+ data.storage_class
64
+ end
66
65
 
67
- # The object key.
68
- # @return [String]
69
- def key
70
- data.key
71
- end
66
+ # The object key.
67
+ # @return [String]
68
+ def key
69
+ data.key
70
+ end
72
71
 
73
- # Version ID of an object.
74
- # @return [String]
75
- def version_id
76
- data.version_id
77
- end
72
+ # Version ID of an object.
73
+ # @return [String]
74
+ def version_id
75
+ data.version_id
76
+ end
78
77
 
79
- # Specifies whether the object is (true) or is not (false) the latest
80
- # version of an object.
81
- # @return [Boolean]
82
- def is_latest
83
- data.is_latest
84
- end
78
+ # Specifies whether the object is (true) or is not (false) the latest
79
+ # version of an object.
80
+ # @return [Boolean]
81
+ def is_latest
82
+ data.is_latest
83
+ end
85
84
 
86
- # Date and time the object was last modified.
87
- # @return [Time]
88
- def last_modified
89
- data.last_modified
90
- end
85
+ # Date and time the object was last modified.
86
+ # @return [Time]
87
+ def last_modified
88
+ data.last_modified
89
+ end
91
90
 
92
- # @return [Types::Owner]
93
- def owner
94
- data.owner
95
- end
91
+ # @return [Types::Owner]
92
+ def owner
93
+ data.owner
94
+ end
96
95
 
97
- # @!endgroup
96
+ # @!endgroup
98
97
 
99
- # @return [Client]
100
- def client
101
- @client
102
- end
98
+ # @return [Client]
99
+ def client
100
+ @client
101
+ end
102
+
103
+ # @raise [NotImplementedError]
104
+ # @api private
105
+ def load
106
+ msg = "#load is not implemented, data only available via enumeration"
107
+ raise NotImplementedError, msg
108
+ end
109
+ alias :reload :load
110
+
111
+ # @raise [NotImplementedError] Raises when {#data_loaded?} is `false`.
112
+ # @return [Types::ObjectVersion]
113
+ # Returns the data for this {ObjectVersion}.
114
+ def data
115
+ load unless @data
116
+ @data
117
+ end
118
+
119
+ # @return [Boolean]
120
+ # Returns `true` if this resource is loaded. Accessing attributes or
121
+ # {#data} on an unloaded resource will trigger a call to {#load}.
122
+ def data_loaded?
123
+ !!@data
124
+ end
125
+
126
+ # @!group Actions
127
+
128
+ # @example Request syntax with placeholder values
129
+ #
130
+ # object_version.delete({
131
+ # mfa: "MFA",
132
+ # request_payer: "requester", # accepts requester
133
+ # })
134
+ # @param [Hash] options ({})
135
+ # @option options [String] :mfa
136
+ # The concatenation of the authentication device's serial number, a
137
+ # space, and the value that is displayed on your authentication device.
138
+ # @option options [String] :request_payer
139
+ # Confirms that the requester knows that she or he will be charged for
140
+ # the request. Bucket owners need not specify this parameter in their
141
+ # requests. Documentation on downloading objects from requester pays
142
+ # buckets can be found at
143
+ # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
144
+ # @return [Types::DeleteObjectOutput]
145
+ def delete(options = {})
146
+ options = options.merge(
147
+ bucket: @bucket_name,
148
+ key: @object_key,
149
+ version_id: @id
150
+ )
151
+ resp = @client.delete_object(options)
152
+ resp.data
153
+ end
103
154
 
104
- # @raise [Errors::ResourceNotLoadable]
105
- # @api private
106
- def load
107
- msg = "#load is not implemented, data only available via enumeration"
108
- raise Errors::ResourceNotLoadable, msg
155
+ # @example Request syntax with placeholder values
156
+ #
157
+ # object_version.get({
158
+ # if_match: "IfMatch",
159
+ # if_modified_since: Time.now,
160
+ # if_none_match: "IfNoneMatch",
161
+ # if_unmodified_since: Time.now,
162
+ # range: "Range",
163
+ # response_cache_control: "ResponseCacheControl",
164
+ # response_content_disposition: "ResponseContentDisposition",
165
+ # response_content_encoding: "ResponseContentEncoding",
166
+ # response_content_language: "ResponseContentLanguage",
167
+ # response_content_type: "ResponseContentType",
168
+ # response_expires: Time.now,
169
+ # sse_customer_algorithm: "SSECustomerAlgorithm",
170
+ # sse_customer_key: "SSECustomerKey",
171
+ # sse_customer_key_md5: "SSECustomerKeyMD5",
172
+ # request_payer: "requester", # accepts requester
173
+ # part_number: 1,
174
+ # })
175
+ # @param [Hash] options ({})
176
+ # @option options [String] :if_match
177
+ # Return the object only if its entity tag (ETag) is the same as the one
178
+ # specified, otherwise return a 412 (precondition failed).
179
+ # @option options [Time,DateTime,Date,Integer,String] :if_modified_since
180
+ # Return the object only if it has been modified since the specified
181
+ # time, otherwise return a 304 (not modified).
182
+ # @option options [String] :if_none_match
183
+ # Return the object only if its entity tag (ETag) is different from the
184
+ # one specified, otherwise return a 304 (not modified).
185
+ # @option options [Time,DateTime,Date,Integer,String] :if_unmodified_since
186
+ # Return the object only if it has not been modified since the specified
187
+ # time, otherwise return a 412 (precondition failed).
188
+ # @option options [String] :range
189
+ # Downloads the specified range bytes of an object. For more information
190
+ # about the HTTP Range header, go to
191
+ # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
192
+ # @option options [String] :response_cache_control
193
+ # Sets the Cache-Control header of the response.
194
+ # @option options [String] :response_content_disposition
195
+ # Sets the Content-Disposition header of the response
196
+ # @option options [String] :response_content_encoding
197
+ # Sets the Content-Encoding header of the response.
198
+ # @option options [String] :response_content_language
199
+ # Sets the Content-Language header of the response.
200
+ # @option options [String] :response_content_type
201
+ # Sets the Content-Type header of the response.
202
+ # @option options [Time,DateTime,Date,Integer,String] :response_expires
203
+ # Sets the Expires header of the response.
204
+ # @option options [String] :sse_customer_algorithm
205
+ # Specifies the algorithm to use to when encrypting the object (e.g.,
206
+ # AES256).
207
+ # @option options [String] :sse_customer_key
208
+ # Specifies the customer-provided encryption key for Amazon S3 to use in
209
+ # encrypting data. This value is used to store the object and then it is
210
+ # discarded; Amazon does not store the encryption key. The key must be
211
+ # appropriate for use with the algorithm specified in the
212
+ # x-amz-server-side​-encryption​-customer-algorithm header.
213
+ # @option options [String] :sse_customer_key_md5
214
+ # Specifies the 128-bit MD5 digest of the encryption key according to
215
+ # RFC 1321. Amazon S3 uses this header for a message integrity check to
216
+ # ensure the encryption key was transmitted without error.
217
+ # @option options [String] :request_payer
218
+ # Confirms that the requester knows that she or he will be charged for
219
+ # the request. Bucket owners need not specify this parameter in their
220
+ # requests. Documentation on downloading objects from requester pays
221
+ # buckets can be found at
222
+ # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
223
+ # @option options [Integer] :part_number
224
+ # Part number of the object being read. This is a positive integer
225
+ # between 1 and 10,000. Effectively performs a 'ranged' GET request
226
+ # for the part specified. Useful for downloading just a part of an
227
+ # object.
228
+ # @return [Types::GetObjectOutput]
229
+ def get(options = {})
230
+ options = options.merge(
231
+ bucket: @bucket_name,
232
+ key: @object_key,
233
+ version_id: @id
234
+ )
235
+ resp = @client.get_object(options)
236
+ resp.data
237
+ end
238
+
239
+ # @example Request syntax with placeholder values
240
+ #
241
+ # object_version.head({
242
+ # if_match: "IfMatch",
243
+ # if_modified_since: Time.now,
244
+ # if_none_match: "IfNoneMatch",
245
+ # if_unmodified_since: Time.now,
246
+ # range: "Range",
247
+ # sse_customer_algorithm: "SSECustomerAlgorithm",
248
+ # sse_customer_key: "SSECustomerKey",
249
+ # sse_customer_key_md5: "SSECustomerKeyMD5",
250
+ # request_payer: "requester", # accepts requester
251
+ # part_number: 1,
252
+ # })
253
+ # @param [Hash] options ({})
254
+ # @option options [String] :if_match
255
+ # Return the object only if its entity tag (ETag) is the same as the one
256
+ # specified, otherwise return a 412 (precondition failed).
257
+ # @option options [Time,DateTime,Date,Integer,String] :if_modified_since
258
+ # Return the object only if it has been modified since the specified
259
+ # time, otherwise return a 304 (not modified).
260
+ # @option options [String] :if_none_match
261
+ # Return the object only if its entity tag (ETag) is different from the
262
+ # one specified, otherwise return a 304 (not modified).
263
+ # @option options [Time,DateTime,Date,Integer,String] :if_unmodified_since
264
+ # Return the object only if it has not been modified since the specified
265
+ # time, otherwise return a 412 (precondition failed).
266
+ # @option options [String] :range
267
+ # Downloads the specified range bytes of an object. For more information
268
+ # about the HTTP Range header, go to
269
+ # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
270
+ # @option options [String] :sse_customer_algorithm
271
+ # Specifies the algorithm to use to when encrypting the object (e.g.,
272
+ # AES256).
273
+ # @option options [String] :sse_customer_key
274
+ # Specifies the customer-provided encryption key for Amazon S3 to use in
275
+ # encrypting data. This value is used to store the object and then it is
276
+ # discarded; Amazon does not store the encryption key. The key must be
277
+ # appropriate for use with the algorithm specified in the
278
+ # x-amz-server-side​-encryption​-customer-algorithm header.
279
+ # @option options [String] :sse_customer_key_md5
280
+ # Specifies the 128-bit MD5 digest of the encryption key according to
281
+ # RFC 1321. Amazon S3 uses this header for a message integrity check to
282
+ # ensure the encryption key was transmitted without error.
283
+ # @option options [String] :request_payer
284
+ # Confirms that the requester knows that she or he will be charged for
285
+ # the request. Bucket owners need not specify this parameter in their
286
+ # requests. Documentation on downloading objects from requester pays
287
+ # buckets can be found at
288
+ # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
289
+ # @option options [Integer] :part_number
290
+ # Part number of the object being read. This is a positive integer
291
+ # between 1 and 10,000. Effectively performs a 'ranged' HEAD request
292
+ # for the part specified. Useful querying about the size of the part and
293
+ # the number of parts in this object.
294
+ # @return [Types::HeadObjectOutput]
295
+ def head(options = {})
296
+ options = options.merge(
297
+ bucket: @bucket_name,
298
+ key: @object_key,
299
+ version_id: @id
300
+ )
301
+ resp = @client.head_object(options)
302
+ resp.data
303
+ end
304
+
305
+ # @!group Associations
306
+
307
+ # @return [Object]
308
+ def object
309
+ Object.new(
310
+ bucket_name: @bucket_name,
311
+ key: @object_key,
312
+ client: @client
313
+ )
314
+ end
315
+
316
+ # @deprecated
317
+ # @api private
318
+ def identifiers
319
+ {
320
+ bucket_name: @bucket_name,
321
+ object_key: @object_key,
322
+ id: @id
323
+ }
324
+ end
325
+ deprecated(:identifiers)
326
+
327
+ private
328
+
329
+ def extract_bucket_name(args, options)
330
+ value = args[0] || options.delete(:bucket_name)
331
+ case value
332
+ when String then value
333
+ when nil then raise ArgumentError, "missing required option :bucket_name"
334
+ else
335
+ msg = "expected :bucket_name to be a String, got #{value.class}"
336
+ raise ArgumentError, msg
109
337
  end
110
- alias :reload :load
111
-
112
- # @raise [Errors::ResourceNotLoadableError] Raises when {#data_loaded?} is `false`.
113
- # @return [Types::ObjectVersion]
114
- # Returns the data for this {ObjectVersion}.
115
- def data
116
- load unless @data
117
- @data
338
+ end
339
+
340
+ def extract_object_key(args, options)
341
+ value = args[1] || options.delete(:object_key)
342
+ case value
343
+ when String then value
344
+ when nil then raise ArgumentError, "missing required option :object_key"
345
+ else
346
+ msg = "expected :object_key to be a String, got #{value.class}"
347
+ raise ArgumentError, msg
118
348
  end
349
+ end
119
350
 
120
- # @return [Boolean]
121
- # Returns `true` if this resource is loaded. Accessing attributes or
122
- # {#data} on an unloaded resource will trigger a call to {#load}.
123
- def data_loaded?
124
- !!@data
351
+ def extract_id(args, options)
352
+ value = args[2] || options.delete(:id)
353
+ case value
354
+ when String then value
355
+ when nil then raise ArgumentError, "missing required option :id"
356
+ else
357
+ msg = "expected :id to be a String, got #{value.class}"
358
+ raise ArgumentError, msg
125
359
  end
360
+ end
361
+
362
+ class Collection < Aws::Resources::Collection
126
363
 
127
- # @!group Actions
364
+ # @!group Batch Actions
128
365
 
129
366
  # @example Request syntax with placeholder values
130
367
  #
131
- # object_version.delete({
368
+ # object_version.batch_delete!({
132
369
  # mfa: "MFA",
133
370
  # request_payer: "requester", # accepts requester
134
371
  # })
135
- # @param [Hash] options ({})
372
+ # @param options ({})
136
373
  # @option options [String] :mfa
137
374
  # The concatenation of the authentication device's serial number, a
138
375
  # space, and the value that is displayed on your authentication device.
@@ -142,265 +379,26 @@ module Aws
142
379
  # requests. Documentation on downloading objects from requester pays
143
380
  # buckets can be found at
144
381
  # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
145
- # @return [Types::DeleteObjectOutput]
146
- def delete(options = {})
147
- options = options.merge(
148
- bucket: @bucket_name,
149
- key: @object_key,
150
- version_id: @id
151
- )
152
- resp = @client.delete_object(options)
153
- resp.data
154
- end
155
-
156
- # @example Request syntax with placeholder values
157
- #
158
- # object_version.get({
159
- # if_match: "IfMatch",
160
- # if_modified_since: Time.now,
161
- # if_none_match: "IfNoneMatch",
162
- # if_unmodified_since: Time.now,
163
- # range: "Range",
164
- # response_cache_control: "ResponseCacheControl",
165
- # response_content_disposition: "ResponseContentDisposition",
166
- # response_content_encoding: "ResponseContentEncoding",
167
- # response_content_language: "ResponseContentLanguage",
168
- # response_content_type: "ResponseContentType",
169
- # response_expires: Time.now,
170
- # sse_customer_algorithm: "SSECustomerAlgorithm",
171
- # sse_customer_key: "SSECustomerKey",
172
- # sse_customer_key_md5: "SSECustomerKeyMD5",
173
- # request_payer: "requester", # accepts requester
174
- # part_number: 1,
175
- # })
176
- # @param [Hash] options ({})
177
- # @option options [String] :if_match
178
- # Return the object only if its entity tag (ETag) is the same as the one
179
- # specified, otherwise return a 412 (precondition failed).
180
- # @option options [Time,DateTime,Date,Integer,String] :if_modified_since
181
- # Return the object only if it has been modified since the specified
182
- # time, otherwise return a 304 (not modified).
183
- # @option options [String] :if_none_match
184
- # Return the object only if its entity tag (ETag) is different from the
185
- # one specified, otherwise return a 304 (not modified).
186
- # @option options [Time,DateTime,Date,Integer,String] :if_unmodified_since
187
- # Return the object only if it has not been modified since the specified
188
- # time, otherwise return a 412 (precondition failed).
189
- # @option options [String] :range
190
- # Downloads the specified range bytes of an object. For more information
191
- # about the HTTP Range header, go to
192
- # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
193
- # @option options [String] :response_cache_control
194
- # Sets the Cache-Control header of the response.
195
- # @option options [String] :response_content_disposition
196
- # Sets the Content-Disposition header of the response
197
- # @option options [String] :response_content_encoding
198
- # Sets the Content-Encoding header of the response.
199
- # @option options [String] :response_content_language
200
- # Sets the Content-Language header of the response.
201
- # @option options [String] :response_content_type
202
- # Sets the Content-Type header of the response.
203
- # @option options [Time,DateTime,Date,Integer,String] :response_expires
204
- # Sets the Expires header of the response.
205
- # @option options [String] :sse_customer_algorithm
206
- # Specifies the algorithm to use to when encrypting the object (e.g.,
207
- # AES256).
208
- # @option options [String] :sse_customer_key
209
- # Specifies the customer-provided encryption key for Amazon S3 to use in
210
- # encrypting data. This value is used to store the object and then it is
211
- # discarded; Amazon does not store the encryption key. The key must be
212
- # appropriate for use with the algorithm specified in the
213
- # x-amz-server-side​-encryption​-customer-algorithm header.
214
- # @option options [String] :sse_customer_key_md5
215
- # Specifies the 128-bit MD5 digest of the encryption key according to
216
- # RFC 1321. Amazon S3 uses this header for a message integrity check to
217
- # ensure the encryption key was transmitted without error.
218
- # @option options [String] :request_payer
219
- # Confirms that the requester knows that she or he will be charged for
220
- # the request. Bucket owners need not specify this parameter in their
221
- # requests. Documentation on downloading objects from requester pays
222
- # buckets can be found at
223
- # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
224
- # @option options [Integer] :part_number
225
- # Part number of the object being read. This is a positive integer
226
- # between 1 and 10,000. Effectively performs a 'ranged' GET request
227
- # for the part specified. Useful for downloading just a part of an
228
- # object.
229
- # @return [Types::GetObjectOutput]
230
- def get(options = {})
231
- options = options.merge(
232
- bucket: @bucket_name,
233
- key: @object_key,
234
- version_id: @id
235
- )
236
- resp = @client.get_object(options)
237
- resp.data
238
- end
239
-
240
- # @example Request syntax with placeholder values
241
- #
242
- # object_version.head({
243
- # if_match: "IfMatch",
244
- # if_modified_since: Time.now,
245
- # if_none_match: "IfNoneMatch",
246
- # if_unmodified_since: Time.now,
247
- # range: "Range",
248
- # sse_customer_algorithm: "SSECustomerAlgorithm",
249
- # sse_customer_key: "SSECustomerKey",
250
- # sse_customer_key_md5: "SSECustomerKeyMD5",
251
- # request_payer: "requester", # accepts requester
252
- # part_number: 1,
253
- # })
254
- # @param [Hash] options ({})
255
- # @option options [String] :if_match
256
- # Return the object only if its entity tag (ETag) is the same as the one
257
- # specified, otherwise return a 412 (precondition failed).
258
- # @option options [Time,DateTime,Date,Integer,String] :if_modified_since
259
- # Return the object only if it has been modified since the specified
260
- # time, otherwise return a 304 (not modified).
261
- # @option options [String] :if_none_match
262
- # Return the object only if its entity tag (ETag) is different from the
263
- # one specified, otherwise return a 304 (not modified).
264
- # @option options [Time,DateTime,Date,Integer,String] :if_unmodified_since
265
- # Return the object only if it has not been modified since the specified
266
- # time, otherwise return a 412 (precondition failed).
267
- # @option options [String] :range
268
- # Downloads the specified range bytes of an object. For more information
269
- # about the HTTP Range header, go to
270
- # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
271
- # @option options [String] :sse_customer_algorithm
272
- # Specifies the algorithm to use to when encrypting the object (e.g.,
273
- # AES256).
274
- # @option options [String] :sse_customer_key
275
- # Specifies the customer-provided encryption key for Amazon S3 to use in
276
- # encrypting data. This value is used to store the object and then it is
277
- # discarded; Amazon does not store the encryption key. The key must be
278
- # appropriate for use with the algorithm specified in the
279
- # x-amz-server-side​-encryption​-customer-algorithm header.
280
- # @option options [String] :sse_customer_key_md5
281
- # Specifies the 128-bit MD5 digest of the encryption key according to
282
- # RFC 1321. Amazon S3 uses this header for a message integrity check to
283
- # ensure the encryption key was transmitted without error.
284
- # @option options [String] :request_payer
285
- # Confirms that the requester knows that she or he will be charged for
286
- # the request. Bucket owners need not specify this parameter in their
287
- # requests. Documentation on downloading objects from requester pays
288
- # buckets can be found at
289
- # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
290
- # @option options [Integer] :part_number
291
- # Part number of the object being read. This is a positive integer
292
- # between 1 and 10,000. Effectively performs a 'ranged' HEAD request
293
- # for the part specified. Useful querying about the size of the part and
294
- # the number of parts in this object.
295
- # @return [Types::HeadObjectOutput]
296
- def head(options = {})
297
- options = options.merge(
298
- bucket: @bucket_name,
299
- key: @object_key,
300
- version_id: @id
301
- )
302
- resp = @client.head_object(options)
303
- resp.data
304
- end
305
-
306
- # @!group Associations
307
-
308
- # @return [Object]
309
- def object
310
- Object.new(
311
- bucket_name: @bucket_name,
312
- key: @object_key,
313
- client: @client
314
- )
315
- end
316
-
317
- # @deprecated
318
- # @api private
319
- def identifiers
320
- {
321
- bucket_name: @bucket_name,
322
- object_key: @object_key,
323
- id: @id
324
- }
325
- end
326
- deprecated(:identifiers)
327
-
328
- private
329
-
330
- def extract_bucket_name(args, options)
331
- value = args[0] || options.delete(:bucket_name)
332
- case value
333
- when String then value
334
- when nil then raise ArgumentError, "missing required option :bucket_name"
335
- else
336
- msg = "expected :bucket_name to be a String, got #{value.class}"
337
- raise ArgumentError, msg
338
- end
339
- end
340
-
341
- def extract_object_key(args, options)
342
- value = args[1] || options.delete(:object_key)
343
- case value
344
- when String then value
345
- when nil then raise ArgumentError, "missing required option :object_key"
346
- else
347
- msg = "expected :object_key to be a String, got #{value.class}"
348
- raise ArgumentError, msg
349
- end
350
- end
351
-
352
- def extract_id(args, options)
353
- value = args[2] || options.delete(:id)
354
- case value
355
- when String then value
356
- when nil then raise ArgumentError, "missing required option :id"
357
- else
358
- msg = "expected :id to be a String, got #{value.class}"
359
- raise ArgumentError, msg
360
- end
361
- end
362
-
363
- class Collection < Aws::Resources::Collection
364
-
365
- # @!group Batch Actions
366
-
367
- # @example Request syntax with placeholder values
368
- #
369
- # object_version.batch_delete!({
370
- # mfa: "MFA",
371
- # request_payer: "requester", # accepts requester
372
- # })
373
- # @param options ({})
374
- # @option options [String] :mfa
375
- # The concatenation of the authentication device's serial number, a
376
- # space, and the value that is displayed on your authentication device.
377
- # @option options [String] :request_payer
378
- # Confirms that the requester knows that she or he will be charged for
379
- # the request. Bucket owners need not specify this parameter in their
380
- # requests. Documentation on downloading objects from requester pays
381
- # buckets can be found at
382
- # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
383
- # @return [void]
384
- def batch_delete!(options = {})
385
- batch_enum.each do |batch|
386
- params = Aws::Util.copy_hash(options)
387
- params[:bucket] = batch[0].bucket_name
388
- params[:delete] ||= {}
389
- params[:delete][:objects] ||= []
390
- batch.each do |item|
391
- params[:delete][:objects] << {
392
- key: item.object_key,
393
- version_id: item.id
394
- }
395
- end
396
- batch[0].client.delete_objects(params)
382
+ # @return [void]
383
+ def batch_delete!(options = {})
384
+ batch_enum.each do |batch|
385
+ params = Aws::Util.copy_hash(options)
386
+ params[:bucket] = batch[0].bucket_name
387
+ params[:delete] ||= {}
388
+ params[:delete][:objects] ||= []
389
+ batch.each do |item|
390
+ params[:delete][:objects] << {
391
+ key: item.object_key,
392
+ version_id: item.id
393
+ }
397
394
  end
398
- nil
395
+ batch[0].client.delete_objects(params)
399
396
  end
397
+ nil
398
+ end
400
399
 
401
- # @!endgroup
400
+ # @!endgroup
402
401
 
403
- end
404
402
  end
405
403
  end
406
404
  end