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
@@ -245,10 +245,11 @@ module Aws
|
|
245
245
|
# without any errors.
|
246
246
|
#
|
247
247
|
def upload_file(source, options = {})
|
248
|
+
uploading_options = options.dup
|
248
249
|
uploader = FileUploader.new(
|
249
|
-
multipart_threshold:
|
250
|
+
multipart_threshold: uploading_options.delete(:multipart_threshold),
|
250
251
|
client: client)
|
251
|
-
uploader.upload(source,
|
252
|
+
uploader.upload(source, uploading_options.merge(bucket: bucket_name, key: key))
|
252
253
|
true
|
253
254
|
end
|
254
255
|
|
data/lib/aws-sdk-s3/errors.rb
CHANGED
@@ -1,23 +1,14 @@
|
|
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
|
-
module
|
10
|
-
module Errors
|
8
|
+
module Aws::S3
|
9
|
+
module Errors
|
11
10
|
|
12
|
-
|
11
|
+
extend Aws::Errors::DynamicErrors
|
13
12
|
|
14
|
-
# Raised when calling #load or #data on a resource class that can not be
|
15
|
-
# loaded. This can happen when:
|
16
|
-
#
|
17
|
-
# * A resource class has identifiers, but no data attributes.
|
18
|
-
# * Resource data is only available when making an API call that
|
19
|
-
# enumerates all resources of that type.
|
20
|
-
class ResourceNotLoadable < RuntimeError; end
|
21
|
-
end
|
22
13
|
end
|
23
14
|
end
|
@@ -1,287 +1,285 @@
|
|
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
|
-
class MultipartUpload
|
8
|
+
module Aws::S3
|
9
|
+
class MultipartUpload
|
11
10
|
|
12
|
-
|
11
|
+
extend Aws::Deprecations
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
# @overload def initialize(bucket_name, object_key, id, options = {})
|
14
|
+
# @param [String] bucket_name
|
15
|
+
# @param [String] object_key
|
16
|
+
# @param [String] id
|
17
|
+
# @option options [Client] :client
|
18
|
+
# @overload def initialize(options = {})
|
19
|
+
# @option options [required, String] :bucket_name
|
20
|
+
# @option options [required, String] :object_key
|
21
|
+
# @option options [required, String] :id
|
22
|
+
# @option options [Client] :client
|
23
|
+
def initialize(*args)
|
24
|
+
options = Hash === args.last ? args.pop.dup : {}
|
25
|
+
@bucket_name = extract_bucket_name(args, options)
|
26
|
+
@object_key = extract_object_key(args, options)
|
27
|
+
@id = extract_id(args, options)
|
28
|
+
@data = options.delete(:data)
|
29
|
+
@client = options.delete(:client) || Client.new(options)
|
30
|
+
end
|
32
31
|
|
33
|
-
|
32
|
+
# @!group Read-Only Attributes
|
34
33
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
# @return [String]
|
35
|
+
def bucket_name
|
36
|
+
@bucket_name
|
37
|
+
end
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
# @return [String]
|
40
|
+
def object_key
|
41
|
+
@object_key
|
42
|
+
end
|
44
43
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
# @return [String]
|
45
|
+
def id
|
46
|
+
@id
|
47
|
+
end
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
# Upload ID that identifies the multipart upload.
|
50
|
+
# @return [String]
|
51
|
+
def upload_id
|
52
|
+
data.upload_id
|
53
|
+
end
|
55
54
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
55
|
+
# Key of the object for which the multipart upload was initiated.
|
56
|
+
# @return [String]
|
57
|
+
def key
|
58
|
+
data.key
|
59
|
+
end
|
61
60
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
61
|
+
# Date and time at which the multipart upload was initiated.
|
62
|
+
# @return [Time]
|
63
|
+
def initiated
|
64
|
+
data.initiated
|
65
|
+
end
|
67
66
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
67
|
+
# The class of storage used to store the object.
|
68
|
+
# @return [String]
|
69
|
+
def storage_class
|
70
|
+
data.storage_class
|
71
|
+
end
|
73
72
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
73
|
+
# @return [Types::Owner]
|
74
|
+
def owner
|
75
|
+
data.owner
|
76
|
+
end
|
78
77
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
78
|
+
# Identifies who initiated the multipart upload.
|
79
|
+
# @return [Types::Initiator]
|
80
|
+
def initiator
|
81
|
+
data.initiator
|
82
|
+
end
|
84
83
|
|
85
|
-
|
84
|
+
# @!endgroup
|
86
85
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
86
|
+
# @return [Client]
|
87
|
+
def client
|
88
|
+
@client
|
89
|
+
end
|
91
90
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
91
|
+
# @raise [NotImplementedError]
|
92
|
+
# @api private
|
93
|
+
def load
|
94
|
+
msg = "#load is not implemented, data only available via enumeration"
|
95
|
+
raise NotImplementedError, msg
|
96
|
+
end
|
97
|
+
alias :reload :load
|
99
98
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
99
|
+
# @raise [NotImplementedError] Raises when {#data_loaded?} is `false`.
|
100
|
+
# @return [Types::MultipartUpload]
|
101
|
+
# Returns the data for this {MultipartUpload}.
|
102
|
+
def data
|
103
|
+
load unless @data
|
104
|
+
@data
|
105
|
+
end
|
107
106
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
107
|
+
# @return [Boolean]
|
108
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
109
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
110
|
+
def data_loaded?
|
111
|
+
!!@data
|
112
|
+
end
|
114
113
|
|
115
|
-
|
114
|
+
# @!group Actions
|
116
115
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
116
|
+
# @example Request syntax with placeholder values
|
117
|
+
#
|
118
|
+
# multipart_upload.abort({
|
119
|
+
# request_payer: "requester", # accepts requester
|
120
|
+
# })
|
121
|
+
# @param [Hash] options ({})
|
122
|
+
# @option options [String] :request_payer
|
123
|
+
# Confirms that the requester knows that she or he will be charged for
|
124
|
+
# the request. Bucket owners need not specify this parameter in their
|
125
|
+
# requests. Documentation on downloading objects from requester pays
|
126
|
+
# buckets can be found at
|
127
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
128
|
+
# @return [Types::AbortMultipartUploadOutput]
|
129
|
+
def abort(options = {})
|
130
|
+
options = options.merge(
|
131
|
+
bucket: @bucket_name,
|
132
|
+
key: @object_key,
|
133
|
+
upload_id: @id
|
134
|
+
)
|
135
|
+
resp = @client.abort_multipart_upload(options)
|
136
|
+
resp.data
|
137
|
+
end
|
138
|
+
|
139
|
+
# @example Request syntax with placeholder values
|
140
|
+
#
|
141
|
+
# object = multipart_upload.complete({
|
142
|
+
# multipart_upload: {
|
143
|
+
# parts: [
|
144
|
+
# {
|
145
|
+
# etag: "ETag",
|
146
|
+
# part_number: 1,
|
147
|
+
# },
|
148
|
+
# ],
|
149
|
+
# },
|
150
|
+
# request_payer: "requester", # accepts requester
|
151
|
+
# })
|
152
|
+
# @param [Hash] options ({})
|
153
|
+
# @option options [Types::CompletedMultipartUpload] :multipart_upload
|
154
|
+
# @option options [String] :request_payer
|
155
|
+
# Confirms that the requester knows that she or he will be charged for
|
156
|
+
# the request. Bucket owners need not specify this parameter in their
|
157
|
+
# requests. Documentation on downloading objects from requester pays
|
158
|
+
# buckets can be found at
|
159
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
160
|
+
# @return [Object]
|
161
|
+
def complete(options = {})
|
162
|
+
options = options.merge(
|
163
|
+
bucket: @bucket_name,
|
164
|
+
key: @object_key,
|
165
|
+
upload_id: @id
|
166
|
+
)
|
167
|
+
resp = @client.complete_multipart_upload(options)
|
168
|
+
Object.new(
|
169
|
+
bucket_name: @bucket_name,
|
170
|
+
key: @object_key,
|
171
|
+
client: @client
|
172
|
+
)
|
173
|
+
end
|
174
|
+
|
175
|
+
# @!group Associations
|
176
|
+
|
177
|
+
# @return [Object]
|
178
|
+
def object
|
179
|
+
Object.new(
|
180
|
+
bucket_name: @bucket_name,
|
181
|
+
key: @object_key,
|
182
|
+
client: @client
|
183
|
+
)
|
184
|
+
end
|
139
185
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
186
|
+
# @param [String] part_number
|
187
|
+
# @return [MultipartUploadPart]
|
188
|
+
def part(part_number)
|
189
|
+
MultipartUploadPart.new(
|
190
|
+
bucket_name: @bucket_name,
|
191
|
+
object_key: @object_key,
|
192
|
+
multipart_upload_id: @id,
|
193
|
+
part_number: part_number,
|
194
|
+
client: @client
|
195
|
+
)
|
196
|
+
end
|
197
|
+
|
198
|
+
# @example Request syntax with placeholder values
|
199
|
+
#
|
200
|
+
# parts = multipart_upload.parts({
|
201
|
+
# request_payer: "requester", # accepts requester
|
202
|
+
# })
|
203
|
+
# @param [Hash] options ({})
|
204
|
+
# @option options [String] :request_payer
|
205
|
+
# Confirms that the requester knows that she or he will be charged for
|
206
|
+
# the request. Bucket owners need not specify this parameter in their
|
207
|
+
# requests. Documentation on downloading objects from requester pays
|
208
|
+
# buckets can be found at
|
209
|
+
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
210
|
+
# @return [MultipartUploadPart::Collection]
|
211
|
+
def parts(options = {})
|
212
|
+
batches = Enumerator.new do |y|
|
163
213
|
options = options.merge(
|
164
214
|
bucket: @bucket_name,
|
165
215
|
key: @object_key,
|
166
216
|
upload_id: @id
|
167
217
|
)
|
168
|
-
resp = @client.
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
Object.new(
|
181
|
-
bucket_name: @bucket_name,
|
182
|
-
key: @object_key,
|
183
|
-
client: @client
|
184
|
-
)
|
185
|
-
end
|
186
|
-
|
187
|
-
# @param [String] part_number
|
188
|
-
# @return [MultipartUploadPart]
|
189
|
-
def part(part_number)
|
190
|
-
MultipartUploadPart.new(
|
191
|
-
bucket_name: @bucket_name,
|
192
|
-
object_key: @object_key,
|
193
|
-
multipart_upload_id: @id,
|
194
|
-
part_number: part_number,
|
195
|
-
client: @client
|
196
|
-
)
|
197
|
-
end
|
198
|
-
|
199
|
-
# @example Request syntax with placeholder values
|
200
|
-
#
|
201
|
-
# parts = multipart_upload.parts({
|
202
|
-
# request_payer: "requester", # accepts requester
|
203
|
-
# })
|
204
|
-
# @param [Hash] options ({})
|
205
|
-
# @option options [String] :request_payer
|
206
|
-
# Confirms that the requester knows that she or he will be charged for
|
207
|
-
# the request. Bucket owners need not specify this parameter in their
|
208
|
-
# requests. Documentation on downloading objects from requester pays
|
209
|
-
# buckets can be found at
|
210
|
-
# http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
|
211
|
-
# @return [MultipartUploadPart::Collection]
|
212
|
-
def parts(options = {})
|
213
|
-
batches = Enumerator.new do |y|
|
214
|
-
options = options.merge(
|
215
|
-
bucket: @bucket_name,
|
216
|
-
key: @object_key,
|
217
|
-
upload_id: @id
|
218
|
-
)
|
219
|
-
resp = @client.list_parts(options)
|
220
|
-
resp.each_page do |page|
|
221
|
-
batch = []
|
222
|
-
page.data.parts.each do |p|
|
223
|
-
batch << MultipartUploadPart.new(
|
224
|
-
bucket_name: options[:bucket],
|
225
|
-
object_key: options[:key],
|
226
|
-
multipart_upload_id: options[:upload_id],
|
227
|
-
part_number: p.part_number,
|
228
|
-
data: p,
|
229
|
-
client: @client
|
230
|
-
)
|
231
|
-
end
|
232
|
-
y.yield(batch)
|
218
|
+
resp = @client.list_parts(options)
|
219
|
+
resp.each_page do |page|
|
220
|
+
batch = []
|
221
|
+
page.data.parts.each do |p|
|
222
|
+
batch << MultipartUploadPart.new(
|
223
|
+
bucket_name: options[:bucket],
|
224
|
+
object_key: options[:key],
|
225
|
+
multipart_upload_id: options[:upload_id],
|
226
|
+
part_number: p.part_number,
|
227
|
+
data: p,
|
228
|
+
client: @client
|
229
|
+
)
|
233
230
|
end
|
231
|
+
y.yield(batch)
|
234
232
|
end
|
235
|
-
MultipartUploadPart::Collection.new(batches)
|
236
233
|
end
|
234
|
+
MultipartUploadPart::Collection.new(batches)
|
235
|
+
end
|
237
236
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
237
|
+
# @deprecated
|
238
|
+
# @api private
|
239
|
+
def identifiers
|
240
|
+
{
|
241
|
+
bucket_name: @bucket_name,
|
242
|
+
object_key: @object_key,
|
243
|
+
id: @id
|
244
|
+
}
|
245
|
+
end
|
246
|
+
deprecated(:identifiers)
|
248
247
|
|
249
|
-
|
248
|
+
private
|
250
249
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
end
|
250
|
+
def extract_bucket_name(args, options)
|
251
|
+
value = args[0] || options.delete(:bucket_name)
|
252
|
+
case value
|
253
|
+
when String then value
|
254
|
+
when nil then raise ArgumentError, "missing required option :bucket_name"
|
255
|
+
else
|
256
|
+
msg = "expected :bucket_name to be a String, got #{value.class}"
|
257
|
+
raise ArgumentError, msg
|
260
258
|
end
|
259
|
+
end
|
261
260
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
end
|
261
|
+
def extract_object_key(args, options)
|
262
|
+
value = args[1] || options.delete(:object_key)
|
263
|
+
case value
|
264
|
+
when String then value
|
265
|
+
when nil then raise ArgumentError, "missing required option :object_key"
|
266
|
+
else
|
267
|
+
msg = "expected :object_key to be a String, got #{value.class}"
|
268
|
+
raise ArgumentError, msg
|
271
269
|
end
|
270
|
+
end
|
272
271
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
end
|
272
|
+
def extract_id(args, options)
|
273
|
+
value = args[2] || options.delete(:id)
|
274
|
+
case value
|
275
|
+
when String then value
|
276
|
+
when nil then raise ArgumentError, "missing required option :id"
|
277
|
+
else
|
278
|
+
msg = "expected :id to be a String, got #{value.class}"
|
279
|
+
raise ArgumentError, msg
|
282
280
|
end
|
283
|
-
|
284
|
-
class Collection < Aws::Resources::Collection; end
|
285
281
|
end
|
282
|
+
|
283
|
+
class Collection < Aws::Resources::Collection; end
|
286
284
|
end
|
287
285
|
end
|