Skip to content

Commit

Permalink
update add_definitions_to_bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyclements committed Apr 2, 2024
1 parent f25fb14 commit 82cef79
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions R/add_definitions_to_bucket.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,6 @@
#' @export
#' @details
#' The function creates a timestamp in the format "YYYYMMDDHHMMSS" and appends it to the station_id to form the filename. It then reads the provided JSON file, creates a new JSON file with the timestamped filename, and uploads it to the specified GCS bucket.
add_definitions_to_bucket <- function (country, station_id, new_definitions, timestamp = NULL)
{
bucket <- get_bucket_name(country)
definitions_dir <- "definitions"
if (is.null(timestamp)) {
timestamp <- format(Sys.time(), format = "%Y%m%d%H%M%S")
}
new_filename <- paste0(station_id, ".", timestamp,
".json")
#new_json <- paste0(new_definitions, ".json")
# googleCloudStorageR::gcs_upload(file = new_json, bucket = bucket,
# name = file.path(definitions_dir, new_filename))
#
object_function <- function(input, output) {
jsonlite::write_json(input, path = output, auto_unbox = TRUE, pretty = TRUE)
}
googleCloudStorageR::gcs_upload(file = new_definitions, bucket = bucket,
name = paste0(file.path(definitions_dir, new_filename)),
object_function = object_function,
predefinedAcl = "bucketLevel")
add_definitions_to_bucket <- function (country, station_id, new_definitions, timestamp = NULL) {
epicsadata:::add_definitions_to_bucket(country = country, station_id = station_id, new_definitions = new_definitions, timestamp = timestamp)

Check warning on line 14 in R/add_definitions_to_bucket.R

View check run for this annotation

Codecov / codecov/patch

R/add_definitions_to_bucket.R#L14

Added line #L14 was not covered by tests
}

0 comments on commit 82cef79

Please sign in to comment.