Class: Aliyun::Oss::Struct::Multipart
- Defined in:
- lib/aliyun/oss/struct/multipart.rb
Instance Attribute Summary collapse
-
#bucket ⇒ Object
Bucket name of the Multipart Upload Event.
-
#client ⇒ Object
reference to client.
-
#initiated ⇒ Object
Initiation time of the Multipart Upload Event.
-
#key ⇒ Object
Object name of the Multipart Upload Event.
-
#upload_id ⇒ Object
UUID for the Multipart Upload Event.
Instance Method Summary collapse
-
#abort ⇒ true
Abort Multipart Upload Event.
-
#complete(parts = []) ⇒ Struct::Object
Complete Multipart Upload Event.
-
#copy(*args) ⇒ true
Copy exsting object to Multipart Upload Event.
-
#list_parts(options = {}) ⇒ Array<Aliyun::Oss::Struct::Part>
List uploaded parts for the Multipart Upload Event.
-
#upload(*args) ⇒ HTTParty::Response::Headers
Upload part to Multipart Upload Event.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Aliyun::Oss::Struct::Base
Instance Attribute Details
#bucket ⇒ Object
Bucket name of the Multipart Upload Event
12 13 14 |
# File 'lib/aliyun/oss/struct/multipart.rb', line 12 def bucket @bucket end |
#client ⇒ Object
reference to client
18 19 20 |
# File 'lib/aliyun/oss/struct/multipart.rb', line 18 def client @client end |
#initiated ⇒ Object
Initiation time of the Multipart Upload Event
15 16 17 |
# File 'lib/aliyun/oss/struct/multipart.rb', line 15 def initiated @initiated end |
#key ⇒ Object
Object name of the Multipart Upload Event
9 10 11 |
# File 'lib/aliyun/oss/struct/multipart.rb', line 9 def key @key end |
#upload_id ⇒ Object
UUID for the Multipart Upload Event
6 7 8 |
# File 'lib/aliyun/oss/struct/multipart.rb', line 6 def upload_id @upload_id end |
Instance Method Details
#abort ⇒ true
After abort the Multipart Upload, the Uploaded data will be deleted
When abort a Multipart Upload event, if there are still part upload belonging to this event, then theree parts will not be removed. So if there is a concurrent access, in order to release the space on the OSS completely, you need to call #bucket_abort_multipart a few times.
Abort Multipart Upload Event
96 97 98 |
# File 'lib/aliyun/oss/struct/multipart.rb', line 96 def abort !!client.bucket_abort_multipart(upload_id, key) end |
#complete(parts = []) ⇒ Struct::Object
Complete Multipart Upload Event
80 81 82 83 84 85 86 |
# File 'lib/aliyun/oss/struct/multipart.rb', line 80 def complete(parts = []) resp = client.bucket_complete_multipart(upload_id, key, parts) keys = %w(CompleteMultipartUploadResult) Struct::Object.new( Utils.dig_value(resp.parsed_response, *keys).merge(client: client) ) end |
#copy(*args) ⇒ true
Copy exsting object to Multipart Upload Event
48 49 50 |
# File 'lib/aliyun/oss/struct/multipart.rb', line 48 def copy(*args) !!client.bucket_multipart_copy_upload(*args.unshift(upload_id, key)) end |
#list_parts(options = {}) ⇒ Array<Aliyun::Oss::Struct::Part>
List uploaded parts for the Multipart Upload Event
61 62 63 64 65 66 67 68 69 |
# File 'lib/aliyun/oss/struct/multipart.rb', line 61 def list_parts( = {}) result = client.bucket_list_parts(upload_id, key, ) .parsed_response parts_keys = %w(ListPartsResult Part) Utils.wrap(Utils.dig_value(result, *parts_keys)).map do |part| Struct::Part.new(part) end end |
#upload(*args) ⇒ HTTParty::Response::Headers
Upload part to Multipart Upload Event
34 35 36 |
# File 'lib/aliyun/oss/struct/multipart.rb', line 34 def upload(*args) client.bucket_multipart_upload(*args.unshift(upload_id, key)).headers end |