GCP Storage Bucket binding spec
To setup GCP Storage Bucket binding create a component of type . See this guide on how to create and apply a binding configuration.
Warning
以上示例将密钥明文存储, It is recommended to use a secret store for the secrets as described here.
To perform a create operation, invoke the GCP Storage Bucket binding with a POST
method and the following JSON body:
{
"data": "YOUR_CONTENT"
}
示例
Save text to a random generated UUID file
curl -d '{ "operation": "create", "data": "Hello World" }' \
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
Save text to a specific file
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
Upload a file
To upload a file, pass the file contents as the data payload; you may want to encode this in e.g. Base64 for binary content.
然后你就可以像平常一样上传了:
curl -d '{ "operation": "create", "data": "$(cat my-test-file.jpg)", "metadata": { "name": "my-test-file.jpg" } }' \