本文整理汇总了Golang中github.com/awslabs/aws-sdk-go/service/s3.S3.PutObject方法的典型用法代码示例。如果您正苦于以下问题:Golang S3.PutObject方法的具体用法?Golang S3.PutObject怎么用?Golang S3.PutObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/awslabs/aws-sdk-go/service/s3.S3
的用法示例。
在下文中一共展示了S3.PutObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: putFile
func putFile(svc *s3.S3, bucket, object string, reader io.ReadSeeker) error {
_, err := svc.PutObject(&s3.PutObjectInput{
Bucket: &bucket,
Key: &object,
Body: reader,
})
return err
}
示例2: putFile
func putFile(svc *s3.S3, bucket, object string, reader io.ReadSeeker) error {
_, err := svc.PutObject(&s3.PutObjectInput{
Bucket: &bucket,
Key: &object,
Body: reader,
ContentType: aws.String("application/tar"),
})
return err
}
示例3: Do
func Do(db *bolt.DB, s3Bucket *s3.S3, bucketname string) error {
err := db.View(func(tx *bolt.Tx) error {
var b bytes.Buffer
buffInMem := bufio.NewWriter(&b)
_, err := tx.WriteTo(buffInMem)
backupdate := time.Now()
params := &s3.PutObjectInput{
Bucket: aws.String(bucketname),
Key: aws.String(backupdate.Format("2006_01_02_15-04-05")),
Body: bytes.NewReader(b.Bytes()),
ACL: aws.String("authenticated-read"),
ServerSideEncryption: aws.String("AES256"),
Metadata: &map[string]*string{
"bolt-backup": aws.String(backupdate.Format("2006/01/02/15:04:05")),
},
}
_, err = s3Bucket.PutObject(params)
return err
})
return err
}