Skip to content

start_file_transfer

start_file_transfer(
    connector_id: ConnectorId,
    *,
    config_overrides: Optional[TransferClientConfig] = None,
    send_file_paths: Optional[FilePaths] = None,
    retrieve_file_paths: Optional[FilePaths] = None,
    local_directory_path: Optional[FilePath] = None,
    remote_directory_path: Optional[FilePath] = None,
    custom_http_headers: Optional[CustomHttpHeaders] = None,
) -> StartFileTransferResponse

Begins a file transfer between local Amazon Web Services storage and a remote AS2 or SFTP server.

  • For an AS2 connector, you specify the ConnectorId and one or more SendFilePaths to 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 RetrieveFilePaths to identify the files you want to transfer, and a LocalDirectoryPath to 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 SendFilePaths to identify the files you want to transfer, and a RemoteDirectoryPath to specify the destination folder.

Parameters:

  • connector_id (ConnectorId) –

    The unique identifier for the connector.

  • send_file_paths (Optional[FilePaths], default: None ) –

    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 .

    Replace amzn-s3-demo-bucket with one of your actual buckets.

  • retrieve_file_paths (Optional[FilePaths], default: None ) –

    One or more source paths for the partner's SFTP server. Each string represents a source file path for one inbound file transfer.

  • local_directory_path (Optional[FilePath], default: None ) –

    For an inbound transfer, the LocaDirectoryPath specifies the destination for one or more files that are transferred from the partner's SFTP server.

  • remote_directory_path (Optional[FilePath], default: None ) –

    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.

  • custom_http_headers (Optional[CustomHttpHeaders], default: None ) –

    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.

Raises:

Source code in docs_src/capo_transfer/_services/transfer.py
def start_file_transfer(
    self,
    connector_id: "capo_transfer.types.connector_id.ConnectorId",
    *,
    config_overrides: Optional[TransferClientConfig] = None,
    send_file_paths: Optional["capo_transfer.types.file_paths.FilePaths"] = None,
    retrieve_file_paths: Optional[
        "capo_transfer.types.file_paths.FilePaths"
    ] = None,
    local_directory_path: Optional["capo_transfer.types.file_path.FilePath"] = None,
    remote_directory_path: Optional[
        "capo_transfer.types.file_path.FilePath"
    ] = None,
    custom_http_headers: Optional[
        "capo_transfer.types.custom_http_headers.CustomHttpHeaders"
    ] = None,
) -> "capo_transfer.types.start_file_transfer_response.StartFileTransferResponse":
    """<p>Begins a file transfer between local Amazon Web Services storage and a remote AS2 or SFTP server.</p> <ul> <li> <p>For an AS2 connector, you specify the <code>ConnectorId</code> and one or more <code>SendFilePaths</code> to identify the files you want to transfer.</p> </li> <li> <p>For an SFTP connector, the file transfer can be either outbound or inbound. In both cases, you specify the <code>ConnectorId</code>. Depending on the direction of the transfer, you also specify the following items:</p> <ul> <li> <p>If you are transferring file from a partner's SFTP server to Amazon Web Services storage, you specify one or more <code>RetrieveFilePaths</code> to identify the files you want to transfer, and a <code>LocalDirectoryPath</code> to specify the destination folder.</p> </li> <li> <p>If you are transferring file to a partner's SFTP server from Amazon Web Services storage, you specify one or more <code>SendFilePaths</code> to identify the files you want to transfer, and a <code>RemoteDirectoryPath</code> to specify the destination folder.</p> </li> </ul> </li> </ul>

    Args:
        connector_id: <p>The unique identifier for the connector.</p>
        send_file_paths: <p>One or more source paths for the Amazon S3 storage. Each string represents a source file path for one outbound file transfer. For example, <code> <i>amzn-s3-demo-bucket</i>/<i>myfile.txt</i> </code>.</p> <note> <p>Replace <code> <i>amzn-s3-demo-bucket</i> </code> with one of your actual buckets.</p> </note>
        retrieve_file_paths: <p>One or more source paths for the partner's SFTP server. Each string represents a source file path for one inbound file transfer.</p>
        local_directory_path: <p>For an inbound transfer, the <code>LocaDirectoryPath</code> specifies the destination for one or more files that are transferred from the partner's SFTP server.</p>
        remote_directory_path: <p>For an outbound transfer, the <code>RemoteDirectoryPath</code> specifies the destination for one or more files that are transferred to the partner's SFTP server. If you don't specify a <code>RemoteDirectoryPath</code>, the destination for transferred files is the SFTP user's home directory.</p>
        custom_http_headers: <p>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.</p>

    Raises:
        capo_transfer.errors.internal_service_error.InternalServiceError: <p>This exception is thrown when an error occurs in the Transfer Family service.</p>
        capo_transfer.errors.invalid_request_exception.InvalidRequestException: <p>This exception is thrown when the client submits a malformed request.</p>
        capo_transfer.errors.resource_not_found_exception.ResourceNotFoundException: <p>This exception is thrown when a resource is not found by the Amazon Web ServicesTransfer Family service.</p>
        capo_transfer.errors.service_unavailable_exception.ServiceUnavailableException: <p>The request has failed because the Amazon Web ServicesTransfer Family service is not available.</p>
        capo_transfer.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_transfer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_transfer.types.start_file_transfer_request.StartFileTransferRequest]",
    ) -> OperationResponse[
        "capo_transfer.types.start_file_transfer_response.StartFileTransferResponse"
    ]:
        import capo_transfer._operations.transfer_service.start_file_transfer

        output, http_response = (
            capo_transfer._operations.transfer_service.start_file_transfer.start_file_transfer(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_transfer.types.start_file_transfer_request.StartFileTransferRequest",
    ) -> dict[str, Any]:
        import capo_transfer.types.start_file_transfer_request

        return capo_transfer.types.start_file_transfer_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("StartFileTransfer", redact_input=_redact_input),
    )
    input_: capo_transfer.types.start_file_transfer_request.StartFileTransferRequest = {
        "connector_id": connector_id
    }
    if send_file_paths is not None:
        input_["send_file_paths"] = send_file_paths
    if retrieve_file_paths is not None:
        input_["retrieve_file_paths"] = retrieve_file_paths
    if local_directory_path is not None:
        input_["local_directory_path"] = local_directory_path
    if remote_directory_path is not None:
        input_["remote_directory_path"] = remote_directory_path
    if custom_http_headers is not None:
        input_["custom_http_headers"] = custom_http_headers

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output