diff --git a/DESCRIPTION b/DESCRIPTION index 8429289..0a8f10e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: azkit Title: Azure storage authentication toolkit -Version: 0.2.1 +Version: 0.2.2 Authors@R: c(person( "Fran", "Barton", diff --git a/R/read_azure_table.R b/R/read_azure_table.R index 0782dcb..b4b92f0 100644 --- a/R/read_azure_table.R +++ b/R/read_azure_table.R @@ -7,12 +7,19 @@ #' the default, the function will look instead for a value stored in the #' environment variable "AZ_TABLE_EP" #' @param ... parameters to be passed through to [get_auth_token] +#' @inheritParams get_container #' @returns A tibble #' @export -read_azure_table <- function(table_name = NULL, table_endpoint = NULL, ...) { +read_azure_table <- function( + table_name = NULL, + table_endpoint = NULL, + token = NULL, + ... +) { table_name <- table_name %||% check_envvar("AZ_TABLE_NAME") table_ep <- table_endpoint %||% check_envvar("AZ_TABLE_EP") - access_token <- get_auth_token(...) |> + token <- token %||% get_auth_token(...) + access_token <- token |> purrr::pluck("credentials", "access_token") headers <- list("2025-11-05", "application/json;odata=nometadata") |> purrr::set_names(c("x-ms-version", "Accept")) @@ -30,3 +37,4 @@ read_azure_table <- function(table_name = NULL, table_endpoint = NULL, ...) { purrr::map(tibble::as_tibble) |> purrr::list_rbind() } + diff --git a/man/read_azure_table.Rd b/man/read_azure_table.Rd index 07c877b..0dc2010 100644 --- a/man/read_azure_table.Rd +++ b/man/read_azure_table.Rd @@ -4,7 +4,7 @@ \alias{read_azure_table} \title{Read in data from an Azure table} \usage{ -read_azure_table(table_name = NULL, table_endpoint = NULL, ...) +read_azure_table(table_name = NULL, table_endpoint = NULL, token = NULL, ...) } \arguments{ \item{table_name}{name of the table to be read. If left as \code{NULL}, @@ -15,6 +15,9 @@ environment variable "AZ_TABLE_NAME"} the default, the function will look instead for a value stored in the environment variable "AZ_TABLE_EP"} +\item{token}{An Azure authentication token. If left as \code{NULL}, a token +returned by \link{get_auth_token} will be used} + \item{...}{parameters to be passed through to \link{get_auth_token}} } \value{