diff --git a/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/s3.md b/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/s3.md index deaaf0add..e38dc221d 100644 --- a/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/s3.md +++ b/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/s3.md @@ -29,8 +29,8 @@ spec: value: ***************** - name: secretKey value: ***************** - - name: bucket - value: mybucket + - name: sessionToken + value: mysession ``` {{% alert title="Warning" color="warning" %}} @@ -54,6 +54,85 @@ This component supports **output binding** with the following operations: - `create` +### Create file + +To perform a create operation, invoke the AWS S3 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": "YOUR_CONTENT" +} +``` + +#### Examples + + +##### Save text to a random generated UUID file + +{{< tabs Windows Linux >}} + {{% codetab %}} + On Windows, utilize cmd prompt (PowerShell has different escaping mechanism) + ```bash + curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\" }" http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + + {{% codetab %}} + ```bash + curl -d '{ "operation": "create", "data": "Hello World" }' \ + http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + +{{< /tabs >}} + +##### Save text to a specific file + +{{< tabs Windows Linux >}} + + {{% codetab %}} + ```bash + curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\", \"metadata\": { \"key\": \"my-test-file.txt\" } }" \ + http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + + {{% codetab %}} + ```bash + curl -d '{ "operation": "create", "data": "Hello World", "metadata": { "key": "my-test-file.txt" } }' \ + http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + +{{< /tabs >}} + + +##### Upload a file + +To upload a file, pass the file contents as the data payload; you may want to encode this in e.g. Base64 for binary content. + +Then you can upload it as you would normally: + +{{< tabs Windows Linux >}} + + {{% codetab %}} + ```bash + curl -d "{ \"operation\": \"create\", \"data\": \"(YOUR_FILE_CONTENTS)\", \"metadata\": { \"key\": \"my-test-file.jpg\" } }" http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + + {{% codetab %}} + ```bash + curl -d '{ "operation": "create", "data": "$(cat my-test-file.jpg)", "metadata": { "key": "my-test-file.jpg" } }' \ + http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + +{{< /tabs >}} + ## Related links - [Basic schema for a Dapr component]({{< ref component-schema >}})