From 82cef797c7e6a8c7d14a47d7443a96a2ce53be64 Mon Sep 17 00:00:00 2001 From: lilyclements Date: Tue, 2 Apr 2024 13:03:33 +0100 Subject: [PATCH] update add_definitions_to_bucket --- R/add_definitions_to_bucket.R | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/R/add_definitions_to_bucket.R b/R/add_definitions_to_bucket.R index e9e6c0a..3fbc88e 100644 --- a/R/add_definitions_to_bucket.R +++ b/R/add_definitions_to_bucket.R @@ -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) } \ No newline at end of file