jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Turli <notificati...@github.com>
Subject Re: [jclouds/jclouds-labs] JCLOUDS-1273: Support multiple resource groups in ARM (#385)
Date Tue, 25 Apr 2017 07:50:00 GMT
andreaturli commented on this pull request.



>  
-      getOrCreateVirtualNetworkWithSubnet(location, options, azureGroupName);
-      configureSecurityGroupForOptions(group, azureGroupName, template.getLocation(), options);
+      createResourceGroupIfNeeded(group, location, options);

I think you are right although I'd probably prefer to read something like
```
...
      if (options.getResourceGroup() != null) {
         group = options.getResourceGroup();
      }


   private ResourceGroup getOrCreateResourceGroup(String group, String location) {
      if (group != null) {
      logger.debug(">> using resource group [%s]", group);
      ResourceGroup rg = api.getResourceGroupApi().get(group);
      if (rg != null)  return rg;

      logger.debug(">> resource group [%s] does not exist. Creating!", group);
      return api.getResourceGroupApi().create(group, location,
            ImmutableMap.of("description", "jclouds default resource group"));
      }
   }
```
and then set the resourceGroup.name on the options object where needed.

but maybe it is not significantly better. Again, just a minor comment :)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/385#discussion_r113126917
Mime
View raw message