зеркало из https://github.com/Azure/AzureRMR.git
get provider api version 2
This commit is contained in:
Родитель
e892be3d5f
Коммит
e227d83836
|
@ -24,15 +24,11 @@ public=list(
|
|||
# 4. get from host: resgroup, {provider, path}|type, name
|
||||
# 5. get from host by id: id
|
||||
initialize=function(token, subscription, resource_group, provider, path, type, name, id, ...,
|
||||
deployed_properties=list(), api_version=NULL)
|
||||
deployed_properties=list())
|
||||
{
|
||||
self$token <- token
|
||||
self$subscription <- subscription
|
||||
|
||||
if(is.null(api_version))
|
||||
private$set_api_version(provider, path, type, id)
|
||||
else private$api_version <- api_version
|
||||
|
||||
parms <- if(!is_empty(list(...)))
|
||||
private$init_and_deploy(resource_group, provider, path, type, name, id, ...)
|
||||
else if(!is_empty(deployed_properties))
|
||||
|
@ -86,9 +82,9 @@ private=list(
|
|||
}
|
||||
init_from_host_by_args <- function(resource_group, type, name)
|
||||
{
|
||||
self$resource_group <- parms$resource_group
|
||||
self$type <- parms$type
|
||||
self$name <- parms$name
|
||||
self$resource_group <- resource_group
|
||||
self$type <- type
|
||||
self$name <- name
|
||||
|
||||
parms <- private$res_op()
|
||||
|
||||
|
@ -182,19 +178,23 @@ private=list(
|
|||
}
|
||||
|
||||
op <- file.path("providers", provider)
|
||||
apis <- named_list(call_azure_rm(self$token, self$id, op)$resourceTypes, "resourceType")
|
||||
apis <- named_list(call_azure_rm(self$token, self$subscription, op)$resourceTypes, "resourceType")
|
||||
|
||||
private$api_version <- apis[[path]]$apiVersions[[1]]
|
||||
},
|
||||
|
||||
res_op=function(op="", ...)
|
||||
{
|
||||
if(is.null(private$api_version))
|
||||
private$set_api_version(type=self$type)
|
||||
op <- file.path("resourcegroups", self$resource_group, "providers", self$type, self$name, op)
|
||||
call_azure_rm(self$token, self$subscription, op, ..., api_version=private$api_version)
|
||||
},
|
||||
|
||||
res_id_op=function(op="", ...)
|
||||
{
|
||||
if(is.null(private$api_version))
|
||||
private$set_api_version(id=self$id)
|
||||
# strip off subscription, which is handled by call_azure_rm separately
|
||||
id <- sub("^.+/resourcegroups", "resourcegroups", self$id, ignore.case=TRUE)
|
||||
op <- file.path(id, op)
|
||||
|
|
|
@ -44,7 +44,7 @@ public=list(
|
|||
# API versions vary across different providers; find the latest
|
||||
get_provider_api_version=function(provider=NULL, resource_type=NULL, which=1)
|
||||
{
|
||||
if(is.null(provider))
|
||||
if(is_empty(provider))
|
||||
{
|
||||
apis <- named_list(call_azure_rm(self$token, self$id, "providers")$value, "namespace")
|
||||
lapply(apis, function(api)
|
||||
|
@ -57,7 +57,7 @@ public=list(
|
|||
{
|
||||
op <- file.path("providers", provider)
|
||||
apis <- named_list(call_azure_rm(self$token, self$id, op)$resourceTypes, "resourceType")
|
||||
if(!is.null(resource_type))
|
||||
if(!is_empty(resource_type))
|
||||
{
|
||||
this_api <- apis[[resource_type]]
|
||||
this_api$apiVersions[[which]]
|
||||
|
|
Загрузка…
Ссылка в новой задаче