![](/img/trans.png)
[英]Can you set multiple ACLs with google cloud storage resumable URLs?
[英]Can add file but cannot set metadata in Google Cloud Storage
我可以将文件复制到 Google Cloud Storage:
% gsutil -m cp audio/index.csv gs://passive-english/audio/
If you experience problems with multiprocessing on MacOS, they might be related to https://bugs.python.org/issue33725. You can disable multiprocessing by editing your .boto config or by adding the following flag to your command: `-o "GSUtil:parallel_process_count=1"`. Note that multithreading is still available even if you disable multiprocessing.
Copying file://audio/index.csv [Content-Type=text/csv]...
\ [1/1 files][196.2 KiB/196.2 KiB] 100% Done
Operation completed over 1 objects/196.2 KiB.
但我无法更改它的元数据:
% gsutil setmeta -h "Cache-Control:public, max-age=7200" gs://passive-english/audio/index.csv
Setting metadata on gs://passive-english/audio/index.csv...
AccessDeniedException: 403 Access denied.
我授权使用 json 文件:
% env | grep GOOGL
GOOGLE_APPLICATION_CREDENTIALS=/app-342xxx-2cxxxxxx.json
如何授予访问权限以便 gsutil 可以更改文件的元数据?
更新 1:
我授予服务帐户角色 Editor 和Storage Object Admin
权限。
更新 2 :我授予服务帐户角色 Owner 和 Storage Object Admin 权限。 还是没用
要更新对象的元数据,您需要 IAM 权限storage.objects.update
。
该权限包含在角色中:
使用 CLI 添加所需的角色:
gcloud projects add-iam-policy-binding ${GCP_PROJECT_ID} \
--member=serviceAccount:${GCP_SERVICE_ACCOUNT_EMAIL}
--role=REPLACE_WITH_REQUIRED_ROLE (e.g. roles/storage.objectAdmin)
使用谷歌云控制台 GUI:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.