【发布时间】:2019-07-14 07:50:03
【问题描述】:
我有一个测试云函数 (CF) 可在更新云存储中的对象时触发。
exports.test_cf = (event, callback) => {
console.log("Test CF executed successfully");
callback();
}
使用上述功能部署:
gcloud functions deploy --runtime nodejs6 --trigger-resource [BUCKET-NAME] --trigger-event google.storage.object.archive --timeout=540s --verbosity=info
在存储桶上设置版本控制后,我使用gsutil将文件复制到存储桶,如下所示:
gsutil cp <file> gs://[BUCKET-NAME]/
以上命令触发了 CF。这是为什么?根据 GCP 文档,google.storage.archive 仅在更新时触发 CF。
另一个问题:如何使用gsutil更新存储桶中的对象?我看到gsutil rewrite,但它与更新不同。
【问题讨论】:
-
请在每个帖子中限制自己一个问题,否则可能会因为“过于宽泛”而被关闭。
标签: google-cloud-platform google-cloud-storage google-cloud-functions