Skip to content

Commit

Permalink
support #65
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Jan 26, 2024
1 parent 6806cda commit c52032a
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 0 deletions.
42 changes: 42 additions & 0 deletions R/GSMonitorManager.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#' Geoserver REST API Monitor Manager
#'
#' @docType class
#' @importFrom R6 R6Class
#' @export
#' @keywords geoserver rest api Layer
#' @return Object of \code{\link{R6Class}} with methods for the GeoServer Monitoring extension.
#' @format \code{\link{R6Class}} object.
#'
#' @examples
#' \dontrun{
#' GSMonitorManager$new("http://localhost:8080/geoserver", "admin", "geoserver")
#' }
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
GSMonitorManager <- R6Class("GSMonitorManager",
inherit = GSManager,

public = list(

#'@description Get the requests
#'@return an object of class \code{data.frame}
getRequests = function(offset = 0){
self$INFO("Fetching requests")
tmp = tempfile(fileext = ".csv")
req <- GSUtils$GET(
self$getUrl(), private$user,
private$keyring_backend$get(service = private$keyring_service, username = private$user),
sprintf("/monitor/requests.csv?order=startTime;DESC&count=100&offset=%s", offset), verbose = self$verbose.debug, filename = tmp)
out <- NULL
if(status_code(req) == 200){
out <- readr::read_csv(tmp)
unlink(tmp)
self$INFO(sprintf("Successfully fetched %s requests", nrow(out)))
}else{
self$ERROR("Error while fetching requests")
}
return(out)
}
)
)
94 changes: 94 additions & 0 deletions man/GSMonitorManager.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c52032a

Please sign in to comment.