每当我必须使用 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 toTrue
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/