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

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,314 +1,312 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
3
+ # This file is generated. See the contributing guide for more information:
4
4
  # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
5
  #
6
6
  # WARNING ABOUT GENERATED CODE
7
7
 
8
- module Aws
9
- module S3
10
- class MultipartUploadPart
8
+ module Aws::S3
9
+ class MultipartUploadPart
11
10
 
12
- extend Aws::Deprecations
11
+ extend Aws::Deprecations
13
12
 
14
- # @overload def initialize(bucket_name, object_key, multipart_upload_id, part_number, options = {})
15
- # @param [String] bucket_name
16
- # @param [String] object_key
17
- # @param [String] multipart_upload_id
18
- # @param [Integer] part_number
19
- # @option options [Client] :client
20
- # @overload def initialize(options = {})
21
- # @option options [required, String] :bucket_name
22
- # @option options [required, String] :object_key
23
- # @option options [required, String] :multipart_upload_id
24
- # @option options [required, Integer] :part_number
25
- # @option options [Client] :client
26
- def initialize(*args)
27
- options = Hash === args.last ? args.pop.dup : {}
28
- @bucket_name = extract_bucket_name(args, options)
29
- @object_key = extract_object_key(args, options)
30
- @multipart_upload_id = extract_multipart_upload_id(args, options)
31
- @part_number = extract_part_number(args, options)
32
- @data = options.delete(:data)
33
- @client = options.delete(:client) || Client.new(options)
34
- end
13
+ # @overload def initialize(bucket_name, object_key, multipart_upload_id, part_number, options = {})
14
+ # @param [String] bucket_name
15
+ # @param [String] object_key
16
+ # @param [String] multipart_upload_id
17
+ # @param [Integer] part_number
18
+ # @option options [Client] :client
19
+ # @overload def initialize(options = {})
20
+ # @option options [required, String] :bucket_name
21
+ # @option options [required, String] :object_key
22
+ # @option options [required, String] :multipart_upload_id
23
+ # @option options [required, Integer] :part_number
24
+ # @option options [Client] :client
25
+ def initialize(*args)
26
+ options = Hash === args.last ? args.pop.dup : {}
27
+ @bucket_name = extract_bucket_name(args, options)
28
+ @object_key = extract_object_key(args, options)
29
+ @multipart_upload_id = extract_multipart_upload_id(args, options)
30
+ @part_number = extract_part_number(args, options)
31
+ @data = options.delete(:data)
32
+ @client = options.delete(:client) || Client.new(options)
33
+ end
35
34
 
36
- # @!group Read-Only Attributes
35
+ # @!group Read-Only Attributes
37
36
 
38
- # @return [String]
39
- def bucket_name
40
- @bucket_name
41
- end
37
+ # @return [String]
38
+ def bucket_name
39
+ @bucket_name
40
+ end
42
41
 
43
- # @return [String]
44
- def object_key
45
- @object_key
46
- end
42
+ # @return [String]
43
+ def object_key
44
+ @object_key
45
+ end
47
46
 
48
- # @return [String]
49
- def multipart_upload_id
50
- @multipart_upload_id
51
- end
47
+ # @return [String]
48
+ def multipart_upload_id
49
+ @multipart_upload_id
50
+ end
52
51
 
53
- # @return [Integer]
54
- def part_number
55
- @part_number
56
- end
52
+ # @return [Integer]
53
+ def part_number
54
+ @part_number
55
+ end
57
56
 
58
- # Date and time at which the part was uploaded.
59
- # @return [Time]
60
- def last_modified
61
- data.last_modified
62
- end
57
+ # Date and time at which the part was uploaded.
58
+ # @return [Time]
59
+ def last_modified
60
+ data.last_modified
61
+ end
63
62
 
64
- # Entity tag returned when the part was uploaded.
65
- # @return [String]
66
- def etag
67
- data.etag
68
- end
63
+ # Entity tag returned when the part was uploaded.
64
+ # @return [String]
65
+ def etag
66
+ data.etag
67
+ end
69
68
 
70
- # Size of the uploaded part data.
71
- # @return [Integer]
72
- def size
73
- data.size
74
- end
69
+ # Size of the uploaded part data.
70
+ # @return [Integer]
71
+ def size
72
+ data.size
73
+ end
75
74
 
76
- # @!endgroup
75
+ # @!endgroup
77
76
 
78
- # @return [Client]
79
- def client
80
- @client
81
- end
77
+ # @return [Client]
78
+ def client
79
+ @client
80
+ end
82
81
 
83
- # @raise [Errors::ResourceNotLoadable]
84
- # @api private
85
- def load
86
- msg = "#load is not implemented, data only available via enumeration"
87
- raise Errors::ResourceNotLoadable, msg
88
- end
89
- alias :reload :load
82
+ # @raise [NotImplementedError]
83
+ # @api private
84
+ def load
85
+ msg = "#load is not implemented, data only available via enumeration"
86
+ raise NotImplementedError, msg
87
+ end
88
+ alias :reload :load
90
89
 
91
- # @raise [Errors::ResourceNotLoadableError] Raises when {#data_loaded?} is `false`.
92
- # @return [Types::Part]
93
- # Returns the data for this {MultipartUploadPart}.
94
- def data
95
- load unless @data
96
- @data
97
- end
90
+ # @raise [NotImplementedError] Raises when {#data_loaded?} is `false`.
91
+ # @return [Types::Part]
92
+ # Returns the data for this {MultipartUploadPart}.
93
+ def data
94
+ load unless @data
95
+ @data
96
+ end
98
97
 
99
- # @return [Boolean]
100
- # Returns `true` if this resource is loaded. Accessing attributes or
101
- # {#data} on an unloaded resource will trigger a call to {#load}.
102
- def data_loaded?
103
- !!@data
104
- end
98
+ # @return [Boolean]
99
+ # Returns `true` if this resource is loaded. Accessing attributes or
100
+ # {#data} on an unloaded resource will trigger a call to {#load}.
101
+ def data_loaded?
102
+ !!@data
103
+ end
105
104
 
106
- # @!group Actions
105
+ # @!group Actions
107
106
 
108
- # @example Request syntax with placeholder values
109
- #
110
- # multipart_upload_part.copy_from({
111
- # copy_source: "CopySource", # required
112
- # copy_source_if_match: "CopySourceIfMatch",
113
- # copy_source_if_modified_since: Time.now,
114
- # copy_source_if_none_match: "CopySourceIfNoneMatch",
115
- # copy_source_if_unmodified_since: Time.now,
116
- # copy_source_range: "CopySourceRange",
117
- # sse_customer_algorithm: "SSECustomerAlgorithm",
118
- # sse_customer_key: "SSECustomerKey",
119
- # sse_customer_key_md5: "SSECustomerKeyMD5",
120
- # copy_source_sse_customer_algorithm: "CopySourceSSECustomerAlgorithm",
121
- # copy_source_sse_customer_key: "CopySourceSSECustomerKey",
122
- # copy_source_sse_customer_key_md5: "CopySourceSSECustomerKeyMD5",
123
- # request_payer: "requester", # accepts requester
124
- # })
125
- # @param [Hash] options ({})
126
- # @option options [required, String] :copy_source
127
- # The name of the source bucket and key name of the source object,
128
- # separated by a slash (/). Must be URL-encoded.
129
- # @option options [String] :copy_source_if_match
130
- # Copies the object if its entity tag (ETag) matches the specified tag.
131
- # @option options [Time,DateTime,Date,Integer,String] :copy_source_if_modified_since
132
- # Copies the object if it has been modified since the specified time.
133
- # @option options [String] :copy_source_if_none_match
134
- # Copies the object if its entity tag (ETag) is different than the
135
- # specified ETag.
136
- # @option options [Time,DateTime,Date,Integer,String] :copy_source_if_unmodified_since
137
- # Copies the object if it hasn't been modified since the specified
138
- # time.
139
- # @option options [String] :copy_source_range
140
- # The range of bytes to copy from the source object. The range value
141
- # must use the form bytes=first-last, where the first and last are the
142
- # zero-based byte offsets to copy. For example, bytes=0-9 indicates that
143
- # you want to copy the first ten bytes of the source. You can copy a
144
- # range only if the source object is greater than 5 GB.
145
- # @option options [String] :sse_customer_algorithm
146
- # Specifies the algorithm to use to when encrypting the object (e.g.,
147
- # AES256).
148
- # @option options [String] :sse_customer_key
149
- # Specifies the customer-provided encryption key for Amazon S3 to use in
150
- # encrypting data. This value is used to store the object and then it is
151
- # discarded; Amazon does not store the encryption key. The key must be
152
- # appropriate for use with the algorithm specified in the
153
- # x-amz-server-side​-encryption​-customer-algorithm header. This must be
154
- # the same encryption key specified in the initiate multipart upload
155
- # request.
156
- # @option options [String] :sse_customer_key_md5
157
- # Specifies the 128-bit MD5 digest of the encryption key according to
158
- # RFC 1321. Amazon S3 uses this header for a message integrity check to
159
- # ensure the encryption key was transmitted without error.
160
- # @option options [String] :copy_source_sse_customer_algorithm
161
- # Specifies the algorithm to use when decrypting the source object
162
- # (e.g., AES256).
163
- # @option options [String] :copy_source_sse_customer_key
164
- # Specifies the customer-provided encryption key for Amazon S3 to use to
165
- # decrypt the source object. The encryption key provided in this header
166
- # must be one that was used when the source object was created.
167
- # @option options [String] :copy_source_sse_customer_key_md5
168
- # Specifies the 128-bit MD5 digest of the encryption key according to
169
- # RFC 1321. Amazon S3 uses this header for a message integrity check to
170
- # ensure the encryption key was transmitted without error.
171
- # @option options [String] :request_payer
172
- # Confirms that the requester knows that she or he will be charged for
173
- # the request. Bucket owners need not specify this parameter in their
174
- # requests. Documentation on downloading objects from requester pays
175
- # buckets can be found at
176
- # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
177
- # @return [Types::UploadPartCopyOutput]
178
- def copy_from(options = {})
179
- options = options.merge(
180
- bucket: @bucket_name,
181
- key: @object_key,
182
- upload_id: @multipart_upload_id,
183
- part_number: @part_number
184
- )
185
- resp = @client.upload_part_copy(options)
186
- resp.data
187
- end
107
+ # @example Request syntax with placeholder values
108
+ #
109
+ # multipart_upload_part.copy_from({
110
+ # copy_source: "CopySource", # required
111
+ # copy_source_if_match: "CopySourceIfMatch",
112
+ # copy_source_if_modified_since: Time.now,
113
+ # copy_source_if_none_match: "CopySourceIfNoneMatch",
114
+ # copy_source_if_unmodified_since: Time.now,
115
+ # copy_source_range: "CopySourceRange",
116
+ # sse_customer_algorithm: "SSECustomerAlgorithm",
117
+ # sse_customer_key: "SSECustomerKey",
118
+ # sse_customer_key_md5: "SSECustomerKeyMD5",
119
+ # copy_source_sse_customer_algorithm: "CopySourceSSECustomerAlgorithm",
120
+ # copy_source_sse_customer_key: "CopySourceSSECustomerKey",
121
+ # copy_source_sse_customer_key_md5: "CopySourceSSECustomerKeyMD5",
122
+ # request_payer: "requester", # accepts requester
123
+ # })
124
+ # @param [Hash] options ({})
125
+ # @option options [required, String] :copy_source
126
+ # The name of the source bucket and key name of the source object,
127
+ # separated by a slash (/). Must be URL-encoded.
128
+ # @option options [String] :copy_source_if_match
129
+ # Copies the object if its entity tag (ETag) matches the specified tag.
130
+ # @option options [Time,DateTime,Date,Integer,String] :copy_source_if_modified_since
131
+ # Copies the object if it has been modified since the specified time.
132
+ # @option options [String] :copy_source_if_none_match
133
+ # Copies the object if its entity tag (ETag) is different than the
134
+ # specified ETag.
135
+ # @option options [Time,DateTime,Date,Integer,String] :copy_source_if_unmodified_since
136
+ # Copies the object if it hasn't been modified since the specified
137
+ # time.
138
+ # @option options [String] :copy_source_range
139
+ # The range of bytes to copy from the source object. The range value
140
+ # must use the form bytes=first-last, where the first and last are the
141
+ # zero-based byte offsets to copy. For example, bytes=0-9 indicates that
142
+ # you want to copy the first ten bytes of the source. You can copy a
143
+ # range only if the source object is greater than 5 GB.
144
+ # @option options [String] :sse_customer_algorithm
145
+ # Specifies the algorithm to use to when encrypting the object (e.g.,
146
+ # AES256).
147
+ # @option options [String] :sse_customer_key
148
+ # Specifies the customer-provided encryption key for Amazon S3 to use in
149
+ # encrypting data. This value is used to store the object and then it is
150
+ # discarded; Amazon does not store the encryption key. The key must be
151
+ # appropriate for use with the algorithm specified in the
152
+ # x-amz-server-side​-encryption​-customer-algorithm header. This must be
153
+ # the same encryption key specified in the initiate multipart upload
154
+ # request.
155
+ # @option options [String] :sse_customer_key_md5
156
+ # Specifies the 128-bit MD5 digest of the encryption key according to
157
+ # RFC 1321. Amazon S3 uses this header for a message integrity check to
158
+ # ensure the encryption key was transmitted without error.
159
+ # @option options [String] :copy_source_sse_customer_algorithm
160
+ # Specifies the algorithm to use when decrypting the source object
161
+ # (e.g., AES256).
162
+ # @option options [String] :copy_source_sse_customer_key
163
+ # Specifies the customer-provided encryption key for Amazon S3 to use to
164
+ # decrypt the source object. The encryption key provided in this header
165
+ # must be one that was used when the source object was created.
166
+ # @option options [String] :copy_source_sse_customer_key_md5
167
+ # Specifies the 128-bit MD5 digest of the encryption key according to
168
+ # RFC 1321. Amazon S3 uses this header for a message integrity check to
169
+ # ensure the encryption key was transmitted without error.
170
+ # @option options [String] :request_payer
171
+ # Confirms that the requester knows that she or he will be charged for
172
+ # the request. Bucket owners need not specify this parameter in their
173
+ # requests. Documentation on downloading objects from requester pays
174
+ # buckets can be found at
175
+ # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
176
+ # @return [Types::UploadPartCopyOutput]
177
+ def copy_from(options = {})
178
+ options = options.merge(
179
+ bucket: @bucket_name,
180
+ key: @object_key,
181
+ upload_id: @multipart_upload_id,
182
+ part_number: @part_number
183
+ )
184
+ resp = @client.upload_part_copy(options)
185
+ resp.data
186
+ end
188
187
 
189
- # @example Request syntax with placeholder values
190
- #
191
- # multipart_upload_part.upload({
192
- # body: source_file,
193
- # content_length: 1,
194
- # content_md5: "ContentMD5",
195
- # sse_customer_algorithm: "SSECustomerAlgorithm",
196
- # sse_customer_key: "SSECustomerKey",
197
- # sse_customer_key_md5: "SSECustomerKeyMD5",
198
- # request_payer: "requester", # accepts requester
199
- # })
200
- # @param [Hash] options ({})
201
- # @option options [String, IO] :body
202
- # Object data.
203
- # @option options [Integer] :content_length
204
- # Size of the body in bytes. This parameter is useful when the size of
205
- # the body cannot be determined automatically.
206
- # @option options [String] :content_md5
207
- # The base64-encoded 128-bit MD5 digest of the part data.
208
- # @option options [String] :sse_customer_algorithm
209
- # Specifies the algorithm to use to when encrypting the object (e.g.,
210
- # AES256).
211
- # @option options [String] :sse_customer_key
212
- # Specifies the customer-provided encryption key for Amazon S3 to use in
213
- # encrypting data. This value is used to store the object and then it is
214
- # discarded; Amazon does not store the encryption key. The key must be
215
- # appropriate for use with the algorithm specified in the
216
- # x-amz-server-side​-encryption​-customer-algorithm header. This must be
217
- # the same encryption key specified in the initiate multipart upload
218
- # request.
219
- # @option options [String] :sse_customer_key_md5
220
- # Specifies the 128-bit MD5 digest of the encryption key according to
221
- # RFC 1321. Amazon S3 uses this header for a message integrity check to
222
- # ensure the encryption key was transmitted without error.
223
- # @option options [String] :request_payer
224
- # Confirms that the requester knows that she or he will be charged for
225
- # the request. Bucket owners need not specify this parameter in their
226
- # requests. Documentation on downloading objects from requester pays
227
- # buckets can be found at
228
- # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
229
- # @return [Types::UploadPartOutput]
230
- def upload(options = {})
231
- options = options.merge(
232
- bucket: @bucket_name,
233
- key: @object_key,
234
- upload_id: @multipart_upload_id,
235
- part_number: @part_number
236
- )
237
- resp = @client.upload_part(options)
238
- resp.data
239
- end
188
+ # @example Request syntax with placeholder values
189
+ #
190
+ # multipart_upload_part.upload({
191
+ # body: source_file,
192
+ # content_length: 1,
193
+ # content_md5: "ContentMD5",
194
+ # sse_customer_algorithm: "SSECustomerAlgorithm",
195
+ # sse_customer_key: "SSECustomerKey",
196
+ # sse_customer_key_md5: "SSECustomerKeyMD5",
197
+ # request_payer: "requester", # accepts requester
198
+ # })
199
+ # @param [Hash] options ({})
200
+ # @option options [String, IO] :body
201
+ # Object data.
202
+ # @option options [Integer] :content_length
203
+ # Size of the body in bytes. This parameter is useful when the size of
204
+ # the body cannot be determined automatically.
205
+ # @option options [String] :content_md5
206
+ # The base64-encoded 128-bit MD5 digest of the part data.
207
+ # @option options [String] :sse_customer_algorithm
208
+ # Specifies the algorithm to use to when encrypting the object (e.g.,
209
+ # AES256).
210
+ # @option options [String] :sse_customer_key
211
+ # Specifies the customer-provided encryption key for Amazon S3 to use in
212
+ # encrypting data. This value is used to store the object and then it is
213
+ # discarded; Amazon does not store the encryption key. The key must be
214
+ # appropriate for use with the algorithm specified in the
215
+ # x-amz-server-side​-encryption​-customer-algorithm header. This must be
216
+ # the same encryption key specified in the initiate multipart upload
217
+ # request.
218
+ # @option options [String] :sse_customer_key_md5
219
+ # Specifies the 128-bit MD5 digest of the encryption key according to
220
+ # RFC 1321. Amazon S3 uses this header for a message integrity check to
221
+ # ensure the encryption key was transmitted without error.
222
+ # @option options [String] :request_payer
223
+ # Confirms that the requester knows that she or he will be charged for
224
+ # the request. Bucket owners need not specify this parameter in their
225
+ # requests. Documentation on downloading objects from requester pays
226
+ # buckets can be found at
227
+ # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
228
+ # @return [Types::UploadPartOutput]
229
+ def upload(options = {})
230
+ options = options.merge(
231
+ bucket: @bucket_name,
232
+ key: @object_key,
233
+ upload_id: @multipart_upload_id,
234
+ part_number: @part_number
235
+ )
236
+ resp = @client.upload_part(options)
237
+ resp.data
238
+ end
240
239
 
241
- # @!group Associations
240
+ # @!group Associations
242
241
 
243
- # @return [MultipartUpload]
244
- def multipart_upload
245
- MultipartUpload.new(
246
- bucket_name: @bucket_name,
247
- object_key: @object_key,
248
- id: @multipart_upload_id,
249
- client: @client
250
- )
251
- end
242
+ # @return [MultipartUpload]
243
+ def multipart_upload
244
+ MultipartUpload.new(
245
+ bucket_name: @bucket_name,
246
+ object_key: @object_key,
247
+ id: @multipart_upload_id,
248
+ client: @client
249
+ )
250
+ end
252
251
 
253
- # @deprecated
254
- # @api private
255
- def identifiers
256
- {
257
- bucket_name: @bucket_name,
258
- object_key: @object_key,
259
- multipart_upload_id: @multipart_upload_id,
260
- part_number: @part_number
261
- }
262
- end
263
- deprecated(:identifiers)
252
+ # @deprecated
253
+ # @api private
254
+ def identifiers
255
+ {
256
+ bucket_name: @bucket_name,
257
+ object_key: @object_key,
258
+ multipart_upload_id: @multipart_upload_id,
259
+ part_number: @part_number
260
+ }
261
+ end
262
+ deprecated(:identifiers)
264
263
 
265
- private
264
+ private
266
265
 
267
- def extract_bucket_name(args, options)
268
- value = args[0] || options.delete(:bucket_name)
269
- case value
270
- when String then value
271
- when nil then raise ArgumentError, "missing required option :bucket_name"
272
- else
273
- msg = "expected :bucket_name to be a String, got #{value.class}"
274
- raise ArgumentError, msg
275
- end
266
+ def extract_bucket_name(args, options)
267
+ value = args[0] || options.delete(:bucket_name)
268
+ case value
269
+ when String then value
270
+ when nil then raise ArgumentError, "missing required option :bucket_name"
271
+ else
272
+ msg = "expected :bucket_name to be a String, got #{value.class}"
273
+ raise ArgumentError, msg
276
274
  end
275
+ end
277
276
 
278
- def extract_object_key(args, options)
279
- value = args[1] || options.delete(:object_key)
280
- case value
281
- when String then value
282
- when nil then raise ArgumentError, "missing required option :object_key"
283
- else
284
- msg = "expected :object_key to be a String, got #{value.class}"
285
- raise ArgumentError, msg
286
- end
277
+ def extract_object_key(args, options)
278
+ value = args[1] || options.delete(:object_key)
279
+ case value
280
+ when String then value
281
+ when nil then raise ArgumentError, "missing required option :object_key"
282
+ else
283
+ msg = "expected :object_key to be a String, got #{value.class}"
284
+ raise ArgumentError, msg
287
285
  end
286
+ end
288
287
 
289
- def extract_multipart_upload_id(args, options)
290
- value = args[2] || options.delete(:multipart_upload_id)
291
- case value
292
- when String then value
293
- when nil then raise ArgumentError, "missing required option :multipart_upload_id"
294
- else
295
- msg = "expected :multipart_upload_id to be a String, got #{value.class}"
296
- raise ArgumentError, msg
297
- end
288
+ def extract_multipart_upload_id(args, options)
289
+ value = args[2] || options.delete(:multipart_upload_id)
290
+ case value
291
+ when String then value
292
+ when nil then raise ArgumentError, "missing required option :multipart_upload_id"
293
+ else
294
+ msg = "expected :multipart_upload_id to be a String, got #{value.class}"
295
+ raise ArgumentError, msg
298
296
  end
297
+ end
299
298
 
300
- def extract_part_number(args, options)
301
- value = args[3] || options.delete(:part_number)
302
- case value
303
- when Integer then value
304
- when nil then raise ArgumentError, "missing required option :part_number"
305
- else
306
- msg = "expected :part_number to be a Integer, got #{value.class}"
307
- raise ArgumentError, msg
308
- end
299
+ def extract_part_number(args, options)
300
+ value = args[3] || options.delete(:part_number)
301
+ case value
302
+ when Integer then value
303
+ when nil then raise ArgumentError, "missing required option :part_number"
304
+ else
305
+ msg = "expected :part_number to be a Integer, got #{value.class}"
306
+ raise ArgumentError, msg
309
307
  end
310
-
311
- class Collection < Aws::Resources::Collection; end
312
308
  end
309
+
310
+ class Collection < Aws::Resources::Collection; end
313
311
  end
314
312
  end