cterasdk.core.files.browser module

cterasdk.core.files.browser module#

class cterasdk.core.files.browser.Backups(portal, base_path)

Bases: FileBrowser

Backups File Browser APIs

device_config(device, destination=None)

Download a device configuration file

Parameters:
  • device (str) – The device name

  • destination (str,optional) – File destination, if it is a directory, the original filename will be kept, defaults to the default directory

class cterasdk.core.files.browser.CloudDrive(portal, base_path)

Bases: FileBrowser

Cloud Drive File Browser APIs

add_share_recipients(path, recipients)

Add share recipients

Parameters:
Returns:

A list of all recipients added

Return type:

list[cterasdk.core.types.ShareRecipient]

delete(path)

Delete a file

Parameters:

path (str) – Path of the file or directory to delete

delete_multi(*args)

Delete multiple files and/or directories

Parameters:

*args – Variable lengthed list of paths of files and/or directories to delete

get_share_info(path)

Get share settings and recipients

mkdir(path, recurse=False)

Create a new directory

Parameters:
  • path (str) – Path of the directory to create

  • recurse (bool,optional) – Whether to create the path recursivly, defaults to False

move(src, dest)

Move a file or directory

Parameters:
  • src (str) – The source path of the file or directory

  • dst (str) – The destination path of the file or directory

move_multi(src, dest)
remove_share_recipients(path, accounts)

Remove share recipients

Parameters:
Returns:

A list of all share recipients removed

Return type:

list[cterasdk.core.types.PortalAccount]

rename(path, name)

Rename a file

Parameters:
  • path (str) – Path of the file or directory to rename

  • name (str) – The name to rename to

share(path, recipients, as_project=True, allow_reshare=True, allow_sync=True)

Share a file or a folder

Parameters:
  • path (str) – The path of the file or folder to share

  • recipients (list[cterasdk.core.types.ShareRecipient]) – A list of share recipients

  • as_project (bool,optional) – Share as a team project, defaults to True when the item is a cloud folder else False

  • allow_reshare (bool,optional) – Allow recipients to re-share this item, defaults to True

  • allow_sync (bool,optional) – Allow recipients to sync this item, defaults to True when the item is a cloud folder else False

Returns:

A list of all recipients added to the collaboration share

Return type:

list[cterasdk.core.types.ShareRecipient]

undelete(path)

Restore a previously deleted file or directory

Parameters:

path (str) – Path of the file or directory to restore

undelete_multi(*args)

Restore previously deleted multiple files and/or directories

Parameters:

*args – Variable length list of paths of files and/or directories to restore

unshare(path)

Unshare a file or a folder

upload(file_path, server_path)

Upload a file

Parameters:
  • file_path (str) – Path to the local file to upload

  • server_path (str) – Path to the directory to upload the file to

class cterasdk.core.files.browser.FileBrowser(portal, base_path)

Bases: BaseCommand

Portal File Browser APIs

copy(src, dest)

Copy a file or directory

Parameters:
  • src (str) – The source path of the file or directory

  • dst (str) – The destination path of the file or directory

copy_multi(src, dest)
download(path, destination=None)

Download a file

Parameters:
  • path (str) – Path of the file to download

  • destination (str,optional) – File destination, if it is a directory, the original filename will be kept, defaults to the default directory

download_as_zip(cloud_directory, files, destination=None)

Download a list of files and/or directories from a cloud folder as a ZIP file

Warning

The list of files is not validated. The ZIP file will include only the existing files and directories

Parameters:
  • cloud_directory (str) – Path to the cloud directory

  • files (list[str]) – List of files and/or directories in the cloud folder to download

  • destination (str,optional) – File destination, if it is a directory, the original filename will be kept, defaults to the default directory

ls(path, include_deleted=False)

Execute ls on the provided path

Parameters:
  • path (str) – Path to list

  • include_deleted (bool,optional) – Include deleted files, defaults to False

mklink(path, access='RO', expire_in=30)

Create a link to a file

Parameters:
  • path (str) – The path of the file to create a link to

  • access (str,optional) – Access policy of the link, defaults to ‘RO’

  • expire_in (int,optional) – Number of days until the link expires, defaults to 30

mkpath(array)
walk(path, include_deleted=False)

Perform walk on the provided path

Parameters:
  • path (str) – Path to perform walk on

  • include_deleted (bool,optional) – Include deleted files, defaults to False