本文整理汇总了Golang中github.com/awslabs/aws-sdk-go/service/s3.S3类的典型用法代码示例。如果您正苦于以下问题:Golang S3类的具体用法?Golang S3怎么用?Golang S3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了S3类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: runTests
func runTests(t *testing.T, svc *s3.S3, tests []s3BucketTest) {
for _, test := range tests {
req, _ := svc.ListObjectsRequest(&s3.ListObjectsInput{Bucket: &test.bucket})
req.Build()
assert.Equal(t, test.url, req.HTTPRequest.URL.String())
}
}
开发者ID:ninefive,项目名称:confd,代码行数:7,代码来源:host_style_bucket_test.go
示例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,
})
return err
}
开发者ID:kloudsio,项目名称:rancher-compose,代码行数:9,代码来源:s3_uploader.go
示例3: 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
}
开发者ID:vdemeester,项目名称:rancher-compose,代码行数:10,代码来源:s3_uploader.go
示例4: getOrCreateBucket
func getOrCreateBucket(svc *s3.S3, bucketName string) error {
_, err := svc.HeadBucket(&s3.HeadBucketInput{
Bucket: &bucketName,
})
if reqErr, ok := err.(awserr.RequestFailure); ok && reqErr.StatusCode() == 404 {
logrus.Infof("Creating bucket %s", bucketName)
_, err = svc.CreateBucket(&s3.CreateBucketInput{
Bucket: &bucketName,
})
}
return err
}
开发者ID:kloudsio,项目名称:rancher-compose,代码行数:14,代码来源:s3_uploader.go
示例5: 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
}
开发者ID:johannesboyne,项目名称:boltbackup,代码行数:21,代码来源:boltbackup.go
注:本文中的github.com/awslabs/aws-sdk-go/service/s3.S3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论