Alibaba Cloud Object Storage Service binding spec
Detailed documentation on the Alibaba Cloud Object Storage binding component
Component format
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]"
Warning
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described here.
Spec metadata fields
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. |
Binding support
This component supports output binding with the following operations:
create
: Create object
Create object
To perform a create object operation, invoke the binding with a POST
method and the following JSON body:
{
"operation": "create",
"data": "YOUR_CONTENT"
}
Note
By default, a random UUID is auto-generated as the object key. See below for Metadata support to set the key for the object.
Example
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>
Note
Windows CMD requires escaping the "
character.
Metadata information
Object key
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"
}
Related links
- Bindings building block
- How-To: Trigger application with input binding
- How-To: Use bindings to interface with external resources
- Bindings API reference
Last modified September 17, 2021 : Merge pull request #1757 from georgestevens99/1440SecretKeyRefExplanation (620a5f8)