英文:
get s3 object expiration in golang
问题
似乎有一种方法可以通过在PutObjectInput中附加一个带有"expdays"键的元数据来设置上传的过期天数,但似乎没有办法从像"ListObjects"调用中的对象中获取此元数据。ListObjectOutput返回的是一个s3.Objects列表,但该对象没有元数据字段,我也没有看到其他获取它的方法。
英文:
There seems to be a way to set expiration days in an upload by attaching a Metadata with an "expdays" key to the PutObjectInput but there doesn't appear to be any way to then get this metadata from an object in like a "ListObjects" call. ListObjectOutput returns "Contents" which is a list of s3.Objects but that object doesn't have a metadata field and I don't see any other way to get it either.
答案1
得分: 2
ListObjects调用返回结果中的实际对象列表[]Object,而Object不包含过期时间。然而,GetObject返回GetObjectOutput,它包含一个Expiration字段。因此,您可以迭代返回的Object,并获取每个对象的过期时间,但如果对象很多,这可能会耗费时间。
英文:
The ListObjects calls return a []Object for the actual object list in the result, and Object does not include the expiration. However, GetObject returns GetObjectOutput which does have an Expiration field. So you could iterate your returned Objects and get the expiration for each, though this could be time-consuming if there are many of them.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论