合并段
更新时间: 2019-03-13 10:30
功能说明
通过分段上传任务的ID,合并指定桶中已上传的段。
方法定义
- func (obsClient ObsClient) CompleteMultipartUpload(input *CompleteMultipartUploadInput) (output *CompleteMultipartUploadOutput, err error)
使用带授权信息URL的方法定义
- func (obsClient ObsClient) CompleteMultipartUploadWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header, data io.Reader) (output *CompleteMultipartUploadOutput, err error)
请求参数
参数名 | 类型 | 约束 |
---|---|---|
input | *CompleteMultipartUploadInput | 必选 |
返回结果
参数名 | 类型 |
---|---|
output | *CompleteMultipartUploadOutput |
err | error |
代码样例
- func main() {
- input := &obs.CompleteMultipartUploadInput{}
- input.Bucket = "bucketname"
- input.Key = "objectkey"
- input.UploadId = "uploadid"
- input.Parts = []obs.Part{
- obs.Part{PartNumber: 1, ETag: "etag1"},
- obs.Part{PartNumber: 2, ETag: "etag2"},
- obs.Part{PartNumber: 3, ETag: "etag3"},
- }
- output, err := obsClient.CompleteMultipartUpload(input)
- if err == nil {
- fmt.Printf("RequestId:%s\n", output.RequestId)
- fmt.Printf("Location:%s, Bucket:%s, Key:%s, ETag:%s\n", output.Location, output.Bucket, output.Key, output.ETag)
- } else {
- if obsError, ok := err.(obs.ObsError); ok {
- fmt.Println(obsError.Code)
- fmt.Println(obsError.Message)
- } else {
- fmt.Println(err)
- }
- }
- }
父主题:对象相关接口