зеркало из https://github.com/Azure/AzureRMR.git
set package-wide default API version
This commit is contained in:
Родитель
730998e6dc
Коммит
7810d18d95
|
@ -0,0 +1,6 @@
|
|||
.onLoad <- function(libname, pkgname)
|
||||
{
|
||||
azure_api_version="2018-05-01"
|
||||
options(azure_api_version=azure_api_version)
|
||||
invisible(NULL)
|
||||
}
|
|
@ -68,9 +68,9 @@ private=list(
|
|||
# obtain subscription IDs owned by this app
|
||||
set_subs=function()
|
||||
{
|
||||
cont <- call_azure_sm(private$token, subscription="", operation="", api_version="2016-06-01")
|
||||
cont <- call_azure_sm(private$token, subscription="", operation="")
|
||||
|
||||
df <- lapply(cont, data.frame, stringsAsFactors=FALSE)
|
||||
df <- lapply(cont$value, data.frame, stringsAsFactors=FALSE)
|
||||
df <- do.call(rbind, df)
|
||||
|
||||
# update subscription IDs; notify if more than one found
|
||||
|
|
|
@ -18,7 +18,7 @@ public=list(
|
|||
self$name <- name
|
||||
|
||||
op <- paste0("resourcegroups/", self$name)
|
||||
cont <- call_azure_sm(private$token, self$subscription, operation=op, api_version="2018-05-01")
|
||||
cont <- call_azure_sm(private$token, self$subscription, op)
|
||||
self$id <- cont$id
|
||||
self$location <- cont$location
|
||||
self$managed_by <- cont$managedBy
|
||||
|
@ -40,7 +40,7 @@ private=list(
|
|||
set_res=function()
|
||||
{
|
||||
op <- paste0("resourcegroups/", self$name, "/resources")
|
||||
cont <- call_azure_sm(private$token, self$subscription, operation=op, api_version="2018-05-01")
|
||||
cont <- call_azure_sm(private$token, self$subscription, op)
|
||||
self$resources <- sapply(cont$value, `[[`, "name")
|
||||
NULL
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public=list(
|
|||
{
|
||||
private$token <- token
|
||||
self$id <- id
|
||||
info <- call_azure_sm(token, id, "", api_version="2018-05-01")
|
||||
info <- call_azure_sm(token, id, "")
|
||||
self$name <- info$displayName
|
||||
self$state <- info$state
|
||||
self$policies <- info$subscriptionPolicies
|
||||
|
@ -44,7 +44,7 @@ private=list(
|
|||
token=NULL,
|
||||
set_rgrps=function()
|
||||
{
|
||||
cont <- call_azure_sm(private$token, self$id, operation="resourcegroups", api_version="2018-05-01")
|
||||
cont <- call_azure_sm(private$token, self$id, "resourcegroups")
|
||||
self$resource_groups <- sapply(cont$value, `[[`, "name")
|
||||
NULL
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
call_azure_sm <- function(token, subscription, operation, api_version,
|
||||
call_azure_sm <- function(token, subscription, operation, api_version=getOption("azure_api_version"),
|
||||
http_verb=c("GET", "DELETE", "PUT", "POST", "HEAD"),
|
||||
catch=c("stop", "warn", "message", "pass"), ...)
|
||||
{
|
||||
creds <- token$credentials
|
||||
|
||||
# TODO: if token has expired, renew it
|
||||
|
||||
url <- httr::parse_url(creds$resource)
|
||||
url$path <- file.path("subscriptions", subscription, operation, fsep="/")
|
||||
url$query <- list(`api-version`=api_version)
|
||||
|
|
Загрузка…
Ссылка в новой задаче