Skip to content
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

Added SFTP source Kamelet #42

Merged
merged 2 commits into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions docs/modules/ROOT/assets/images/kamelets/sftp-source.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* xref:ROOT:mqtt-source.adoc[image:kamelets/mqtt-source.svg[] MQTT Source]
* xref:ROOT:nats-source.adoc[image:kamelets/nats-source.svg[] NATS Source]
* xref:ROOT:salesforce-source.adoc[image:kamelets/salesforce-source.svg[] Salesforce Source]
* xref:ROOT:sftp-source.adoc[image:kamelets/sftp-source.svg[] SFTP Source]
* xref:ROOT:slack-source.adoc[image:kamelets/slack-source.svg[] Slack Source]
* xref:ROOT:telegram-source.adoc[image:kamelets/telegram-source.svg[] Telegram Source]
* xref:ROOT:timer-source.adoc[image:kamelets/timer-source.svg[] Timer Source]
Expand Down
6 changes: 4 additions & 2 deletions docs/modules/ROOT/pages/ftp-source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ The following table summarizes the configuration options available for the `ftp-
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *directoryName {empty}* *| directoryName| The starting directory| string| |
| *directoryName {empty}* *| Directory Name| The starting directory| string| |
| *host {empty}* *| Host| Hostname of the FTP server| string| |
| *password {empty}* *| Password| The password to access the FTP server| string| |
| *port {empty}* *| Port| Port of the FTP server| string| `21`|
| *username {empty}* *| Username| The username to access the FTP server| string| |
| passiveMode| Passive Mode| Sets passive mode connection| boolean| `false`|
| recursive| Recursive| If a directory, will look for files in all the sub-directories as well.| boolean| `false`|
|===

NOTE: Fields marked with ({empty}*) are mandatory.
Expand All @@ -42,7 +44,7 @@ spec:
apiVersion: camel.apache.org/v1alpha1
name: ftp-source
properties:
directoryName: "The directoryName"
directoryName: "The Directory Name"
host: "The Host"
password: "The Password"
username: "The Username"
Expand Down
69 changes: 69 additions & 0 deletions docs/modules/ROOT/pages/sftp-source.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
= image:kamelets/sftp-source.svg[] SFTP Source

*Provided by: "Apache Software Foundation"*

Receive data from an SFTP Server.

== Configuration Options

The following table summarizes the configuration options available for the `sftp-source` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *directoryName {empty}* *| Directory Name| The starting directory| string| |
| *host {empty}* *| Host| Hostname of the SFTP server| string| |
| *password {empty}* *| Password| The password to access the SFTP server| string| |
| *port {empty}* *| Port| Port of the FTP server| string| `22`|
| *username {empty}* *| Username| The username to access the SFTP server| string| |
| passiveMode| Passive Mode| Sets passive mode connection| boolean| `false`|
| recursive| Recursive| If a directory, will look for files in all the sub-directories as well.| boolean| `false`|
|===

NOTE: Fields marked with ({empty}*) are mandatory.

== Usage

This section summarizes how the `sftp-source` can be used in various contexts.

=== Knative Source

The `sftp-source` Kamelet can be used as Knative source by binding it to a Knative object.

.sftp-source-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: sftp-source-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: sftp-source
properties:
directoryName: "The Directory Name"
host: "The Host"
password: "The Password"
username: "The Username"
sink:
ref:
kind: InMemoryChannel
apiVersion: messaging.knative.dev/v1
name: mychannel

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `sftp-source-binding.yaml` file into your hard drive, then configure it according to your needs.

You can run the source using the following command:

[source,shell]
----
kubectl apply -f sftp-source-binding.yaml
----
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
1 change: 1 addition & 0 deletions ftp-source.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
camel.apache.org/provider: "Apache Software Foundation"
labels:
camel.apache.org/kamelet.type: "source"
camel.apache.org/kamelet.group: "FTP"
spec:
definition:
title: "FTP Source"
Expand Down
69 changes: 69 additions & 0 deletions sftp-source.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: sftp-source
annotations:
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxOS4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAyMjEuMSAzMDAiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDIyMS4xIDMwMDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCgkuc3Qwe2ZpbGw6IzgzMkVBQjt9DQoJLnN0MXtmaWxsOiNCQUJBQkE7fQ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CgkJPC9nPg0KCTwvZz4NCgk8cmVjdCB4PSIwIiB5PSI0OC40IiBjbGFzcz0ic3QyIiB3aWR0aD0iMjIxLjciIGhlaWdodD0iNzYiLz4NCgk8dGV4dCB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDc3LjgyNTIgODIuOTEyOCkiIGNsYXNzPSJzdDkgc3QyMSBzdDIyIj5mdHA8L3RleHQ+DQo8L2c+DQo8L3N2Zz4NCg=="
camel.apache.org/provider: "Apache Software Foundation"
labels:
camel.apache.org/kamelet.type: "source"
oscerd marked this conversation as resolved.
Show resolved Hide resolved
camel.apache.org/kamelet.group: "FTP"
spec:
definition:
title: "SFTP Source"
description: |-
Receive data from an SFTP Server.
required:
- host
- port
- username
- password
- directoryName
properties:
host:
title: Host
description: Hostname of the SFTP server
type: string
port:
title: Port
description: Port of the FTP server
type: string
default: 22
username:
title: Username
description: The username to access the SFTP server
type: string
password:
title: Password
description: The password to access the SFTP server
type: string
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
directoryName:
title: Directory Name
description: The starting directory
type: string
passiveMode:
title: Passive Mode
description: Sets passive mode connection
type: boolean
default: false
recursive:
title: Recursive
description: If a directory, will look for files in all the sub-directories as well.
type: boolean
default: false
types:
out:
mediaType: application/json
flow:
from:
uri: "sftp:{{username}}@{{host}}:{{port}}/{{directoryName}}"
parameters:
password: "{{password}}"
passiveMode: "{{passiveMode}}"
recursive: "{{recursive}}"
steps:
- convert-body-to:
type: "java.lang.String"
- to: "kamelet:sink"