oss 0.1.1 → 0.1.2
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/README.md +641 -0
- data/lib/oss/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c64351f553df8d0f35e61b0b70a8d2ce71f61b41
|
4
|
+
data.tar.gz: 6d3f3b16ce830d02c4772eca63e344c323ef8b88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb5bf2d3528123b8991764b8e77eda0a27b76193550ebaa1a4eb6bb67d3ccd07fe2af94045962271049aa0a719d5a5b6ed9fc5f7440ffebc304488ec33e81fdb
|
7
|
+
data.tar.gz: 9edb1a15057ea3d761c69743e62295b48c9f4c951a30786e7e0ef6d6987d7bbd7977d1317b92c2eca1b131ebc4dd448bf3ba93d45a22beb270af86a44f618fce
|
data/README.md
CHANGED
@@ -107,6 +107,647 @@ file.close
|
|
107
107
|
```
|
108
108
|
you can find more api options in API Doc `OSS::Object`
|
109
109
|
|
110
|
+
## API
|
111
|
+
|
112
|
+
### Service Operations
|
113
|
+
Class `Oss::Service`
|
114
|
+
|
115
|
+
#### .get_service(options)
|
116
|
+
|
117
|
+
List buckets in this account.
|
118
|
+
|
119
|
+
parameters:
|
120
|
+
|
121
|
+
- `options` {Hash} query parameters, default is `nil`
|
122
|
+
- `prefix` {string} search buckets using `prefix` key
|
123
|
+
- `marker` {string} search start from `marker`, including `marker` key
|
124
|
+
- `max_keys` {String} max buckets, default is `100`, limit to `1000`
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
service = @api.get_service(prefix: 'prefix')
|
128
|
+
```
|
129
|
+
Success will return service class object, use chain method get response params.
|
130
|
+
|
131
|
+
- `.buckets`
|
132
|
+
return buckets Array
|
133
|
+
```ruby
|
134
|
+
service.buckets.each do |bucket|
|
135
|
+
puts bucket[:location]
|
136
|
+
puts bucket[:name]
|
137
|
+
puts bucket[:creation_date]
|
138
|
+
end
|
139
|
+
```
|
140
|
+
|
141
|
+
- `.owner`
|
142
|
+
return owner info
|
143
|
+
```ruby
|
144
|
+
puts service.owner[:id]
|
145
|
+
puts service.owner[:name]
|
146
|
+
```
|
147
|
+
|
148
|
+
- `.prefix, .marker, .max_keys, .is_truncated, .next_marker`
|
149
|
+
return option infos
|
150
|
+
```ruby
|
151
|
+
puts service.prefix
|
152
|
+
puts service.max_keys
|
153
|
+
```
|
154
|
+
|
155
|
+
#### .list_buckets
|
156
|
+
|
157
|
+
same as get_service, its a alias
|
158
|
+
|
159
|
+
### Bucket Operations
|
160
|
+
Class `Oss::Bucket`
|
161
|
+
|
162
|
+
#### .put_bucket(bucket_name, acl)
|
163
|
+
|
164
|
+
Create a new bucket.
|
165
|
+
|
166
|
+
parameters:
|
167
|
+
|
168
|
+
- `name` {String} bucket name
|
169
|
+
- `acl` {String} set bucket acl, `public-read-write`, `public-read`, `private`
|
170
|
+
|
171
|
+
```ruby
|
172
|
+
@api.put_bucket('bucket_name', 'public-read')
|
173
|
+
```
|
174
|
+
if success will return true
|
175
|
+
|
176
|
+
#### .put_bucket_acl(bucket_name, acl)
|
177
|
+
|
178
|
+
Update the bucket ACL.
|
179
|
+
|
180
|
+
parameters:
|
181
|
+
- `name` {String} bucket name
|
182
|
+
- `acl` {String} set bucket acl, `public-read-write`, `public-read`, `private`
|
183
|
+
|
184
|
+
```ruby
|
185
|
+
@api.put_bucket_acl('bucket_name', 'public-read')
|
186
|
+
```
|
187
|
+
if success will return true
|
188
|
+
|
189
|
+
#### .put_bucket_logging(bucket_name, target_bucket, enable, target_prefix)
|
190
|
+
|
191
|
+
Update the bucket logging settings. Log file will create every one hour and name format: <prefix><bucket>-YYYY-mm-DD-HH-MM-SS-UniqueString.
|
192
|
+
|
193
|
+
parameters:
|
194
|
+
- `name` {String} bucket name
|
195
|
+
- `target_bucket` {String} log storage target bucket
|
196
|
+
- `enable` {Bool} enable or disable log
|
197
|
+
- `target_prefix` {String} log file prefix
|
198
|
+
|
199
|
+
```ruby
|
200
|
+
@api.put_bucket_logging('bucket_name', 'bucket_name', true, 'prefix-')
|
201
|
+
```
|
202
|
+
if success will return true
|
203
|
+
|
204
|
+
#### .put_bucket_website(bucket_name, index_doc, error_doc)
|
205
|
+
|
206
|
+
Set the bucket as a static website.
|
207
|
+
|
208
|
+
parameters:
|
209
|
+
- `bucket_name` {String} bucket name
|
210
|
+
- `index_doc` {String} index file object key
|
211
|
+
- `error_doc` {String} error file object key
|
212
|
+
|
213
|
+
```ruby
|
214
|
+
@api.put_bucket_website('bucket_name', 'index.html', '404.html')
|
215
|
+
```
|
216
|
+
|
217
|
+
if success will return true
|
218
|
+
|
219
|
+
#### .put_bucket_referer(bucket_name, allow_empty, referer_list)
|
220
|
+
|
221
|
+
Set the bucket request Referer white list.
|
222
|
+
|
223
|
+
parameters:
|
224
|
+
- `bucket_name` {String} bucket name
|
225
|
+
- `allow_empty` {Bool} allow empty request referer or not
|
226
|
+
- `referer_list` {Array} Referer white list, e.g.: [ 'https://www.taobao.com', 'http://www.aliyun.com' ]
|
227
|
+
|
228
|
+
```ruby
|
229
|
+
referer_list = [ 'https://www.taobao.com', 'http://www.aliyun.com' ]
|
230
|
+
@api.put_bucket_referer('bucket_name', true, referer_list)
|
231
|
+
```
|
232
|
+
|
233
|
+
if success will return true
|
234
|
+
|
235
|
+
#### .put_bucket_lifecycle(bucket_name, rules)
|
236
|
+
|
237
|
+
Set the bucket object lifecycle.
|
238
|
+
|
239
|
+
parameters:
|
240
|
+
- `bucket_name` {String} bucket name
|
241
|
+
- `rules` {Array} rule config list, each Rule will contains blow properties:
|
242
|
+
- `id` {String} rule id, if not set, OSS will auto create it with random string.
|
243
|
+
- `prefix` {String} store prefix
|
244
|
+
- `status` {Bool} rule status, true or false
|
245
|
+
- `[days]` {Number} expire after the days
|
246
|
+
- `[date]` {String} expire date, e.g.: `2022-10-11T00:00:00.000Z` date and days only set one.
|
247
|
+
|
248
|
+
```ruby
|
249
|
+
rules = [
|
250
|
+
{id: 'rule1', days: 300, prefix: 'pre-', status: true},
|
251
|
+
{id: 'rule2', date: '2022-10-11T00:00:00.000Z', prefix: 'log-', status: true}
|
252
|
+
]
|
253
|
+
@api.put_bucket_lifecycle('bucket_name', rules)
|
254
|
+
```
|
255
|
+
|
256
|
+
if success will return true
|
257
|
+
|
258
|
+
#### .get_bucket(bucket_name, options)
|
259
|
+
|
260
|
+
List objects in the bucket.
|
261
|
+
|
262
|
+
parameters:
|
263
|
+
- `bucket_name` {String} bucket name
|
264
|
+
- `options` query parameters, default is `nil`
|
265
|
+
- `[prefix]` {String} search object using prefix key
|
266
|
+
- `[marker]` {String} search start from marker, including marker key
|
267
|
+
- `[delimiter]` {String} delimiter search scope e.g. / only search current dir, not including subdir
|
268
|
+
- `[max_keys]` {String|Number} max objects, default is 100, limit to 1000
|
269
|
+
|
270
|
+
```ruby
|
271
|
+
list = @api.get_bucket('bucket_name')
|
272
|
+
```
|
273
|
+
|
274
|
+
Success will return service class object, use chain method get response params.
|
275
|
+
|
276
|
+
- `.contents`
|
277
|
+
Success will return objects list on objects properties.
|
278
|
+
|
279
|
+
```ruby
|
280
|
+
list.contents.each do |object|
|
281
|
+
puts object[:key]
|
282
|
+
puts object[:last_modified]
|
283
|
+
puts object[:etag]
|
284
|
+
puts object[:type]
|
285
|
+
...
|
286
|
+
end
|
287
|
+
```
|
288
|
+
|
289
|
+
- `name` {String} object name on oss
|
290
|
+
- `lastModified` {String} object last modified GMT date, e.g.: 2015-02-19T08:39:44.000Z
|
291
|
+
- `etag` {String} object etag contains ", e.g.: "5B3C1A2E053D763E1B002CC607C5A0FE"
|
292
|
+
- `type` {String} object type, e.g.: Normal
|
293
|
+
- `size` {String} object size, e.g.: 344606
|
294
|
+
- `storage_class` {String} storage class type, e.g.: Standard
|
295
|
+
- `owner` {Hash} object owner, including `id` and `display_name`
|
296
|
+
|
297
|
+
- `.prefixes` {Array} prefix list
|
298
|
+
- `.is_truncated` {Boolean} truncate or not
|
299
|
+
- `.next_marker` {String} next marker string
|
300
|
+
|
301
|
+
#### .get_bucket_acl(bucket_name)
|
302
|
+
|
303
|
+
Get the bucket ACL.
|
304
|
+
|
305
|
+
parameters:
|
306
|
+
- `bucket_name` {String} bucket name
|
307
|
+
|
308
|
+
Success will return Hash:
|
309
|
+
|
310
|
+
- `grant` {String} acl settings string
|
311
|
+
- `owner` {Hash} object owner, including `id` and `display_name`
|
312
|
+
|
313
|
+
#### .get_bucket_location(bucket_name)
|
314
|
+
|
315
|
+
Get the bucket ACL.
|
316
|
+
|
317
|
+
parameters:
|
318
|
+
- `bucket_name` {String} bucket name
|
319
|
+
|
320
|
+
Success will return location string.
|
321
|
+
|
322
|
+
```ruby
|
323
|
+
puts @api.get_bucket_location('bucket_name')
|
324
|
+
```
|
325
|
+
|
326
|
+
#### .get_bucket_logging(bucket_name)
|
327
|
+
|
328
|
+
Get the bucket logging settings.
|
329
|
+
|
330
|
+
parameters:
|
331
|
+
- `bucket_name` {String} bucket name
|
332
|
+
|
333
|
+
Success will return Hash:
|
334
|
+
|
335
|
+
- `logging_enabled` {Bool} enable logging or not
|
336
|
+
- `target_bucket` {String} log store bucket
|
337
|
+
- `target_prefix` {String} log file prefix
|
338
|
+
|
339
|
+
```ruby
|
340
|
+
log = @api.get_bucket_logging('bucket_name')
|
341
|
+
puts log[:logging_enabled]
|
342
|
+
puts log[:target_bucket]
|
343
|
+
puts log[:target_prefix]
|
344
|
+
```
|
345
|
+
|
346
|
+
#### .get_bucket_referer(bucket_name)
|
347
|
+
|
348
|
+
Get the bucket request Referer white list.
|
349
|
+
|
350
|
+
parameters:
|
351
|
+
- `bucket_name` {String} bucket name
|
352
|
+
|
353
|
+
Success will return Hash:
|
354
|
+
|
355
|
+
- `allow_empty_referer` {Bool} allow empty request referer or not
|
356
|
+
- `referers` {Array} Referer white list
|
357
|
+
|
358
|
+
#### .get_bucket_website(bucket_name)
|
359
|
+
|
360
|
+
Get the bucket website config.
|
361
|
+
|
362
|
+
parameters:
|
363
|
+
- `bucket_name` {String} bucket name
|
364
|
+
|
365
|
+
Success will return Hash:
|
366
|
+
|
367
|
+
- `index_doc` {String} index page
|
368
|
+
- `error_doc` {String} error page, maybe nil
|
369
|
+
|
370
|
+
#### .get_bucket_lifecycle(bucket_name)
|
371
|
+
|
372
|
+
Get the bucket object lifecycle.
|
373
|
+
|
374
|
+
- `bucket_name` {String} bucket name
|
375
|
+
|
376
|
+
Success will return lifecycle rules Array:
|
377
|
+
|
378
|
+
- `id` {String} rule id, if not set, OSS will auto create it with random string.
|
379
|
+
- `prefix` {String} store prefix
|
380
|
+
- `status` {Bool} rule status, true or false
|
381
|
+
- `[days]` {Number} expire after the days
|
382
|
+
- `[date]` {String} expire date, e.g.: `2022-10-11T00:00:00.000Z` date and days only has one.
|
383
|
+
|
384
|
+
#### .delete_bucket_logging(bucket_name)
|
385
|
+
|
386
|
+
Delete the bucket logging settings.
|
387
|
+
|
388
|
+
parameters:
|
389
|
+
- `bucket_name` {String} bucket name
|
390
|
+
|
391
|
+
Success will return true
|
392
|
+
|
393
|
+
#### .delete_bucket_website(bucket_name)
|
394
|
+
|
395
|
+
Delete the bucket website config.
|
396
|
+
|
397
|
+
parameters:
|
398
|
+
- `bucket_name` {String} bucket name
|
399
|
+
|
400
|
+
Success will return true
|
401
|
+
|
402
|
+
#### .delete_bucket_lifecycle(bucket_name)
|
403
|
+
|
404
|
+
Delete the bucket object lifecycle.
|
405
|
+
|
406
|
+
parameters:
|
407
|
+
- `bucket_name` {String} bucket name
|
408
|
+
|
409
|
+
Success will return true
|
410
|
+
|
411
|
+
#### .delete_bucket(bucket_name)
|
412
|
+
|
413
|
+
Delete an empty bucket.
|
414
|
+
|
415
|
+
- `bucket_name` {String} bucket name
|
416
|
+
|
417
|
+
Success will return true
|
418
|
+
|
419
|
+
### Object Operations
|
420
|
+
Class `Oss::Object`
|
421
|
+
|
422
|
+
#### .put_object(bucket_name, object, file, options)
|
423
|
+
|
424
|
+
Add an object to the bucket.
|
425
|
+
|
426
|
+
parameters:
|
427
|
+
- `bucket_name` {String} bucket name
|
428
|
+
- `object` {String} object key name
|
429
|
+
- `file` {String} file string
|
430
|
+
- `options` {Hash} optional parameters
|
431
|
+
- `expires` {String} expires time (milliseconds) for download, e.g.: 3600000
|
432
|
+
- `content_control` {String} cache control for download, e.g.: public, no-cache
|
433
|
+
- `content_encoding` {String} object content encoding for download
|
434
|
+
- `content_type` {String} object content type
|
435
|
+
- `content_disposition` {String} object name for download
|
436
|
+
- `encryption` {String} oss server side encryption `AES256`
|
437
|
+
- `acl` {String} object acl
|
438
|
+
|
439
|
+
Success will return true
|
440
|
+
|
441
|
+
#### .copy_object(bucket_name, object, old_bucket, old_object, options)
|
442
|
+
|
443
|
+
To copy an existing object on OSS to form another object.
|
444
|
+
|
445
|
+
parameters:
|
446
|
+
- `bucket_name` {String} bucket name
|
447
|
+
- `object` {String} object key name
|
448
|
+
- `old_bucket` {String} existing object bucket
|
449
|
+
- `old_object` {String} existing object
|
450
|
+
- `options` {Hash} optional parameters
|
451
|
+
- `encryption` {String} oss server side encryption `AES256`
|
452
|
+
- `acl` {String} object acl header
|
453
|
+
- `if_none_match` {String} x-oss-copy-source-if-none-match header
|
454
|
+
- `if_match` {String} x-oss-copy-source-if-match header
|
455
|
+
- `if_unmodified_since` {String} x-oss-copy-source-if-unmodified-since header
|
456
|
+
- `if_modified_since` {String} x-oss-copy-source-if-modified-since header
|
457
|
+
- `metadata_directive` {String} x-oss-metadata-directive header
|
458
|
+
|
459
|
+
Success will return Hash:
|
460
|
+
|
461
|
+
- `last_modify` the object last modify time
|
462
|
+
- `etag` the object etag
|
463
|
+
|
464
|
+
#### .get_object(bucket_name, object, options)
|
465
|
+
|
466
|
+
Get an object from the bucket.
|
467
|
+
|
468
|
+
parameters:
|
469
|
+
- `bucket_name` {String} bucket name
|
470
|
+
- `object` {String} object key name
|
471
|
+
- `options` {Hash} optional parameters
|
472
|
+
- `if_none_match` {String} x-oss-copy-source-if-none-match header
|
473
|
+
- `if_match` {String} x-oss-copy-source-if-match header
|
474
|
+
- `if_unmodified_since` {String} x-oss-copy-source-if-unmodified-since header
|
475
|
+
- `if_modified_since` {String} x-oss-copy-source-if-modified-since header
|
476
|
+
- `range` {String} http range header
|
477
|
+
|
478
|
+
Success will return response object:
|
479
|
+
|
480
|
+
```ruby
|
481
|
+
object = @api.get_object('bucket_name', 'object_name')
|
482
|
+
# show all file headers
|
483
|
+
p object.headers
|
484
|
+
|
485
|
+
# save file
|
486
|
+
file = File.new('/path/to/save', 'w')
|
487
|
+
file.puts object.body
|
488
|
+
file.close
|
489
|
+
```
|
490
|
+
|
491
|
+
#### .append_object(bucket_name, object, file, position, options)
|
492
|
+
|
493
|
+
Append file to a exist object.
|
494
|
+
|
495
|
+
parameters:
|
496
|
+
- `bucket_name` {String} bucket name
|
497
|
+
- `object` {String} object key name
|
498
|
+
- `file` {String} append file content
|
499
|
+
- `position` {Integer} append file position
|
500
|
+
- `options` {Hash} optional parameters
|
501
|
+
|
502
|
+
Success will return Hash:
|
503
|
+
|
504
|
+
- `hash_crc64ecma` {String} append object hash crc64
|
505
|
+
- `next_append_position` {String} next append position
|
506
|
+
|
507
|
+
#### .delete_object(bucket_name, object_name)
|
508
|
+
|
509
|
+
Delete the object.
|
510
|
+
|
511
|
+
parameters:
|
512
|
+
- `bucket_name` {String} bucket name
|
513
|
+
- `object_name` {String} object name
|
514
|
+
|
515
|
+
Success will return true
|
516
|
+
|
517
|
+
#### .delete_multiple_objects(bucket_name, objects)
|
518
|
+
|
519
|
+
Delete multiple objects.
|
520
|
+
|
521
|
+
parameters:
|
522
|
+
- `bucket_name` {String} bucket name
|
523
|
+
- `objects` {Array} object names
|
524
|
+
|
525
|
+
Success will return success deleted object names
|
526
|
+
|
527
|
+
#### .head_object(bucket_name, object_name, options)
|
528
|
+
|
529
|
+
Head an object and get the meta info.
|
530
|
+
|
531
|
+
parameters:
|
532
|
+
- `bucket_name` {String} bucket name
|
533
|
+
- `object_name` {String} object name
|
534
|
+
- `options` {Hash} optional parameters
|
535
|
+
- `if_none_match` {String} x-oss-copy-source-if-none-match header
|
536
|
+
- `if_match` {String} x-oss-copy-source-if-match header
|
537
|
+
- `if_unmodified_since` {String} x-oss-copy-source-if-unmodified-since header
|
538
|
+
- `if_modified_since` {String} x-oss-copy-source-if-modified-since header
|
539
|
+
|
540
|
+
Success will return response headers
|
541
|
+
|
542
|
+
#### .put_object_acl(bucket_name, object_name, acl)
|
543
|
+
|
544
|
+
Set the object ACL.
|
545
|
+
|
546
|
+
parameters:
|
547
|
+
- `bucket_name` {String} bucket name
|
548
|
+
- `object_name` {String} object name
|
549
|
+
- `acl` {String} ACL control header
|
550
|
+
|
551
|
+
Success will return true
|
552
|
+
|
553
|
+
#### .get_object_acl(bucket_name, object_name)
|
554
|
+
|
555
|
+
Get the object ACL.
|
556
|
+
|
557
|
+
parameters:
|
558
|
+
- `bucket_name` {String} bucket name
|
559
|
+
- `object_name` {String} object name
|
560
|
+
|
561
|
+
Success will return Hash:
|
562
|
+
|
563
|
+
- `grant` {String} acl settings string
|
564
|
+
- `owner` {Hash} object owner, including `id` and `display_name`
|
565
|
+
|
566
|
+
#### .post_object(bucket_name, key, options)
|
567
|
+
|
568
|
+
Create form post upload parameters.
|
569
|
+
|
570
|
+
parameters:
|
571
|
+
- `bucket_name` {String} bucket name
|
572
|
+
- `key` form upload key
|
573
|
+
- `options` [Form field](https://docs.aliyun.com/en?spm=5176.383663.278239.8.BZrDTK#/pub/oss_en_us/api-reference/object&PostObject)
|
574
|
+
|
575
|
+
return form post need parameters including `OSSAccessKeyId` `Signature`
|
576
|
+
|
577
|
+
### Multipart Upload Operations
|
578
|
+
Class `Oss::Multipart`
|
579
|
+
|
580
|
+
#### .initiate_multipart_upload(bucket_name, object_name, options)
|
581
|
+
|
582
|
+
The Initiate Multipart Upload interface must be called to notify OSS that a Multipart Upload event should be initiated before data transfer starts in the Multipart Upload mode. This interface will then return a globally unique Upload ID created by OSS to identify the Multipart Upload event. With the ID users can initiate related operations including stopping Multipart Upload, querying Multipart Upload, etc.
|
583
|
+
|
584
|
+
parameters:
|
585
|
+
- `bucket_name` {String} bucket name
|
586
|
+
- `object_name` {String} object name
|
587
|
+
- `options` {Hash} optional parameters
|
588
|
+
- `expires` {String} expires time (milliseconds) for download, e.g.: 3600000
|
589
|
+
- `content_control` {String} cache control for download, e.g.: public, no-cache
|
590
|
+
- `content_encoding` {String} object content encoding for download
|
591
|
+
- `content_disposition` {String} object name for download
|
592
|
+
- `encryption` {String} oss server side encryption `AES256`
|
593
|
+
|
594
|
+
Success will return Hash:
|
595
|
+
- `bucket` {String} bucket name
|
596
|
+
- `key` {String} key
|
597
|
+
- `upload_id` {String} upload_id
|
598
|
+
|
599
|
+
#### .upload_part(bucket_name, object_name, upload_id, file, part_number, options)
|
600
|
+
|
601
|
+
After a Multipart Upload is initialized, data can be uploaded by part according to the specified Object name and Upload ID. Each part uploaded has an identification number (Part number, range: 1-10,000).
|
602
|
+
|
603
|
+
parameters:
|
604
|
+
- `bucket_name` {String} bucket name
|
605
|
+
- `object_name` {String} object name
|
606
|
+
- `upload_id` {String} upload id
|
607
|
+
- `part_number` {Integer} upload part number
|
608
|
+
- `file` {String} file content
|
609
|
+
- `options` {Hash} optional parameters
|
610
|
+
|
611
|
+
Success will return Hash:
|
612
|
+
- `etag` {String} part etag
|
613
|
+
- `part_number` {String} part_number
|
614
|
+
|
615
|
+
#### .upload_part_copy(bucket_name, object_name, upload_id, old_bucket, old_object, part_number, options)
|
616
|
+
|
617
|
+
The interface Upload Part Copy is used to upload a Part data by copying the data from an existing Object.
|
618
|
+
|
619
|
+
parameters:
|
620
|
+
- `bucket_name` {String} bucket name
|
621
|
+
- `object_name` {String} object name
|
622
|
+
- `upload_id` {String} upload id
|
623
|
+
- `old_bucket` {String} exist source bucket name
|
624
|
+
- `old_object` {String} exist source object name
|
625
|
+
- `part_number` {Integer} upload part number
|
626
|
+
- `options` {Hash} optional parameters
|
627
|
+
- `if_none_match` {String} x-oss-copy-source-if-none-match header
|
628
|
+
- `if_match` {String} x-oss-copy-source-if-match header
|
629
|
+
- `if_unmodified_since` {String} x-oss-copy-source-if-unmodified-since header
|
630
|
+
- `copy_source_begin` {Integer} copy source begin byte
|
631
|
+
- `copy_source_end` {Integer} copy source end byte
|
632
|
+
|
633
|
+
Success will return Hash:
|
634
|
+
- `etag` {String} part etag
|
635
|
+
- `last_modify` {String} object last modify time
|
636
|
+
|
637
|
+
#### .complete_multipart_upload(bucket_name, object_name, upload_id, parts)
|
638
|
+
|
639
|
+
After all the Part data are uploaded, the API of Complete Multipart Upload must be called to complete the Multipart Upload of the entire file.
|
640
|
+
|
641
|
+
parameters:
|
642
|
+
- `bucket_name` {String} bucket name
|
643
|
+
- `object_name` {String} object name
|
644
|
+
- `upload_id` {String} upload id
|
645
|
+
- `parts` {Array} uploaded parts Hash including `part_number` `etag`
|
646
|
+
|
647
|
+
Success will return Hash:
|
648
|
+
- `location` {String} storage location
|
649
|
+
- `bucket` {String} bucket name
|
650
|
+
- `key` {String} object key
|
651
|
+
- `etag` {String} object etag
|
652
|
+
|
653
|
+
#### .abort_multipart_upload(bucket_name, object_name, upload_id)
|
654
|
+
|
655
|
+
This interface can be used to abort a Multipart Upload event according to the corresponding Upload ID offered by the user.
|
656
|
+
|
657
|
+
parameters:
|
658
|
+
- `bucket_name` {String} bucket name
|
659
|
+
- `object_name` {String} object name
|
660
|
+
- `upload_id` {String} upload id
|
661
|
+
|
662
|
+
Success will return true
|
663
|
+
|
664
|
+
#### .list_multipart_upload(bucket_name, options)
|
665
|
+
|
666
|
+
This interface can list all Multipart Upload events under execution, which means all the events initialized but neither completed nor aborted.
|
667
|
+
|
668
|
+
parameters:
|
669
|
+
- `bucket_name` {String} bucket name
|
670
|
+
- `upload_id` {String} upload id
|
671
|
+
- `options` {Hash} optional parameters
|
672
|
+
- `delimiter` {string} A character for grouping the names of Objects.
|
673
|
+
- `prefix` {string} search object using `prefix` key
|
674
|
+
- `key_marker` {string} Used together with the upload-id-marker parameter to specify the initial position of returned results
|
675
|
+
- `max_uploads` {String} max uploads, default is `100`, limit to `1000`
|
676
|
+
- `upload-id-marker` {String} Used together with the key-marker parameter to specify the initial position of return results.
|
677
|
+
|
678
|
+
Success will return the class object, use chain method get response params.
|
679
|
+
|
680
|
+
- `.uploads`
|
681
|
+
return uploads Array including Hash:
|
682
|
+
- `key` {String} upload key
|
683
|
+
- `upload_id` {String} upload id
|
684
|
+
- `initiated` {String} initiated time
|
685
|
+
|
686
|
+
#### .list_parts(bucket_name, object_name, options)
|
687
|
+
|
688
|
+
The interface List Parts can be used to list all Parts corresponding to a specified Upload ID which have been successfully uploaded.
|
689
|
+
|
690
|
+
parameters:
|
691
|
+
- `bucket_name` {String} bucket name
|
692
|
+
- `object_name` {String} object name
|
693
|
+
- `options` {Hash} optional parameters
|
694
|
+
- `uploadId` {String} search upload id
|
695
|
+
- `max_parts` {String} search max parts
|
696
|
+
- `part_number_marker` {String} search part number
|
697
|
+
|
698
|
+
Success will return the class object, use chain method get response params.
|
699
|
+
|
700
|
+
- `.parts`
|
701
|
+
return parts Array including Hash:
|
702
|
+
- `part_number` {String} part number
|
703
|
+
- `last_modified` {String} last modified time
|
704
|
+
- `etag` {String} part etag
|
705
|
+
- `size` {String} part size
|
706
|
+
|
707
|
+
### CORS (Cross-Origin Resource Sharing) Operations
|
708
|
+
Class `Oss::Cors`
|
709
|
+
|
710
|
+
#### .put_bucket_cors(bucket_name, rules)
|
711
|
+
|
712
|
+
The operation Put Bucket cors will set a CORS rule on a specified bucket. If a rule is already existent, the original rule will be overlaid.
|
713
|
+
|
714
|
+
parameters:
|
715
|
+
- `bucket_name` {String} bucket name
|
716
|
+
- `rules` {Array} rules array e.g. `[[{key: 'AllowedOrigin', value: '*'}, {key: 'AllowedMethod', value: 'GET'}], [{key: 'AllowedOrigin', value: 'http://www.a.com'}, {key: 'AllowedMethod', value: 'PUT'}]]`
|
717
|
+
|
718
|
+
Success will return true
|
719
|
+
|
720
|
+
#### .get_bucket_cors(bucket_name)
|
721
|
+
|
722
|
+
The operation of Get Bucket cors operation is used to get the current CORS rules in the specified Bucket.
|
723
|
+
|
724
|
+
parameters:
|
725
|
+
- `bucket_name` {String} bucket name
|
726
|
+
|
727
|
+
Success will return rules Array
|
728
|
+
|
729
|
+
#### .delete_bucket_cors(bucket_name)
|
730
|
+
|
731
|
+
The Delete Bucket cors operation is used to disable the CORS function corresponding to the specified Bucket and remove all the rules.
|
732
|
+
|
733
|
+
parameters:
|
734
|
+
- `bucket_name` {String} bucket name
|
735
|
+
|
736
|
+
Success will return true
|
737
|
+
|
738
|
+
#### .option_object(bucket_name, object_name, origin, request_method, request_headers)
|
739
|
+
|
740
|
+
Before sending the cross-origin request, the browser will first send a preflight request (OPTIONS) with specific source origin, HTTP method, and header information to OSS so that it can decide whether to send the real request.
|
741
|
+
|
742
|
+
parameters:
|
743
|
+
- `bucket_name` {String} bucket name
|
744
|
+
- `object_name` {String} object name
|
745
|
+
- `origin` {String} Origin header
|
746
|
+
- `request_method` {String} Access-Control-Request-Method header
|
747
|
+
- `request_headers` {String} Access-Control-Request-Headers header
|
748
|
+
|
749
|
+
Success will return response headers
|
750
|
+
|
110
751
|
## License
|
111
752
|
|
112
753
|
The gem is available as open source under the terms of the [Apache 2.0 License](http://opensource.org/licenses/Apache-2.0).
|
data/lib/oss/version.rb
CHANGED