python - 谷歌云函数部署 "allow unauthenticated invocations..."

标签 python google-cloud-platform google-cloud-functions gcloud gcloud-python

每当我必须使用 gcloud 部署新的 python 函数时sdk 我收到这条消息

Allow unauthenticated invocations of new function [function-name]?

(y/N)?

WARNING: Function created with limited-access IAM policy. To enable unauthorized access consider

"gcloud alpha functions add-iam-policy-binding function-name --region=europe-west1 --member=allUsers --role=roles/cloudfunctions.invoker"


是否有任何标志可以添加到命令中以使其成为 NO部署时?
这是我用来部署一个函数的示例命令:
gcloud functions deploy function-name --region=europe-west1 --entry-point function-entry-point --trigger-resource "projects/my-project/databases/(default)/documents/user_ids/{user_id}" --trigger-event providers/cloud.firestore/eventTypes/document.create --runtime python37 --timeout 60 --project my-project

最佳答案

来自 https://cloud.google.com/sdk/docs/scripting-gcloud#disabling_prompts :

You can disable prompts from gcloud CLI commands by setting the disable_prompts property in your configuration to True or by using the global --quiet or -q flag.



因此,对于您的示例,您可以运行:
gcloud functions deploy function-name --quiet --region=europe-west1 --entry-point function-entry-point --trigger-resource "projects/my-project/databases/(default)/documents/user_ids/{user_id}" --trigger-event providers/cloud.firestore/eventTypes/document.create --runtime python37 --timeout 60 --project my-project

关于python - 谷歌云函数部署 "allow unauthenticated invocations...",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61552469/

相关文章:

Python 断言不工作 : limit user enter only stated numbers but assert not working

python - 有没有办法避免遍历 python 中 itertools.combinations() 生成的所有可能的组合?

jenkins - 如何在具有节点,阶段的 Jenkins 文件中使用凭证功能

google-cloud-platform - Google Cloud Functions 公开网址

google-cloud-platform - 谷歌云功能超时,显然是在数据库访问期间

python - 无法将 int 转换为 str

python - 如何从 pandas 的列中删除列表中的字符串

mysql - Google Cloud SQL 访问网络

go - 云函数部署时间

node.js - 错误 : Error parsing triggers: Cannot find module 'firebase-functions'