Trigger Trigger

yaml
type: "io.kestra.plugin.fs.sftp.Trigger"

Trigger a flow as soon as new files are detected in a given SFTP server's directory.

Examples

Wait for one or more files in a given SFTP server's directory and process each of these files sequentially.

yaml
id: sftp_trigger_flow
namespace: company.team

tasks:
  - id: for_each_file
    type: io.kestra.plugin.core.flow.EachSequential
    value: "{{ trigger.files }}"
    tasks:
      - id: return
        type: io.kestra.plugin.core.debug.Return
        format: "{{ taskrun.value | jq('.path') }}"

triggers:
  - id: watch
    type: io.kestra.plugin.fs.sftp.Trigger
    host: localhost
    port: 6622
    username: foo
    password: bar
    from: "/in/"
    interval: PT10S
    action: MOVE
    moveDirectory: "/archive/"

Wait for one or more files in a given SFTP server's directory and process each of these files sequentially. Delete files manually after processing to prevent infinite triggering.

yaml
id: sftp_trigger_flow
namespace: company.team

tasks:
  - id: for_each_file
    type: io.kestra.plugin.core.flow.EachSequential
    value: "{{ trigger.files | jq('.path') }}"
    tasks:
      - id: return
        type: io.kestra.plugin.core.debug.Return
        format: "{{ taskrun.value }}"
      - id: delete
        type: io.kestra.plugin.fs.sftp.Delete
        host: localhost
        port: 6622
        username: foo
        password: bar
        uri: "/in/{{ taskrun.value }}"

triggers:
  - id: watch
    type: io.kestra.plugin.fs.sftp.Trigger
    host: localhost
    port: 6622
    username: foo
    password: bar
    from: "/in/"
    interval: PT10S
    action: NONE

Wait for one or more files in a given SFTP server's directory and process each of these files sequentially. In this example, we restrict the trigger to only wait for CSV files in the mydir directory.

yaml
id: ftp_wait_for_csv_in_mydir
namespace: company.team

tasks:
  - id: each
    type: io.kestra.plugin.core.flow.EachSequential
    value: "{{ trigger.files }}"
    tasks:
      - id: return
        type: io.kestra.plugin.core.debug.Return
        format: "{{ taskrun.value | jq('.path') }}"

triggers:
  - id: watch
    type: io.kestra.plugin.fs.sftp.Trigger
    host: localhost
    port: "6622"
    username: foo
    password: bar
    from: "mydir/"
    regExp: ".*.csv"
    action: MOVE
    moveDirectory: "archive/"
    interval: PTS

Properties

action

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️
  • Possible Values:
    • MOVE
    • DELETE
    • NONE

The action to perform on the retrieved files. If using 'NONE' make sure to handle the files inside your flow to avoid infinite triggering.

from

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

The directory to list

host

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

Hostname of the remote server

conditions

  • Type: array
  • SubType: Condition
  • Dynamic:
  • Required:

List of conditions in order to limit the flow trigger.

interval

  • Type: string
  • Dynamic:
  • Required:
  • Default: 60.000000000
  • Format: duration

The interval between test of triggers

keyExchangeAlgorithm

  • Type: string
  • Dynamic:
  • Required:

Configures Key exchange algorithm explicitly e. g diffie-hellman-group14-sha1, diffie-hellman-group-exchange-sha256, diffie-hellman-group-exchange-sha1, diffie-hellman-group1-sha1.

keyfile

  • Type: string
  • Dynamic: ✔️
  • Required:

Private keyfile in the PEM file format to connect to a remote server using SSH

To generate a PEM format key from OpenSSH, use the following command: ssh-keygen -m PEM

moveDirectory

  • Type: string
  • Dynamic: ✔️
  • Required:

**The destination directory in case off MOVE **

passphrase

  • Type: string
  • Dynamic: ✔️
  • Required:

Passphrase of the ssh key

password

  • Type: string
  • Dynamic: ✔️
  • Required:

Password on the remote server

port

  • Type: string
  • Dynamic: ✔️
  • Required:
  • Default: 22

Port of the remote server

proxyHost

  • Type: string
  • Dynamic: ✔️
  • Required:

SFTP proxy host

proxyPassword

  • Type: string
  • Dynamic: ✔️
  • Required:

SFTP proxy password

proxyPort

  • Type: string
  • Dynamic: ✔️
  • Required:

SFTP proxy port

proxyType

  • Type: string
  • Dynamic: ✔️
  • Required:

SFTP proxy type

proxyUser

  • Type: string
  • Dynamic: ✔️
  • Required:

SFTP proxy user

recursive

  • Type: boolean
  • Dynamic:
  • Required:
  • Default: false

List file recursively

regExp

  • Type: string
  • Dynamic: ✔️
  • Required:

A regexp to filter on full path

rootDir

  • Type: boolean
  • Dynamic: ✔️
  • Required:
  • Default: true

Is path is relative to root dir

stopAfter

  • Type: array
  • SubType: string
  • Dynamic:
  • Required:

List of execution states after which a trigger should be stopped (a.k.a. disabled).

username

  • Type: string
  • Dynamic: ✔️
  • Required:

Username on the remote server

Outputs

files

  • Type: array
  • SubType: File
  • SubType: File
  • Required:

Metadata of downloaded files.

outputFiles

  • Type: object
  • SubType: string
  • Required:

The downloaded files as a map of from/to URIs.

Definitions

io.kestra.plugin.fs.vfs.models.File

Properties

accessDate
  • Type: string
  • Dynamic:
  • Required:
  • Format: date-time
fileType
  • Type: string
  • Dynamic:
  • Required:
  • Possible Values:
    • FOLDER
    • FILE
    • FILE_OR_FOLDER
    • IMAGINARY
flags
  • Type: integer
  • Dynamic:
  • Required:
groupId
  • Type: integer
  • Dynamic:
  • Required:
name
  • Type: string
  • Dynamic:
  • Required:
path
  • Type: string
  • Dynamic:
  • Required:
  • Format: uri
permissions
  • Type: integer
  • Dynamic:
  • Required:
size
  • Type: integer
  • Dynamic:
  • Required:
  • Type: boolean
  • Dynamic:
  • Required:
  • Default: false
updatedDate
  • Type: string
  • Dynamic:
  • Required:
  • Format: date-time
userId
  • Type: integer
  • Dynamic:
  • Required:

Was this page helpful?