Google cloud platform 通过REST添加新版本的secret
我想通过GCP REST API添加一个秘密的新版本。 遗憾的是,对于REST来说,这些文档相当乏味,甚至连URL都没有拼写出来 我得到的答复是:Google cloud platform 通过REST添加新版本的secret,google-cloud-platform,google-secret-manager,Google Cloud Platform,Google Secret Manager,我想通过GCP REST API添加一个秘密的新版本。 遗憾的是,对于REST来说,这些文档相当乏味,甚至连URL都没有拼写出来 我得到的答复是: curl -H "authorization: Bearer $(gcloud auth print-access-token)" 'https://secretmanager.googleapis.com/v1beta1/projects/myproject/secrets/foo' 但只有404用于: curl -H &qu
curl -H "authorization: Bearer $(gcloud auth print-access-token)" 'https://secretmanager.googleapis.com/v1beta1/projects/myproject/secrets/foo'
但只有404用于:
curl -H "authorization: Bearer $(gcloud auth print-access-token)" -H 'content-type: application/json' -d '{"payload":{"data":"foo"}}' 'https://secretmanager.googleapis.com/v1beta1/projects/myproject/secrets/foo/addVersion'
还尝试了其他排列。
有人能告诉我如何构造REST调用来添加新版本吗?如果您弹出API资源管理器,就开始显示实际的URL。因此:
https://secretmanager.googleapis.com/v1beta1/projects/myproject/secrets/foo:addVersion
在文档部分,您可以单击“API”选项卡并查看:
$ curl "https://secretmanager.googleapis.com/v1/projects/PROJECT_ID/secrets/SECRET_ID:addVersion" \
--request "POST" \
--header "authorization: Bearer $(gcloud auth print-access-token)" \
--header "content-type: application/json" \
--header "x-goog-user-project: project-id" \
--data "{\"payload\": {\"data\": \"${SECRET_DATA}\"}}"
其中:
是您的GCP项目IDPROJECT\u ID
是要为其添加版本的密钥的名称SECRET\u ID
是base64编码的秘密SECRET\u数据