本文整理汇总了Golang中github.com/ks3sdklib/aws-sdk-go/service/s3.S3.CompleteMultipartUpload方法的典型用法代码示例。如果您正苦于以下问题:Golang S3.CompleteMultipartUpload方法的具体用法?Golang S3.CompleteMultipartUpload怎么用?Golang S3.CompleteMultipartUpload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/ks3sdklib/aws-sdk-go/service/s3.S3
的用法示例。
在下文中一共展示了S3.CompleteMultipartUpload方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: multipart
func multipart(c *s3.S3) {
key := "中文"
acl := "public-read"
out, _ := c.CreateMultipartUpload(
&s3.CreateMultipartUploadInput{
Bucket: &bucket,
Key: &key,
ACL: &acl,
},
)
uploadid := out.UploadID
var partnum int64
partnum = 1
s := strings.NewReader("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890")
uploadRest, _ := c.UploadPart(
&s3.UploadPartInput{
Bucket: &bucket,
Key: &key,
UploadID: uploadid,
PartNumber: &partnum,
Body: s,
},
)
fmt.Println(uploadRest)
listRet, _ := c.ListParts(
&s3.ListPartsInput{
Bucket: &bucket,
Key: &key,
UploadID: uploadid,
},
)
fmt.Println("123")
listP := listRet.Parts
for i := 0; i < len(listP); i++ {
alistP := listP[i]
fmt.Println(*alistP.PartNumber)
fmt.Println(*alistP.ETag)
}
fmt.Println(*listRet.Key)
fmt.Println("123")
var parts []*s3.CompletedPart
apart := &s3.CompletedPart{
ETag: listRet.Parts[0].ETag,
PartNumber: listRet.Parts[0].PartNumber,
}
parts = append(parts, apart)
comRet, _ := c.CompleteMultipartUpload(
&s3.CompleteMultipartUploadInput{
Bucket: &bucket,
Key: &key,
UploadID: uploadid,
MultipartUpload: &s3.CompletedMultipartUpload{
Parts: parts,
},
},
)
fmt.Println(comRet)
}