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. namespace: default
  6. spec:
  7. type: bindings.alicloud.oss
  8. version: v1
  9. metadata:
  10. - name: endpoint
  11. value: "[endpoint]"
  12. - name: accessKeyID
  13. value: "[key-id]"
  14. - name: accessKey
  15. value: "[access-key]"
  16. - name: bucket
  17. 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. }

Related links

Last modified March 18, 2021: Merge pull request #1321 from dapr/aacrawfi/logos (9a399d5)