Sha256: 6fb6e5f86f2acde73fc3f6553b059226cb6d643cd78e6a36da5c49730437b950
Contents?: true
Size: 1.99 KB
Versions: 41
Compression:
Stored size: 1.99 KB
Contents
module Fog module Storage class AWS class Real require 'fog/aws/parsers/storage/complete_multipart_upload' # Complete a multipart upload # # @param [String] bucket_name Name of bucket to complete multipart upload for # @param [String] object_name Name of object to complete multipart upload for # @param [String] upload_id Id of upload to add part to # @param [Array<String>] parts Array of etags as Strings for parts # # @return [Excon::Response] # * body [Hash]: (success) # * Bucket [String] - bucket of new object # * ETag [String] - etag of new object # * Key [String] - key of new object # * Location [String] - location of new object # * body [Hash]: (failure) # * Code [String] - Error status code # * Message [String] - Error description # # @note This request could fail and still return +200 OK+, so it's important that you check the response. # @see http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadComplete.html # def complete_multipart_upload(bucket_name, object_name, upload_id, parts) data = "<CompleteMultipartUpload>" parts.each_with_index do |part, index| data << "<Part>" data << "<PartNumber>#{index + 1}</PartNumber>" data << "<ETag>#{part}</ETag>" data << "</Part>" end data << "</CompleteMultipartUpload>" request({ :body => data, :expects => 200, :headers => { 'Content-Length' => data.length }, :bucket_name => bucket_name, :object_name => object_name, :method => 'POST', :parser => Fog::Parsers::Storage::AWS::CompleteMultipartUpload.new, :query => {'uploadId' => upload_id} }) end end # Real end # Storage end # AWS end # Fog
Version data entries
41 entries across 41 versions & 3 rubygems