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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47082bcd6514ee19071b0e65b3614849bc841028
|
4
|
+
data.tar.gz: d0a6a1b92982a0cfb6a1df90d2abf54d9870a947
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 321f5f82ee5ec0c7537a8578e6f26c1a22c17722c3debd411ca3f7f34ed66a8792147960c8e0499285c2b48b290f6f12d487a1aa1d2ea5e56b57b5882caaa2b0
|
7
|
+
data.tar.gz: c3fbf872aa1413afcfc62116b0aed6c6cfaa703ea0d2130dcb50896b905a84731a6a580223a79830d42d1a8452319aea8dc47ff010814ba81f332041cbdca599
|
data/lib/aws-sdk-s3.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
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
|
data/lib/aws-sdk-s3/bucket.rb
CHANGED
@@ -1,599 +1,597 @@
|
|
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
|
-
end
|
8
|
+
module Aws::S3
|
9
|
+
class Bucket
|
10
|
+
|
11
|
+
extend Aws::Deprecations
|
12
|
+
|
13
|
+
# @overload def initialize(name, options = {})
|
14
|
+
# @param [String] name
|
15
|
+
# @option options [Client] :client
|
16
|
+
# @overload def initialize(options = {})
|
17
|
+
# @option options [required, String] :name
|
18
|
+
# @option options [Client] :client
|
19
|
+
def initialize(*args)
|
20
|
+
options = Hash === args.last ? args.pop.dup : {}
|
21
|
+
@name = extract_name(args, options)
|
22
|
+
@data = options.delete(:data)
|
23
|
+
@client = options.delete(:client) || Client.new(options)
|
24
|
+
end
|
26
25
|
|
27
|
-
|
26
|
+
# @!group Read-Only Attributes
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
# @return [String]
|
29
|
+
def name
|
30
|
+
@name
|
31
|
+
end
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
# Date the bucket was created.
|
34
|
+
# @return [Time]
|
35
|
+
def creation_date
|
36
|
+
data.creation_date
|
37
|
+
end
|
39
38
|
|
40
|
-
|
39
|
+
# @!endgroup
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
41
|
+
# @return [Client]
|
42
|
+
def client
|
43
|
+
@client
|
44
|
+
end
|
46
45
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
46
|
+
# @raise [NotImplementedError]
|
47
|
+
# @api private
|
48
|
+
def load
|
49
|
+
msg = "#load is not implemented, data only available via enumeration"
|
50
|
+
raise NotImplementedError, msg
|
51
|
+
end
|
52
|
+
alias :reload :load
|
53
|
+
|
54
|
+
# @raise [NotImplementedError] Raises when {#data_loaded?} is `false`.
|
55
|
+
# @return [Types::Bucket]
|
56
|
+
# Returns the data for this {Bucket}.
|
57
|
+
def data
|
58
|
+
load unless @data
|
59
|
+
@data
|
60
|
+
end
|
62
61
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
62
|
+
# @return [Boolean]
|
63
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
64
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
65
|
+
def data_loaded?
|
66
|
+
!!@data
|
67
|
+
end
|
69
68
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
69
|
+
# @param [Hash] options ({})
|
70
|
+
# @return [Boolean]
|
71
|
+
# Returns `true` if the Bucket exists.
|
72
|
+
def exists?(options = {})
|
73
|
+
begin
|
74
|
+
wait_until_exists(options.merge(max_attempts: 1))
|
75
|
+
true
|
76
|
+
rescue Aws::Waiters::Errors::UnexpectedError => e
|
77
|
+
raise e.error
|
78
|
+
rescue Aws::Waiters::Errors::WaiterFailed
|
79
|
+
false
|
82
80
|
end
|
81
|
+
end
|
83
82
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
83
|
+
# @param [Hash] options ({})
|
84
|
+
# @option options [Integer] :max_attempts (20)
|
85
|
+
# @option options [Float] :delay (5)
|
86
|
+
# @option options [Proc] :before_attempt
|
87
|
+
# @option options [Proc] :before_wait
|
88
|
+
# @return [Bucket]
|
89
|
+
def wait_until_exists(options = {})
|
90
|
+
options, params = separate_params_and_options(options)
|
91
|
+
waiter = Waiters::BucketExists.new(options)
|
92
|
+
yield_waiter_and_warn(waiter, &Proc.new) if block_given?
|
93
|
+
waiter.wait(params.merge(bucket: @name))
|
94
|
+
Bucket.new({
|
95
|
+
name: @name,
|
96
|
+
client: @client
|
97
|
+
})
|
98
|
+
end
|
100
99
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
100
|
+
# @param [Hash] options ({})
|
101
|
+
# @option options [Integer] :max_attempts (20)
|
102
|
+
# @option options [Float] :delay (5)
|
103
|
+
# @option options [Proc] :before_attempt
|
104
|
+
# @option options [Proc] :before_wait
|
105
|
+
# @return [Bucket]
|
106
|
+
def wait_until_not_exists(options = {})
|
107
|
+
options, params = separate_params_and_options(options)
|
108
|
+
waiter = Waiters::BucketNotExists.new(options)
|
109
|
+
yield_waiter_and_warn(waiter, &Proc.new) if block_given?
|
110
|
+
waiter.wait(params.merge(bucket: @name))
|
111
|
+
Bucket.new({
|
112
|
+
name: @name,
|
113
|
+
client: @client
|
114
|
+
})
|
115
|
+
end
|
117
116
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
117
|
+
# @!group Actions
|
118
|
+
|
119
|
+
# @example Request syntax with placeholder values
|
120
|
+
#
|
121
|
+
# bucket.create({
|
122
|
+
# acl: "private", # accepts private, public-read, public-read-write, authenticated-read
|
123
|
+
# create_bucket_configuration: {
|
124
|
+
# location_constraint: "EU", # accepts EU, eu-west-1, us-west-1, us-west-2, ap-south-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, sa-east-1, cn-north-1, eu-central-1
|
125
|
+
# },
|
126
|
+
# grant_full_control: "GrantFullControl",
|
127
|
+
# grant_read: "GrantRead",
|
128
|
+
# grant_read_acp: "GrantReadACP",
|
129
|
+
# grant_write: "GrantWrite",
|
130
|
+
# grant_write_acp: "GrantWriteACP",
|
131
|
+
# })
|
132
|
+
# @param [Hash] options ({})
|
133
|
+
# @option options [String] :acl
|
134
|
+
# The canned ACL to apply to the bucket.
|
135
|
+
# @option options [Types::CreateBucketConfiguration] :create_bucket_configuration
|
136
|
+
# @option options [String] :grant_full_control
|
137
|
+
# Allows grantee the read, write, read ACP, and write ACP permissions on
|
138
|
+
# the bucket.
|
139
|
+
# @option options [String] :grant_read
|
140
|
+
# Allows grantee to list the objects in the bucket.
|
141
|
+
# @option options [String] :grant_read_acp
|
142
|
+
# Allows grantee to read the bucket ACL.
|
143
|
+
# @option options [String] :grant_write
|
144
|
+
# Allows grantee to create, overwrite, and delete any object in the
|
145
|
+
# bucket.
|
146
|
+
# @option options [String] :grant_write_acp
|
147
|
+
# Allows grantee to write the ACL for the applicable bucket.
|
148
|
+
# @return [Types::CreateBucketOutput]
|
149
|
+
def create(options = {})
|
150
|
+
options = options.merge(bucket: @name)
|
151
|
+
resp = @client.create_bucket(options)
|
152
|
+
resp.data
|
153
|
+
end
|
155
154
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
155
|
+
# @example Request syntax with placeholder values
|
156
|
+
#
|
157
|
+
# bucket.delete()
|
158
|
+
# @param [Hash] options ({})
|
159
|
+
# @return [EmptyStructure]
|
160
|
+
def delete(options = {})
|
161
|
+
options = options.merge(bucket: @name)
|
162
|
+
resp = @client.delete_bucket(options)
|
163
|
+
resp.data
|
164
|
+
end
|
166
165
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
166
|
+
# @example Request syntax with placeholder values
|
167
|
+
#
|
168
|
+
# bucket.delete_objects({
|
169
|
+
# delete: { # required
|
170
|
+
# objects: [ # required
|
171
|
+
# {
|
172
|
+
# key: "ObjectKey", # required
|
173
|
+
# version_id: "ObjectVersionId",
|
174
|
+
# },
|
175
|
+
# ],
|
176
|
+
# quiet: false,
|
177
|
+
# },
|
178
|
+
# mfa: "MFA",
|
179
|
+
# request_payer: "requester", # accepts requester
|
180
|
+
# })
|
181
|
+
# @param [Hash] options ({})
|
182
|
+
# @option options [required, Types::Delete] :delete
|
183
|
+
# @option options [String] :mfa
|
184
|
+
# The concatenation of the authentication device's serial number, a
|
185
|
+
# space, and the value that is displayed on your authentication device.
|
186
|
+
# @option options [String] :request_payer
|
187
|
+
# Confirms that the requester knows that she or he will be charged for
|
188
|
+
# the request. Bucket owners need not specify this parameter in their
|
189
|
+
# requests. Documentation on downloading objects from requester pays
|
190
|
+
# buckets can be found at
|
191
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
192
|
+
# @return [Types::DeleteObjectsOutput]
|
193
|
+
def delete_objects(options = {})
|
194
|
+
options = options.merge(bucket: @name)
|
195
|
+
resp = @client.delete_objects(options)
|
196
|
+
resp.data
|
197
|
+
end
|
199
198
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
199
|
+
# @example Request syntax with placeholder values
|
200
|
+
#
|
201
|
+
# object = bucket.put_object({
|
202
|
+
# acl: "private", # accepts private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-owner-full-control
|
203
|
+
# body: source_file,
|
204
|
+
# cache_control: "CacheControl",
|
205
|
+
# content_disposition: "ContentDisposition",
|
206
|
+
# content_encoding: "ContentEncoding",
|
207
|
+
# content_language: "ContentLanguage",
|
208
|
+
# content_length: 1,
|
209
|
+
# content_md5: "ContentMD5",
|
210
|
+
# content_type: "ContentType",
|
211
|
+
# expires: Time.now,
|
212
|
+
# grant_full_control: "GrantFullControl",
|
213
|
+
# grant_read: "GrantRead",
|
214
|
+
# grant_read_acp: "GrantReadACP",
|
215
|
+
# grant_write_acp: "GrantWriteACP",
|
216
|
+
# key: "ObjectKey", # required
|
217
|
+
# metadata: {
|
218
|
+
# "MetadataKey" => "MetadataValue",
|
219
|
+
# },
|
220
|
+
# server_side_encryption: "AES256", # accepts AES256, aws:kms
|
221
|
+
# storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA
|
222
|
+
# website_redirect_location: "WebsiteRedirectLocation",
|
223
|
+
# sse_customer_algorithm: "SSECustomerAlgorithm",
|
224
|
+
# sse_customer_key: "SSECustomerKey",
|
225
|
+
# sse_customer_key_md5: "SSECustomerKeyMD5",
|
226
|
+
# ssekms_key_id: "SSEKMSKeyId",
|
227
|
+
# request_payer: "requester", # accepts requester
|
228
|
+
# tagging: "TaggingHeader",
|
229
|
+
# })
|
230
|
+
# @param [Hash] options ({})
|
231
|
+
# @option options [String] :acl
|
232
|
+
# The canned ACL to apply to the object.
|
233
|
+
# @option options [String, IO] :body
|
234
|
+
# Object data.
|
235
|
+
# @option options [String] :cache_control
|
236
|
+
# Specifies caching behavior along the request/reply chain.
|
237
|
+
# @option options [String] :content_disposition
|
238
|
+
# Specifies presentational information for the object.
|
239
|
+
# @option options [String] :content_encoding
|
240
|
+
# Specifies what content encodings have been applied to the object and
|
241
|
+
# thus what decoding mechanisms must be applied to obtain the media-type
|
242
|
+
# referenced by the Content-Type header field.
|
243
|
+
# @option options [String] :content_language
|
244
|
+
# The language the content is in.
|
245
|
+
# @option options [Integer] :content_length
|
246
|
+
# Size of the body in bytes. This parameter is useful when the size of
|
247
|
+
# the body cannot be determined automatically.
|
248
|
+
# @option options [String] :content_md5
|
249
|
+
# The base64-encoded 128-bit MD5 digest of the part data.
|
250
|
+
# @option options [String] :content_type
|
251
|
+
# A standard MIME type describing the format of the object data.
|
252
|
+
# @option options [Time,DateTime,Date,Integer,String] :expires
|
253
|
+
# The date and time at which the object is no longer cacheable.
|
254
|
+
# @option options [String] :grant_full_control
|
255
|
+
# Gives the grantee READ, READ\_ACP, and WRITE\_ACP permissions on the
|
256
|
+
# object.
|
257
|
+
# @option options [String] :grant_read
|
258
|
+
# Allows grantee to read the object data and its metadata.
|
259
|
+
# @option options [String] :grant_read_acp
|
260
|
+
# Allows grantee to read the object ACL.
|
261
|
+
# @option options [String] :grant_write_acp
|
262
|
+
# Allows grantee to write the ACL for the applicable object.
|
263
|
+
# @option options [required, String] :key
|
264
|
+
# Object key for which the PUT operation was initiated.
|
265
|
+
# @option options [Hash<String,String>] :metadata
|
266
|
+
# A map of metadata to store with the object in S3.
|
267
|
+
# @option options [String] :server_side_encryption
|
268
|
+
# The Server-side encryption algorithm used when storing this object in
|
269
|
+
# S3 (e.g., AES256, aws:kms).
|
270
|
+
# @option options [String] :storage_class
|
271
|
+
# The type of storage to use for the object. Defaults to 'STANDARD'.
|
272
|
+
# @option options [String] :website_redirect_location
|
273
|
+
# If the bucket is configured as a website, redirects requests for this
|
274
|
+
# object to another object in the same bucket or to an external URL.
|
275
|
+
# Amazon S3 stores the value of this header in the object metadata.
|
276
|
+
# @option options [String] :sse_customer_algorithm
|
277
|
+
# Specifies the algorithm to use to when encrypting the object (e.g.,
|
278
|
+
# AES256).
|
279
|
+
# @option options [String] :sse_customer_key
|
280
|
+
# Specifies the customer-provided encryption key for Amazon S3 to use in
|
281
|
+
# encrypting data. This value is used to store the object and then it is
|
282
|
+
# discarded; Amazon does not store the encryption key. The key must be
|
283
|
+
# appropriate for use with the algorithm specified in the
|
284
|
+
# x-amz-server-side-encryption-customer-algorithm header.
|
285
|
+
# @option options [String] :sse_customer_key_md5
|
286
|
+
# Specifies the 128-bit MD5 digest of the encryption key according to
|
287
|
+
# RFC 1321. Amazon S3 uses this header for a message integrity check to
|
288
|
+
# ensure the encryption key was transmitted without error.
|
289
|
+
# @option options [String] :ssekms_key_id
|
290
|
+
# Specifies the AWS KMS key ID to use for object encryption. All GET and
|
291
|
+
# PUT requests for an object protected by AWS KMS will fail if not made
|
292
|
+
# via SSL or using SigV4. Documentation on configuring any of the
|
293
|
+
# officially supported AWS SDKs and CLI can be found at
|
294
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version
|
295
|
+
# @option options [String] :request_payer
|
296
|
+
# Confirms that the requester knows that she or he will be charged for
|
297
|
+
# the request. Bucket owners need not specify this parameter in their
|
298
|
+
# requests. Documentation on downloading objects from requester pays
|
299
|
+
# buckets can be found at
|
300
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
301
|
+
# @option options [String] :tagging
|
302
|
+
# The tag-set for the object. The tag-set must be encoded as URL Query
|
303
|
+
# parameters
|
304
|
+
# @return [Object]
|
305
|
+
def put_object(options = {})
|
306
|
+
options = options.merge(bucket: @name)
|
307
|
+
resp = @client.put_object(options)
|
308
|
+
Object.new(
|
309
|
+
bucket_name: @name,
|
310
|
+
key: options[:key],
|
311
|
+
client: @client
|
312
|
+
)
|
313
|
+
end
|
315
314
|
|
316
|
-
|
315
|
+
# @!group Associations
|
317
316
|
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
317
|
+
# @return [BucketAcl]
|
318
|
+
def acl
|
319
|
+
BucketAcl.new(
|
320
|
+
bucket_name: @name,
|
321
|
+
client: @client
|
322
|
+
)
|
323
|
+
end
|
325
324
|
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
325
|
+
# @return [BucketCors]
|
326
|
+
def cors
|
327
|
+
BucketCors.new(
|
328
|
+
bucket_name: @name,
|
329
|
+
client: @client
|
330
|
+
)
|
331
|
+
end
|
333
332
|
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
333
|
+
# @return [BucketLifecycle]
|
334
|
+
def lifecycle
|
335
|
+
BucketLifecycle.new(
|
336
|
+
bucket_name: @name,
|
337
|
+
client: @client
|
338
|
+
)
|
339
|
+
end
|
341
340
|
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
341
|
+
# @return [BucketLogging]
|
342
|
+
def logging
|
343
|
+
BucketLogging.new(
|
344
|
+
bucket_name: @name,
|
345
|
+
client: @client
|
346
|
+
)
|
347
|
+
end
|
349
348
|
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
end
|
395
|
-
y.yield(batch)
|
349
|
+
# @example Request syntax with placeholder values
|
350
|
+
#
|
351
|
+
# multipart_uploads = bucket.multipart_uploads({
|
352
|
+
# delimiter: "Delimiter",
|
353
|
+
# encoding_type: "url", # accepts url
|
354
|
+
# key_marker: "KeyMarker",
|
355
|
+
# prefix: "Prefix",
|
356
|
+
# upload_id_marker: "UploadIdMarker",
|
357
|
+
# })
|
358
|
+
# @param [Hash] options ({})
|
359
|
+
# @option options [String] :delimiter
|
360
|
+
# Character you use to group keys.
|
361
|
+
# @option options [String] :encoding_type
|
362
|
+
# Requests Amazon S3 to encode the object keys in the response and
|
363
|
+
# specifies the encoding method to use. An object key may contain any
|
364
|
+
# Unicode character; however, XML 1.0 parser cannot parse some
|
365
|
+
# characters, such as characters with an ASCII value from 0 to 10. For
|
366
|
+
# characters that are not supported in XML 1.0, you can add this
|
367
|
+
# parameter to request that Amazon S3 encode the keys in the response.
|
368
|
+
# @option options [String] :key_marker
|
369
|
+
# Together with upload-id-marker, this parameter specifies the multipart
|
370
|
+
# upload after which listing should begin.
|
371
|
+
# @option options [String] :prefix
|
372
|
+
# Lists in-progress uploads only for those keys that begin with the
|
373
|
+
# specified prefix.
|
374
|
+
# @option options [String] :upload_id_marker
|
375
|
+
# Together with key-marker, specifies the multipart upload after which
|
376
|
+
# listing should begin. If key-marker is not specified, the
|
377
|
+
# upload-id-marker parameter is ignored.
|
378
|
+
# @return [MultipartUpload::Collection]
|
379
|
+
def multipart_uploads(options = {})
|
380
|
+
batches = Enumerator.new do |y|
|
381
|
+
options = options.merge(bucket: @name)
|
382
|
+
resp = @client.list_multipart_uploads(options)
|
383
|
+
resp.each_page do |page|
|
384
|
+
batch = []
|
385
|
+
page.data.uploads.each do |u|
|
386
|
+
batch << MultipartUpload.new(
|
387
|
+
bucket_name: @name,
|
388
|
+
object_key: u.key,
|
389
|
+
id: u.upload_id,
|
390
|
+
data: u,
|
391
|
+
client: @client
|
392
|
+
)
|
396
393
|
end
|
394
|
+
y.yield(batch)
|
397
395
|
end
|
398
|
-
MultipartUpload::Collection.new(batches)
|
399
396
|
end
|
397
|
+
MultipartUpload::Collection.new(batches)
|
398
|
+
end
|
400
399
|
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
400
|
+
# @return [BucketNotification]
|
401
|
+
def notification
|
402
|
+
BucketNotification.new(
|
403
|
+
bucket_name: @name,
|
404
|
+
client: @client
|
405
|
+
)
|
406
|
+
end
|
408
407
|
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
408
|
+
# @param [String] key
|
409
|
+
# @return [Object]
|
410
|
+
def object(key)
|
411
|
+
Object.new(
|
412
|
+
bucket_name: @name,
|
413
|
+
key: key,
|
414
|
+
client: @client
|
415
|
+
)
|
416
|
+
end
|
418
417
|
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
end
|
460
|
-
y.yield(batch)
|
418
|
+
# @example Request syntax with placeholder values
|
419
|
+
#
|
420
|
+
# object_versions = bucket.object_versions({
|
421
|
+
# delimiter: "Delimiter",
|
422
|
+
# encoding_type: "url", # accepts url
|
423
|
+
# key_marker: "KeyMarker",
|
424
|
+
# prefix: "Prefix",
|
425
|
+
# version_id_marker: "VersionIdMarker",
|
426
|
+
# })
|
427
|
+
# @param [Hash] options ({})
|
428
|
+
# @option options [String] :delimiter
|
429
|
+
# A delimiter is a character you use to group keys.
|
430
|
+
# @option options [String] :encoding_type
|
431
|
+
# Requests Amazon S3 to encode the object keys in the response and
|
432
|
+
# specifies the encoding method to use. An object key may contain any
|
433
|
+
# Unicode character; however, XML 1.0 parser cannot parse some
|
434
|
+
# characters, such as characters with an ASCII value from 0 to 10. For
|
435
|
+
# characters that are not supported in XML 1.0, you can add this
|
436
|
+
# parameter to request that Amazon S3 encode the keys in the response.
|
437
|
+
# @option options [String] :key_marker
|
438
|
+
# Specifies the key to start with when listing objects in a bucket.
|
439
|
+
# @option options [String] :prefix
|
440
|
+
# Limits the response to keys that begin with the specified prefix.
|
441
|
+
# @option options [String] :version_id_marker
|
442
|
+
# Specifies the object version you want to start listing from.
|
443
|
+
# @return [ObjectVersion::Collection]
|
444
|
+
def object_versions(options = {})
|
445
|
+
batches = Enumerator.new do |y|
|
446
|
+
options = options.merge(bucket: @name)
|
447
|
+
resp = @client.list_object_versions(options)
|
448
|
+
resp.each_page do |page|
|
449
|
+
batch = []
|
450
|
+
page.data.versions_delete_markers.each do |v|
|
451
|
+
batch << ObjectVersion.new(
|
452
|
+
bucket_name: @name,
|
453
|
+
object_key: v.key,
|
454
|
+
id: v.version_id,
|
455
|
+
data: v,
|
456
|
+
client: @client
|
457
|
+
)
|
461
458
|
end
|
459
|
+
y.yield(batch)
|
462
460
|
end
|
463
|
-
ObjectVersion::Collection.new(batches)
|
464
461
|
end
|
462
|
+
ObjectVersion::Collection.new(batches)
|
463
|
+
end
|
465
464
|
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
end
|
505
|
-
y.yield(batch)
|
465
|
+
# @example Request syntax with placeholder values
|
466
|
+
#
|
467
|
+
# objects = bucket.objects({
|
468
|
+
# delimiter: "Delimiter",
|
469
|
+
# encoding_type: "url", # accepts url
|
470
|
+
# prefix: "Prefix",
|
471
|
+
# request_payer: "requester", # accepts requester
|
472
|
+
# })
|
473
|
+
# @param [Hash] options ({})
|
474
|
+
# @option options [String] :delimiter
|
475
|
+
# A delimiter is a character you use to group keys.
|
476
|
+
# @option options [String] :encoding_type
|
477
|
+
# Requests Amazon S3 to encode the object keys in the response and
|
478
|
+
# specifies the encoding method to use. An object key may contain any
|
479
|
+
# Unicode character; however, XML 1.0 parser cannot parse some
|
480
|
+
# characters, such as characters with an ASCII value from 0 to 10. For
|
481
|
+
# characters that are not supported in XML 1.0, you can add this
|
482
|
+
# parameter to request that Amazon S3 encode the keys in the response.
|
483
|
+
# @option options [String] :prefix
|
484
|
+
# Limits the response to keys that begin with the specified prefix.
|
485
|
+
# @option options [String] :request_payer
|
486
|
+
# Confirms that the requester knows that she or he will be charged for
|
487
|
+
# the list objects request. Bucket owners need not specify this
|
488
|
+
# parameter in their requests.
|
489
|
+
# @return [ObjectSummary::Collection]
|
490
|
+
def objects(options = {})
|
491
|
+
batches = Enumerator.new do |y|
|
492
|
+
options = options.merge(bucket: @name)
|
493
|
+
resp = @client.list_objects(options)
|
494
|
+
resp.each_page do |page|
|
495
|
+
batch = []
|
496
|
+
page.data.contents.each do |c|
|
497
|
+
batch << ObjectSummary.new(
|
498
|
+
bucket_name: @name,
|
499
|
+
key: c.key,
|
500
|
+
data: c,
|
501
|
+
client: @client
|
502
|
+
)
|
506
503
|
end
|
504
|
+
y.yield(batch)
|
507
505
|
end
|
508
|
-
ObjectSummary::Collection.new(batches)
|
509
506
|
end
|
507
|
+
ObjectSummary::Collection.new(batches)
|
508
|
+
end
|
510
509
|
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
510
|
+
# @return [BucketPolicy]
|
511
|
+
def policy
|
512
|
+
BucketPolicy.new(
|
513
|
+
bucket_name: @name,
|
514
|
+
client: @client
|
515
|
+
)
|
516
|
+
end
|
518
517
|
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
518
|
+
# @return [BucketRequestPayment]
|
519
|
+
def request_payment
|
520
|
+
BucketRequestPayment.new(
|
521
|
+
bucket_name: @name,
|
522
|
+
client: @client
|
523
|
+
)
|
524
|
+
end
|
526
525
|
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
526
|
+
# @return [BucketTagging]
|
527
|
+
def tagging
|
528
|
+
BucketTagging.new(
|
529
|
+
bucket_name: @name,
|
530
|
+
client: @client
|
531
|
+
)
|
532
|
+
end
|
534
533
|
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
534
|
+
# @return [BucketVersioning]
|
535
|
+
def versioning
|
536
|
+
BucketVersioning.new(
|
537
|
+
bucket_name: @name,
|
538
|
+
client: @client
|
539
|
+
)
|
540
|
+
end
|
542
541
|
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
542
|
+
# @return [BucketWebsite]
|
543
|
+
def website
|
544
|
+
BucketWebsite.new(
|
545
|
+
bucket_name: @name,
|
546
|
+
client: @client
|
547
|
+
)
|
548
|
+
end
|
550
549
|
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
550
|
+
# @deprecated
|
551
|
+
# @api private
|
552
|
+
def identifiers
|
553
|
+
{ name: @name }
|
554
|
+
end
|
555
|
+
deprecated(:identifiers)
|
557
556
|
|
558
|
-
|
557
|
+
private
|
559
558
|
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
end
|
559
|
+
def extract_name(args, options)
|
560
|
+
value = args[0] || options.delete(:name)
|
561
|
+
case value
|
562
|
+
when String then value
|
563
|
+
when nil then raise ArgumentError, "missing required option :name"
|
564
|
+
else
|
565
|
+
msg = "expected :name to be a String, got #{value.class}"
|
566
|
+
raise ArgumentError, msg
|
569
567
|
end
|
568
|
+
end
|
570
569
|
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
end
|
578
|
-
yield(waiter.waiter)
|
570
|
+
def yield_waiter_and_warn(waiter, &block)
|
571
|
+
if !@waiter_block_warned
|
572
|
+
msg = "pass options to configure the waiter; "
|
573
|
+
msg << "yielding the waiter is deprecated"
|
574
|
+
warn(msg)
|
575
|
+
@waiter_block_warned = true
|
579
576
|
end
|
577
|
+
yield(waiter.waiter)
|
578
|
+
end
|
580
579
|
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
end
|
580
|
+
def separate_params_and_options(options)
|
581
|
+
opts = Set.new([:client, :max_attempts, :delay, :before_attempt, :before_wait])
|
582
|
+
waiter_opts = {}
|
583
|
+
waiter_params = {}
|
584
|
+
options.each_pair do |key, value|
|
585
|
+
if opts.include?(key)
|
586
|
+
waiter_opts[key] = value
|
587
|
+
else
|
588
|
+
waiter_params[key] = value
|
591
589
|
end
|
592
|
-
waiter_opts[:client] ||= @client
|
593
|
-
[waiter_opts, waiter_params]
|
594
590
|
end
|
595
|
-
|
596
|
-
|
591
|
+
waiter_opts[:client] ||= @client
|
592
|
+
[waiter_opts, waiter_params]
|
597
593
|
end
|
594
|
+
|
595
|
+
class Collection < Aws::Resources::Collection; end
|
598
596
|
end
|
599
597
|
end
|