当前位置: 首页>>代码示例>>Golang>>正文


Golang S3.CompleteMultipartUpload方法代码示例

本文整理汇总了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)
}
开发者ID:hadesbox,项目名称:aws-sdk-go,代码行数:60,代码来源:test.go


注:本文中的github.com/ks3sdklib/aws-sdk-go/service/s3.S3.CompleteMultipartUpload方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。