无法使用AWS SDK在Go中获取s3.Object的ACL。

huangapple go评论86阅读模式
英文:

Unable to get s3.Object ACL using AWS SDK in go

问题

我正在尝试使用官方的示例列出一个存储桶中的对象。

err = svc.ListObjectsPages(&s3.ListObjectsInput{
    Bucket: &bucketName,
}, func(p *s3.ListObjectsOutput, last bool) (shouldContinue bool) {
    fmt.Println("Page,", i)
    i++

    for _, obj := range p.Contents {
        fmt.Println("Object:", *obj.Key)
    }
    return true
})

然而,我发现s3.Object 类型没有与之关联的任何 ACL 信息。

我如何获取s3.Object的 ACL 信息?

英文:

I am trying to list the objects of one bucket using the official example

	err = svc.ListObjectsPages(&s3.ListObjectsInput{
		Bucket: &bucketName,
	}, func(p *s3.ListObjectsOutput, last bool) (shouldContinue bool) {
		fmt.Println("Page,", i)
		i++

		for _, obj := range p.Contents {
			fmt.Println("Object:", *obj.Key)
		}
		return true
	})

However I see that the s3.Object type does not have any ACL information associated with it.

How can I get the s3.Object's ACL information?

答案1

得分: 1

请参考以下示例,了解如何使用AWS SDK for Go V2获取Amazon S3对象的ACL信息。

https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/gov2/s3/GetObjectAcl

英文:

Refer to this example to learn how to get an Amazon S3 object's ACL information using the AWS SDK for Go V2.

https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/gov2/s3/GetObjectAcl

huangapple
  • 本文由 发表于 2021年12月17日 00:00:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/70382082.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定