ConnectorTypeFTP
class connector_types.connector_type_ftp.ConnectorTypeFTP
Connect to a FTP server.
This connector type uses the FTP protocol to list folder contents, to transfer files between Cloudomation Engine and the remote host, to rename or or delete files or directories.
The FTP protocol should not be confused with SFTP. While similar in names, FTP and SFTP use different protocols and offer different ways of transferring files. If you want to use the SFTP protocol, refer to ConnectorTypeSCP
For more on the differences between FTP and SFTP refer to Difference between FTP and SFTP
Currently supported connection methods:
- plain FTP: not encrypted, insecure
- implicit FTPS: FTP over TLS
Currently unsupported connection methods:
- explicit FTPS: plain FTP upgrading to TLS using the AUTH command
Input Schema
-
hostnameThe remote host name to connect to.
Type:
string -
portType:
anyOfOptions: -
usernameThe user name to use.
Type:
string -
passwordThe password to use to authenticate.
Type:
string -
modeThe mode to operate in.
Type:
anyOfOptions: -
socket_timeoutTimeout for socket reads.
Type:
integerDefault:
60 -
connect_timeoutTimeout for connection establishment.
Type:
integerDefault:
60 -
encodingEncoding used to convert binary responses to strings.
Type:
stringDefault:
utf-8 -
actionDEPRECATED. Replaced by
mode.mode_name. -
srcDEPRECATED. Replaced by
mode.src. -
dstDEPRECATED. Replaced by
mode.dst. -
pathDEPRECATED. Replaced by
mode.path. -
recursiveDEPRECATED. Replaced by
mode.recursive. -
server_caThe CA certificate of the server. To be used for self-signed certificates.
Type:
anyOfOptions: -
client_certA client certificate used to authenticate the SSL transport.
Type:
anyOfOptions: -
client_keyThe key of the client certificate used to authenticate the SSL transport.
Type:
anyOfOptions: -
check_hostnameIf set, the hostname of the server is checked against the server_ca certificate.
Type:
booleanDefault:
True
Output Schema
-
listingThe contents of the directory. Only set for mode
list.Type:
objectAdditional Properties:
TruePattern Properties:
-
.*Data
-
-
statsA dictionary containing information about the path. Only set for mode
stats.Type:
objectAdditional Properties:
TruePattern Properties:
-
.*Data
-
Constants
ssl_context_inputs = ['check_hostname', 'client_cert', 'client_key', 'server_ca']Example
Download a file from a FTP server to Cloudomation Engine.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='FTP',
name='download a file',
hostname='my-ftp-host',
username='myself',
password='***',
action='copy',
src='path/to/file.txt',
dst='cloudomation:file.txt',
)
return this.success('all done')
More
File Upload
Upload a file from Cloudomation Engine to a FTP server.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='FTP',
name='upload a file',
hostname='my-ftp-host',
username='myself',
password='***',
action='copy',
src='cloudomation:file.txt',
dst='path/to/file.txt',
)
return this.success('all done')
Directory listing
List the content of a directory.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
listing = this.connect(
connector_type='FTP',
name='list a directory',
hostname='my-ftp-host',
username='myself',
password='***',
action='list',
path='path/to/list',
).get('output_value')['listing']
return this.success('all done')
Get file or directory information
Read information about a file or a directory on the server.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
stats = this.connect(
connector_type='FTP',
name='get information',
hostname='my-ftp-host',
username='myself',
password='***',
action='stats',
path='path/to/file.txt',
).get('output_value')['stats']
return this.success('all done')
Remove a file or a directory
Remove a file or a directory from the server.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='FTP',
name='remove a file',
hostname='my-ftp-host',
username='myself',
password='***',
action='remove',
path='path/to/file.txt',
)
return this.success('all done')
Rename a file or a directory
Rename a file or a directory on the server.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='FTP',
name='rename a file',
hostname='my-ftp-host',
username='myself',
password='***',
action='rename',
src='path/to/file.txt',
dst='new/path/renamed.csv',
)
return this.success('all done')