Skip to main content
Version: 10 - 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 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

  • hostname

    The remote host name to connect to.

    Type: string

  • port

    Type: anyOf

  • username

    The user name to use.

    Type: string

  • password

    The password to use to authenticate.

    Type: string

  • mode

    The mode to operate in.

    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

  • action

    DEPRECATED. Replaced by mode.mode_name.

  • src

    DEPRECATED. Replaced by mode.src.

  • dst

    DEPRECATED. Replaced by mode.dst.

  • path

    DEPRECATED. Replaced by mode.path.

  • recursive

    DEPRECATED. Replaced by mode.recursive.

  • server_ca

    The CA certificate of the server. To be used for self-signed certificates.

    Type: anyOf

  • client_cert

    A client certificate used to authenticate the SSL transport.

    Type: anyOf

  • client_key

    The key of the client certificate used to authenticate the SSL transport.

    Type: anyOf

  • check_hostname

    If set, the hostname of the server is checked against the server_ca certificate.

    Type: boolean

    Default: True

Output Schema

  • listing

    The contents of the directory. Only set for mode list.

    Type: object

    Additional Properties: True

    Pattern Properties:

    • .*

      Data

  • stats

    A dictionary containing information about the path. Only set for mode stats.

    Type: object

    Additional Properties: True

    Pattern 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')