From 8946fe1b84f6435e15dc261d6109602e8dcb4c31 Mon Sep 17 00:00:00 2001 From: LTLA Date: Mon, 3 Feb 2025 09:41:22 -0800 Subject: [PATCH] Added force= option for deleting assets/versions or rejecting probation. --- DESCRIPTION | 4 ++-- R/rejectProbation.R | 6 ++++-- R/removeAsset.R | 10 ++++++---- R/removeVersion.R | 11 +++++++---- man/rejectProbation.Rd | 5 ++++- man/removeAsset.Rd | 9 ++++++--- man/removeVersion.Rd | 10 +++++++--- 7 files changed, 36 insertions(+), 19 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 769c3ca..9480519 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: gobbler -Version: 0.3.11 -Date: 2025-01-28 +Version: 0.3.12 +Date: 2025-02-03 Title: Interface to the gobbler service Description: Friendly interface to the gobbler service. diff --git a/R/rejectProbation.R b/R/rejectProbation.R index 576ee6e..08a2523 100644 --- a/R/rejectProbation.R +++ b/R/rejectProbation.R @@ -6,6 +6,8 @@ #' @param project String containing the project name. #' @param asset String containing the asset name. #' @param version String containing the version name. +#' @param force Logical scalar indicating that the asset should be forcibly removed if it contains invalid files. +#' If this needs to be set to \code{TRUE}, users may need to call \code{\link{refreshUsage}} afterwards to correct project-level usage statistics. #' @inheritParams createProject #' #' @return \code{NULL} is invisibly returned upon successful rejection. @@ -33,7 +35,7 @@ #' listVersions("test", "probation", registry=info$registry) #' #' @export -rejectProbation <- function(project, asset, version, staging, url) { - dump_request(staging, url, "reject_probation", list(project=project, asset=asset, version=version)) +rejectProbation <- function(project, asset, version, staging, url, force=FALSE) { + dump_request(staging, url, "reject_probation", list(project=project, asset=asset, version=version, force=force)) invisible(NULL) } diff --git a/R/removeAsset.R b/R/removeAsset.R index 6c6ab3b..27a074d 100644 --- a/R/removeAsset.R +++ b/R/removeAsset.R @@ -2,8 +2,10 @@ #' #' Remove an asset of the project from the registry. #' -#' @param project String containing the project to remove. -#' @param asset String containing the asset to remove. +#' @param project String specifying the project containing the asset to remove. +#' @param asset String specifying the asset to remove. +#' @param force Logical scalar indicating that the asset should be forcibly removed if it contains invalid files. +#' If this needs to be set to \code{TRUE}, users may need to call \code{\link{refreshUsage}} afterwards to correct project-level usage statistics. #' @inheritParams createProject #' #' @return \code{NULL} is invisibly returned if the asset was successfully removed. @@ -29,7 +31,7 @@ #' listAssets("test", registry=info$registry) #' #' @export -removeAsset <- function(project, asset, staging, url) { - dump_request(staging, url, "delete_asset", list(project=project, asset=asset)) +removeAsset <- function(project, asset, staging, url, force=FALSE) { + dump_request(staging, url, "delete_asset", list(project=project, asset=asset, force=force)) invisible(NULL) } diff --git a/R/removeVersion.R b/R/removeVersion.R index 625775d..c143354 100644 --- a/R/removeVersion.R +++ b/R/removeVersion.R @@ -2,9 +2,12 @@ #' #' Remove a version of an asset of a project from the registry. #' -#' @param project String containing the project to remove. -#' @param asset String containing the asset to remove. +#' @param project String specifying the project containing the version of the asset to remove. +#' @param asset String specifying the asset containing the version to remove. #' @param version String containing the version of the asset to remove. +#' @param force Logical scalar indicating that the asset should be forcibly removed if it contains invalid files. +#' If this needs to be set to \code{TRUE}, users may need to call \code{\link{refreshUsage}} to correct project-level usage statistics. +#' Similarly, \code{\link{refreshLatest}} may also need to be called. #' @inheritParams createProject #' #' @return \code{NULL} is invisibly returned if the version was successfully removed. @@ -30,7 +33,7 @@ #' listVersions("test", "simple", registry=info$registry) #' #' @export -removeVersion <- function(project, asset, version, staging, url) { - dump_request(staging, url, "delete_version", list(project=project, asset=asset, version=version)) +removeVersion <- function(project, asset, version, staging, url, force=FALSE) { + dump_request(staging, url, "delete_version", list(project=project, asset=asset, version=version, force=force)) invisible(NULL) } diff --git a/man/rejectProbation.Rd b/man/rejectProbation.Rd index 1d0e7c4..87d8ded 100644 --- a/man/rejectProbation.Rd +++ b/man/rejectProbation.Rd @@ -4,7 +4,7 @@ \alias{rejectProbation} \title{Reject a probational upload} \usage{ -rejectProbation(project, asset, version, staging, url) +rejectProbation(project, asset, version, staging, url, force = FALSE) } \arguments{ \item{project}{String containing the project name.} @@ -16,6 +16,9 @@ rejectProbation(project, asset, version, staging, url) \item{staging}{String containing the path to the staging directory.} \item{url}{String containing the URL of the gobbler REST API.} + +\item{force}{Logical scalar indicating that the asset should be forcibly removed if it contains invalid files. +If this needs to be set to \code{TRUE}, users may need to call \code{\link{refreshUsage}} afterwards to correct project-level usage statistics.} } \value{ \code{NULL} is invisibly returned upon successful rejection. diff --git a/man/removeAsset.Rd b/man/removeAsset.Rd index f24402d..899223e 100644 --- a/man/removeAsset.Rd +++ b/man/removeAsset.Rd @@ -4,16 +4,19 @@ \alias{removeAsset} \title{Remove an asset of a project} \usage{ -removeAsset(project, asset, staging, url) +removeAsset(project, asset, staging, url, force = FALSE) } \arguments{ -\item{project}{String containing the project to remove.} +\item{project}{String specifying the project containing the asset to remove.} -\item{asset}{String containing the asset to remove.} +\item{asset}{String specifying the asset to remove.} \item{staging}{String containing the path to the staging directory.} \item{url}{String containing the URL of the gobbler REST API.} + +\item{force}{Logical scalar indicating that the asset should be forcibly removed if it contains invalid files. +If this needs to be set to \code{TRUE}, users may need to call \code{\link{refreshUsage}} afterwards to correct project-level usage statistics.} } \value{ \code{NULL} is invisibly returned if the asset was successfully removed. diff --git a/man/removeVersion.Rd b/man/removeVersion.Rd index 257905e..2278b61 100644 --- a/man/removeVersion.Rd +++ b/man/removeVersion.Rd @@ -4,18 +4,22 @@ \alias{removeVersion} \title{Remove a versioned asset} \usage{ -removeVersion(project, asset, version, staging, url) +removeVersion(project, asset, version, staging, url, force = FALSE) } \arguments{ -\item{project}{String containing the project to remove.} +\item{project}{String specifying the project containing the version of the asset to remove.} -\item{asset}{String containing the asset to remove.} +\item{asset}{String specifying the asset containing the version to remove.} \item{version}{String containing the version of the asset to remove.} \item{staging}{String containing the path to the staging directory.} \item{url}{String containing the URL of the gobbler REST API.} + +\item{force}{Logical scalar indicating that the asset should be forcibly removed if it contains invalid files. +If this needs to be set to \code{TRUE}, users may need to call \code{\link{refreshUsage}} to correct project-level usage statistics. +Similarly, \code{\link{refreshLatest}} may also need to be called.} } \value{ \code{NULL} is invisibly returned if the version was successfully removed.