startFileTransfer method
Begins a file transfer between local Amazon Web Services storage and a remote AS2 or SFTP server.
-
For an AS2 connector, you specify the
ConnectorIdand one or moreSendFilePathsto identify the files you want to transfer. -
For an SFTP connector, the file transfer can be either outbound or
inbound. In both cases, you specify the
ConnectorId. Depending on the direction of the transfer, you also specify the following items:-
If you are transferring file from a partner's SFTP server to Amazon Web
Services storage, you specify one or more
RetrieveFilePathsto identify the files you want to transfer, and aLocalDirectoryPathto specify the destination folder. -
If you are transferring file to a partner's SFTP server from Amazon Web
Services storage, you specify one or more
SendFilePathsto identify the files you want to transfer, and aRemoteDirectoryPathto specify the destination folder.
-
If you are transferring file from a partner's SFTP server to Amazon Web
Services storage, you specify one or more
May throw InternalServiceError.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
Parameter connectorId :
The unique identifier for the connector.
Parameter customHttpHeaders :
An array of key-value pairs that represent custom HTTP headers to include
in AS2 messages. These headers are added to the AS2 message when sending
files to your trading partner.
Parameter localDirectoryPath :
For an inbound transfer, the LocaDirectoryPath specifies the
destination for one or more files that are transferred from the partner's
SFTP server.
Parameter remoteDirectoryPath :
For an outbound transfer, the RemoteDirectoryPath specifies
the destination for one or more files that are transferred to the
partner's SFTP server. If you don't specify a
RemoteDirectoryPath, the destination for transferred files is
the SFTP user's home directory.
Parameter retrieveFilePaths :
One or more source paths for the partner's SFTP server. Each string
represents a source file path for one inbound file transfer.
Parameter sendFilePaths :
One or more source paths for the Amazon S3 storage. Each string represents
a source file path for one outbound file transfer. For example,
amzn-s3-demo-bucket/myfile.txt .
Implementation
Future<StartFileTransferResponse> startFileTransfer({
required String connectorId,
List<CustomHttpHeader>? customHttpHeaders,
String? localDirectoryPath,
String? remoteDirectoryPath,
List<String>? retrieveFilePaths,
List<String>? sendFilePaths,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'TransferService.StartFileTransfer'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ConnectorId': connectorId,
if (customHttpHeaders != null) 'CustomHttpHeaders': customHttpHeaders,
if (localDirectoryPath != null)
'LocalDirectoryPath': localDirectoryPath,
if (remoteDirectoryPath != null)
'RemoteDirectoryPath': remoteDirectoryPath,
if (retrieveFilePaths != null) 'RetrieveFilePaths': retrieveFilePaths,
if (sendFilePaths != null) 'SendFilePaths': sendFilePaths,
},
);
return StartFileTransferResponse.fromJson(jsonResponse.body);
}