cterasdk.core.files.browser module

cterasdk.core.files.browser module#

class cterasdk.core.files.browser.Backups(core)

Bases: FileBrowser

property base
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(core)

Bases: FileBrowser

add_share_recipients(path, recipients)

Add share recipients

Parameters:
Returns:

A list of all recipients added

Return type:

list[cterasdk.core.types.ShareRecipient]

delete(*paths)

Delete one or more files or folders

Parameters:

path (str) – Path

get_share_info(path)

Get share settings and recipients

Parameters:

path (str) – Path

makedirs(path)

Create a directory recursively

Parameters:

path (str) – Directory path

mkdir(path)

Create a new directory

Parameters:

path (str) – Directory path

move(*paths, destination=None)

Move one or more files or folders

Parameters:
  • paths (list[str]) – List of paths

  • destination (str) – Destination

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(*paths)

Recover one or more files or folders

Parameters:

path (str) – Path

unshare(path)

Unshare a file or a folder

upload(path, destination)

Upload a file

Parameters:
  • path (str) – Local path

  • destination (str) – Remote path

class cterasdk.core.files.browser.FileBrowser(core)

Bases: BaseCommand

property base
copy(*paths, destination=None)

Copy one or more files or folders

Parameters:
  • paths (list[str]) – List of paths

  • destination (str) – Destination

download(path, destination=None)

Download a file

Parameters:
  • path (str) – Path

  • 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

get_object_path(elements)
list_snapshots(path)

List snapshots of a file or directory

Parameters:

path (str) – Path to the file or directory

Returns:

List of snapshots, each containing: - startTimestamp: When the snapshot was created - calculatedTimestamp: When the snapshot was processed - current: Whether this is the current version - url: The URL path to access this snapshot’s contents

Return type:

list[dict]

listdir(path, depth=None, include_deleted=False)

List Directory

Parameters:
  • path (str) – Path

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

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

Create a public link to a file or a folder

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

walk(path, include_deleted=False)

Walk Directory Contents

Parameters:
  • path (str) – Path to walk

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