| StoragehubManager {d4storagehub4R} | R Documentation |
StoragehubManager
Description
StoragehubManager
StoragehubManager
Value
Object of R6Class for modelling a D4Science StoragehubManager
Super class
d4storagehub4R::d4storagehub4RLogger -> StoragehubManager
Methods
Public methods
Inherited methods
Method new()
Method is used to instantiate the StoragehubManager.
Usage
StoragehubManager$new( token, token_type = "gcube", logger = NULL, keyring_backend = "env" )
Arguments
tokenuser access token
token_typetoken type, either 'gcube' (default) or 'jwt'
loggerlogger can be either NULL, "INFO" (with minimum logs), or "DEBUG" (for complete curl http calls logs)
keyring_backendkeyring backend to use.it can be set to use a different backend for storing the D4science gcube token with keyring (Default value is 'env').
Method getToken()
Get token
Usage
StoragehubManager$getToken()
Returns
the user access token
Method getUserProfile()
Get user profile
Usage
StoragehubManager$getUserProfile()
Returns
the user profile
Method getUserWorkspace()
Get user workspace
Usage
StoragehubManager$getUserWorkspace()
Returns
the user workspace root path
Method fetchWSEndpoint()
Fetches the workspace endpoint from the D4Science ICProxy service
Usage
StoragehubManager$fetchWSEndpoint()
Method fetchUserProfile()
Fetches the user profile
Usage
StoragehubManager$fetchUserProfile()
Method getWSRoot()
Get workspace root
Usage
StoragehubManager$getWSRoot()
Returns
the workspace root, as list
Method getWSRootID()
Get workspace root ID
Usage
StoragehubManager$getWSRootID()
Returns
the workspace root ID, as character
Method getWSItem()
Get workspace item given a itemPath in a parent folder
Usage
StoragehubManager$getWSItem( parentFolderID = NULL, itemPath, showHidden = FALSE )
Arguments
parentFolderIDparent folder ID
itemPathitem path
showHiddenshow hidden files
Returns
the workspace item, NULL if no workspace item existing
Method getWSItemID()
Get workspace item ID given a itemPath in a parent folder
Usage
StoragehubManager$getWSItemID( parentFolderID = NULL, itemPath, showHidden = FALSE )
Arguments
parentFolderIDparent folder ID
itemPathitem path
showHiddenshow hidden files
Returns
the workspace item ID, NULL if no workspace item existing
Method getWSVREFolder()
Get VRE Folder
Usage
StoragehubManager$getWSVREFolder()
Returns
the VRE folder, as list
Method getWSVREFolderID()
Get VRE Folder ID
Usage
StoragehubManager$getWSVREFolderID()
Returns
the VRE folder ID, as character
Method listWSItems()
Lists workspace items given a parentFolder ID
Usage
StoragehubManager$listWSItems(parentFolderID = NULL, showHidden = FALSE)
Arguments
parentFolderIDparent folder ID
showHiddenshow hidden files
Returns
an object of class data.frame
Method listWSItemsByPath()
Lists workspace items given a folder path
Usage
StoragehubManager$listWSItemsByPath(folderPath, showHidden = FALSE)
Arguments
folderPathfolder path where to list items
showHiddenshow hidden files
Returns
an object of class data.frame
Method searchWSItem()
Searches for a workspace item given a item path
Usage
StoragehubManager$searchWSItem( itemPath, includeVreFolder = TRUE, showHidden = FALSE )
Arguments
itemPathpath of the item
includeVreFoldersearch also in VRE folder
showHiddenshow hidden files
Returns
the item, NULL if nothing found
Method searchWSItemID()
Searches for a workspace item ID given a item path
Usage
StoragehubManager$searchWSItemID( itemPath, includeVreFolder = TRUE, showHidden = FALSE )
Arguments
itemPathpath of the item
includeVreFoldersearch also in VRE folder
showHiddenshow hidden files
Returns
the item, NULL if nothing found
Method createFolder()
Creates a folder, given a folder path, a folder name/description. By default recursive = TRUE meaning
that a folder path matching nested folders will trigger all nested folders. Setting recursive = FALSE, the
folder creation will work only if the folder path matches an existing folder. The hidden (default
FALSE) argument can be used to set hidden folders on the workspace. Using folderID, recursive will be
set to FALSE.
Usage
StoragehubManager$createFolder( folderPath = NULL, folderID = NULL, name, description = "", hidden = FALSE, recursive = TRUE )
Arguments
folderPathparent folder path where to create the folder
folderIDparent folder ID where to create the folder
namename of the folder
descriptiondescription of the folder
hiddenhidden, default is
FALSErecursiverecursive, default is
TRUE
Returns
the ID of the created folder
Method uploadFile()
Uploads a file to a folder (given a folder path). The argument description can be used to further describe the
file to upload. The argument archive (default = FALSE) indicates the type of item (FILE or ARCHIVE) to be uploaded.
Usage
StoragehubManager$uploadFile( folderPath = NULL, folderID = NULL, file, description = basename(file), archive = FALSE )
Arguments
folderPathfolder path where to upload the file
folderIDfolder ID where to upload the file
filefile to upload
descriptionfile description, default would be the file basename
archivearchive, default is
FALSE
Returns
the ID of the uploaded file
Method deleteItem()
Deletes an item given its path on the workspace
Usage
StoragehubManager$deleteItem(itemPath, force = FALSE)
Arguments
itemPathitem path
forcewhether to force deletion, default is
FALSE
Returns
TRUE if deleted, FALSE otherwise
Method shareItem()
Shares an item with users
Usage
StoragehubManager$shareItem(itemPath, defaultAccessType, users)
Arguments
itemPathitem path
defaultAccessTypeaccess type to use for sharing, among 'WRITE_ALL', 'WRITE_OWNER', 'READ_ONLY', 'ADMINISTRATOR'
usersone or more user names with whom the item has to be shared
Returns
TRUE if shared, FALSE otherwise
Method unshareItem()
unshare an item
Usage
StoragehubManager$unshareItem(itemPath, users)
Arguments
itemPathitem path
usersusers
Returns
TRUE if unshared, FALSE otherwise
Method downloadItem()
Download item
Usage
StoragehubManager$downloadItem(item = NULL, wd = NULL)
Arguments
itemitem
wdworking directory where to download the item
Method downloadItemByPath()
Download item by path
Usage
StoragehubManager$downloadItemByPath(path, wd = NULL)
Arguments
pathpath
wdworking directory where to download the item
Method getPublicFileLinkByID()
Get public file link by ID
Usage
StoragehubManager$getPublicFileLinkByID(pathID)
Arguments
pathIDfile item ID
Returns
the public file URL
Method getPublicFileLink()
Get public file link
Usage
StoragehubManager$getPublicFileLink(path)
Arguments
pathfile path
Returns
the public file URL
Method clone()
The objects of this class are cloneable with this method.
Usage
StoragehubManager$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Note
Main user class to be used with d4storagehub4R
Deprecated
Author(s)
Emmanuel Blondel <emmanuel.blondel1@gmail.com>
Examples
## Not run:
manager <- StoragehubManager$new(
token = "<your token>",
logger = "DEBUG"
)
## End(Not run)