Skip to content

Blocks Catalog

Below is a list of Blocks available for registration in prefect-managedfiletransfer.

To register blocks in this module to view and edit them on Prefect Cloud, first install the required packages, then

prefect block register -m prefect_managedfiletransfer
Note, to use the load method on Blocks, you must already have a block document saved through code or saved through the UI.

[Serverwithbasicauthblock Module][prefect_managedfiletransfer.ServerWithBasicAuthBlock]

[ServerWithBasicAuthBlock][prefect_managedfiletransfer.ServerWithBasicAuthBlock.ServerWithBasicAuthBlock]

A connection to a remote server with basic authentication.

To load the ServerWithBasicAuthBlock:

from prefect import flow
from prefect_managedfiletransfer.ServerWithBasicAuthBlock import ServerWithBasicAuthBlock

@flow
def my_flow():
    my_block = ServerWithBasicAuthBlock.load("MY_BLOCK_NAME")

my_flow()

[Serverwithpublickeyauthblock Module][prefect_managedfiletransfer.ServerWithPublicKeyAuthBlock]

[ServerWithPublicKeyAuthBlock][prefect_managedfiletransfer.ServerWithPublicKeyAuthBlock.ServerWithPublicKeyAuthBlock]

Block for storing SFTP server details with public key authentication. Attributes: username: The username for SFTP authentication. private_key: The private key for SFTP authentication, stored as a SecretStr. host: The hostname or IP address of the SFTP server. port: The port number for SFTP, default is 22.

To load the ServerWithPublicKeyAuthBlock:

from prefect import flow
from prefect_managedfiletransfer.ServerWithPublicKeyAuthBlock import ServerWithPublicKeyAuthBlock

@flow
def my_flow():
    my_block = ServerWithPublicKeyAuthBlock.load("MY_BLOCK_NAME")

my_flow()

[Rcloneconfigfileblock Module][prefect_managedfiletransfer.RCloneConfigFileBlock]

[RCloneConfigFileBlock][prefect_managedfiletransfer.RCloneConfigFileBlock.RCloneConfigFileBlock]

Block for storing RClone configuration file contents. This block is used to store the contents of an RClone configuration file, which can be used to configure RClone for file transfers. The block is updated with tokends when they are refreshed, allowing for dynamic updates to the RClone configuration.

Generate a config locally with rclone config create my_sharepoint onedrive like below, then save the contents in a block with remote_name=my_sharepoint,config_file_contents= [my_sharepoint] type = onedrive token = {"access_token":"...","token_type":"Bearer","refresh_token":"...","expiry":"2000-00-00T00:00:00.000000000Z"} drive_id = b!-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa drive_type = documentLibrary.

To load the RCloneConfigFileBlock:

from prefect import flow
from prefect_managedfiletransfer.RCloneConfigFileBlock import RCloneConfigFileBlock

@flow
def my_flow():
    my_block = RCloneConfigFileBlock.load("MY_BLOCK_NAME")

my_flow()