To setup an Alibaba Cloud Object Storage binding create a component of type bindings.alicloud.oss
. See this guide on how to create and apply a secretstore configuration. See this guide on referencing secrets to retrieve and use the secret with Dapr components.
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: alicloudobjectstorage
namespace: default
spec:
type: bindings.alicloud.oss
version: v1
metadata:
- name: endpoint
value: "[endpoint]"
- name: accessKeyID
value: "[key-id]"
- name: accessKey
value: "[access-key]"
- name: bucket
value: "[bucket]"
Field | Required | Binding support | Details | Example |
---|---|---|---|---|
endpoint | Y | Output | Alicloud OSS endpoint. | https://oss-cn-hangzhou.aliyuncs.com |
accessKeyID | Y | Output | Access key ID credential. | |
accessKey | Y | Output | Access key credential. | |
bucket | Y | Output | Name of the storage bucket. |
This component supports output binding with the following operations:
create
: Create objectTo perform a create object operation, invoke the binding with a POST
method and the following JSON body:
{
"operation": "create",
"data": "YOUR_CONTENT"
}
Saving to a random generated UUID file
curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\" }" http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
curl -d '{ "operation": "create", "data": "Hello World" }' http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
Saving to a specific file
curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\", \"metadata\": { \"key\": \"my-key\" } }" http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
curl -d '{ "operation": "create", "data": "Hello World", "metadata": { "key": "my-key" } }' http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
"
character.By default, the Alicloud OSS output binding will auto-generate a UUID as the object key. You can set the key with the following metadata:
{
"data": "file content",
"metadata": {
"key": "my-key"
},
"operation": "create"
}