From 20abbdf72f525efc9a89074e3cf6a264dba9ea74 Mon Sep 17 00:00:00 2001 From: hong-revo Date: Mon, 7 May 2018 01:09:30 +1000 Subject: [PATCH] consistent interface for rg creation --- R/az_resgroup.R | 10 +++++----- R/az_subscription.R | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/R/az_resgroup.R b/R/az_resgroup.R index b6bc665..26ba231 100644 --- a/R/az_resgroup.R +++ b/R/az_resgroup.R @@ -12,7 +12,7 @@ public=list( token=NULL, # constructor: can refer to an existing RG, or create a new RG - initialize=function(token, subscription, name=NULL, ..., parms=list(...), create=FALSE) + initialize=function(token, subscription, name=NULL, ..., parms=list()) { if(is_empty(name) && is_empty(parms)) stop("Must supply either resource group name, or parameter list") @@ -20,8 +20,8 @@ public=list( self$token <- token self$subscription <- subscription - parms <- if(create) - private$init_and_create(name, parms) + parms <- if(!is_empty(list(...))) + private$init_and_create(name, ...) else private$init(name, parms) self$id <- parms$id @@ -119,9 +119,9 @@ private=list( parms }, - init_and_create=function(name, parms) + init_and_create=function(name, ...) { - parms <- c(name=name, parms) + parms <- modifyList(list(...), list(name=name)) private$validate_parms(parms) self$name <- name private$rg_op(body=parms, encode="json", http_verb="PUT") diff --git a/R/az_subscription.R b/R/az_subscription.R index e5a18b4..e9700d8 100644 --- a/R/az_subscription.R +++ b/R/az_subscription.R @@ -79,9 +79,9 @@ public=list( named_list(lst) }, - create_resource_group=function(name, location) + create_resource_group=function(name, location, ...) { - az_resource_group$new(self$token, self$id, name, location=location, create=TRUE) + az_resource_group$new(self$token, self$id, name, location=location, ...) }, delete_resource_group=function(name)