有没有一种方法可以使整个Google Storage Bucket具有预设的元数据? [英] Is there a way to make a whole Google Storage Bucket have preset metadata?

查看:49
本文介绍了有没有一种方法可以使整个Google Storage Bucket具有预设的元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置一个存储桶,以将某些元数据自动分配给每个新更新的项(处置,附件).

I would like to set one of my storage buckets to automatically assign certain metadata to every item that is newly updated (disposition, attachment).

我该怎么办,有办法吗?

How do I do this, is there a way?

推荐答案

据我所知,还没有办法做到这一点.我一直在考虑解决方法,并且想出了一个可能的解决方案.

As far as my knowledge goes there isn't a way to do that. I've been thinking on a workaround and I came up with a possible solution.

使用将文件上传到存储桶时触发的云功能 [1] ,然后发布到API [2] [3] 编辑该文件的元数据.这样,添加到存储桶中的每个文件都将具有相同的元数据(在您希望它们存储的字段中),而无需手动更改它们.

Use a Cloud Function that triggers when a file it's uploaded to a bucket [1], then POST to the API [2] [3] to edit the metadata of that file. This way, every file added to the bucket would have the same metadata (in the fields you want them to) without the need of change them manually.

如果该存储桶中已经有需要更改其元数据的文件,则可以在此处

In case you already have files in that bucket that need to have their metadata changed you can run this command found here [4]:

gsutil -m setmeta -h"[METADATA_KEY]:[METADATA_VALUE]" gs://[BUCKET_NAME]/*

这篇关于有没有一种方法可以使整个Google Storage Bucket具有预设的元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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