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.

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: alicloudobjectstorage
  5. spec:
  6. type: bindings.alicloud.oss
  7. version: v1
  8. metadata:
  9. - name: endpoint
  10. value: "[endpoint]"
  11. - name: accessKeyID
  12. value: "[key-id]"
  13. - name: accessKey
  14. value: "[access-key]"
  15. - name: bucket
  16. 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

FieldRequiredBinding supportDetailsExample
endpointYOutputAlicloud OSS endpoint.https://oss-cn-hangzhou.aliyuncs.com
accessKeyIDYOutputAccess key ID credential.
accessKeyYOutputAccess key credential.
bucketYOutputName of the storage bucket.

Binding support

This component supports output binding with the following operations:

Create object

To perform a create object operation, invoke the binding with a POST method and the following JSON body:

  1. {
  2. "operation": "create",
  3. "data": "YOUR_CONTENT"
  4. }

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

  1. curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\" }" http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
  1. curl -d '{ "operation": "create", "data": "Hello World" }' http://localhost:<dapr-port>/v1.0/bindings/<binding-name>

Saving to a specific file

  1. curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\", \"metadata\": { \"key\": \"my-key\" } }" http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
  1. 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:

  1. {
  2. "data": "file content",
  3. "metadata": {
  4. "key": "my-key"
  5. },
  6. "operation": "create"
  7. }

Last modified July 27, 2022: Remove namespace element from component examples (#2647) (ff9de5c8)