-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#' Pull the list(s) of objects and tags in S3 | ||
#' | ||
#' Pulls Information from the results of s3tagcrawler for TGR that are in an S3 bucket, including the object list and their tags as well as size metadata. | ||
#' | ||
#' @param bucket A character vector containing the full names of the S3 bucket(s) containing the data to return. | ||
#' @return Returns a long form data frame of objects in the indicated S3 bucket(s). | ||
#' @author Amy Paguirigan | ||
#' @details | ||
#' Requires valid S3 credentials to be set in the environment by setCreds. | ||
#' @export | ||
listS3Objects <- function(bucket) { | ||
if ("" %in% Sys.getenv(c("S3A", "S3SA"))) { | ||
print("You have missing environment variables. Please setCreds().")} else print("Credentials set successfully.") | ||
Sys.setenv(AWS_ACCESS_KEY_ID = Sys.getenv("S3A"), | ||
AWS_SECRET_ACCESS_KEY = Sys.getenv("S3SA"), | ||
AWS_DEFAULT_REGION = "us-west-2") | ||
print("Pulling S3 tag list(s).") | ||
s3tags <- purrr::map_dfr(bucket, function(x) {aws.s3::s3read_using(utils::read.csv, stringsAsFactors = F, | ||
object = paste0("tg/apptags/", x, "-meta.csv"), | ||
bucket = x)}) | ||
return(s3tags) | ||
} | ||
#' Pull a summary of objects in S3 | ||
#' | ||
#' Pulls summary information from the apptags prefix in S3 for a given S3 bucket(s). | ||
#' | ||
#' @param bucket A character vector containing the full names of the S3 bucket(s) containing the data to return. | ||
#' @return Returns a data frame containing a summary of what objects are in the indicated S3 bucket(s). | ||
#' @author Amy Paguirigan | ||
#' @details | ||
#' Requires valid S3 credentials to be set in the environment by setCreds. | ||
#' @export | ||
summarizeS3Objects <- function(bucket) { | ||
if ("" %in% Sys.getenv(c("S3A", "S3SA"))) { | ||
print("You have missing environment variables. Please setCreds().")} else print("Credentials set successfully.") | ||
Sys.setenv(AWS_ACCESS_KEY_ID = Sys.getenv("S3A"), | ||
AWS_SECRET_ACCESS_KEY = Sys.getenv("S3SA"), | ||
AWS_DEFAULT_REGION = "us-west-2") | ||
print("Pulling S3 object summary.") | ||
s3summary <- purrr::map_dfr(bucket, function(x) {aws.s3::s3read_using(utils::read.csv, stringsAsFactors = F, | ||
object = paste0("tg/apptags/", x, "-summary.csv"), | ||
bucket = x)}) | ||
return(s3summary) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.