-
Notifications
You must be signed in to change notification settings - Fork 778
Sftp Binding Component Docs #4418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
hhunter-ms
merged 10 commits into
dapr:v1.15
from
arslanmusta:sftp-binding-component-docs
Nov 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
935ad18
sftp binding docs added.
arslanmusta 12607aa
Update daprdocs/content/en/reference/components-reference/supported-b…
arslanmusta af5b3e5
Update daprdocs/content/en/reference/components-reference/supported-b…
arslanmusta 60e23aa
Update daprdocs/content/en/reference/components-reference/supported-b…
arslanmusta 977013b
Update daprdocs/content/en/reference/components-reference/supported-b…
arslanmusta f60f25a
Update daprdocs/data/components/bindings/generic.yaml
arslanmusta a836d7d
Update daprdocs/content/en/reference/components-reference/supported-b…
arslanmusta f283821
Merge branch 'v1.15' into sftp-binding-component-docs
arslanmusta 87a350e
Apply suggestions from code review
arslanmusta 94b96cd
Merge branch 'v1.15' into sftp-binding-component-docs
hhunter-ms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
231 changes: 231 additions & 0 deletions
231
daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,231 @@ | ||
| --- | ||
| type: docs | ||
| title: "Sftp binding spec" | ||
| linkTitle: "Sftp" | ||
arslanmusta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| description: "Detailed documentation on the Sftp binding component" | ||
arslanmusta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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. | ||
arslanmusta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```yaml | ||
| apiVersion: dapr.io/v1alpha1 | ||
| kind: Component | ||
| metadata: | ||
| name: <NAME> | ||
| spec: | ||
| type: bindings.sftp | ||
| version: v1 | ||
| metadata: | ||
| - name: rootPath | ||
| value: "<string>" | ||
| - name: address | ||
| value: "<string>" | ||
| - name: username | ||
| value: "<string>" | ||
| - name: password | ||
| value: "*****************" | ||
| - name: privateKey | ||
| value: "*****************" | ||
| - name: privateKeyPassphrase | ||
| value: "*****************" | ||
| - name: hostPublicKey | ||
| value: "*****************" | ||
| - name: knownHostsFile | ||
| value: "<string>" | ||
| - name: insecureIgnoreHostKey | ||
| value: "<bool>" | ||
| ``` | ||
| ## 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"` | | ||
arslanmusta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | `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 | <pre>"\|-<br>-----BEGIN OPENSSH PRIVATE KEY-----<br>*****************<br>-----END OPENSSH PRIVATE KEY-----"</pre> | | ||
| | `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: | ||
arslanmusta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```json | ||
| { | ||
| "operation": "create", | ||
| "data": "<YOUR_BASE_64_CONTENT>", | ||
| "metadata": { | ||
| "fileName": "<filename>", | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| #### Example | ||
|
|
||
| {{< tabs Windows Linux >}} | ||
|
|
||
| {{% codetab %}} | ||
| ```bash | ||
| curl -d "{ \"operation\": \"create\", \"data\": \"YOUR_BASE_64_CONTENT\", \"metadata\": { \"fileName\": \"my-test-file.jpg\" } }" http://localhost:<dapr-port>/v1.0/bindings/<binding-name> | ||
| ``` | ||
| {{% /codetab %}} | ||
|
|
||
| {{% codetab %}} | ||
| ```bash | ||
| curl -d '{ "operation": "create", "data": "YOUR_BASE_64_CONTENT", "metadata": { "fileName": "my-test-file.jpg" } }' \ | ||
| http://localhost:<dapr-port>/v1.0/bindings/<binding-name> | ||
| ``` | ||
| {{% /codetab %}} | ||
|
|
||
| {{< /tabs >}} | ||
|
|
||
| #### Response | ||
|
|
||
| The response body will contain the following JSON: | ||
arslanmusta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```json | ||
| { | ||
| "fileName": "<filename>" | ||
| } | ||
| ``` | ||
|
|
||
| ### Get file | ||
|
|
||
| To perform a get file operation, invoke the Sftp binding with a `POST` method and the following JSON body: | ||
arslanmusta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```json | ||
| { | ||
| "operation": "get", | ||
| "metadata": { | ||
| "fileName": "<filename>" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| #### Example | ||
|
|
||
| {{< tabs Windows Linux >}} | ||
|
|
||
| {{% codetab %}} | ||
| ```bash | ||
| curl -d '{ \"operation\": \"get\", \"metadata\": { \"fileName\": \"filename\" }}' http://localhost:<dapr-port>/v1.0/bindings/<binding-name> | ||
| ``` | ||
| {{% /codetab %}} | ||
|
|
||
| {{% codetab %}} | ||
| ```bash | ||
| curl -d '{ "operation": "get", "metadata": { "fileName": "filename" }}' \ | ||
| http://localhost:<dapr-port>/v1.0/bindings/<binding-name> | ||
| ``` | ||
| {{% /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: | ||
arslanmusta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```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:<dapr-port>/v1.0/bindings/<binding-name> | ||
| ``` | ||
| {{% /codetab %}} | ||
|
|
||
| {{% codetab %}} | ||
| ```bash | ||
| curl -d '{ "operation": "list", "metadata": { "fileName": "my/cool/directory" }}' \ | ||
| http://localhost:<dapr-port>/v1.0/bindings/<binding-name> | ||
| ``` | ||
| {{% /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: | ||
arslanmusta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```json | ||
| { | ||
| "operation": "delete", | ||
| "metadata": { | ||
| "fileName": "myfile" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| #### Example | ||
|
|
||
| {{< tabs Windows Linux >}} | ||
|
|
||
| {{% codetab %}} | ||
| ```bash | ||
| curl -d '{ \"operation\": \"delete\", \"metadata\": { \"fileName\": \"myfile\" }}' http://localhost:<dapr-port>/v1.0/bindings/<binding-name> | ||
| ``` | ||
| {{% /codetab %}} | ||
|
|
||
| {{% codetab %}} | ||
| ```bash | ||
| curl -d '{ "operation": "delete", "metadata": { "fileName": "myfile" }}' \ | ||
| http://localhost:<dapr-port>/v1.0/bindings/<binding-name> | ||
| ``` | ||
| {{% /codetab %}} | ||
|
|
||
| {{< /tabs >}} | ||
|
|
||
| #### Response | ||
|
|
||
| An HTTP 204 (No Content) and empty body will be returned if successful. | ||
arslanmusta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## 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 >}}) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.