Add alicloud oss output binding (#1180)

* add alicloud oss output binding

* split alicloud oss to alibaba cloud section

* typo

* remove redundant text

* Update to new format

* Update yaml

Co-authored-by: Aaron Crawfis <Aaron.Crawfis@microsoft.com>
This commit is contained in:
Yaron Schneider 2021-02-10 09:13:43 -08:00 committed by GitHub
parent f753ab814b
commit 1009cfdcca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 112 additions and 0 deletions

View File

@ -28,6 +28,12 @@ Every binding has its own unique set of properties. Click the name link to see t
| [Twitter]({{< ref twitter.md >}}) | ✅ | ✅ | Alpha |
| [SendGrid]({{< ref sendgrid.md >}}) | | ✅ | Alpha |
### Alibaba Cloud
| Name | Input<br>Binding | Output<br>Binding | Status |
|------|:----------------:|:-----------------:|--------|
| [Alibaba Cloud OSS]({{< ref alicloudoss.md >}}) | | ✅ | Alpha |
### Amazon Web Services (AWS)
| Name | Input<br>Binding | Output<br>Binding | Status |

View File

@ -0,0 +1,106 @@
---
type: docs
title: "Alibaba Cloud Object Storage Service binding spec"
linkTitle: "Alibaba Cloud Object Storage"
description: "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]({{< ref "howto-bindings.md#1-create-a-binding" >}}) on how to create and apply a secretstore configuration. See this guide on [referencing secrets]({{< ref component-secrets.md >}}) to retrieve and use the secret with Dapr components.
```yaml
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]"
```
{{% alert title="Warning" color="warning" %}}
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}).
{{% /alert %}}
## Spec metadata fields
| Field | Required | Details | Example |
|---------------|----------|---------|---------|
| `endpoint` | Y | Alicloud OSS endpoint. | https://oss-cn-hangzhou.aliyuncs.com
| `accessKeyID` | Y | Access key ID credential. |
| `accessKey` | Y | Access key credential. |
| `bucket` | Y | Name of the storage bucket. |
## Output operations
The following operations are supported as within the output binding:
### Create object
To perform a create object operation, invoke the binding with a `POST` method and the following JSON body:
```json
{
"operation": "create",
"data": "YOUR_CONTENT"
}
```
{{% alert title="Note" color="primary" %}}
By default, a random UUID is auto-generated as the object key. See below for Metadata support to set the key for the object.
{{% /alert %}}
#### Example
**Saving to a random generated UUID file**
```bash
curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\" }" http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
```
<br />
**Saving to a specific file**
```bash
curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\", \"metadata\": { \"key\": \"my-key\" } }" http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
```
{{% alert title="Note" color="primary" %}}
Windows CMD requires escaping the `"` character.
{{% /alert %}}
## 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:
```json
{
"data": "file content",
"metadata": {
"key": "my-key"
},
"operation": "create"
}
```
## Related links
- [Bindings building block]({{< ref bindings >}})
- [How-To: Trigger application with input binding]({{< ref howto-triggers.md >}})
- [How-To: Use bindings to interface with external resources]({{< ref howto-bindings.md >}})
- [Bindings API reference]({{< ref bindings_api.md >}})