如何更新现有Amazon S3文件的元数据? [英] How do I update metadata for an existing Amazon S3 file?

查看:639
本文介绍了如何更新现有Amazon S3文件的元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要更新所有AmazonS3云文件中的缓存控制标题。但是,我无法弄清楚我是如何使用jclouds API来做到的。
我使用的是Apache jclouds插件。我得到了两个相关答案:



第一个答案是建议使用SwiftKey Api类,它在grails的jcloud插件中不可用。第二个答案是使用AWS java sdk,它已经有一个grails包装插件 https://grails.org/ plugin / aws-sdk ,但它不支持元数据更新。

解决方案

p>


每个Amazon S3对象都有数据,密钥和元数据。对象键(或
键名)唯一标识存储桶中的对象。对象元数据
是一组名称 - 值对。您可以在上传时设置对象元数据
上传对象后,您无法修改对象
元数据。修改对象元数据的唯一方法是制作
对象的副本并设置元数据。


http://docs.aws.amazon.com/AmazonS3/latest/ dev / UsingMetadata.html


I need to update the cache control header in all AmazonS3's Cloud Files. However, I can't figure out how I do that using the jclouds API. I'm using apache jclouds plugin. And I got two related answers:

The first answer is suggesting to use SwiftKey Api class which is not available in grails's jcloud plugin. The second answer is using AWS java sdk for which there is already a grails wrapping plugin https://grails.org/plugin/aws-sdk but it doesn't support metadata update.

解决方案

You can't:

Each Amazon S3 object has data, a key, and metadata. Object key (or key name) uniquely identifies the object in a bucket. Object metadata is a set of name-value pairs. You can set object metadata at the time you upload it. After you upload the object, you cannot modify object metadata. The only way to modify object metadata is to make a copy of the object and set the metadata.

http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html

这篇关于如何更新现有Amazon S3文件的元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆