如何在统一存储桶上设置 Cache-Control 元数据?
我在 Google Cloud 存储上有一桶图像。我已将存储桶的访问控制设置为统一,并将存储桶公开。我现在想将存储桶的 Cache-Control
元数据设置为一年的 max-age
,而不是默认的一小时。
但是,我无法设置单个对象的元数据,因为这是一个统一的存储桶。我只是得到
AccessDeniedException: 403
这是预期的。
我在 GUI 中找不到选项,也找不到云 shell 在统一存储桶上设置元数据的命令,有谁知道如何操作,或者我是否需要切换回细粒度访问控制?
I have a bucket of images on Google Cloud storage. I've set the bucket's access control to uniform and made the bucket public. I'd now like to set the Cache-Control
metadata for the bucket to have a max-age
of one year, rather than the default one hour.
However, I cannot set the metadata for individual objects, since this is a uniform bucket. I simply get
AccessDeniedException: 403 <my email> does not have storage.objects.update access to the Google Cloud Storage object.
Which is expected.
I cannot find an option in the GUI or a command for the cloud shell to set metadata on a uniform bucket, does any one know how, or do I need to switch back to Fine-grained access control?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您遇到的错误与设置对象元数据无关!这意味着您使用的
identity
(google account
或service-account
)无权更新存储桶中的对象
。您需要检查授予您的
身份
的 IAM 权限并添加所有必需的 IAM 权限。您可以从
Cloud Console
编辑对象元数据中的Cache-Control
,如下所示:参考:文档。
笔记:
The error you have is not related to setting object/s metadata! it means the
identity
(google account
or theservice-account
) that you are using does not have permission to update objects inbuckets
.You need to review the IAM permissions given to your
identity
and add all required IAM permissions.You can edit the
Cache-Control
in object/s metadata fromCloud Console
as follows:Reference: documentation.
Note: