Skip to main content
Version: 7 - Gugelhupf

ConnectorTypeSMB

class connector_types.connector_type_smb.ConnectorTypeSMB

Copy a file from a SMB (CIFS, Samba) remote host to cloudomation or vice-versa.

This connector type uses the SMB protocol to copy a single file from a remote host to cloudomation or to copy a single file from cloudomation to a remote host. Alternatively, you can use this connector to list the contents of a folder of a remote host.

Inputs

NameTypeDefaultDescription
actionStringcopyThe action to perform. Supported actions: copy and list.
connect_timeoutNumber60How long to wait for the SSH connection to be established
copy_timeoutint60How long to wait for the copy to finish
domainString``The domain name to use
dstStringNoneThe path of the destination file. Use the format "cloudomation:[path]" to copy a file to cloudomation. Must be set for action copy.
hostnameStringThe remote host name to connect to
is_direct_tcpboolTrueFalse: use legacy NetBIOS communication or True: use SMB communication
my_nameStringCloudomationThe own NetBIOS name to use
passwordStringThe password to use to authenticate
pathstrNoneThe path for which to list the content. Must be set for action list.
patternstr*A pattern to limit the files returned by the action list.
portNumber445The port number to connect to
remote_nameStringThe remote NetBIOS name to use
srcStringNoneThe path of the source file to copy. Use the format "cloudomation:[path]" to copy a file from cloudomation. Must be set for action copy.
use_ntlm_v2boolTrueFalse use NTLMv1 or True use NTLMv2 for authentication
usernameStringThe user name to use

Outputs

NameTypeDefaultDescription
listinglist[]The contents of the directory. Only set when using the list action.
loglist[]

Constants

input_list = ['action', 'connect_timeout', 'copy_timeout', 'domain', 'dst', 'hostname', 'is_direct_tcp', 'my_name', 'password', 'path', 'pattern', 'port', 'remote_name', 'src', 'use_ntlm_v2', 'username'] output_list = ['listing', 'log'] ssl_context_inputs = ['check_hostname', 'client_cert', 'client_key', 'server_ca'] version = 1

Methods

execute

log

one_of_inputs

run

Example

Copying a file

import flow_api

def handler(system: flow_api.System, this: flow_api.Execution):
this.connect(
connector_type='SMB',
hostname='my-smb-host',
username='myself',
password='***',
src='share-name\\path\\to\\file.txt',
dst='cloudomation:file.txt',
)

return this.success('all done')

Listing the contents of a directory

import flow_api

def handler(system: flow_api.System, this: flow_api.Execution):
listing = this.connect(
connector_type='SMB',
hostname='my-smb-host',
username='myself',
password='***',
action='list',
path='share-name\\path\\to\\list',
).get('output_value')['listing']

return this.success('all done')