[英]Adding Presign URL Expiration for AWS s3 in aws-sdk-go-v2 for Go
There is a very fine example of using the aws-sdk-go-v2 to create pre-signed URLs.有一个使用 aws-sdk-go-v2 创建预签名 URL 的非常好的示例。
This works well but I'm stuck on setting the expiration time.这很有效,但我坚持设置到期时间。 I do see the PresignOptions struct has an
Expires
but I'm not certain how to do that.我确实看到 PresignOptions 结构有一个
Expires
但我不确定如何做到这一点。
I also see WithPresignExpires
but alas, I also do not know how to use this given the example.我也看到了
WithPresignExpires
但唉,我也不知道如何使用这个例子。
Can an example be provided here?可以在这里提供一个例子吗? I'm learning Go but something is just outside my grasp here.
我正在学习围棋,但这里有些东西超出了我的掌握范围。
Seems I can do this for 60 minute expiration.似乎我可以在 60 分钟到期时执行此操作。
func GetPresignedURL(c context.Context, api S3PresignGetObjectAPI, input *s3.GetObjectInput) (*v4.PresignedHTTPRequest, error) {
return api.PresignGetObject(c, input, s3.WithPresignExpires(3600*time.Second))
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.