StoragehubManager
StoragehubManager
Object of R6Class for modelling a D4Science StoragehubManager
Emmanuel Blondel <emmanuel.blondel1@gmail.com>
d4storagehub4R::d4storagehub4RLogger -> StoragehubManager
new()Method is used to instantiate the StoragehubManager.
StoragehubManager$new(
token,
token_type = "gcube",
logger = NULL,
keyring_backend = "env"
)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').
getToken()Get token
StoragehubManager$getToken()the user access token
getUserProfile()Get user profile
StoragehubManager$getUserProfile()the user profile
getUserWorkspace()Get user workspace
StoragehubManager$getUserWorkspace()the user workspace root path
fetchWSEndpoint()Fetches the workspace endpoint from the D4Science ICProxy service
StoragehubManager$fetchWSEndpoint()
fetchUserProfile()Fetches the user profile
StoragehubManager$fetchUserProfile()
getWSRoot()Get workspace root
StoragehubManager$getWSRoot()the workspace root, as list
getWSRootID()Get workspace root ID
StoragehubManager$getWSRootID()the workspace root ID, as character
getWSItem()Get workspace item given a itemPath in a parent folder
StoragehubManager$getWSItem(
parentFolderID = NULL,
itemPath,
showHidden = FALSE
)parentFolderIDparent folder ID
itemPathitem path
showHiddenshow hidden files
the workspace item, NULL if no workspace item existing
getWSItemID()Get workspace item ID given a itemPath in a parent folder
StoragehubManager$getWSItemID(
parentFolderID = NULL,
itemPath,
showHidden = FALSE
)parentFolderIDparent folder ID
itemPathitem path
showHiddenshow hidden files
the workspace item ID, NULL if no workspace item existing
getWSVREFolder()Get VRE Folder
StoragehubManager$getWSVREFolder()the VRE folder, as list
getWSVREFolderID()Get VRE Folder ID
StoragehubManager$getWSVREFolderID()the VRE folder ID, as character
listWSItems()Lists workspace items given a parentFolder ID
StoragehubManager$listWSItems(parentFolderID = NULL, showHidden = FALSE)parentFolderIDparent folder ID
showHiddenshow hidden files
an object of class data.frame
listWSItemsByPath()Lists workspace items given a folder path
StoragehubManager$listWSItemsByPath(folderPath, showHidden = FALSE)folderPathfolder path where to list items
showHiddenshow hidden files
an object of class data.frame
searchWSItem()Searches for a workspace item given a item path
StoragehubManager$searchWSItem(
itemPath,
includeVreFolder = TRUE,
showHidden = FALSE
)itemPathpath of the item
includeVreFoldersearch also in VRE folder
showHiddenshow hidden files
the item, NULL if nothing found
searchWSItemID()Searches for a workspace item ID given a item path
StoragehubManager$searchWSItemID(
itemPath,
includeVreFolder = TRUE,
showHidden = FALSE
)itemPathpath of the item
includeVreFoldersearch also in VRE folder
showHiddenshow hidden files
the item, NULL if nothing found
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.
StoragehubManager$createFolder(
folderPath = NULL,
folderID = NULL,
name,
description = "",
hidden = FALSE,
recursive = TRUE
)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 FALSE
recursiverecursive, default is TRUE
the ID of the created folder
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.
StoragehubManager$uploadFile(
folderPath = NULL,
folderID = NULL,
file,
description = basename(file),
archive = FALSE
)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
the ID of the uploaded file
deleteItem()Deletes an item given its path on the workspace
StoragehubManager$deleteItem(itemPath, force = FALSE)itemPathitem path
forcewhether to force deletion, default is FALSE
TRUE if deleted, FALSE otherwise
shareItem()Shares an item with users
StoragehubManager$shareItem(itemPath, defaultAccessType, users)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
TRUE if shared, FALSE otherwise
unshareItem()unshare an item
StoragehubManager$unshareItem(itemPath, users)itemPathitem path
usersusers
TRUE if unshared, FALSE otherwise
downloadItem()Download item
StoragehubManager$downloadItem(item = NULL, wd = NULL)itemitem
wdworking directory where to download the item
downloadItemByPath()Download item by path
StoragehubManager$downloadItemByPath(path, wd = NULL)pathpath
wdworking directory where to download the item
getPublicFileLinkByID()Get public file link by ID
StoragehubManager$getPublicFileLinkByID(pathID)pathIDfile item ID
the public file URL
getPublicFileLink()Get public file link
StoragehubManager$getPublicFileLink(path)pathfile path
the public file URL
clone()The objects of this class are cloneable with this method.
StoragehubManager$clone(deep = FALSE)deepWhether to make a deep clone.
if (FALSE) {
manager <- StoragehubManager$new(
token = "",
logger = "DEBUG"
)
}
Run the code above in your browser using DataLab