Data Factory > protocol-ftp-delete β
TL;DR;
This task allows deleting files on a FTP/SFTP server.
Name:
Max execution time: 120 mins
Target β
Delete files on an FTP/SFTP server
Inputs and Outputs β
json
{
"name": "protocol-ftp-delete",
"taskReferenceName": "ftp_delete",
"description": "The business description of the task",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"connection": "SFTP",
"host": "",
"username": "",
"password": "",
"port": 21,
"mode": "REQUEST",
"request": "file://assets/request.xml"
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Inputs β
TIP
If at least one task parameters (whether mandatory or not) is invalid, task execution is stopped and the returned status is FAILED. For example:
- The proposed value for the
connectionproperty is invalid.
| Property | Description |
|---|---|
connection | Mandatory - Enum - FTP, SFTP, FTPS |
authenticationMethod | Enum - PASSWORD, PUBLIC_KEY (only available if connection = SFTP), Default: PASSWORDIf connection != SFTP and authenticationMethod = PUBLIC_KEY, the task fails. |
host | Mandatory β String |
privateKey | Mandatory if authenticationMethod=PUBLIC_KEY - StringIt is strongly recommended to use a secret variable to store the private key. |
passphrase | String Only taken into account if authenticationMethod= PUBLIC_KEY. |
username | Mandatory - String |
password | Mandatory if connection != SFTP, if connection == SFTP and password is set then an invalid input error is added - String |
port | Mandatory - Number |
mode | Mandatory, Enum - FILES, REQUESTFILES: Delete files listed in the files property.REQUEST: Allows to dynamically define a list of files to remove. |
files | Mandatory if mode=FILES - Array of StringThe list of files to delete. glob patterns are supported. See wikipedia.org/wiki/Glob_(programming) for more details. |
request | Mandatory if mode = REQUEST - File See below |
TIP
The supported private keys are the following :
---- BEGIN SSH2 PUBLIC KEY ---------BEGIN RSA PRIVATE KEY----------BEGIN DSA PRIVATE KEY----------BEGIN EC PRIVATE KEY-----PuTTY-User-Key-File-2: (ssh-rsa)PuTTY-User-Key-File-2: (ssh-dss)-----BEGIN OPENSSH PRIVATE KEY-----
Outputs β
TIP
The outputs of the task defined below are always available if the task completes its execution (status COMPLETED and FAILED). If the task is stopped before the end of its execution (if the task is canceled by the user for example - CANCELED status, or if it exceeds the authorized execution time - TIMED_OUT), the outputs are not available.
| Property | Description |
|---|---|
allFilesDeleted | Enum - YES, NOIf at least one file could not be deleted: NO otherwise YES. |
report | File The execution report in XML format. See below It is named as follows: report-protocol-ftp-delete-<yyyy>-<MM>-<dd>-<HH>-<mm>-<ss>.xml |
Details regarding the request document β
xml
<Ftp-Delete>
<File>
<Path>/products-*</Path>
</File>
<File>
<Path>/sub-folder/products-2.csv</Path>
</File>
</Ftp-Delete>1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
| XPath | Description | Occurrence |
|---|---|---|
Ftp-Delete | Root | 1 |
File | For each file to be deleted | 0..* |
Path | The path of the file to be deleted, glob patterns are supported. See wikipedia.org/wiki/Glob_(programming) for more details. | 1 |
Execution Report Details β
General notes β
- The report follows the execution report standard structure.
Example β
xml
<Report task="protocol-ftp-delete" start-at="2023-01-20T13:27:54.810Z" task-cid="..." job-cid="..." end-at="2023-01-20T13:28:51.414Z" duration-ms="56604">
<Input name="request">(l'url du fichier request)</Input>
<Input name="allowPartial">(true|false)</Input>
<Log type="warning" code="INVALID_FILE_PATH">
<Metadata name="xpath"></Metadata>
<Metadata name="path">/abc,,,,/a.jpg</Metadata>
<Message>the file path provided is invalid: /abc,,,,/a.jpg</Message>
</Log>
</Report>1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Available logs β
- For following logs, whatever the severity
info,warningouerror, the task finale status is success except when it is specified otherwise. The task ends up in error only when an unknown error is encountered (ie. an error not listed below) or when it's is explicitly specified in the table below.
| Code | Message | Metadata | Type | Remarks |
|---|---|---|---|---|
| INVALID_INPUT | The parameter is not valid: {inputName} | inputName: The input name, inputValue: The input value | error | This error occurs when an invalid input is provided. In this case, nothing happened and the task ends in error. More information below. |
| INVALID_XML | The XML file is not valid | xsd: The XSD error | error | This error occurs when the request XML file is not valid. In this case, nothing happened and the task ends in error. |
| CONNECTION_FAILED | The connection to the FTP/SFTP server failed | host: The host, port: The port, username: The username | error | This error occurs when the connection to the FTP/SFTP server failed. In this case, the task ends in error. |
| DELETE_FAILED | The file {filePath} could not be deleted | filePath: The file path | error | This error occurs when a file could not be deleted. In this case, the task ends in success and the allFilesDeleted output is set to NO. |
| DELETE_SUCCESS | The file {filePath} has been deleted | filePath: The file path | info | This log is added for each file that has been deleted. |
Details regarding the log INVALID_INPUT, the following case are covered:
| Case | Message | Metadata | Remarks |
|---|---|---|---|
connection is null or empty | The parameter is not valid: {inputName} | inputName=connection | In this case, the task end in error, and an execution report is generated. |
authenticationMethod is null or empty or invalid | The parameter is not valid: {inputName} | inputName=authenticationMethod, inputValue={provided value} | In this case, the task end in error, and an execution report is generated. |
host is null or empty | The parameter is not valid: {inputName} | inputName=host, inputValue={provided value} | In this case, the task end in error, and an execution report is generated. |
username is null or empty | The parameter is not valid: {inputName} | inputName=username | In this case, the task end in error, and an execution report is generated. |
password is null or empty | The parameter is not valid: {inputName} | inputName=password | In this case, the task end in error, and an execution report is generated. |
port is not a valid number | The parameter is not valid: {inputName} | inputName=port, inputValue={provided value} | In this case, the task end in error, and an execution report is generated. |
mode is null or empty or invalid | The parameter is not valid: {inputName} | inputName=mode, inputValue={provided value} | In this case, the task end in error, and an execution report is generated. |
files is null or not an array of string and mode=FILES (files may be an empty array) | The parameter is not valid: {inputName} | inputName=files | In this case, the task end in error, and an execution report is generated. |
request is null or not a file and mode=REQUEST | The parameter is not valid: {inputName} | inputName=request, inputValue={provided value} | In this case, the task end in error, and an execution report is generated. |
privateKey is null or empty | The parameter is not valid: {inputName} | inputName=privateKey | In this case, the task end in error, and an execution report is generated. |
Known limitations β
- For SFTP connections, only the following ciphers are allowed:
aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc,aes128-gcm,aes256-gcm,arcfour256,arcfour128,cast128-cbc,arcfour.