diff --git a/src/main/java/io/kestra/plugin/fs/ftp/Delete.java b/src/main/java/io/kestra/plugin/fs/ftp/Delete.java index 47774bb..7ca0210 100644 --- a/src/main/java/io/kestra/plugin/fs/ftp/Delete.java +++ b/src/main/java/io/kestra/plugin/fs/ftp/Delete.java @@ -23,13 +23,20 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 21", - "username: foo", - "password: pass", - "uri: \"/upload/dir1/file.txt\"", - } + full = true, + code = """ + id: fs_ftp_delete + namespace: company.team + + tasks: + - id: delete + type: io.kestra.plugin.fs.ftp.Delete + host: localhost + port: 21 + username: foo + password: pass + uri: "/upload/dir1/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftp/Download.java b/src/main/java/io/kestra/plugin/fs/ftp/Download.java index a526229..a5708c5 100644 --- a/src/main/java/io/kestra/plugin/fs/ftp/Download.java +++ b/src/main/java/io/kestra/plugin/fs/ftp/Download.java @@ -23,13 +23,20 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 21", - "username: foo", - "password: pass", - "from: \"/in/file.txt\"", - } + full = true, + code = """ + id: fs_ftp_download + namespace: company.team + + tasks: + - id: download + type: io.kestra.plugin.fs.ftp.Download + host: localhost + port: 21 + username: foo + password: pass + from: "/in/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftp/Downloads.java b/src/main/java/io/kestra/plugin/fs/ftp/Downloads.java index 68d4885..f7ed66c 100644 --- a/src/main/java/io/kestra/plugin/fs/ftp/Downloads.java +++ b/src/main/java/io/kestra/plugin/fs/ftp/Downloads.java @@ -24,16 +24,23 @@ examples = { @Example( title = "Download a list of files and move it to an archive folders", - code = { - "host: localhost", - "port: 21", - "username: foo", - "password: pass", - "from: \"/in/\"", - "interval: PT10S", - "action: MOVE", - "moveDirectory: \"/archive/\"", - } + full = true, + code = """ + id: fs_ftp_downloads + namespace: company.team + + tasks: + - id: downloads + type: io.kestra.plugin.fs.ftp.Downloads + host: localhost + port: 21 + username: foo + password: pass + from: "/in/" + interval: PT10S + action: MOVE + moveDirectory: "/archive/" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftp/List.java b/src/main/java/io/kestra/plugin/fs/ftp/List.java index 77a154a..e196fc3 100644 --- a/src/main/java/io/kestra/plugin/fs/ftp/List.java +++ b/src/main/java/io/kestra/plugin/fs/ftp/List.java @@ -23,14 +23,21 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 21", - "username: foo", - "password: pass", - "from: \"/upload/dir1/\"", - "regExp: \".*\\/dir1\\/.*\\.(yaml|yml)\"", - } + full = true, + code = """ + id: fs_ftp_list + namespace: company.team + + tasks: + - id: list + type: io.kestra.plugin.fs.ftp.List + host: localhost + port: 21 + username: foo + password: pass + from: "/upload/dir1/" + regExp: ".*\/dir1\/.*\.(yaml|yml)" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftp/Move.java b/src/main/java/io/kestra/plugin/fs/ftp/Move.java index 5aee36e..43cebba 100644 --- a/src/main/java/io/kestra/plugin/fs/ftp/Move.java +++ b/src/main/java/io/kestra/plugin/fs/ftp/Move.java @@ -24,14 +24,21 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 21", - "username: foo", - "password: pass", - "from: \"/upload/dir1/file.txt\"", - "to: \"/upload/dir2/file.txt\"", - } + full = true, + code = """ + id: fs_ftp_move + namespace: company.team + + tasks: + - id: move + type: io.kestra.plugin.fs.ftp.Move + host: localhost + port: 21 + username: foo + password: pass + from: "/upload/dir1/file.txt" + to: "/upload/dir2/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftp/Trigger.java b/src/main/java/io/kestra/plugin/fs/ftp/Trigger.java index 736f948..e3de8b6 100644 --- a/src/main/java/io/kestra/plugin/fs/ftp/Trigger.java +++ b/src/main/java/io/kestra/plugin/fs/ftp/Trigger.java @@ -25,66 +25,66 @@ @Example( title = "Wait for one or more files in a given FTP server's directory and process each of these files sequentially.", full = true, - code = { - "id: ftp_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.ftp.Trigger", - " host: localhost", - " port: 21", - " username: foo", - " password: bar", - " from: \"/in/\"", - " interval: PT10S", - " action: MOVE", - " moveDirectory: \"/archive/\"", - } + code = """ + id: ftp_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.ftp.Trigger + host: localhost + port: 21 + username: foo + password: bar + from: "/in/" + interval: PT10S + action: MOVE + moveDirectory: "/archive/" + """ ), @Example( title = "Wait for one or more files in a given FTP server's directory and process each of these files sequentially. Delete files manually after processing to prevent infinite triggering.", full = true, - code = { - "id: ftp_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('.name') }}\"", - " - id: delete", - " type: io.kestra.plugin.fs.ftp.Delete", - " host: localhost", - " port: 21", - " username: foo", - " password: bar", - " uri: \"/in/{{ taskrun.value | jq('.name') }}\"", - "", - "triggers:", - " - id: watch", - " type: io.kestra.plugin.fs.ftp.Trigger", - " host: localhost", - " port: 21", - " username: foo", - " password: bar", - " from: \"/in/\"", - " interval: PT10S", - " action: NONE", - } + code = """ + id: ftp_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('.name') }}" + - id: delete + type: io.kestra.plugin.fs.ftp.Delete + host: localhost + port: 21 + username: foo + password: bar + uri: "/in/{{ taskrun.value | jq('.name') }}" + + triggers: + - id: watch + type: io.kestra.plugin.fs.ftp.Trigger + host: localhost + port: 21 + username: foo + password: bar + from: "/in/" + interval: PT10S + action: NONE + """ ), @Example( title = "Wait for one or more files in a given FTP 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.", @@ -113,7 +113,8 @@ regExp: ".*.csv" action: MOVE moveDirectory: "archive/" - interval: PTS""" + interval: PTS + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftp/Upload.java b/src/main/java/io/kestra/plugin/fs/ftp/Upload.java index aaa1fa8..8aa377f 100644 --- a/src/main/java/io/kestra/plugin/fs/ftp/Upload.java +++ b/src/main/java/io/kestra/plugin/fs/ftp/Upload.java @@ -23,14 +23,25 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 21", - "username: foo", - "password: pass", - "from: \"{{ outputs.taskid.uri }}\"", - "to: \"/upload/dir2/file.txt\"", - } + full = true, + code = """ + id: fs_ftp_upload + namespace: company.team + + inputs: + - id: file + type: FILE + + tasks: + - id: upload + type: io.kestra.plugin.fs.ftp.Upload + host: localhost + port: 21 + username: foo + password: pass + from: "{{ inputs.file }}" + to: "/upload/dir2/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftp/Uploads.java b/src/main/java/io/kestra/plugin/fs/ftp/Uploads.java index 8c681f3..1d6f73f 100644 --- a/src/main/java/io/kestra/plugin/fs/ftp/Uploads.java +++ b/src/main/java/io/kestra/plugin/fs/ftp/Uploads.java @@ -23,16 +23,29 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 21", - "username: foo", - "password: pass", - "from:", - " - \"{{ outputs.taskid1.uri }}\"", - " - \"{{ outputs.taskid2.uri }}\"", - "to: \"/upload/dir2\"", - } + full = true, + code = """ + id: fs_ftp_uploads + namespace: company.team + + inputs: + - id: file1 + type: FILE + - id: file2 + type: FILE + + tasks: + - id: uploads + type: io.kestra.plugin.fs.ftp.Uploads + host: localhost + port: 21 + username: foo + password: pass + from: + - "{{ inputs.file1 }}" + - "{{ inputs.file2 }}" + to: "/upload/dir2" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftps/Delete.java b/src/main/java/io/kestra/plugin/fs/ftps/Delete.java index 202d671..56d558e 100644 --- a/src/main/java/io/kestra/plugin/fs/ftps/Delete.java +++ b/src/main/java/io/kestra/plugin/fs/ftps/Delete.java @@ -26,13 +26,20 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 990", - "username: foo", - "password: pass", - "uri: \"/upload/dir1/file.txt\"", - } + full = true, + code = """ + id: fs_ftps_delete + namespace: company.team + + tasks: + - id: delete + type: io.kestra.plugin.fs.ftps.Delete + host: localhost + port: 990 + username: foo + password: pass + uri: "/upload/dir1/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftps/Download.java b/src/main/java/io/kestra/plugin/fs/ftps/Download.java index 1f5a7a9..0c54360 100644 --- a/src/main/java/io/kestra/plugin/fs/ftps/Download.java +++ b/src/main/java/io/kestra/plugin/fs/ftps/Download.java @@ -26,13 +26,20 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 990", - "username: foo", - "password: pass", - "from: \"/in/file.txt\"", - } + full = true, + code = """ + id: fs_ftps_download + namespace: company.team + + tasks: + - id: download + type: io.kestra.plugin.fs.ftps.Download + host: localhost + port: 990 + username: foo + password: pass + from: "/in/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftps/Downloads.java b/src/main/java/io/kestra/plugin/fs/ftps/Downloads.java index 6e9916a..9b0e16b 100644 --- a/src/main/java/io/kestra/plugin/fs/ftps/Downloads.java +++ b/src/main/java/io/kestra/plugin/fs/ftps/Downloads.java @@ -27,16 +27,23 @@ examples = { @Example( title = "Download a list of files and move it to an archive folders", - code = { - "host: localhost", - "port: 990", - "username: foo", - "password: pass", - "from: \"/in/\"", - "interval: PT10S", - "action: MOVE", - "moveDirectory: \"/archive/\"", - } + full = true, + code = """ + id: fs_ftps_downloads + namespace: company.team + + tasks: + - id: downloads + type: io.kestra.plugin.fs.ftps.Downloads + host: localhost + port: 990 + username: foo + password: pass + from: "/in/" + interval: PT10S + action: MOVE + moveDirectory: "/archive/" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftps/List.java b/src/main/java/io/kestra/plugin/fs/ftps/List.java index 37c6095..6610a62 100644 --- a/src/main/java/io/kestra/plugin/fs/ftps/List.java +++ b/src/main/java/io/kestra/plugin/fs/ftps/List.java @@ -26,14 +26,21 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 990", - "username: foo", - "password: pass", - "from: \"/upload/dir1/\"", - "regExp: \".*\\/dir1\\/.*\\.(yaml|yml)\"", - } + full = true, + code = """ + id: fs_ftps_list + namespace: company.team + + tasks: + - id: list + type: io.kestra.plugin.fs.ftps.List + host: localhost + port: 990 + username: foo + password: pass + from: "/upload/dir1/" + regExp: ".*\/dir1\/.*\.(yaml|yml)" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftps/Move.java b/src/main/java/io/kestra/plugin/fs/ftps/Move.java index 7003d43..8520a67 100644 --- a/src/main/java/io/kestra/plugin/fs/ftps/Move.java +++ b/src/main/java/io/kestra/plugin/fs/ftps/Move.java @@ -27,14 +27,21 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 990", - "username: foo", - "password: pass", - "from: \"/upload/dir1/file.txt\"", - "to: \"/upload/dir2/file.txt\"", - } + full = true, + code = """ + id: fs_ftps_move + namespace: company.team + + tasks: + - id: move + type: io.kestra.plugin.fs.ftps.Move + host: localhost + port: 990 + username: foo + password: pass + from: "/upload/dir1/file.txt" + to: "/upload/dir2/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftps/Trigger.java b/src/main/java/io/kestra/plugin/fs/ftps/Trigger.java index e073645..824b438 100644 --- a/src/main/java/io/kestra/plugin/fs/ftps/Trigger.java +++ b/src/main/java/io/kestra/plugin/fs/ftps/Trigger.java @@ -28,31 +28,31 @@ @Example( title = "Wait for one or more files in a given FTPS server's directory and process each of these files sequentially.", full = true, - code = { - "id: ftps_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.ftps.Trigger", - " host: localhost", - " port: 990", - " username: foo", - " password: bar", - " from: \"/in/\"", - " interval: PT10S", - " action: MOVE", - " moveDirectory: \"/archive/\"", - } + code = """ + id: ftps_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.ftps.Trigger + host: localhost + port: 990 + username: foo + password: bar + from: "/in/" + interval: PT10S + action: MOVE + moveDirectory: "/archive/" + """ ), @Example( title = "Wait for one or more files in a given FTPS 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.", @@ -81,7 +81,8 @@ regExp: ".*.csv" action: MOVE moveDirectory: "archive/" - interval: PTS""" + interval: PTS + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftps/Upload.java b/src/main/java/io/kestra/plugin/fs/ftps/Upload.java index 3efc0aa..f51d240 100644 --- a/src/main/java/io/kestra/plugin/fs/ftps/Upload.java +++ b/src/main/java/io/kestra/plugin/fs/ftps/Upload.java @@ -26,14 +26,25 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 990", - "username: foo", - "password: pass", - "from: \"{{ outputs.taskid.uri }}\"", - "to: \"/upload/dir2/file.txt\"", - } + full = true, + code = """ + id: fs_ftps_upload + namespace: company.team + + inputs: + - id: file + type: FILE + + tasks: + - id: upload + type: io.kestra.plugin.fs.ftps.Upload + host: localhost + port: 990 + username: foo + password: pass + from: "{{ inputs.file }}" + to: "/upload/dir2/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ftps/Uploads.java b/src/main/java/io/kestra/plugin/fs/ftps/Uploads.java index cb387f0..05df856 100644 --- a/src/main/java/io/kestra/plugin/fs/ftps/Uploads.java +++ b/src/main/java/io/kestra/plugin/fs/ftps/Uploads.java @@ -26,16 +26,29 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 990", - "username: foo", - "password: pass", - "from:", - " - \"{{ outputs.taskid1.uri }}\"", - " - \"{{ outputs.taskid2.uri }}\"", - "to: \"/upload/dir2\"", - } + full = true, + code = """ + id: fs_ftps_uploads + namespace: company.team + + inputs: + - id: file1 + type: FILE + - id: file2 + type: FILE + + tasks: + - id: uploads + type: io.kestra.plugin.fs.ftps.Uploads + host: localhost + port: 990 + username: foo + password: pass + from: + - "{{ inputs.file1 }}" + - "{{ inputs.file2 }}" + to: "/upload/dir2" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/sftp/Delete.java b/src/main/java/io/kestra/plugin/fs/sftp/Delete.java index 751b361..9c5a998 100644 --- a/src/main/java/io/kestra/plugin/fs/sftp/Delete.java +++ b/src/main/java/io/kestra/plugin/fs/sftp/Delete.java @@ -22,13 +22,20 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: \"22\"", - "username: foo", - "password: pass", - "uri: \"/upload/dir1/file.txt\"", - } + full = true, + code = """ + id: fs_sftp_delete + namespace: company.team + + tasks: + - id: delete + type: io.kestra.plugin.fs.sftp.Delete + host: localhost + port: "22" + username: foo + password: pass + uri: "/upload/dir1/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/sftp/Download.java b/src/main/java/io/kestra/plugin/fs/sftp/Download.java index 46912b6..90c8914 100644 --- a/src/main/java/io/kestra/plugin/fs/sftp/Download.java +++ b/src/main/java/io/kestra/plugin/fs/sftp/Download.java @@ -22,13 +22,20 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: \"22\"", - "username: foo", - "password: pass", - "from: \"/in/file.txt\"", - } + full = true, + code = """ + id: fs_sftp_download + namespace: company.team + + tasks: + - id: download + type: io.kestra.plugin.fs.sftp.Download + host: localhost + port: "22" + username: foo + password: pass + from: "/in/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/sftp/Downloads.java b/src/main/java/io/kestra/plugin/fs/sftp/Downloads.java index 071cd74..6d216ce 100644 --- a/src/main/java/io/kestra/plugin/fs/sftp/Downloads.java +++ b/src/main/java/io/kestra/plugin/fs/sftp/Downloads.java @@ -23,16 +23,23 @@ examples = { @Example( title = "Download a list of files and move it to an archive folders", - code = { - "host: localhost", - "port: \"22\"", - "username: foo", - "password: pass", - "from: \"/in/\"", - "interval: PT10S", - "action: MOVE", - "moveDirectory: \"/archive/\"", - } + full = true, + code = """ + id: fs_sftp_downloads + namespace: company.team + + tasks: + - id: downloads + type: io.kestra.plugin.fs.sftp.Downloads + host: localhost + port: "22" + username: foo + password: pass + from: "/in/" + interval: PT10S + action: MOVE + moveDirectory: "/archive/" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/sftp/List.java b/src/main/java/io/kestra/plugin/fs/sftp/List.java index afdccb1..d030c1a 100644 --- a/src/main/java/io/kestra/plugin/fs/sftp/List.java +++ b/src/main/java/io/kestra/plugin/fs/sftp/List.java @@ -22,14 +22,21 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: \"22\"", - "username: foo", - "password: pass", - "from: \"/upload/dir1/\"", - "regExp: \".*\\/dir1\\/.*\\.(yaml|yml)\"", - } + full = true, + code = """ + id: fs_sftp_list + namespace: company.team + + tasks: + - id: list + type: io.kestra.plugin.fs.sftp.List + host: localhost + port: "22" + username: foo + password: pass + from: "/upload/dir1/" + regExp: ".*\/dir1\/.*\.(yaml|yml)" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/sftp/Move.java b/src/main/java/io/kestra/plugin/fs/sftp/Move.java index e15a70b..076e8f6 100644 --- a/src/main/java/io/kestra/plugin/fs/sftp/Move.java +++ b/src/main/java/io/kestra/plugin/fs/sftp/Move.java @@ -23,14 +23,21 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: \"22\"", - "username: foo", - "password: pass", - "from: \"/upload/dir1/file.txt\"", - "to: \"/upload/dir2/file.txt\"", - } + full = true, + code = """ + id: fs_sftp_move + namespace: company.team + + tasks: + - id: move + type: io.kestra.plugin.fs.sftp.Move + host: localhost + port: "22" + username: foo + password: pass + from: "/upload/dir1/file.txt" + to: "/upload/dir2/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/sftp/Trigger.java b/src/main/java/io/kestra/plugin/fs/sftp/Trigger.java index a00e2a7..957ace3 100644 --- a/src/main/java/io/kestra/plugin/fs/sftp/Trigger.java +++ b/src/main/java/io/kestra/plugin/fs/sftp/Trigger.java @@ -24,66 +24,66 @@ @Example( title = "Wait for one or more files in a given SFTP server's directory and process each of these files sequentially.", full = true, - code = { - "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/\"", - } + code = """ + 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/" + """ ), @Example( title = "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.", full = true, - code = { - "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", - } + code = """ + 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 + """ ), @Example( title = "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.", @@ -112,7 +112,8 @@ regExp: ".*.csv" action: MOVE moveDirectory: "archive/" - interval: PTS""" + interval: PTS + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/sftp/Upload.java b/src/main/java/io/kestra/plugin/fs/sftp/Upload.java index e2115d0..b8762a1 100644 --- a/src/main/java/io/kestra/plugin/fs/sftp/Upload.java +++ b/src/main/java/io/kestra/plugin/fs/sftp/Upload.java @@ -22,14 +22,25 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: \"22\"", - "username: foo", - "password: pass", - "from: \"{{ outputs.taskid.uri }}\"", - "to: \"/upload/dir2/file.txt\"", - } + full = true, + code = """ + id: fs_sftp_upload + namespace: company.team + + inputs: + - id: file + type: FILE + + tasks: + - id: upload + type: io.kestra.plugin.fs.sftp.Upload + host: localhost + port: "22" + username: foo + password: pass + from: "{{ inputs.file }}" + to: "/upload/dir2/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/sftp/Uploads.java b/src/main/java/io/kestra/plugin/fs/sftp/Uploads.java index 64a802c..e0851ab 100644 --- a/src/main/java/io/kestra/plugin/fs/sftp/Uploads.java +++ b/src/main/java/io/kestra/plugin/fs/sftp/Uploads.java @@ -22,16 +22,29 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: \"22\"", - "username: foo", - "password: pass", - "from:", - " - \"{{ outputs.taskid1.uri }}\"", - " - \"{{ outputs.taskid2.uri }}\"", - "to: \"/upload/dir2\"", - } + full = true, + code = """ + id: fs_sftp_uploads + namespace: company.team + + inputs: + - id: file1 + type: FILE + - id: file2 + type: FILE + + tasks: + - id: uploads + type: io.kestra.plugin.fs.sftp.Uploads + host: localhost + port: "22" + username: foo + password: pass + from: + - "{{ inputs.file1 }}" + - "{{ inputs.file2 }}" + to: "/upload/dir2" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/smb/Delete.java b/src/main/java/io/kestra/plugin/fs/smb/Delete.java index 00b0381..ae504c6 100644 --- a/src/main/java/io/kestra/plugin/fs/smb/Delete.java +++ b/src/main/java/io/kestra/plugin/fs/smb/Delete.java @@ -22,13 +22,20 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 445", - "username: foo", - "password: pass", - "uri: \"/my_share/dir1/file.txt\"", - } + full = true, + code = """ + id: fs_smb_delete + namespace: company.team + + tasks: + - id: delete + type: io.kestra.plugin.fs.smb.Delete + host: localhost + port: 445 + username: foo + password: pass + uri: "/my_share/dir1/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/smb/Download.java b/src/main/java/io/kestra/plugin/fs/smb/Download.java index a9994dc..af84ac1 100644 --- a/src/main/java/io/kestra/plugin/fs/smb/Download.java +++ b/src/main/java/io/kestra/plugin/fs/smb/Download.java @@ -22,13 +22,20 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 445", - "username: foo", - "password: pass", - "from: \"/my_share/file.txt\"", - } + full = true, + code = """ + id: fs_smb_download + namespace: company.team + + tasks: + - id: download + type: io.kestra.plugin.fs.smb.Download + host: localhost + port: 445 + username: foo + password: pass + from: "/my_share/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/smb/Downloads.java b/src/main/java/io/kestra/plugin/fs/smb/Downloads.java index 5e0d079..0956aeb 100644 --- a/src/main/java/io/kestra/plugin/fs/smb/Downloads.java +++ b/src/main/java/io/kestra/plugin/fs/smb/Downloads.java @@ -23,16 +23,23 @@ examples = { @Example( title = "Download files from `my_share` and move them to an `archive_share`", - code = { - "host: localhost", - "port: 445", - "username: foo", - "password: pass", - "from: \"/my_share/\"", - "interval: PT10S", - "action: MOVE", - "moveDirectory: \"/archive_share/\"", - } + full = true, + code = """ + id: fs_smb_downloads + namespace: company.team + + tasks: + - id: downloads + type: io.kestra.plugin.fs.smb.Downloads + host: localhost + port: 445 + username: foo + password: pass + from: "/my_share/" + interval: PT10S + action: MOVE + moveDirectory: "/archive_share/" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/smb/List.java b/src/main/java/io/kestra/plugin/fs/smb/List.java index 8e59dcf..034ab95 100644 --- a/src/main/java/io/kestra/plugin/fs/smb/List.java +++ b/src/main/java/io/kestra/plugin/fs/smb/List.java @@ -22,14 +22,21 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 445", - "username: foo", - "password: pass", - "from: \"/my_share/dir1/\"", - "regExp: \".*\\/dir1\\/.*\\.(yaml|yml)\"", - } + full = true, + code = """ + id: fs_smb_list + namespace: company.team + + tasks: + - id: list + type: io.kestra.plugin.fs.smb.List + host: localhost + port: 445 + username: foo + password: pass + from: "/my_share/dir1/" + regExp: ".*\/dir1\/.*\.(yaml|yml)" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/smb/Move.java b/src/main/java/io/kestra/plugin/fs/smb/Move.java index 9db2275..d56182f 100644 --- a/src/main/java/io/kestra/plugin/fs/smb/Move.java +++ b/src/main/java/io/kestra/plugin/fs/smb/Move.java @@ -23,14 +23,21 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 445", - "username: foo", - "password: pass", - "from: \"/my_share/dir1/file.txt\"", - "to: \"/my_share/dir2/file.txt\"", - } + full = true, + code = """ + id: fs_smb_move + namespace: company.team + + tasks: + - id: move + type: io.kestra.plugin.fs.smb.Move + host: localhost + port: 445 + username: foo + password: pass + from: "/my_share/dir1/file.txt" + to: "/my_share/dir2/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/smb/Trigger.java b/src/main/java/io/kestra/plugin/fs/smb/Trigger.java index 329704c..831ee2c 100644 --- a/src/main/java/io/kestra/plugin/fs/smb/Trigger.java +++ b/src/main/java/io/kestra/plugin/fs/smb/Trigger.java @@ -26,68 +26,68 @@ Wait for one or more files in a given SMB server's directory and process each of these files sequentially. Then move them to another share which is used as an archive.""", full = true, - code = { - "id: smb_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.smb.Trigger", - " host: localhost", - " port: 445", - " username: foo", - " password: bar", - " from: \"/my_share/in/\"", - " interval: PT10S", - " action: MOVE", - " moveDirectory: \"/archive_share/\"", - } + code = """ + id: smb_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.smb.Trigger + host: localhost + port: 445 + username: foo + password: bar + from: "/my_share/in/" + interval: PT10S + action: MOVE + moveDirectory: "/archive_share/" + """ ), @Example( title = """ Wait for one or more files in a given SMB server's directory and process each of these files sequentially. Then move them to another share which is used as an archive.""", full = true, - code = { - "id: smb_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') }}\"", - " - id: delete", - " type: io.kestra.plugin.fs.smb.Delete", - " host: localhost", - " port: 445", - " username: foo", - " password: bar", - " uri: \"/my_share/in/{{ taskrun.value | jq('.path') }}\"", - "", - "triggers:", - " - id: watch", - " type: io.kestra.plugin.fs.smb.Trigger", - " host: localhost", - " port: 445", - " username: foo", - " password: bar", - " from: \"/my_share/in/\"", - " interval: PT10S", - " action: NONE" - } + code = """ + id: smb_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') }}" + - id: delete + type: io.kestra.plugin.fs.smb.Delete + host: localhost + port: 445 + username: foo + password: bar + uri: "/my_share/in/{{ taskrun.value | jq('.path') }}" + + triggers: + - id: watch + type: io.kestra.plugin.fs.smb.Trigger + host: localhost + port: 445 + username: foo + password: bar + from: "/my_share/in/" + interval: PT10S + action: NONE + """ ), @Example( title = """ @@ -118,7 +118,8 @@ regExp: ".*.csv" action: MOVE moveDirectory: "my_share/archivedir" - interval: PTS""" + interval: PTS + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/smb/Upload.java b/src/main/java/io/kestra/plugin/fs/smb/Upload.java index 92aafe0..b8d38be 100644 --- a/src/main/java/io/kestra/plugin/fs/smb/Upload.java +++ b/src/main/java/io/kestra/plugin/fs/smb/Upload.java @@ -22,14 +22,25 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 445", - "username: foo", - "password: pass", - "from: \"{{ outputs.taskid.uri }}\"", - "to: \"/my_share/dir2/file.txt\"", - } + full = true, + code = """ + id: fs_smb_upload + namespace: company.team + + inputs: + - id: file + type: FILE + + tasks: + - id: upload + type: io.kestra.plugin.fs.smb.Upload + host: localhost + port: 445 + username: foo + password: pass + from: "{{ inputs.file }}" + to: "/my_share/dir2/file.txt" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/smb/Uploads.java b/src/main/java/io/kestra/plugin/fs/smb/Uploads.java index af93cc2..031aa7f 100644 --- a/src/main/java/io/kestra/plugin/fs/smb/Uploads.java +++ b/src/main/java/io/kestra/plugin/fs/smb/Uploads.java @@ -22,16 +22,29 @@ @Plugin( examples = { @Example( - code = { - "host: localhost", - "port: 445", - "username: foo", - "password: pass", - "from:", - " - \"{{ outputs.taskid1.uri }}\"", - " - \"{{ outputs.taskid2.uri }}\"", - "to: \"/my_share/dir2\"", - } + full = true, + code = """ + id: fs_smb_uploads + namespace: company.team + + inputs: + - id: file1 + type: FILE + - id: file2 + type: FILE + + tasks: + - id: uploads + type: io.kestra.plugin.fs.smb.Uploads + host: localhost + port: 445 + username: foo + password: pass + from: + - "{{ inputs.file1 }}" + - "{{ inputs.file2 }}" + to: "/my_share/dir2" + """ ) } ) diff --git a/src/main/java/io/kestra/plugin/fs/ssh/Command.java b/src/main/java/io/kestra/plugin/fs/ssh/Command.java index b7f9f65..38af161 100644 --- a/src/main/java/io/kestra/plugin/fs/ssh/Command.java +++ b/src/main/java/io/kestra/plugin/fs/ssh/Command.java @@ -45,25 +45,39 @@ examples = { @Example( title = "Run SSH command using password authentication", - code = { - "host: localhost", - "port: \"22\"", - "authMethod: PASSWORD", - "username: foo", - "password: pass", - "commands: ['ls']", - } + full = true, + code = """ + id: fs_ssh_command + namespace: company.team + + tasks: + - id: command + type: io.kestra.plugin.fs.ssh.Command + host: localhost + port: "22" + authMethod: PASSWORD + username: foo + password: pass + commands: ['ls'] + """ ), @Example( title = "Run SSH command using public key authentication (must be an OpenSSH private key)", - code = { - "host: localhost", - "port: \"22\"", - "authMethod: PUBLIC_KEY", - "username: root", - "privateKey: \"{{ secret('SSH_RSA_PRIVATE_KEY') }}\"", - "commands: ['touch kestra_was_here']" - } + full = true, + code = """ + id: fs_ssh_command + namespace: company.team + + tasks: + - id: command + type: io.kestra.plugin.fs.ssh.Command + host: localhost + port: "22" + authMethod: PUBLIC_KEY + username: root + privateKey: "{{ secret('SSH_RSA_PRIVATE_KEY') }}" + commands: ['touch kestra_was_here'] + """ ) } )