R/get_location.R

Defines functions get_location

Documented in get_location

#' @title Bucket location
#' @description Get the AWS region location of bucket.
#'
#' @template bucket
#' @template dots
#'
#' @return A character string containing the region, if one has been set.
#' @references \href{http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html}{API Documentation}
#' @export
get_location <- function(bucket, ...){
    r <- s3HTTP(verb = "GET", 
                bucket = bucket,
                query = list(location = ""),
                check_region = FALSE,
                ...)
    if (!length(r)) {
        return("us-east-1")
    } else {
        return(r[[1L]])
    }
}
cloudyr/aws.s3 documentation built on May 29, 2020, 7:18 p.m.