mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
f6d361b2e2
Logics have been centralised: * region to hostname * url generation * signature * chaning scheme also changes the port During the process a couple of inconsistencies have also been fixed. Known limitations: When using the @endpoint with a custom port you need to specify the port when using get_object_http_url or get_object_https_url. When using bucket names that contain dots outside of us-east-1 make sure to access it with the same region in your AWS::Storage.
41 lines
1.5 KiB
Ruby
41 lines
1.5 KiB
Ruby
module Fog
|
|
module Storage
|
|
class AWS
|
|
class Real
|
|
|
|
# Upload a part for a multipart upload
|
|
#
|
|
# @param bucket_name [String] Name of bucket to add part to
|
|
# @param object_name [String] Name of object to add part to
|
|
# @param upload_id [String] Id of upload to add part to
|
|
# @param part_number [String] Index of part in upload
|
|
# @param data [File||String] Content for part
|
|
# @param options [Hash]
|
|
# @option options Content-MD5 [String] Base64 encoded 128-bit MD5 digest of message
|
|
#
|
|
# @return [Excon::Response] response
|
|
# * headers [Hash]:
|
|
# * ETag [String] etag of new object (will be needed to complete upload)
|
|
#
|
|
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadUploadPart.html
|
|
#
|
|
def upload_part(bucket_name, object_name, upload_id, part_number, data, options = {})
|
|
data = Fog::Storage.parse_data(data)
|
|
headers = options
|
|
headers['Content-Length'] = data[:headers]['Content-Length']
|
|
request({
|
|
:body => data[:body],
|
|
:expects => 200,
|
|
:idempotent => true,
|
|
:headers => headers,
|
|
:bucket_name => bucket_name,
|
|
:object_name => object_name,
|
|
:method => 'PUT',
|
|
:query => {'uploadId' => upload_id, 'partNumber' => part_number}
|
|
})
|
|
end
|
|
|
|
end # Real
|
|
end # Storage
|
|
end # AWS
|
|
end # Fog
|