ConnectorTypeSCP
class connector_types.connector_type_scp.ConnectorTypeSCP
Copy a file from a SCP remote host to cloudomation or vice-versa.
This connector type uses SCP to copy a single file from a remote host to cloudomation or to copy a sigle file from cloudomation to a remote host.
Inputs
Name | Type | Default | Description |
---|---|---|---|
connect_timeout | Number | 60 | How long to wait for the SSH connection to be established |
copy_timeout | int | 60 | How long to wait for the copy to finish |
dst | String | The path of the destination file. Use the format "cloudomation:[path]" to copy a file to cloudomation | |
hostkey | String | The OpenSSH host key to validate the hosts identity | |
hostname | String | The hostname or IP to use | |
key | String | None | The SSH private key to use to authenticate. Either "password" or "key" must be specified |
password | String | None | The password to use to authenticate. Either "password" or "key" must be specified |
port | Number | 22 | The port number to connect to |
src | String | The path of the source file to copy. Use the format "cloudomation:[path]" to copy a file from cloudomation | |
username | String | The user name to use |
Outputs
Name | Type | Default | Description |
---|---|---|---|
execution_id | int | The ID of the connection execution | |
message | str | The ended message for the connection. If the connection ended with an error, the message will contain information about what went wrong | |
status | str | The ended status for the connection. Either "success" or "error". |
Constants
input_list = ['connect_timeout', 'copy_timeout', 'dst', 'hostkey', 'hostname', 'key', 'password', 'port', 'src', 'username'] output_list = [] ssl_context_inputs = ['check_hostname', 'client_cert', 'client_key', 'server_ca'] version = 1Methods
execute ()
get_file (sftp_client, src, dst)
log (message)
one_of_inputs (options)
put_file (sftp_client, src, dst)
run ()
Example
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution):
this.connect(
connector_type='SCP',
hostname='my-ssh-server',
hostkey='ssh-rsa AAAAB3NzaC1yc2E...',
username='kevin',
key='-----BEGIN RSA PRIVATE KEY-----\nMII...',
name='copy apache error log from host',
src='/var/log/httpd-error.log',
dst='cloudomation:apache-error.log',
)
error_log_content = system.file('apache-error.log').get_text_content()
auth_failure_count = error_log_content.count('authentication failure')
this.log(f'there are {auth_failure_count} authentication failures')
return this.success('all done')