зеркало из https://github.com/Azure/AzureRMR.git
use create/get/del pattern for locks
This commit is contained in:
Родитель
272cd37499
Коммит
cbdf37c6a9
|
@ -218,7 +218,7 @@ public=list(
|
|||
location=location, ...)
|
||||
},
|
||||
|
||||
lock=function(name, level=c("cannotdelete", "readonly"), notes="")
|
||||
create_lock=function(name, level=c("cannotdelete", "readonly"), notes="")
|
||||
{
|
||||
level <- match.arg(level)
|
||||
api <- getOption("azure_api_mgmt_version")
|
||||
|
@ -227,14 +227,24 @@ public=list(
|
|||
if(notes != "")
|
||||
body$notes <- notes
|
||||
|
||||
private$rg_op(op, body=body, encode="json", http_verb="PUT", api_version=api)
|
||||
res <- private$rg_op(op, body=body, encode="json", http_verb="PUT", api_version=api)
|
||||
az_resource$new(self$token, self$subscription, deployed_properties=res, api_version=api)
|
||||
},
|
||||
|
||||
unlock=function(name)
|
||||
get_lock=function(name)
|
||||
{
|
||||
api <- getOption("azure_api_mgmt_version")
|
||||
op <- file.path("providers/Microsoft.Authorization/locks", name)
|
||||
res <- private$rg_op(op, api_version=api)
|
||||
az_resource$new(self$token, self$subscription, deployed_properties=res, api_version=api)
|
||||
},
|
||||
|
||||
delete_lock=function(name)
|
||||
{
|
||||
api <- getOption("azure_api_mgmt_version")
|
||||
op <- file.path("providers/Microsoft.Authorization/locks", name)
|
||||
private$rg_op(op, http_verb="DELETE", api_version=api)
|
||||
invisible(NULL)
|
||||
},
|
||||
|
||||
print=function(...)
|
||||
|
|
|
@ -255,7 +255,7 @@ public=list(
|
|||
self$tags
|
||||
},
|
||||
|
||||
lock=function(name, level=c("cannotdelete", "readonly"), notes="")
|
||||
create_lock=function(name, level=c("cannotdelete", "readonly"), notes="")
|
||||
{
|
||||
level <- match.arg(level)
|
||||
api <- getOption("azure_api_mgmt_version")
|
||||
|
@ -264,14 +264,24 @@ public=list(
|
|||
if(notes != "")
|
||||
body$notes <- notes
|
||||
|
||||
self$do_operation(op, body=body, encode="json", http_verb="PUT", api_version=api)
|
||||
res <- self$do_operation(op, body=body, encode="json", http_verb="PUT", api_version=api)
|
||||
az_resource$new(self$token, self$subscription, deployed_properties=res, api_version=api)
|
||||
},
|
||||
|
||||
unlock=function(name)
|
||||
get_lock=function(name)
|
||||
{
|
||||
api <- getOption("azure_api_mgmt_version")
|
||||
op <- file.path("providers/Microsoft.Authorization/locks", name)
|
||||
res <- self$do_operation(op, api_version=api)
|
||||
az_resource$new(self$token, self$subscription, deployed_properties=res, api_version=api)
|
||||
},
|
||||
|
||||
delete_lock=function(name)
|
||||
{
|
||||
api <- getOption("azure_api_mgmt_version")
|
||||
op <- file.path("providers/Microsoft.Authorization/locks", name)
|
||||
self$do_operation(op, http_verb="DELETE", api_version=api)
|
||||
invisible(NULL)
|
||||
},
|
||||
|
||||
print=function(...)
|
||||
|
@ -380,7 +390,8 @@ private=list(
|
|||
validate_response_parms=function(parms)
|
||||
{
|
||||
required_names <- c("id", "name", "type")
|
||||
optional_names <- c("location", "identity", "kind", "managedBy", "plan", "properties", "sku", "tags", "etag")
|
||||
optional_names <-
|
||||
c("identity", "kind", "location", "managedBy", "plan", "properties", "sku", "tags", "etag")
|
||||
validate_object_names(names(parms), required_names, optional_names)
|
||||
},
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ public=list(
|
|||
lst
|
||||
},
|
||||
|
||||
lock=function(name, level=c("cannotdelete", "readonly"), notes="")
|
||||
create_lock=function(name, level=c("cannotdelete", "readonly"), notes="")
|
||||
{
|
||||
level <- match.arg(level)
|
||||
api <- getOption("azure_api_mgmt_version")
|
||||
|
@ -181,14 +181,24 @@ public=list(
|
|||
if(notes != "")
|
||||
body$notes <- notes
|
||||
|
||||
call_azure_rm(self$token, self$id, op, body=body, encode="json", http_verb="PUT", api_version=api)
|
||||
res <- call_azure_rm(self$token, self$id, op, body=body, encode="json", http_verb="PUT", api_version=api)
|
||||
az_resource$new(self$token, self$id, deployed_properties=res, api_version=api)
|
||||
},
|
||||
|
||||
unlock=function(name)
|
||||
get_lock=function(name)
|
||||
{
|
||||
api <- getOption("azure_api_mgmt_version")
|
||||
op <- file.path("providers/Microsoft.Authorization/locks", name)
|
||||
res <- call_azure_rm(self$token, self$id, op, api_version=api)
|
||||
az_resource$new(self$token, self$id, deployed_properties=res, api_version=api)
|
||||
},
|
||||
|
||||
delete_lock=function(name)
|
||||
{
|
||||
api <- getOption("azure_api_mgmt_version")
|
||||
op <- file.path("providers/Microsoft.Authorization/locks", name)
|
||||
call_azure_rm(self$token, self$id, op, http_verb="DELETE", api_version=api)
|
||||
invisible(NULL)
|
||||
},
|
||||
|
||||
print=function(...)
|
||||
|
|
Загрузка…
Ссылка в новой задаче