Rework Azure Blob Storage documentation to be more clear (#1122)

Co-authored-by: Yaron Schneider <yaronsc@microsoft.com>
This commit is contained in:
xavier geerinck 2021-01-30 17:51:15 +01:00 committed by GitHub
parent 52447a421b
commit ab0df69645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 47 additions and 5 deletions

View File

@ -40,20 +40,62 @@ The above example uses secrets as plain strings. It is recommended to use a secr
To perform a create blob operation, invoke the Azure Blob Storage binding with a `POST` method and the following JSON body:
> Note: by default, a random UUID is generated. See below for Metadata support to set the name
```json
{
"operation": "create",
"data": {
"field1": "value1"
}
"data": "YOUR_CONTENT"
}
```
#### Example:
```bash
> We escape since ' is not supported on Windows
> On Windows, utilize CMD (PowerShell has different escaping mechanism)
curl -d '{ "operation": "create", "data": { "field1": "value1" }}' \
**Saving to a random generated UUID file**
```bash
curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\" }" \
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
```
**Saving to a specific file**
```bash
curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\", \"metadata\": { \"blobName\": \"my-test-file.txt\" } }" \
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
```
**Saving a file**
To upload a file, encode it as Base64 and let the Binding know to deserialize it:
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <NAME>
namespace: <NAMESPACE>
spec:
type: bindings.azure.blobstorage
version: v1
metadata:
- name: storageAccount
value: myStorageAccountName
- name: storageAccessKey
value: ***********
- name: container
value: container1
- name: decodeBase64
value: "true"
```
Then you can upload it as you would normally:
```bash
curl -d "{ \"operation\": \"create\", \"data\": \"YOUR_BASE_64_CONTENT\", \"metadata\": { \"blobName\": \"my-test-file.jpg\" } }" \
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
```