ConnectorTypeSMB
class connector_types.connector_type_smb.ConnectorTypeSMB
Copy a file from a SMB (CIFS, Samba) remote host to Cloudomation Engine or vice-versa.
This connector type uses the SMB protocol to copy a single file from a remote host to Cloudomation Engine or to copy a single file from Cloudomation Engine to a remote host. Alternatively, you can use this connector to list the contents of a folder of a remote host.
Input Schema
-
schema_version = '10.0'Type:
string -
authenticationType:
anyOfOptions: -
hostThe remote hostname or IP address.
Type:
string -
portType:
anyOfOptions: -
modeType:
anyOfOptions: -
my_nameThe own NetBIOS name to use.
Type:
stringDefault:
Cloudomation -
remote_nameThe remote NetBIOS name to use.
Type:
string -
domainThe domain name to use.
Type:
string -
connect_timeoutA timeout for connecting to a peer in seconds.
Type:
integerDefault:
30 -
total_timeoutTotal timeout for the request in seconds.
Type:
integerDefault:
30 -
is_direct_tcpFalse: use legacy NetBIOS communication orTrue: use SMB communication.Type:
booleanDefault:
True -
use_ntlm_v2Falseuse NTLMv1 orTrueuse NTLMv2 for authentication.Type:
booleanDefault:
True
Output Schema
-
resultThe contents of the directory. Only set when using the
listaction.Type:
arrayItems:
Example
Copying a file from Cloudomation Engine to a remote host
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='SMB',
authentication={
'authentication_method': 'username_password',
'username': '...',
'password': '...',
},
host='...',
remote_name='...',
domain='...',
mode={
'mode_name': 'copy_file_from_engine',
'source_file_name': 'report.pdf',
'destination_file_name': 'share-name\\reports\\report.pdf',
},
)
return this.success('all done')
Copying a file from a remote host to Cloudomation Engine
Per default, the file will be stored in the same location as the source file.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='SMB',
authentication={
'authentication_method': 'username_password',
'username': '...',
'password': '...',
},
host='...',
remote_name='...',
domain='...',
mode={
'mode_name': 'copy_file_to_engine',
'source_file_name': 'share-name\\reports\\report.pdf',
'destination_file_name': 'report.pdf',
'destination_location': {
'location_mode': 'inherit_from_execution',
},
},
)
return this.success('all done')
To store the file in a project set the destination_location to 'project' and provide the project_id.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='SMB',
authentication={
'authentication_method': 'username_password',
'username': '...',
'password': '...',
},
host='...',
remote_name='...',
domain='...',
mode={
'mode_name': 'copy_file_to_engine',
'source_file_name': 'share-name\\reports\\report.pdf',
'destination_file_name': 'report.pdf',
'destination_location': {
'location_mode': 'project',
'project_id': '...',
},
},
)
return this.success('all done')
To store the file in a bundle set the destination_location to 'bundle' and provide the bundle_id.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='SMB',
authentication={
'authentication_method': 'username_password',
'username': '...',
'password': '...',
},
host='...',
remote_name='...',
domain='...',
mode={
'mode_name': 'copy_file_to_engine',
'source_file_name': 'share-name\\reports\\report.pdf',
'destination_file_name': 'report.pdf',
'destination_location': {
'location_mode': 'bundle',
'bundle_id': '...',
},
},
)
return this.success('all done')
Listing the contents of a directory
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
listing = this.connect(
connector_type='SMB',
authentication={
'authentication_method': 'username_password',
'username': '...',
'password': '...',
},
host='...',
port={
'port_mode': 'port_number',
'port_number': 445,
},
mode={
'mode_name': 'list_files',
'path': 'share-name\\path\\to\\list',
'pattern': '*.csv',
},
).get('output_value')['result']
return this.success('all done')