aws-sdk-s3 1.0.0.rc2 → 1.0.0.rc3
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.
- checksums.yaml +4 -4
- data/lib/aws-sdk-s3.rb +1 -1
- data/lib/aws-sdk-s3/bucket.rb +540 -542
- data/lib/aws-sdk-s3/bucket_acl.rb +144 -146
- data/lib/aws-sdk-s3/bucket_cors.rb +122 -124
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +140 -142
- data/lib/aws-sdk-s3/bucket_logging.rb +119 -121
- data/lib/aws-sdk-s3/bucket_notification.rb +162 -164
- data/lib/aws-sdk-s3/bucket_policy.rb +114 -116
- data/lib/aws-sdk-s3/bucket_request_payment.rb +105 -107
- data/lib/aws-sdk-s3/bucket_tagging.rb +119 -121
- data/lib/aws-sdk-s3/bucket_versioning.rb +162 -164
- data/lib/aws-sdk-s3/bucket_website.rb +150 -152
- data/lib/aws-sdk-s3/client.rb +4380 -3611
- data/lib/aws-sdk-s3/client_api.rb +2343 -2345
- data/lib/aws-sdk-s3/customizations/object.rb +3 -2
- data/lib/aws-sdk-s3/errors.rb +4 -13
- data/lib/aws-sdk-s3/multipart_upload.rb +240 -242
- data/lib/aws-sdk-s3/multipart_upload_part.rb +273 -275
- data/lib/aws-sdk-s3/object.rb +879 -881
- data/lib/aws-sdk-s3/object_acl.rb +186 -188
- data/lib/aws-sdk-s3/object_summary.rb +751 -753
- data/lib/aws-sdk-s3/object_version.rb +356 -358
- data/lib/aws-sdk-s3/plugins/bucket_dns.rb +1 -1
- data/lib/aws-sdk-s3/plugins/s3_signer.rb +1 -1
- data/lib/aws-sdk-s3/presigner.rb +6 -2
- data/lib/aws-sdk-s3/resource.rb +79 -78
- data/lib/aws-sdk-s3/types.rb +7678 -6939
- data/lib/aws-sdk-s3/waiters.rb +150 -151
- metadata +4 -4
data/lib/aws-sdk-s3/object.rb
CHANGED
@@ -1,955 +1,953 @@
|
|
1
1
|
# WARNING ABOUT GENERATED CODE
|
2
2
|
#
|
3
|
-
# This file is generated. See the contributing for
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
8
|
+
module Aws::S3
|
9
|
+
class Object
|
10
|
+
|
11
|
+
extend Aws::Deprecations
|
12
|
+
|
13
|
+
# @overload def initialize(bucket_name, key, options = {})
|
14
|
+
# @param [String] bucket_name
|
15
|
+
# @param [String] key
|
16
|
+
# @option options [Client] :client
|
17
|
+
# @overload def initialize(options = {})
|
18
|
+
# @option options [required, String] :bucket_name
|
19
|
+
# @option options [required, String] :key
|
20
|
+
# @option options [Client] :client
|
21
|
+
def initialize(*args)
|
22
|
+
options = Hash === args.last ? args.pop.dup : {}
|
23
|
+
@bucket_name = extract_bucket_name(args, options)
|
24
|
+
@key = extract_key(args, options)
|
25
|
+
@data = options.delete(:data)
|
26
|
+
@client = options.delete(:client) || Client.new(options)
|
27
|
+
end
|
29
28
|
|
30
|
-
|
29
|
+
# @!group Read-Only Attributes
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
# @return [String]
|
32
|
+
def bucket_name
|
33
|
+
@bucket_name
|
34
|
+
end
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
# @return [String]
|
37
|
+
def key
|
38
|
+
@key
|
39
|
+
end
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
41
|
+
# Specifies whether the object retrieved was (true) or was not (false) a
|
42
|
+
# Delete Marker. If false, this response header does not appear in the
|
43
|
+
# response.
|
44
|
+
# @return [Boolean]
|
45
|
+
def delete_marker
|
46
|
+
data.delete_marker
|
47
|
+
end
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
# @return [String]
|
50
|
+
def accept_ranges
|
51
|
+
data.accept_ranges
|
52
|
+
end
|
54
53
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
54
|
+
# If the object expiration is configured (see PUT Bucket lifecycle), the
|
55
|
+
# response includes this header. It includes the expiry-date and rule-id
|
56
|
+
# key value pairs providing object expiration information. The value of
|
57
|
+
# the rule-id is URL encoded.
|
58
|
+
# @return [String]
|
59
|
+
def expiration
|
60
|
+
data.expiration
|
61
|
+
end
|
63
62
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
63
|
+
# Provides information about object restoration operation and expiration
|
64
|
+
# time of the restored object copy.
|
65
|
+
# @return [String]
|
66
|
+
def restore
|
67
|
+
data.restore
|
68
|
+
end
|
70
69
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
70
|
+
# Last modified date of the object
|
71
|
+
# @return [Time]
|
72
|
+
def last_modified
|
73
|
+
data.last_modified
|
74
|
+
end
|
76
75
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
76
|
+
# Size of the body in bytes.
|
77
|
+
# @return [Integer]
|
78
|
+
def content_length
|
79
|
+
data.content_length
|
80
|
+
end
|
82
81
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
82
|
+
# An ETag is an opaque identifier assigned by a web server to a specific
|
83
|
+
# version of a resource found at a URL
|
84
|
+
# @return [String]
|
85
|
+
def etag
|
86
|
+
data.etag
|
87
|
+
end
|
89
88
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
89
|
+
# This is set to the number of metadata entries not returned in
|
90
|
+
# x-amz-meta headers. This can happen if you create metadata using an
|
91
|
+
# API like SOAP that supports more flexible metadata than the REST API.
|
92
|
+
# For example, using SOAP, you can create metadata whose values are not
|
93
|
+
# legal HTTP headers.
|
94
|
+
# @return [Integer]
|
95
|
+
def missing_meta
|
96
|
+
data.missing_meta
|
97
|
+
end
|
99
98
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
99
|
+
# Version of the object.
|
100
|
+
# @return [String]
|
101
|
+
def version_id
|
102
|
+
data.version_id
|
103
|
+
end
|
105
104
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
105
|
+
# Specifies caching behavior along the request/reply chain.
|
106
|
+
# @return [String]
|
107
|
+
def cache_control
|
108
|
+
data.cache_control
|
109
|
+
end
|
111
110
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
111
|
+
# Specifies presentational information for the object.
|
112
|
+
# @return [String]
|
113
|
+
def content_disposition
|
114
|
+
data.content_disposition
|
115
|
+
end
|
117
116
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
117
|
+
# Specifies what content encodings have been applied to the object and
|
118
|
+
# thus what decoding mechanisms must be applied to obtain the media-type
|
119
|
+
# referenced by the Content-Type header field.
|
120
|
+
# @return [String]
|
121
|
+
def content_encoding
|
122
|
+
data.content_encoding
|
123
|
+
end
|
125
124
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
125
|
+
# The language the content is in.
|
126
|
+
# @return [String]
|
127
|
+
def content_language
|
128
|
+
data.content_language
|
129
|
+
end
|
131
130
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
131
|
+
# A standard MIME type describing the format of the object data.
|
132
|
+
# @return [String]
|
133
|
+
def content_type
|
134
|
+
data.content_type
|
135
|
+
end
|
137
136
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
137
|
+
# The date and time at which the object is no longer cacheable.
|
138
|
+
# @return [Time]
|
139
|
+
def expires
|
140
|
+
data.expires
|
141
|
+
end
|
143
142
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
143
|
+
# @return [String]
|
144
|
+
def expires_string
|
145
|
+
data.expires_string
|
146
|
+
end
|
148
147
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
148
|
+
# If the bucket is configured as a website, redirects requests for this
|
149
|
+
# object to another object in the same bucket or to an external URL.
|
150
|
+
# Amazon S3 stores the value of this header in the object metadata.
|
151
|
+
# @return [String]
|
152
|
+
def website_redirect_location
|
153
|
+
data.website_redirect_location
|
154
|
+
end
|
156
155
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
156
|
+
# The Server-side encryption algorithm used when storing this object in
|
157
|
+
# S3 (e.g., AES256, aws:kms).
|
158
|
+
# @return [String]
|
159
|
+
def server_side_encryption
|
160
|
+
data.server_side_encryption
|
161
|
+
end
|
163
162
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
163
|
+
# A map of metadata to store with the object in S3.
|
164
|
+
# @return [Hash<String,String>]
|
165
|
+
def metadata
|
166
|
+
data.metadata
|
167
|
+
end
|
169
168
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
169
|
+
# If server-side encryption with a customer-provided encryption key was
|
170
|
+
# requested, the response will include this header confirming the
|
171
|
+
# encryption algorithm used.
|
172
|
+
# @return [String]
|
173
|
+
def sse_customer_algorithm
|
174
|
+
data.sse_customer_algorithm
|
175
|
+
end
|
177
176
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
177
|
+
# If server-side encryption with a customer-provided encryption key was
|
178
|
+
# requested, the response will include this header to provide round trip
|
179
|
+
# message integrity verification of the customer-provided encryption
|
180
|
+
# key.
|
181
|
+
# @return [String]
|
182
|
+
def sse_customer_key_md5
|
183
|
+
data.sse_customer_key_md5
|
184
|
+
end
|
186
185
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
186
|
+
# If present, specifies the ID of the AWS Key Management Service (KMS)
|
187
|
+
# master encryption key that was used for the object.
|
188
|
+
# @return [String]
|
189
|
+
def ssekms_key_id
|
190
|
+
data.ssekms_key_id
|
191
|
+
end
|
193
192
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
193
|
+
# @return [String]
|
194
|
+
def storage_class
|
195
|
+
data.storage_class
|
196
|
+
end
|
198
197
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
198
|
+
# If present, indicates that the requester was successfully charged for
|
199
|
+
# the request.
|
200
|
+
# @return [String]
|
201
|
+
def request_charged
|
202
|
+
data.request_charged
|
203
|
+
end
|
205
204
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
205
|
+
# @return [String]
|
206
|
+
def replication_status
|
207
|
+
data.replication_status
|
208
|
+
end
|
210
209
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
210
|
+
# The count of parts this object has.
|
211
|
+
# @return [Integer]
|
212
|
+
def parts_count
|
213
|
+
data.parts_count
|
214
|
+
end
|
216
215
|
|
217
|
-
|
216
|
+
# @!endgroup
|
218
217
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
218
|
+
# @return [Client]
|
219
|
+
def client
|
220
|
+
@client
|
221
|
+
end
|
223
222
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
223
|
+
# Loads, or reloads {#data} for the current {Object}.
|
224
|
+
# Returns `self` making it possible to chain methods.
|
225
|
+
#
|
226
|
+
# object.reload.data
|
227
|
+
#
|
228
|
+
# @return [self]
|
229
|
+
def load
|
230
|
+
resp = @client.head_object(
|
231
|
+
bucket: @bucket_name,
|
232
|
+
key: @key
|
233
|
+
)
|
234
|
+
@data = resp.data
|
235
|
+
self
|
236
|
+
end
|
237
|
+
alias :reload :load
|
238
|
+
|
239
|
+
# @return [Types::HeadObjectOutput]
|
240
|
+
# Returns the data for this {Object}. Calls
|
241
|
+
# {Client#head_object} if {#data_loaded?} is `false`.
|
242
|
+
def data
|
243
|
+
load unless @data
|
244
|
+
@data
|
245
|
+
end
|
247
246
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
247
|
+
# @return [Boolean]
|
248
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
249
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
250
|
+
def data_loaded?
|
251
|
+
!!@data
|
252
|
+
end
|
254
253
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
end
|
254
|
+
# @param [Hash] options ({})
|
255
|
+
# @return [Boolean]
|
256
|
+
# Returns `true` if the Object exists.
|
257
|
+
def exists?(options = {})
|
258
|
+
begin
|
259
|
+
wait_until_exists(options.merge(max_attempts: 1))
|
260
|
+
true
|
261
|
+
rescue Aws::Waiters::Errors::UnexpectedError => e
|
262
|
+
raise e.error
|
263
|
+
rescue Aws::Waiters::Errors::WaiterFailed
|
264
|
+
false
|
267
265
|
end
|
266
|
+
end
|
268
267
|
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
268
|
+
# @param [Hash] options ({})
|
269
|
+
# @option options [Integer] :max_attempts (20)
|
270
|
+
# @option options [Float] :delay (5)
|
271
|
+
# @option options [Proc] :before_attempt
|
272
|
+
# @option options [Proc] :before_wait
|
273
|
+
# @return [Object]
|
274
|
+
def wait_until_exists(options = {})
|
275
|
+
options, params = separate_params_and_options(options)
|
276
|
+
waiter = Waiters::ObjectExists.new(options)
|
277
|
+
yield_waiter_and_warn(waiter, &Proc.new) if block_given?
|
278
|
+
waiter.wait(params.merge(bucket: @bucket_name,
|
279
|
+
key: @key))
|
280
|
+
Object.new({
|
281
|
+
bucket_name: @bucket_name,
|
282
|
+
key: @key,
|
283
|
+
client: @client
|
284
|
+
})
|
285
|
+
end
|
287
286
|
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
287
|
+
# @param [Hash] options ({})
|
288
|
+
# @option options [Integer] :max_attempts (20)
|
289
|
+
# @option options [Float] :delay (5)
|
290
|
+
# @option options [Proc] :before_attempt
|
291
|
+
# @option options [Proc] :before_wait
|
292
|
+
# @return [Object]
|
293
|
+
def wait_until_not_exists(options = {})
|
294
|
+
options, params = separate_params_and_options(options)
|
295
|
+
waiter = Waiters::ObjectNotExists.new(options)
|
296
|
+
yield_waiter_and_warn(waiter, &Proc.new) if block_given?
|
297
|
+
waiter.wait(params.merge(bucket: @bucket_name,
|
298
|
+
key: @key))
|
299
|
+
Object.new({
|
300
|
+
bucket_name: @bucket_name,
|
301
|
+
key: @key,
|
302
|
+
client: @client
|
303
|
+
})
|
304
|
+
end
|
306
305
|
|
307
|
-
|
306
|
+
# @!group Actions
|
307
|
+
|
308
|
+
# @example Request syntax with placeholder values
|
309
|
+
#
|
310
|
+
# object.copy_from({
|
311
|
+
# acl: "private", # accepts private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-owner-full-control
|
312
|
+
# cache_control: "CacheControl",
|
313
|
+
# content_disposition: "ContentDisposition",
|
314
|
+
# content_encoding: "ContentEncoding",
|
315
|
+
# content_language: "ContentLanguage",
|
316
|
+
# content_type: "ContentType",
|
317
|
+
# copy_source: "CopySource", # required
|
318
|
+
# copy_source_if_match: "CopySourceIfMatch",
|
319
|
+
# copy_source_if_modified_since: Time.now,
|
320
|
+
# copy_source_if_none_match: "CopySourceIfNoneMatch",
|
321
|
+
# copy_source_if_unmodified_since: Time.now,
|
322
|
+
# expires: Time.now,
|
323
|
+
# grant_full_control: "GrantFullControl",
|
324
|
+
# grant_read: "GrantRead",
|
325
|
+
# grant_read_acp: "GrantReadACP",
|
326
|
+
# grant_write_acp: "GrantWriteACP",
|
327
|
+
# metadata: {
|
328
|
+
# "MetadataKey" => "MetadataValue",
|
329
|
+
# },
|
330
|
+
# metadata_directive: "COPY", # accepts COPY, REPLACE
|
331
|
+
# tagging_directive: "COPY", # accepts COPY, REPLACE
|
332
|
+
# server_side_encryption: "AES256", # accepts AES256, aws:kms
|
333
|
+
# storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA
|
334
|
+
# website_redirect_location: "WebsiteRedirectLocation",
|
335
|
+
# sse_customer_algorithm: "SSECustomerAlgorithm",
|
336
|
+
# sse_customer_key: "SSECustomerKey",
|
337
|
+
# sse_customer_key_md5: "SSECustomerKeyMD5",
|
338
|
+
# ssekms_key_id: "SSEKMSKeyId",
|
339
|
+
# copy_source_sse_customer_algorithm: "CopySourceSSECustomerAlgorithm",
|
340
|
+
# copy_source_sse_customer_key: "CopySourceSSECustomerKey",
|
341
|
+
# copy_source_sse_customer_key_md5: "CopySourceSSECustomerKeyMD5",
|
342
|
+
# request_payer: "requester", # accepts requester
|
343
|
+
# tagging: "TaggingHeader",
|
344
|
+
# })
|
345
|
+
# @param [Hash] options ({})
|
346
|
+
# @option options [String] :acl
|
347
|
+
# The canned ACL to apply to the object.
|
348
|
+
# @option options [String] :cache_control
|
349
|
+
# Specifies caching behavior along the request/reply chain.
|
350
|
+
# @option options [String] :content_disposition
|
351
|
+
# Specifies presentational information for the object.
|
352
|
+
# @option options [String] :content_encoding
|
353
|
+
# Specifies what content encodings have been applied to the object and
|
354
|
+
# thus what decoding mechanisms must be applied to obtain the media-type
|
355
|
+
# referenced by the Content-Type header field.
|
356
|
+
# @option options [String] :content_language
|
357
|
+
# The language the content is in.
|
358
|
+
# @option options [String] :content_type
|
359
|
+
# A standard MIME type describing the format of the object data.
|
360
|
+
# @option options [required, String] :copy_source
|
361
|
+
# The name of the source bucket and key name of the source object,
|
362
|
+
# separated by a slash (/). Must be URL-encoded.
|
363
|
+
# @option options [String] :copy_source_if_match
|
364
|
+
# Copies the object if its entity tag (ETag) matches the specified tag.
|
365
|
+
# @option options [Time,DateTime,Date,Integer,String] :copy_source_if_modified_since
|
366
|
+
# Copies the object if it has been modified since the specified time.
|
367
|
+
# @option options [String] :copy_source_if_none_match
|
368
|
+
# Copies the object if its entity tag (ETag) is different than the
|
369
|
+
# specified ETag.
|
370
|
+
# @option options [Time,DateTime,Date,Integer,String] :copy_source_if_unmodified_since
|
371
|
+
# Copies the object if it hasn't been modified since the specified
|
372
|
+
# time.
|
373
|
+
# @option options [Time,DateTime,Date,Integer,String] :expires
|
374
|
+
# The date and time at which the object is no longer cacheable.
|
375
|
+
# @option options [String] :grant_full_control
|
376
|
+
# Gives the grantee READ, READ\_ACP, and WRITE\_ACP permissions on the
|
377
|
+
# object.
|
378
|
+
# @option options [String] :grant_read
|
379
|
+
# Allows grantee to read the object data and its metadata.
|
380
|
+
# @option options [String] :grant_read_acp
|
381
|
+
# Allows grantee to read the object ACL.
|
382
|
+
# @option options [String] :grant_write_acp
|
383
|
+
# Allows grantee to write the ACL for the applicable object.
|
384
|
+
# @option options [Hash<String,String>] :metadata
|
385
|
+
# A map of metadata to store with the object in S3.
|
386
|
+
# @option options [String] :metadata_directive
|
387
|
+
# Specifies whether the metadata is copied from the source object or
|
388
|
+
# replaced with metadata provided in the request.
|
389
|
+
# @option options [String] :tagging_directive
|
390
|
+
# Specifies whether the object tag-set are copied from the source object
|
391
|
+
# or replaced with tag-set provided in the request.
|
392
|
+
# @option options [String] :server_side_encryption
|
393
|
+
# The Server-side encryption algorithm used when storing this object in
|
394
|
+
# S3 (e.g., AES256, aws:kms).
|
395
|
+
# @option options [String] :storage_class
|
396
|
+
# The type of storage to use for the object. Defaults to 'STANDARD'.
|
397
|
+
# @option options [String] :website_redirect_location
|
398
|
+
# If the bucket is configured as a website, redirects requests for this
|
399
|
+
# object to another object in the same bucket or to an external URL.
|
400
|
+
# Amazon S3 stores the value of this header in the object metadata.
|
401
|
+
# @option options [String] :sse_customer_algorithm
|
402
|
+
# Specifies the algorithm to use to when encrypting the object (e.g.,
|
403
|
+
# AES256).
|
404
|
+
# @option options [String] :sse_customer_key
|
405
|
+
# Specifies the customer-provided encryption key for Amazon S3 to use in
|
406
|
+
# encrypting data. This value is used to store the object and then it is
|
407
|
+
# discarded; Amazon does not store the encryption key. The key must be
|
408
|
+
# appropriate for use with the algorithm specified in the
|
409
|
+
# x-amz-server-side-encryption-customer-algorithm header.
|
410
|
+
# @option options [String] :sse_customer_key_md5
|
411
|
+
# Specifies the 128-bit MD5 digest of the encryption key according to
|
412
|
+
# RFC 1321. Amazon S3 uses this header for a message integrity check to
|
413
|
+
# ensure the encryption key was transmitted without error.
|
414
|
+
# @option options [String] :ssekms_key_id
|
415
|
+
# Specifies the AWS KMS key ID to use for object encryption. All GET and
|
416
|
+
# PUT requests for an object protected by AWS KMS will fail if not made
|
417
|
+
# via SSL or using SigV4. Documentation on configuring any of the
|
418
|
+
# officially supported AWS SDKs and CLI can be found at
|
419
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version
|
420
|
+
# @option options [String] :copy_source_sse_customer_algorithm
|
421
|
+
# Specifies the algorithm to use when decrypting the source object
|
422
|
+
# (e.g., AES256).
|
423
|
+
# @option options [String] :copy_source_sse_customer_key
|
424
|
+
# Specifies the customer-provided encryption key for Amazon S3 to use to
|
425
|
+
# decrypt the source object. The encryption key provided in this header
|
426
|
+
# must be one that was used when the source object was created.
|
427
|
+
# @option options [String] :copy_source_sse_customer_key_md5
|
428
|
+
# Specifies the 128-bit MD5 digest of the encryption key according to
|
429
|
+
# RFC 1321. Amazon S3 uses this header for a message integrity check to
|
430
|
+
# ensure the encryption key was transmitted without error.
|
431
|
+
# @option options [String] :request_payer
|
432
|
+
# Confirms that the requester knows that she or he will be charged for
|
433
|
+
# the request. Bucket owners need not specify this parameter in their
|
434
|
+
# requests. Documentation on downloading objects from requester pays
|
435
|
+
# buckets can be found at
|
436
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
437
|
+
# @option options [String] :tagging
|
438
|
+
# The tag-set for the object destination object this value must be used
|
439
|
+
# in conjunction with the TaggingDirective. The tag-set must be encoded
|
440
|
+
# as URL Query parameters
|
441
|
+
# @return [Types::CopyObjectOutput]
|
442
|
+
def copy_from(options = {})
|
443
|
+
options = options.merge(
|
444
|
+
bucket: @bucket_name,
|
445
|
+
key: @key
|
446
|
+
)
|
447
|
+
resp = @client.copy_object(options)
|
448
|
+
resp.data
|
449
|
+
end
|
308
450
|
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
# sse_customer_key: "SSECustomerKey",
|
338
|
-
# sse_customer_key_md5: "SSECustomerKeyMD5",
|
339
|
-
# ssekms_key_id: "SSEKMSKeyId",
|
340
|
-
# copy_source_sse_customer_algorithm: "CopySourceSSECustomerAlgorithm",
|
341
|
-
# copy_source_sse_customer_key: "CopySourceSSECustomerKey",
|
342
|
-
# copy_source_sse_customer_key_md5: "CopySourceSSECustomerKeyMD5",
|
343
|
-
# request_payer: "requester", # accepts requester
|
344
|
-
# tagging: "TaggingHeader",
|
345
|
-
# })
|
346
|
-
# @param [Hash] options ({})
|
347
|
-
# @option options [String] :acl
|
348
|
-
# The canned ACL to apply to the object.
|
349
|
-
# @option options [String] :cache_control
|
350
|
-
# Specifies caching behavior along the request/reply chain.
|
351
|
-
# @option options [String] :content_disposition
|
352
|
-
# Specifies presentational information for the object.
|
353
|
-
# @option options [String] :content_encoding
|
354
|
-
# Specifies what content encodings have been applied to the object and
|
355
|
-
# thus what decoding mechanisms must be applied to obtain the media-type
|
356
|
-
# referenced by the Content-Type header field.
|
357
|
-
# @option options [String] :content_language
|
358
|
-
# The language the content is in.
|
359
|
-
# @option options [String] :content_type
|
360
|
-
# A standard MIME type describing the format of the object data.
|
361
|
-
# @option options [required, String] :copy_source
|
362
|
-
# The name of the source bucket and key name of the source object,
|
363
|
-
# separated by a slash (/). Must be URL-encoded.
|
364
|
-
# @option options [String] :copy_source_if_match
|
365
|
-
# Copies the object if its entity tag (ETag) matches the specified tag.
|
366
|
-
# @option options [Time,DateTime,Date,Integer,String] :copy_source_if_modified_since
|
367
|
-
# Copies the object if it has been modified since the specified time.
|
368
|
-
# @option options [String] :copy_source_if_none_match
|
369
|
-
# Copies the object if its entity tag (ETag) is different than the
|
370
|
-
# specified ETag.
|
371
|
-
# @option options [Time,DateTime,Date,Integer,String] :copy_source_if_unmodified_since
|
372
|
-
# Copies the object if it hasn't been modified since the specified
|
373
|
-
# time.
|
374
|
-
# @option options [Time,DateTime,Date,Integer,String] :expires
|
375
|
-
# The date and time at which the object is no longer cacheable.
|
376
|
-
# @option options [String] :grant_full_control
|
377
|
-
# Gives the grantee READ, READ\_ACP, and WRITE\_ACP permissions on the
|
378
|
-
# object.
|
379
|
-
# @option options [String] :grant_read
|
380
|
-
# Allows grantee to read the object data and its metadata.
|
381
|
-
# @option options [String] :grant_read_acp
|
382
|
-
# Allows grantee to read the object ACL.
|
383
|
-
# @option options [String] :grant_write_acp
|
384
|
-
# Allows grantee to write the ACL for the applicable object.
|
385
|
-
# @option options [Hash<String,String>] :metadata
|
386
|
-
# A map of metadata to store with the object in S3.
|
387
|
-
# @option options [String] :metadata_directive
|
388
|
-
# Specifies whether the metadata is copied from the source object or
|
389
|
-
# replaced with metadata provided in the request.
|
390
|
-
# @option options [String] :tagging_directive
|
391
|
-
# Specifies whether the object tag-set are copied from the source object
|
392
|
-
# or replaced with tag-set provided in the request.
|
393
|
-
# @option options [String] :server_side_encryption
|
394
|
-
# The Server-side encryption algorithm used when storing this object in
|
395
|
-
# S3 (e.g., AES256, aws:kms).
|
396
|
-
# @option options [String] :storage_class
|
397
|
-
# The type of storage to use for the object. Defaults to 'STANDARD'.
|
398
|
-
# @option options [String] :website_redirect_location
|
399
|
-
# If the bucket is configured as a website, redirects requests for this
|
400
|
-
# object to another object in the same bucket or to an external URL.
|
401
|
-
# Amazon S3 stores the value of this header in the object metadata.
|
402
|
-
# @option options [String] :sse_customer_algorithm
|
403
|
-
# Specifies the algorithm to use to when encrypting the object (e.g.,
|
404
|
-
# AES256).
|
405
|
-
# @option options [String] :sse_customer_key
|
406
|
-
# Specifies the customer-provided encryption key for Amazon S3 to use in
|
407
|
-
# encrypting data. This value is used to store the object and then it is
|
408
|
-
# discarded; Amazon does not store the encryption key. The key must be
|
409
|
-
# appropriate for use with the algorithm specified in the
|
410
|
-
# x-amz-server-side-encryption-customer-algorithm header.
|
411
|
-
# @option options [String] :sse_customer_key_md5
|
412
|
-
# Specifies the 128-bit MD5 digest of the encryption key according to
|
413
|
-
# RFC 1321. Amazon S3 uses this header for a message integrity check to
|
414
|
-
# ensure the encryption key was transmitted without error.
|
415
|
-
# @option options [String] :ssekms_key_id
|
416
|
-
# Specifies the AWS KMS key ID to use for object encryption. All GET and
|
417
|
-
# PUT requests for an object protected by AWS KMS will fail if not made
|
418
|
-
# via SSL or using SigV4. Documentation on configuring any of the
|
419
|
-
# officially supported AWS SDKs and CLI can be found at
|
420
|
-
# http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version
|
421
|
-
# @option options [String] :copy_source_sse_customer_algorithm
|
422
|
-
# Specifies the algorithm to use when decrypting the source object
|
423
|
-
# (e.g., AES256).
|
424
|
-
# @option options [String] :copy_source_sse_customer_key
|
425
|
-
# Specifies the customer-provided encryption key for Amazon S3 to use to
|
426
|
-
# decrypt the source object. The encryption key provided in this header
|
427
|
-
# must be one that was used when the source object was created.
|
428
|
-
# @option options [String] :copy_source_sse_customer_key_md5
|
429
|
-
# Specifies the 128-bit MD5 digest of the encryption key according to
|
430
|
-
# RFC 1321. Amazon S3 uses this header for a message integrity check to
|
431
|
-
# ensure the encryption key was transmitted without error.
|
432
|
-
# @option options [String] :request_payer
|
433
|
-
# Confirms that the requester knows that she or he will be charged for
|
434
|
-
# the request. Bucket owners need not specify this parameter in their
|
435
|
-
# requests. Documentation on downloading objects from requester pays
|
436
|
-
# buckets can be found at
|
437
|
-
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
438
|
-
# @option options [String] :tagging
|
439
|
-
# The tag-set for the object destination object this value must be used
|
440
|
-
# in conjunction with the TaggingDirective. The tag-set must be encoded
|
441
|
-
# as URL Query parameters
|
442
|
-
# @return [Types::CopyObjectOutput]
|
443
|
-
def copy_from(options = {})
|
444
|
-
options = options.merge(
|
445
|
-
bucket: @bucket_name,
|
446
|
-
key: @key
|
447
|
-
)
|
448
|
-
resp = @client.copy_object(options)
|
449
|
-
resp.data
|
450
|
-
end
|
451
|
+
# @example Request syntax with placeholder values
|
452
|
+
#
|
453
|
+
# object.delete({
|
454
|
+
# mfa: "MFA",
|
455
|
+
# version_id: "ObjectVersionId",
|
456
|
+
# request_payer: "requester", # accepts requester
|
457
|
+
# })
|
458
|
+
# @param [Hash] options ({})
|
459
|
+
# @option options [String] :mfa
|
460
|
+
# The concatenation of the authentication device's serial number, a
|
461
|
+
# space, and the value that is displayed on your authentication device.
|
462
|
+
# @option options [String] :version_id
|
463
|
+
# VersionId used to reference a specific version of the object.
|
464
|
+
# @option options [String] :request_payer
|
465
|
+
# Confirms that the requester knows that she or he will be charged for
|
466
|
+
# the request. Bucket owners need not specify this parameter in their
|
467
|
+
# requests. Documentation on downloading objects from requester pays
|
468
|
+
# buckets can be found at
|
469
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
470
|
+
# @return [Types::DeleteObjectOutput]
|
471
|
+
def delete(options = {})
|
472
|
+
options = options.merge(
|
473
|
+
bucket: @bucket_name,
|
474
|
+
key: @key
|
475
|
+
)
|
476
|
+
resp = @client.delete_object(options)
|
477
|
+
resp.data
|
478
|
+
end
|
451
479
|
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
+
# @example Request syntax with placeholder values
|
481
|
+
#
|
482
|
+
# object.get({
|
483
|
+
# if_match: "IfMatch",
|
484
|
+
# if_modified_since: Time.now,
|
485
|
+
# if_none_match: "IfNoneMatch",
|
486
|
+
# if_unmodified_since: Time.now,
|
487
|
+
# range: "Range",
|
488
|
+
# response_cache_control: "ResponseCacheControl",
|
489
|
+
# response_content_disposition: "ResponseContentDisposition",
|
490
|
+
# response_content_encoding: "ResponseContentEncoding",
|
491
|
+
# response_content_language: "ResponseContentLanguage",
|
492
|
+
# response_content_type: "ResponseContentType",
|
493
|
+
# response_expires: Time.now,
|
494
|
+
# version_id: "ObjectVersionId",
|
495
|
+
# sse_customer_algorithm: "SSECustomerAlgorithm",
|
496
|
+
# sse_customer_key: "SSECustomerKey",
|
497
|
+
# sse_customer_key_md5: "SSECustomerKeyMD5",
|
498
|
+
# request_payer: "requester", # accepts requester
|
499
|
+
# part_number: 1,
|
500
|
+
# })
|
501
|
+
# @param [Hash] options ({})
|
502
|
+
# @option options [String] :if_match
|
503
|
+
# Return the object only if its entity tag (ETag) is the same as the one
|
504
|
+
# specified, otherwise return a 412 (precondition failed).
|
505
|
+
# @option options [Time,DateTime,Date,Integer,String] :if_modified_since
|
506
|
+
# Return the object only if it has been modified since the specified
|
507
|
+
# time, otherwise return a 304 (not modified).
|
508
|
+
# @option options [String] :if_none_match
|
509
|
+
# Return the object only if its entity tag (ETag) is different from the
|
510
|
+
# one specified, otherwise return a 304 (not modified).
|
511
|
+
# @option options [Time,DateTime,Date,Integer,String] :if_unmodified_since
|
512
|
+
# Return the object only if it has not been modified since the specified
|
513
|
+
# time, otherwise return a 412 (precondition failed).
|
514
|
+
# @option options [String] :range
|
515
|
+
# Downloads the specified range bytes of an object. For more information
|
516
|
+
# about the HTTP Range header, go to
|
517
|
+
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
|
518
|
+
# @option options [String] :response_cache_control
|
519
|
+
# Sets the Cache-Control header of the response.
|
520
|
+
# @option options [String] :response_content_disposition
|
521
|
+
# Sets the Content-Disposition header of the response
|
522
|
+
# @option options [String] :response_content_encoding
|
523
|
+
# Sets the Content-Encoding header of the response.
|
524
|
+
# @option options [String] :response_content_language
|
525
|
+
# Sets the Content-Language header of the response.
|
526
|
+
# @option options [String] :response_content_type
|
527
|
+
# Sets the Content-Type header of the response.
|
528
|
+
# @option options [Time,DateTime,Date,Integer,String] :response_expires
|
529
|
+
# Sets the Expires header of the response.
|
530
|
+
# @option options [String] :version_id
|
531
|
+
# VersionId used to reference a specific version of the object.
|
532
|
+
# @option options [String] :sse_customer_algorithm
|
533
|
+
# Specifies the algorithm to use to when encrypting the object (e.g.,
|
534
|
+
# AES256).
|
535
|
+
# @option options [String] :sse_customer_key
|
536
|
+
# Specifies the customer-provided encryption key for Amazon S3 to use in
|
537
|
+
# encrypting data. This value is used to store the object and then it is
|
538
|
+
# discarded; Amazon does not store the encryption key. The key must be
|
539
|
+
# appropriate for use with the algorithm specified in the
|
540
|
+
# x-amz-server-side-encryption-customer-algorithm header.
|
541
|
+
# @option options [String] :sse_customer_key_md5
|
542
|
+
# Specifies the 128-bit MD5 digest of the encryption key according to
|
543
|
+
# RFC 1321. Amazon S3 uses this header for a message integrity check to
|
544
|
+
# ensure the encryption key was transmitted without error.
|
545
|
+
# @option options [String] :request_payer
|
546
|
+
# Confirms that the requester knows that she or he will be charged for
|
547
|
+
# the request. Bucket owners need not specify this parameter in their
|
548
|
+
# requests. Documentation on downloading objects from requester pays
|
549
|
+
# buckets can be found at
|
550
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
551
|
+
# @option options [Integer] :part_number
|
552
|
+
# Part number of the object being read. This is a positive integer
|
553
|
+
# between 1 and 10,000. Effectively performs a 'ranged' GET request
|
554
|
+
# for the part specified. Useful for downloading just a part of an
|
555
|
+
# object.
|
556
|
+
# @return [Types::GetObjectOutput]
|
557
|
+
def get(options = {})
|
558
|
+
options = options.merge(
|
559
|
+
bucket: @bucket_name,
|
560
|
+
key: @key
|
561
|
+
)
|
562
|
+
resp = @client.get_object(options)
|
563
|
+
resp.data
|
564
|
+
end
|
480
565
|
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
+
# @example Request syntax with placeholder values
|
567
|
+
#
|
568
|
+
# multipartupload = object.initiate_multipart_upload({
|
569
|
+
# acl: "private", # accepts private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-owner-full-control
|
570
|
+
# cache_control: "CacheControl",
|
571
|
+
# content_disposition: "ContentDisposition",
|
572
|
+
# content_encoding: "ContentEncoding",
|
573
|
+
# content_language: "ContentLanguage",
|
574
|
+
# content_type: "ContentType",
|
575
|
+
# expires: Time.now,
|
576
|
+
# grant_full_control: "GrantFullControl",
|
577
|
+
# grant_read: "GrantRead",
|
578
|
+
# grant_read_acp: "GrantReadACP",
|
579
|
+
# grant_write_acp: "GrantWriteACP",
|
580
|
+
# metadata: {
|
581
|
+
# "MetadataKey" => "MetadataValue",
|
582
|
+
# },
|
583
|
+
# server_side_encryption: "AES256", # accepts AES256, aws:kms
|
584
|
+
# storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA
|
585
|
+
# website_redirect_location: "WebsiteRedirectLocation",
|
586
|
+
# sse_customer_algorithm: "SSECustomerAlgorithm",
|
587
|
+
# sse_customer_key: "SSECustomerKey",
|
588
|
+
# sse_customer_key_md5: "SSECustomerKeyMD5",
|
589
|
+
# ssekms_key_id: "SSEKMSKeyId",
|
590
|
+
# request_payer: "requester", # accepts requester
|
591
|
+
# })
|
592
|
+
# @param [Hash] options ({})
|
593
|
+
# @option options [String] :acl
|
594
|
+
# The canned ACL to apply to the object.
|
595
|
+
# @option options [String] :cache_control
|
596
|
+
# Specifies caching behavior along the request/reply chain.
|
597
|
+
# @option options [String] :content_disposition
|
598
|
+
# Specifies presentational information for the object.
|
599
|
+
# @option options [String] :content_encoding
|
600
|
+
# Specifies what content encodings have been applied to the object and
|
601
|
+
# thus what decoding mechanisms must be applied to obtain the media-type
|
602
|
+
# referenced by the Content-Type header field.
|
603
|
+
# @option options [String] :content_language
|
604
|
+
# The language the content is in.
|
605
|
+
# @option options [String] :content_type
|
606
|
+
# A standard MIME type describing the format of the object data.
|
607
|
+
# @option options [Time,DateTime,Date,Integer,String] :expires
|
608
|
+
# The date and time at which the object is no longer cacheable.
|
609
|
+
# @option options [String] :grant_full_control
|
610
|
+
# Gives the grantee READ, READ\_ACP, and WRITE\_ACP permissions on the
|
611
|
+
# object.
|
612
|
+
# @option options [String] :grant_read
|
613
|
+
# Allows grantee to read the object data and its metadata.
|
614
|
+
# @option options [String] :grant_read_acp
|
615
|
+
# Allows grantee to read the object ACL.
|
616
|
+
# @option options [String] :grant_write_acp
|
617
|
+
# Allows grantee to write the ACL for the applicable object.
|
618
|
+
# @option options [Hash<String,String>] :metadata
|
619
|
+
# A map of metadata to store with the object in S3.
|
620
|
+
# @option options [String] :server_side_encryption
|
621
|
+
# The Server-side encryption algorithm used when storing this object in
|
622
|
+
# S3 (e.g., AES256, aws:kms).
|
623
|
+
# @option options [String] :storage_class
|
624
|
+
# The type of storage to use for the object. Defaults to 'STANDARD'.
|
625
|
+
# @option options [String] :website_redirect_location
|
626
|
+
# If the bucket is configured as a website, redirects requests for this
|
627
|
+
# object to another object in the same bucket or to an external URL.
|
628
|
+
# Amazon S3 stores the value of this header in the object metadata.
|
629
|
+
# @option options [String] :sse_customer_algorithm
|
630
|
+
# Specifies the algorithm to use to when encrypting the object (e.g.,
|
631
|
+
# AES256).
|
632
|
+
# @option options [String] :sse_customer_key
|
633
|
+
# Specifies the customer-provided encryption key for Amazon S3 to use in
|
634
|
+
# encrypting data. This value is used to store the object and then it is
|
635
|
+
# discarded; Amazon does not store the encryption key. The key must be
|
636
|
+
# appropriate for use with the algorithm specified in the
|
637
|
+
# x-amz-server-side-encryption-customer-algorithm header.
|
638
|
+
# @option options [String] :sse_customer_key_md5
|
639
|
+
# Specifies the 128-bit MD5 digest of the encryption key according to
|
640
|
+
# RFC 1321. Amazon S3 uses this header for a message integrity check to
|
641
|
+
# ensure the encryption key was transmitted without error.
|
642
|
+
# @option options [String] :ssekms_key_id
|
643
|
+
# Specifies the AWS KMS key ID to use for object encryption. All GET and
|
644
|
+
# PUT requests for an object protected by AWS KMS will fail if not made
|
645
|
+
# via SSL or using SigV4. Documentation on configuring any of the
|
646
|
+
# officially supported AWS SDKs and CLI can be found at
|
647
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version
|
648
|
+
# @option options [String] :request_payer
|
649
|
+
# Confirms that the requester knows that she or he will be charged for
|
650
|
+
# the request. Bucket owners need not specify this parameter in their
|
651
|
+
# requests. Documentation on downloading objects from requester pays
|
652
|
+
# buckets can be found at
|
653
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
654
|
+
# @return [MultipartUpload]
|
655
|
+
def initiate_multipart_upload(options = {})
|
656
|
+
options = options.merge(
|
657
|
+
bucket: @bucket_name,
|
658
|
+
key: @key
|
659
|
+
)
|
660
|
+
resp = @client.create_multipart_upload(options)
|
661
|
+
MultipartUpload.new(
|
662
|
+
bucket_name: @bucket_name,
|
663
|
+
object_key: @key,
|
664
|
+
id: resp.data.upload_id,
|
665
|
+
client: @client
|
666
|
+
)
|
667
|
+
end
|
566
668
|
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
+
# @example Request syntax with placeholder values
|
670
|
+
#
|
671
|
+
# object.put({
|
672
|
+
# acl: "private", # accepts private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-owner-full-control
|
673
|
+
# body: source_file,
|
674
|
+
# cache_control: "CacheControl",
|
675
|
+
# content_disposition: "ContentDisposition",
|
676
|
+
# content_encoding: "ContentEncoding",
|
677
|
+
# content_language: "ContentLanguage",
|
678
|
+
# content_length: 1,
|
679
|
+
# content_md5: "ContentMD5",
|
680
|
+
# content_type: "ContentType",
|
681
|
+
# expires: Time.now,
|
682
|
+
# grant_full_control: "GrantFullControl",
|
683
|
+
# grant_read: "GrantRead",
|
684
|
+
# grant_read_acp: "GrantReadACP",
|
685
|
+
# grant_write_acp: "GrantWriteACP",
|
686
|
+
# metadata: {
|
687
|
+
# "MetadataKey" => "MetadataValue",
|
688
|
+
# },
|
689
|
+
# server_side_encryption: "AES256", # accepts AES256, aws:kms
|
690
|
+
# storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA
|
691
|
+
# website_redirect_location: "WebsiteRedirectLocation",
|
692
|
+
# sse_customer_algorithm: "SSECustomerAlgorithm",
|
693
|
+
# sse_customer_key: "SSECustomerKey",
|
694
|
+
# sse_customer_key_md5: "SSECustomerKeyMD5",
|
695
|
+
# ssekms_key_id: "SSEKMSKeyId",
|
696
|
+
# request_payer: "requester", # accepts requester
|
697
|
+
# tagging: "TaggingHeader",
|
698
|
+
# })
|
699
|
+
# @param [Hash] options ({})
|
700
|
+
# @option options [String] :acl
|
701
|
+
# The canned ACL to apply to the object.
|
702
|
+
# @option options [String, IO] :body
|
703
|
+
# Object data.
|
704
|
+
# @option options [String] :cache_control
|
705
|
+
# Specifies caching behavior along the request/reply chain.
|
706
|
+
# @option options [String] :content_disposition
|
707
|
+
# Specifies presentational information for the object.
|
708
|
+
# @option options [String] :content_encoding
|
709
|
+
# Specifies what content encodings have been applied to the object and
|
710
|
+
# thus what decoding mechanisms must be applied to obtain the media-type
|
711
|
+
# referenced by the Content-Type header field.
|
712
|
+
# @option options [String] :content_language
|
713
|
+
# The language the content is in.
|
714
|
+
# @option options [Integer] :content_length
|
715
|
+
# Size of the body in bytes. This parameter is useful when the size of
|
716
|
+
# the body cannot be determined automatically.
|
717
|
+
# @option options [String] :content_md5
|
718
|
+
# The base64-encoded 128-bit MD5 digest of the part data.
|
719
|
+
# @option options [String] :content_type
|
720
|
+
# A standard MIME type describing the format of the object data.
|
721
|
+
# @option options [Time,DateTime,Date,Integer,String] :expires
|
722
|
+
# The date and time at which the object is no longer cacheable.
|
723
|
+
# @option options [String] :grant_full_control
|
724
|
+
# Gives the grantee READ, READ\_ACP, and WRITE\_ACP permissions on the
|
725
|
+
# object.
|
726
|
+
# @option options [String] :grant_read
|
727
|
+
# Allows grantee to read the object data and its metadata.
|
728
|
+
# @option options [String] :grant_read_acp
|
729
|
+
# Allows grantee to read the object ACL.
|
730
|
+
# @option options [String] :grant_write_acp
|
731
|
+
# Allows grantee to write the ACL for the applicable object.
|
732
|
+
# @option options [Hash<String,String>] :metadata
|
733
|
+
# A map of metadata to store with the object in S3.
|
734
|
+
# @option options [String] :server_side_encryption
|
735
|
+
# The Server-side encryption algorithm used when storing this object in
|
736
|
+
# S3 (e.g., AES256, aws:kms).
|
737
|
+
# @option options [String] :storage_class
|
738
|
+
# The type of storage to use for the object. Defaults to 'STANDARD'.
|
739
|
+
# @option options [String] :website_redirect_location
|
740
|
+
# If the bucket is configured as a website, redirects requests for this
|
741
|
+
# object to another object in the same bucket or to an external URL.
|
742
|
+
# Amazon S3 stores the value of this header in the object metadata.
|
743
|
+
# @option options [String] :sse_customer_algorithm
|
744
|
+
# Specifies the algorithm to use to when encrypting the object (e.g.,
|
745
|
+
# AES256).
|
746
|
+
# @option options [String] :sse_customer_key
|
747
|
+
# Specifies the customer-provided encryption key for Amazon S3 to use in
|
748
|
+
# encrypting data. This value is used to store the object and then it is
|
749
|
+
# discarded; Amazon does not store the encryption key. The key must be
|
750
|
+
# appropriate for use with the algorithm specified in the
|
751
|
+
# x-amz-server-side-encryption-customer-algorithm header.
|
752
|
+
# @option options [String] :sse_customer_key_md5
|
753
|
+
# Specifies the 128-bit MD5 digest of the encryption key according to
|
754
|
+
# RFC 1321. Amazon S3 uses this header for a message integrity check to
|
755
|
+
# ensure the encryption key was transmitted without error.
|
756
|
+
# @option options [String] :ssekms_key_id
|
757
|
+
# Specifies the AWS KMS key ID to use for object encryption. All GET and
|
758
|
+
# PUT requests for an object protected by AWS KMS will fail if not made
|
759
|
+
# via SSL or using SigV4. Documentation on configuring any of the
|
760
|
+
# officially supported AWS SDKs and CLI can be found at
|
761
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version
|
762
|
+
# @option options [String] :request_payer
|
763
|
+
# Confirms that the requester knows that she or he will be charged for
|
764
|
+
# the request. Bucket owners need not specify this parameter in their
|
765
|
+
# requests. Documentation on downloading objects from requester pays
|
766
|
+
# buckets can be found at
|
767
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
768
|
+
# @option options [String] :tagging
|
769
|
+
# The tag-set for the object. The tag-set must be encoded as URL Query
|
770
|
+
# parameters
|
771
|
+
# @return [Types::PutObjectOutput]
|
772
|
+
def put(options = {})
|
773
|
+
options = options.merge(
|
774
|
+
bucket: @bucket_name,
|
775
|
+
key: @key
|
776
|
+
)
|
777
|
+
resp = @client.put_object(options)
|
778
|
+
resp.data
|
779
|
+
end
|
669
780
|
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
# @param [Hash] options ({})
|
701
|
-
# @option options [String] :acl
|
702
|
-
# The canned ACL to apply to the object.
|
703
|
-
# @option options [String, IO] :body
|
704
|
-
# Object data.
|
705
|
-
# @option options [String] :cache_control
|
706
|
-
# Specifies caching behavior along the request/reply chain.
|
707
|
-
# @option options [String] :content_disposition
|
708
|
-
# Specifies presentational information for the object.
|
709
|
-
# @option options [String] :content_encoding
|
710
|
-
# Specifies what content encodings have been applied to the object and
|
711
|
-
# thus what decoding mechanisms must be applied to obtain the media-type
|
712
|
-
# referenced by the Content-Type header field.
|
713
|
-
# @option options [String] :content_language
|
714
|
-
# The language the content is in.
|
715
|
-
# @option options [Integer] :content_length
|
716
|
-
# Size of the body in bytes. This parameter is useful when the size of
|
717
|
-
# the body cannot be determined automatically.
|
718
|
-
# @option options [String] :content_md5
|
719
|
-
# The base64-encoded 128-bit MD5 digest of the part data.
|
720
|
-
# @option options [String] :content_type
|
721
|
-
# A standard MIME type describing the format of the object data.
|
722
|
-
# @option options [Time,DateTime,Date,Integer,String] :expires
|
723
|
-
# The date and time at which the object is no longer cacheable.
|
724
|
-
# @option options [String] :grant_full_control
|
725
|
-
# Gives the grantee READ, READ\_ACP, and WRITE\_ACP permissions on the
|
726
|
-
# object.
|
727
|
-
# @option options [String] :grant_read
|
728
|
-
# Allows grantee to read the object data and its metadata.
|
729
|
-
# @option options [String] :grant_read_acp
|
730
|
-
# Allows grantee to read the object ACL.
|
731
|
-
# @option options [String] :grant_write_acp
|
732
|
-
# Allows grantee to write the ACL for the applicable object.
|
733
|
-
# @option options [Hash<String,String>] :metadata
|
734
|
-
# A map of metadata to store with the object in S3.
|
735
|
-
# @option options [String] :server_side_encryption
|
736
|
-
# The Server-side encryption algorithm used when storing this object in
|
737
|
-
# S3 (e.g., AES256, aws:kms).
|
738
|
-
# @option options [String] :storage_class
|
739
|
-
# The type of storage to use for the object. Defaults to 'STANDARD'.
|
740
|
-
# @option options [String] :website_redirect_location
|
741
|
-
# If the bucket is configured as a website, redirects requests for this
|
742
|
-
# object to another object in the same bucket or to an external URL.
|
743
|
-
# Amazon S3 stores the value of this header in the object metadata.
|
744
|
-
# @option options [String] :sse_customer_algorithm
|
745
|
-
# Specifies the algorithm to use to when encrypting the object (e.g.,
|
746
|
-
# AES256).
|
747
|
-
# @option options [String] :sse_customer_key
|
748
|
-
# Specifies the customer-provided encryption key for Amazon S3 to use in
|
749
|
-
# encrypting data. This value is used to store the object and then it is
|
750
|
-
# discarded; Amazon does not store the encryption key. The key must be
|
751
|
-
# appropriate for use with the algorithm specified in the
|
752
|
-
# x-amz-server-side-encryption-customer-algorithm header.
|
753
|
-
# @option options [String] :sse_customer_key_md5
|
754
|
-
# Specifies the 128-bit MD5 digest of the encryption key according to
|
755
|
-
# RFC 1321. Amazon S3 uses this header for a message integrity check to
|
756
|
-
# ensure the encryption key was transmitted without error.
|
757
|
-
# @option options [String] :ssekms_key_id
|
758
|
-
# Specifies the AWS KMS key ID to use for object encryption. All GET and
|
759
|
-
# PUT requests for an object protected by AWS KMS will fail if not made
|
760
|
-
# via SSL or using SigV4. Documentation on configuring any of the
|
761
|
-
# officially supported AWS SDKs and CLI can be found at
|
762
|
-
# http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version
|
763
|
-
# @option options [String] :request_payer
|
764
|
-
# Confirms that the requester knows that she or he will be charged for
|
765
|
-
# the request. Bucket owners need not specify this parameter in their
|
766
|
-
# requests. Documentation on downloading objects from requester pays
|
767
|
-
# buckets can be found at
|
768
|
-
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
769
|
-
# @option options [String] :tagging
|
770
|
-
# The tag-set for the object. The tag-set must be encoded as URL Query
|
771
|
-
# parameters
|
772
|
-
# @return [Types::PutObjectOutput]
|
773
|
-
def put(options = {})
|
774
|
-
options = options.merge(
|
775
|
-
bucket: @bucket_name,
|
776
|
-
key: @key
|
777
|
-
)
|
778
|
-
resp = @client.put_object(options)
|
779
|
-
resp.data
|
780
|
-
end
|
781
|
+
# @example Request syntax with placeholder values
|
782
|
+
#
|
783
|
+
# object.restore_object({
|
784
|
+
# version_id: "ObjectVersionId",
|
785
|
+
# restore_request: {
|
786
|
+
# days: 1, # required
|
787
|
+
# glacier_job_parameters: {
|
788
|
+
# tier: "Standard", # required, accepts Standard, Bulk, Expedited
|
789
|
+
# },
|
790
|
+
# },
|
791
|
+
# request_payer: "requester", # accepts requester
|
792
|
+
# })
|
793
|
+
# @param [Hash] options ({})
|
794
|
+
# @option options [String] :version_id
|
795
|
+
# @option options [Types::RestoreRequest] :restore_request
|
796
|
+
# @option options [String] :request_payer
|
797
|
+
# Confirms that the requester knows that she or he will be charged for
|
798
|
+
# the request. Bucket owners need not specify this parameter in their
|
799
|
+
# requests. Documentation on downloading objects from requester pays
|
800
|
+
# buckets can be found at
|
801
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
802
|
+
# @return [Types::RestoreObjectOutput]
|
803
|
+
def restore_object(options = {})
|
804
|
+
options = options.merge(
|
805
|
+
bucket: @bucket_name,
|
806
|
+
key: @key
|
807
|
+
)
|
808
|
+
resp = @client.restore_object(options)
|
809
|
+
resp.data
|
810
|
+
end
|
781
811
|
|
782
|
-
|
783
|
-
#
|
784
|
-
# object.restore_object({
|
785
|
-
# version_id: "ObjectVersionId",
|
786
|
-
# restore_request: {
|
787
|
-
# days: 1, # required
|
788
|
-
# glacier_job_parameters: {
|
789
|
-
# tier: "Standard", # required, accepts Standard, Bulk, Expedited
|
790
|
-
# },
|
791
|
-
# },
|
792
|
-
# request_payer: "requester", # accepts requester
|
793
|
-
# })
|
794
|
-
# @param [Hash] options ({})
|
795
|
-
# @option options [String] :version_id
|
796
|
-
# @option options [Types::RestoreRequest] :restore_request
|
797
|
-
# @option options [String] :request_payer
|
798
|
-
# Confirms that the requester knows that she or he will be charged for
|
799
|
-
# the request. Bucket owners need not specify this parameter in their
|
800
|
-
# requests. Documentation on downloading objects from requester pays
|
801
|
-
# buckets can be found at
|
802
|
-
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
803
|
-
# @return [Types::RestoreObjectOutput]
|
804
|
-
def restore_object(options = {})
|
805
|
-
options = options.merge(
|
806
|
-
bucket: @bucket_name,
|
807
|
-
key: @key
|
808
|
-
)
|
809
|
-
resp = @client.restore_object(options)
|
810
|
-
resp.data
|
811
|
-
end
|
812
|
+
# @!group Associations
|
812
813
|
|
813
|
-
|
814
|
+
# @return [ObjectAcl]
|
815
|
+
def acl
|
816
|
+
ObjectAcl.new(
|
817
|
+
bucket_name: @bucket_name,
|
818
|
+
object_key: @key,
|
819
|
+
client: @client
|
820
|
+
)
|
821
|
+
end
|
814
822
|
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
end
|
823
|
+
# @return [Bucket]
|
824
|
+
def bucket
|
825
|
+
Bucket.new(
|
826
|
+
name: @bucket_name,
|
827
|
+
client: @client
|
828
|
+
)
|
829
|
+
end
|
823
830
|
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
+
# @param [String] id
|
832
|
+
# @return [MultipartUpload]
|
833
|
+
def multipart_upload(id)
|
834
|
+
MultipartUpload.new(
|
835
|
+
bucket_name: @bucket_name,
|
836
|
+
object_key: @key,
|
837
|
+
id: id,
|
838
|
+
client: @client
|
839
|
+
)
|
840
|
+
end
|
831
841
|
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
+
# @param [String] id
|
843
|
+
# @return [ObjectVersion]
|
844
|
+
def version(id)
|
845
|
+
ObjectVersion.new(
|
846
|
+
bucket_name: @bucket_name,
|
847
|
+
object_key: @key,
|
848
|
+
id: id,
|
849
|
+
client: @client
|
850
|
+
)
|
851
|
+
end
|
842
852
|
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
+
# @deprecated
|
854
|
+
# @api private
|
855
|
+
def identifiers
|
856
|
+
{
|
857
|
+
bucket_name: @bucket_name,
|
858
|
+
key: @key
|
859
|
+
}
|
860
|
+
end
|
861
|
+
deprecated(:identifiers)
|
862
|
+
|
863
|
+
private
|
853
864
|
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
}
|
865
|
+
def extract_bucket_name(args, options)
|
866
|
+
value = args[0] || options.delete(:bucket_name)
|
867
|
+
case value
|
868
|
+
when String then value
|
869
|
+
when nil then raise ArgumentError, "missing required option :bucket_name"
|
870
|
+
else
|
871
|
+
msg = "expected :bucket_name to be a String, got #{value.class}"
|
872
|
+
raise ArgumentError, msg
|
861
873
|
end
|
862
|
-
|
874
|
+
end
|
863
875
|
|
864
|
-
|
876
|
+
def extract_key(args, options)
|
877
|
+
value = args[1] || options.delete(:key)
|
878
|
+
case value
|
879
|
+
when String then value
|
880
|
+
when nil then raise ArgumentError, "missing required option :key"
|
881
|
+
else
|
882
|
+
msg = "expected :key to be a String, got #{value.class}"
|
883
|
+
raise ArgumentError, msg
|
884
|
+
end
|
885
|
+
end
|
865
886
|
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
msg = "expected :bucket_name to be a String, got #{value.class}"
|
873
|
-
raise ArgumentError, msg
|
874
|
-
end
|
887
|
+
def yield_waiter_and_warn(waiter, &block)
|
888
|
+
if !@waiter_block_warned
|
889
|
+
msg = "pass options to configure the waiter; "
|
890
|
+
msg << "yielding the waiter is deprecated"
|
891
|
+
warn(msg)
|
892
|
+
@waiter_block_warned = true
|
875
893
|
end
|
894
|
+
yield(waiter.waiter)
|
895
|
+
end
|
876
896
|
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
897
|
+
def separate_params_and_options(options)
|
898
|
+
opts = Set.new([:client, :max_attempts, :delay, :before_attempt, :before_wait])
|
899
|
+
waiter_opts = {}
|
900
|
+
waiter_params = {}
|
901
|
+
options.each_pair do |key, value|
|
902
|
+
if opts.include?(key)
|
903
|
+
waiter_opts[key] = value
|
882
904
|
else
|
883
|
-
|
884
|
-
raise ArgumentError, msg
|
905
|
+
waiter_params[key] = value
|
885
906
|
end
|
886
907
|
end
|
908
|
+
waiter_opts[:client] ||= @client
|
909
|
+
[waiter_opts, waiter_params]
|
910
|
+
end
|
887
911
|
|
888
|
-
|
889
|
-
if !@waiter_block_warned
|
890
|
-
msg = "pass options to configure the waiter; "
|
891
|
-
msg << "yielding the waiter is deprecated"
|
892
|
-
warn(msg)
|
893
|
-
@waiter_block_warned = true
|
894
|
-
end
|
895
|
-
yield(waiter.waiter)
|
896
|
-
end
|
912
|
+
class Collection < Aws::Resources::Collection
|
897
913
|
|
898
|
-
|
899
|
-
opts = Set.new([:client, :max_attempts, :delay, :before_attempt, :before_wait])
|
900
|
-
waiter_opts = {}
|
901
|
-
waiter_params = {}
|
902
|
-
options.each_pair do |key, value|
|
903
|
-
if opts.include?(key)
|
904
|
-
waiter_opts[key] = value
|
905
|
-
else
|
906
|
-
waiter_params[key] = value
|
907
|
-
end
|
908
|
-
end
|
909
|
-
waiter_opts[:client] ||= @client
|
910
|
-
[waiter_opts, waiter_params]
|
911
|
-
end
|
914
|
+
# @!group Batch Actions
|
912
915
|
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
params[:
|
938
|
-
|
939
|
-
|
940
|
-
batch.each do |item|
|
941
|
-
params[:delete][:objects] << {
|
942
|
-
key: item.key
|
943
|
-
}
|
944
|
-
end
|
945
|
-
batch[0].client.delete_objects(params)
|
916
|
+
# @example Request syntax with placeholder values
|
917
|
+
#
|
918
|
+
# object.batch_delete!({
|
919
|
+
# mfa: "MFA",
|
920
|
+
# request_payer: "requester", # accepts requester
|
921
|
+
# })
|
922
|
+
# @param options ({})
|
923
|
+
# @option options [String] :mfa
|
924
|
+
# The concatenation of the authentication device's serial number, a
|
925
|
+
# space, and the value that is displayed on your authentication device.
|
926
|
+
# @option options [String] :request_payer
|
927
|
+
# Confirms that the requester knows that she or he will be charged for
|
928
|
+
# the request. Bucket owners need not specify this parameter in their
|
929
|
+
# requests. Documentation on downloading objects from requester pays
|
930
|
+
# buckets can be found at
|
931
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
932
|
+
# @return [void]
|
933
|
+
def batch_delete!(options = {})
|
934
|
+
batch_enum.each do |batch|
|
935
|
+
params = Aws::Util.copy_hash(options)
|
936
|
+
params[:bucket] = batch[0].bucket_name
|
937
|
+
params[:delete] ||= {}
|
938
|
+
params[:delete][:objects] ||= []
|
939
|
+
batch.each do |item|
|
940
|
+
params[:delete][:objects] << {
|
941
|
+
key: item.key
|
942
|
+
}
|
946
943
|
end
|
947
|
-
|
944
|
+
batch[0].client.delete_objects(params)
|
948
945
|
end
|
946
|
+
nil
|
947
|
+
end
|
949
948
|
|
950
|
-
|
949
|
+
# @!endgroup
|
951
950
|
|
952
|
-
end
|
953
951
|
end
|
954
952
|
end
|
955
953
|
end
|