From 935ad18db15c4b2af387beb8b7041995d7f4bb1f Mon Sep 17 00:00:00 2001 From: Mustafa Arslan Date: Sat, 2 Nov 2024 16:47:40 +0300 Subject: [PATCH 1/8] sftp binding docs added. Signed-off-by: Mustafa Arslan --- .../supported-bindings/sftp.md | 231 ++++++++++++++++++ .../data/components/bindings/generic.yaml | 8 + 2 files changed, 239 insertions(+) create mode 100644 daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md diff --git a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md new file mode 100644 index 00000000000..44dbca80201 --- /dev/null +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md @@ -0,0 +1,231 @@ +--- +type: docs +title: "Sftp binding spec" +linkTitle: "Sftp" +description: "Detailed documentation on the Sftp binding component" +aliases: + - "/operations/components/setup-bindings/supported-bindings/sftp/" +--- + +## Component format + +To set up the Sftp binding, create a component of type `bindings.sftp`. See this guide on how to create and apply a binding configuration. + +```yaml +apiVersion: dapr.io/v1alpha1 +kind: Component +metadata: + name: +spec: + type: bindings.sftp + version: v1 + metadata: + - name: rootPath + value: "" + - name: address + value: "" + - name: username + value: "" + - name: password + value: "*****************" + - name: privateKey + value: "*****************" + - name: privateKeyPassphrase + value: "*****************" + - name: hostPublicKey + value: "*****************" + - name: knownHostsFile + value: "" + - name: insecureIgnoreHostKey + value: "" +``` + +## Spec metadata fields + +| Field | Required | Binding support | Details | Example | +|--------------------|:--------:|------------|-----|---------| +| `rootPath` | Y | Output | Root path for default working directory | `"/path"` | +| `address` | Y | Output | Address of Sftp server | `"localhost:22"` | +| `username` | Y | Output | Username for authentication | `"username"` | +| `password` | N | Output | Password for username/password authentication | `"password"` | +| `privateKey` | N | Output | Private key for public key authentication |
"\|-
-----BEGIN OPENSSH PRIVATE KEY-----
*****************
-----END OPENSSH PRIVATE KEY-----"
| +| `privateKeyPassphrase` | N | Output | Private key passphrase for public key authentication | `"passphrase"` | +| `hostPublicKey` | N | Output | Host public key for host validation | `"ecdsa-sha2-nistp256 *** root@openssh-server"` | +| `knownHostsFile` | N | Output | Known hosts file for host validation | `"/path/file"` | +| `insecureIgnoreHostKey` | N | Output | Allows to skip host validation. Defaults to `"false"` | `"true"`, `"false"` | + +## Binding support + +This component supports **output binding** with the following operations: + +- `create` : [Create file](#create-file) +- `get` : [Get file](#get-file) +- `list` : [List files](#list-files) +- `delete` : [Delete file](#delete-file) + +### Create file + +To perform a create file operation, invoke the Sftp binding with a `POST` method and the following JSON body: + +```json +{ + "operation": "create", + "data": "", + "metadata": { + "fileName": "", + } +} +``` + +#### Example + +{{< tabs Windows Linux >}} + + {{% codetab %}} + ```bash + curl -d "{ \"operation\": \"create\", \"data\": \"YOUR_BASE_64_CONTENT\", \"metadata\": { \"fileName\": \"my-test-file.jpg\" } }" http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + + {{% codetab %}} + ```bash + curl -d '{ "operation": "create", "data": "YOUR_BASE_64_CONTENT", "metadata": { "fileName": "my-test-file.jpg" } }' \ + http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + +{{< /tabs >}} + +#### Response + +The response body will contain the following JSON: + +```json +{ + "fileName": "" +} + +``` + +### Get file + +To perform a get file operation, invoke the Sftp binding with a `POST` method and the following JSON body: + +```json +{ + "operation": "get", + "metadata": { + "fileName": "" + } +} +``` + +#### Example + +{{< tabs Windows Linux >}} + + {{% codetab %}} + ```bash + curl -d '{ \"operation\": \"get\", \"metadata\": { \"fileName\": \"filename\" }}' http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + + {{% codetab %}} + ```bash + curl -d '{ "operation": "get", "metadata": { "fileName": "filename" }}' \ + http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + +{{< /tabs >}} + +#### Response + +The response body contains the value stored in the file. + +### List files + +To perform a list files operation, invoke the Sftp binding with a `POST` method and the following JSON body: + +```json +{ + "operation": "list" +} +``` + +If you only want to list the files beneath a particular directory below the `rootPath`, specify the relative directory name as the `fileName` in the metadata. + +```json +{ + "operation": "list", + "metadata": { + "fileName": "my/cool/directory" + } +} +``` + +#### Example + +{{< tabs Windows Linux >}} + + {{% codetab %}} + ```bash + curl -d '{ \"operation\": \"list\", \"metadata\": { \"fileName\": \"my/cool/directory\" }}' http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + + {{% codetab %}} + ```bash + curl -d '{ "operation": "list", "metadata": { "fileName": "my/cool/directory" }}' \ + http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + +{{< /tabs >}} + +#### Response + +The response is a JSON array of file names. + +### Delete file + +To perform a delete file operation, invoke the Sftp binding with a `POST` method and the following JSON body: + +```json +{ + "operation": "delete", + "metadata": { + "fileName": "myfile" + } +} +``` + +#### Example + +{{< tabs Windows Linux >}} + + {{% codetab %}} + ```bash + curl -d '{ \"operation\": \"delete\", \"metadata\": { \"fileName\": \"myfile\" }}' http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + + {{% codetab %}} + ```bash + curl -d '{ "operation": "delete", "metadata": { "fileName": "myfile" }}' \ + http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + +{{< /tabs >}} + +#### Response + +An HTTP 204 (No Content) and empty body will be returned if successful. + +## Related links + +- [Basic schema for a Dapr component]({{< ref component-schema >}}) +- [Bindings building block]({{< ref bindings >}}) +- [How-To: Use bindings to interface with external resources]({{< ref howto-bindings.md >}}) +- [Bindings API reference]({{< ref bindings_api.md >}}) diff --git a/daprdocs/data/components/bindings/generic.yaml b/daprdocs/data/components/bindings/generic.yaml index 4f63295bd38..e59df24f6da 100644 --- a/daprdocs/data/components/bindings/generic.yaml +++ b/daprdocs/data/components/bindings/generic.yaml @@ -134,6 +134,14 @@ features: input: true output: false +- component: Sftp + link: sftp + state: Alpha + version: v1 + since: "1.15" + features: + input: false + output: true - component: SMTP link: smtp state: Alpha From 12607aa7c128efddd9e51ad2d8a67ad0c64ad5ba Mon Sep 17 00:00:00 2001 From: Mustafa Arslan Date: Mon, 4 Nov 2024 20:27:54 +0300 Subject: [PATCH 2/8] Update daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md Co-authored-by: Mark Fussell Signed-off-by: Mustafa Arslan --- .../reference/components-reference/supported-bindings/sftp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md index 44dbca80201..9e43ecfc557 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md @@ -1,6 +1,6 @@ --- type: docs -title: "Sftp binding spec" +title: "SFTP binding spec" linkTitle: "Sftp" description: "Detailed documentation on the Sftp binding component" aliases: From af5b3e55d04e6b09ae15bacf68043edd3c61adfb Mon Sep 17 00:00:00 2001 From: Mustafa Arslan Date: Mon, 4 Nov 2024 20:28:05 +0300 Subject: [PATCH 3/8] Update daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md Co-authored-by: Mark Fussell Signed-off-by: Mustafa Arslan --- .../reference/components-reference/supported-bindings/sftp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md index 9e43ecfc557..2cb374fa0d7 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md @@ -2,7 +2,7 @@ type: docs title: "SFTP binding spec" linkTitle: "Sftp" -description: "Detailed documentation on the Sftp binding component" +description: "Detailed documentation on the Secure File Transfer Protocol (SFTP) binding component" aliases: - "/operations/components/setup-bindings/supported-bindings/sftp/" --- From 60e23aadd33047d22c63a7d70c7c1cb2c672cf85 Mon Sep 17 00:00:00 2001 From: Mustafa Arslan Date: Mon, 4 Nov 2024 20:28:13 +0300 Subject: [PATCH 4/8] Update daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md Co-authored-by: Mark Fussell Signed-off-by: Mustafa Arslan --- .../reference/components-reference/supported-bindings/sftp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md index 2cb374fa0d7..a360792986f 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md @@ -98,7 +98,7 @@ To perform a create file operation, invoke the Sftp binding with a `POST` method #### Response -The response body will contain the following JSON: +The response body contains the following JSON: ```json { From 977013b8c99f86ca98fda3b8df4e876076d46c72 Mon Sep 17 00:00:00 2001 From: Mustafa Arslan Date: Mon, 4 Nov 2024 20:28:21 +0300 Subject: [PATCH 5/8] Update daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md Co-authored-by: Mark Fussell Signed-off-by: Mustafa Arslan --- .../reference/components-reference/supported-bindings/sftp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md index a360792986f..9a8077cc9ef 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md @@ -221,7 +221,7 @@ To perform a delete file operation, invoke the Sftp binding with a `POST` method #### Response -An HTTP 204 (No Content) and empty body will be returned if successful. +An HTTP 204 (No Content) and empty body is returned if successful. ## Related links From f60f25a194df97eafcc0c6442664a5128af02306 Mon Sep 17 00:00:00 2001 From: Mustafa Arslan Date: Mon, 4 Nov 2024 20:28:31 +0300 Subject: [PATCH 6/8] Update daprdocs/data/components/bindings/generic.yaml Co-authored-by: Mark Fussell Signed-off-by: Mustafa Arslan --- daprdocs/data/components/bindings/generic.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/data/components/bindings/generic.yaml b/daprdocs/data/components/bindings/generic.yaml index e59df24f6da..250eb4d8810 100644 --- a/daprdocs/data/components/bindings/generic.yaml +++ b/daprdocs/data/components/bindings/generic.yaml @@ -134,7 +134,7 @@ features: input: true output: false -- component: Sftp +- component: SFTP link: sftp state: Alpha version: v1 From a836d7d9abcb2102c8fc11c93514eb6df1b1e29f Mon Sep 17 00:00:00 2001 From: Mustafa Arslan Date: Mon, 4 Nov 2024 20:28:42 +0300 Subject: [PATCH 7/8] Update daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md Co-authored-by: Mark Fussell Signed-off-by: Mustafa Arslan --- .../reference/components-reference/supported-bindings/sftp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md index 9a8077cc9ef..a97f61ae3f5 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md @@ -9,7 +9,7 @@ aliases: ## Component format -To set up the Sftp binding, create a component of type `bindings.sftp`. See this guide on how to create and apply a binding configuration. +To set up the SMTP binding, create a component of type `bindings.sftp`. See this guide on how to create and apply a binding configuration. ```yaml apiVersion: dapr.io/v1alpha1 From 87a350e0cb6fab629e73af7d177bac9a9cfe4554 Mon Sep 17 00:00:00 2001 From: Mustafa Arslan Date: Wed, 20 Nov 2024 12:28:33 +0300 Subject: [PATCH 8/8] Apply suggestions from code review Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Signed-off-by: Mustafa Arslan --- .../supported-bindings/sftp.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md index a97f61ae3f5..a0e356e54b2 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md @@ -1,7 +1,7 @@ --- type: docs title: "SFTP binding spec" -linkTitle: "Sftp" +linkTitle: "SFTP" description: "Detailed documentation on the Secure File Transfer Protocol (SFTP) binding component" aliases: - "/operations/components/setup-bindings/supported-bindings/sftp/" @@ -9,7 +9,7 @@ aliases: ## Component format -To set up the SMTP binding, create a component of type `bindings.sftp`. See this guide on how to create and apply a binding configuration. +To set up the SFTP binding, create a component of type `bindings.sftp`. See [this guide]({{ ref bindings-overview.md }}) on how to create and apply a binding configuration. ```yaml apiVersion: dapr.io/v1alpha1 @@ -45,7 +45,7 @@ spec: | Field | Required | Binding support | Details | Example | |--------------------|:--------:|------------|-----|---------| | `rootPath` | Y | Output | Root path for default working directory | `"/path"` | -| `address` | Y | Output | Address of Sftp server | `"localhost:22"` | +| `address` | Y | Output | Address of SFTP server | `"localhost:22"` | | `username` | Y | Output | Username for authentication | `"username"` | | `password` | N | Output | Password for username/password authentication | `"password"` | | `privateKey` | N | Output | Private key for public key authentication |
"\|-
-----BEGIN OPENSSH PRIVATE KEY-----
*****************
-----END OPENSSH PRIVATE KEY-----"
| @@ -65,7 +65,7 @@ This component supports **output binding** with the following operations: ### Create file -To perform a create file operation, invoke the Sftp binding with a `POST` method and the following JSON body: +To perform a create file operation, invoke the SFTP binding with a `POST` method and the following JSON body: ```json { @@ -109,7 +109,7 @@ The response body contains the following JSON: ### Get file -To perform a get file operation, invoke the Sftp binding with a `POST` method and the following JSON body: +To perform a get file operation, invoke the SFTP binding with a `POST` method and the following JSON body: ```json { @@ -145,7 +145,7 @@ The response body contains the value stored in the file. ### List files -To perform a list files operation, invoke the Sftp binding with a `POST` method and the following JSON body: +To perform a list files operation, invoke the SFTP binding with a `POST` method and the following JSON body: ```json { @@ -189,7 +189,7 @@ The response is a JSON array of file names. ### Delete file -To perform a delete file operation, invoke the Sftp binding with a `POST` method and the following JSON body: +To perform a delete file operation, invoke the SFTP binding with a `POST` method and the following JSON body: ```json {