From 95366a246ce8580d418f5df918087312e12a226d Mon Sep 17 00:00:00 2001 From: Hong Ooi Date: Fri, 29 Mar 2019 18:16:30 +1100 Subject: [PATCH] more than one type of vault --- R/add_methods.R | 12 ++++++------ R/az_vault.R | 4 ++-- R/vault_endpoint.R | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/R/add_methods.R b/R/add_methods.R index b87f180..43b65ae 100644 --- a/R/add_methods.R +++ b/R/add_methods.R @@ -2,7 +2,7 @@ add_methods <- function() { ## extending AzureRMR classes - AzureRMR::az_resource_group$set("public", "create_vault", overwrite=TRUE, + AzureRMR::az_resource_group$set("public", "create_key_vault", overwrite=TRUE, function(name, location=self$location, initial_access=default_access(), sku="Standard", ..., wait=TRUE) { creds <- decode_jwt(self$token$credentials$access_token) @@ -28,23 +28,23 @@ add_methods <- function() list(...) ) - AzureKeyVault::az_vault$new(self$token, self$subscription, self$name, + AzureKeyVault::az_key_vault$new(self$token, self$subscription, self$name, type="Microsoft.KeyVault/vaults", name=name, location=location, properties=props, wait=wait) }) - AzureRMR::az_resource_group$set("public", "get_vault", overwrite=TRUE, + AzureRMR::az_resource_group$set("public", "get_key_vault", overwrite=TRUE, function(name) { - AzureKeyVault::az_vault$new(self$token, self$subscription, self$name, + AzureKeyVault::az_key_vault$new(self$token, self$subscription, self$name, type="Microsoft.KeyVault/vaults", name=name) }) - AzureRMR::az_resource_group$set("public", "delete_vault", overwrite=TRUE, + AzureRMR::az_resource_group$set("public", "delete_key_vault", overwrite=TRUE, function(name, confirm=TRUE, wait=FALSE) { - self$get_vault(name)$delete(confirm=confirm, wait=wait) + self$get_key_vault(name)$delete(confirm=confirm, wait=wait) }) } diff --git a/R/az_vault.R b/R/az_vault.R index 2174ecb..f18668a 100644 --- a/R/az_vault.R +++ b/R/az_vault.R @@ -1,5 +1,5 @@ #' @export -az_vault=R6::R6Class("az_vault", inherit=AzureRMR::az_resource, +az_key_vault=R6::R6Class("az_key_vault", inherit=AzureRMR::az_resource, public=list( @@ -59,7 +59,7 @@ public=list( password=self$token$client$client_secret, ...) { url <- self$properties$vaultUri - vault_endpoint$new(url=url, tenant=tenant, app=app, password=password, ...) + key_vault_endpoint$new(url=url, tenant=tenant, app=app, password=password, ...) } )) diff --git a/R/vault_endpoint.R b/R/vault_endpoint.R index 704bee7..438b47e 100644 --- a/R/vault_endpoint.R +++ b/R/vault_endpoint.R @@ -1,5 +1,5 @@ #' @export -vault_endpoint <- R6::R6Class("vault_endpoint", public=list( +key_vault_endpoint <- R6::R6Class("key_vault_endpoint", public=list( token=NULL, url=NULL, @@ -10,7 +10,7 @@ vault_endpoint <- R6::R6Class("vault_endpoint", public=list( certificates=NULL, storage_accounts=NULL, - initialize=function(url, tenant, app, password, ..., token=NULL) + initialize=function(url, tenant, app, password=NULL, ..., token=NULL) { self$url <- httr::parse_url(url) self$tenant <- tenant