Skip to main content
Version: 11 - TBD

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.

note

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 ConnectorTypeSFTP

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

  • schema_version

    Type: string

  • authentication

    Type: anyOf

  • host

    The remote hostname or IP address.

    Type: string

  • port

    Type: anyOf

  • tls

    If to connect using TLS/SSL.

    Type: anyOf

  • mode

    Type: anyOf

  • socket_timeout

    Timeout for socket reads.

    Type: integer

    Default: 60

  • connect_timeout

    Timeout for connection establishment.

    Type: integer

    Default: 60

  • encoding

    Encoding used to convert binary responses to strings.

    Type: string

    Default: utf-8

Output Schema

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',
authentication={
'authentication_method': 'username_password',
'username': '...',
'password': '...',
},
host='...',
port=21,
mode={
'mode_name': 'copy_file_to_engine',
'source_file_name': 'path/to/file.txt',
'destination_file_name': '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',
authentication={
'authentication_method': 'username_password',
'username': '...',
'password': '...',
},
host='...',
port=21,
mode={
'mode_name': 'copy_file_from_engine',
'source_file_name': 'file.txt',
'destination_file_name': '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',
authentication={
'authentication_method': 'username_password',
'username': '...',
'password': '...',
},
host='...',
port=21,
mode={
'mode_name': 'list',
'path': 'path/to/list',
'recursive': False,
}
).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',
authentication={
'authentication_method': 'username_password',
'username': '...',
'password': '...',
},
host='...',
port=21,
mode={
'mode_name': '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',
authentication={
'authentication_method': 'username_password',
'username': '...',
'password': '...',
},
host='...',
port=21,
mode={
'mode_name': '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',
authentication={
'authentication_method': 'username_password',
'username': '...',
'password': '...',
},
host='...',
port=21,
mode={
'mode_name': 'rename',
'src': 'path/to/file.txt',
'dst': 'new/path/renamed.csv',
},
)
return this.success('all done')