Skip to content

Commit

Permalink
Merge pull request #172 from rvv23/add-predefinedAcl-to-gcs_save
Browse files Browse the repository at this point in the history
Expose `predefinedAcl` in `gcs_save()`
  • Loading branch information
MarkEdmondson1234 authored Jul 26, 2023
2 parents 4f13a73 + d3806be commit d600e5c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions R/rsession.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,28 @@ gcs_save_image <- function(file = ".RData",
gcs_save <- function(...,
file,
bucket = gcs_get_global_bucket(),
envir = parent.frame()){
envir = parent.frame(),
predefinedAcl = c(
"private",
"bucketLevel",
"authenticatedRead",
"bucketOwnerFullControl",
"bucketOwnerRead",
"projectPrivate",
"publicRead",
"default"
)){

predefinedAcl <- match.arg(predefinedAcl)

tmp <- tempfile()
on.exit(unlink(tmp))

bucket <- as.bucket_name(bucket)

save(..., file = tmp, envir = envir)

gcs_upload(tmp, bucket = bucket, name = file)
gcs_upload(tmp, bucket = bucket, name = file, predefinedAcl = predefinedAcl)

}

Expand Down

0 comments on commit d600e5c

Please sign in to comment.