зеркало из https://github.com/Azure/AzureRMR.git
add print method for tokens, clean directory function
This commit is contained in:
Родитель
94a6a596ab
Коммит
8faacef048
|
@ -9,6 +9,7 @@ export(az_subscription)
|
|||
export(az_template)
|
||||
export(call_azure_rm)
|
||||
export(call_azure_url)
|
||||
export(clean_token_directory)
|
||||
export(create_azure_login)
|
||||
export(delete_azure_login)
|
||||
export(delete_azure_token)
|
||||
|
|
|
@ -135,6 +135,12 @@ public=list(
|
|||
|
||||
self$cache()
|
||||
self
|
||||
},
|
||||
|
||||
print=function()
|
||||
{
|
||||
super$print()
|
||||
cat("Resource:", self$params$user_params$resource, "\n")
|
||||
}
|
||||
),
|
||||
|
||||
|
@ -246,6 +252,8 @@ private=list(
|
|||
#'
|
||||
#' To delete a cached token, use `delete_azure_token`. This takes the same inputs as `get_azure_token`, or you can specify the MD5 hash directly in the `hash` argument.
|
||||
#'
|
||||
#' To delete _all_ cached tokens, use `clean_token_directory`.
|
||||
#'
|
||||
#' @section Value:
|
||||
#' For `get_azure_token`, an object of class `AzureToken` representing the AAD token. For `list_azure_tokens`, a list of such objects retrieved from disk.
|
||||
#'
|
||||
|
@ -412,8 +420,7 @@ delete_azure_token <- function(resource_host, tenant, app, password=NULL, userna
|
|||
|
||||
if(confirm && interactive())
|
||||
{
|
||||
yn <- readline(
|
||||
paste0("Do you really want to delete this Azure Active Directory token? (y/N) "))
|
||||
yn <- readline(paste0("Do you really want to delete this Azure Active Directory token? (y/N) "))
|
||||
if(tolower(substr(yn, 1, 1)) != "y")
|
||||
return(invisible(NULL))
|
||||
}
|
||||
|
@ -422,6 +429,22 @@ delete_azure_token <- function(resource_host, tenant, app, password=NULL, userna
|
|||
}
|
||||
|
||||
|
||||
#' @rdname get_azure_token
|
||||
#' @export
|
||||
clean_token_directory <- function(confirm=TRUE)
|
||||
{
|
||||
if(confirm && interactive())
|
||||
{
|
||||
yn <- readline(paste0("Do you really want to delete ALL saved Azure Active Directory tokens? (y/N) "))
|
||||
if(tolower(substr(yn, 1, 1)) != "y")
|
||||
return(invisible(NULL))
|
||||
}
|
||||
toks <- dir(AzureRMR_dir(), pattern="^[0-9a-f]{32}$", full.names=TRUE)
|
||||
file.remove(toks)
|
||||
invisible(NULL)
|
||||
}
|
||||
|
||||
|
||||
#' @rdname get_azure_token
|
||||
#' @export
|
||||
list_azure_tokens <- function()
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
\name{get_azure_token}
|
||||
\alias{get_azure_token}
|
||||
\alias{delete_azure_token}
|
||||
\alias{clean_token_directory}
|
||||
\alias{list_azure_tokens}
|
||||
\title{Manage Azure Active Directory OAuth 2.0 tokens}
|
||||
\usage{
|
||||
|
@ -15,6 +16,8 @@ delete_azure_token(resource_host, tenant, app, password = NULL,
|
|||
aad_host = "https://login.microsoftonline.com/", hash = NULL,
|
||||
confirm = TRUE)
|
||||
|
||||
clean_token_directory(confirm = TRUE)
|
||||
|
||||
list_azure_tokens()
|
||||
}
|
||||
\arguments{
|
||||
|
@ -72,6 +75,8 @@ AzureRMR differs from httr in its handling of token caching in a number of ways.
|
|||
To list all cached tokens on disk, use \code{list_azure_tokens}. This returns a list of token objects, named according to their MD5 hashes.
|
||||
|
||||
To delete a cached token, use \code{delete_azure_token}. This takes the same inputs as \code{get_azure_token}, or you can specify the MD5 hash directly in the \code{hash} argument.
|
||||
|
||||
To delete \emph{all} cached tokens, use \code{clean_token_directory}.
|
||||
}
|
||||
|
||||
\section{Value}{
|
||||
|
|
Загрузка…
Ссылка в новой задаче