Skip to content
Permalink
Browse files
Add tags to virtual network creation
  • Loading branch information
nacx committed Nov 6, 2017
1 parent 5fdfd58 commit c9cd6eaf45d423b8b05acc145be2920c35a48bae
Showing 5 changed files with 7 additions and 4 deletions.
@@ -159,7 +159,7 @@ protected synchronized void createDefaultNetworkIfNeeded(String group, String lo
logger.debug(">> network options have not been configured. Creating network %s(%s) and subnet %s(%s)", name,
defaultVnetAddressPrefix, name, defaultSubnetAddressPrefix);

api.getVirtualNetworkApi(options.getResourceGroup()).createOrUpdate(name, location, properties);
api.getVirtualNetworkApi(options.getResourceGroup()).createOrUpdate(name, location, null, properties);
Subnet createdSubnet = api.getSubnetApi(options.getResourceGroup(), name).get(name);

options.ipOptions(IpOptions.builder().subnet(createdSubnet.id()).allocateNewPublicIp(true).build());
@@ -16,6 +16,7 @@
*/
package org.jclouds.azurecompute.arm.features;
import java.util.List;
import java.util.Map;

import javax.inject.Named;
import javax.ws.rs.Consumes;
@@ -31,6 +32,7 @@
import org.jclouds.azurecompute.arm.domain.VirtualNetwork;
import org.jclouds.azurecompute.arm.filters.ApiVersionFilter;
import org.jclouds.azurecompute.arm.functions.FalseOn204;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.oauth.v2.filters.OAuthFilter;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.MapBinder;
@@ -57,6 +59,7 @@ public interface VirtualNetworkApi {
@PUT
VirtualNetwork createOrUpdate(@PathParam("virtualnetworkname") String virtualnetworkname,
@PayloadParam("location") String location,
@Nullable @PayloadParam("tags") Map<String, String> tags,
@PayloadParam("properties")VirtualNetwork.VirtualNetworkProperties properties);

@Named("virtualnetwork:get")
@@ -55,7 +55,7 @@ public void createVirtualNetwork() {
VirtualNetwork.VirtualNetworkProperties.builder().addressSpace(
VirtualNetwork.AddressSpace.create(Arrays.asList(DEFAULT_VIRTUALNETWORK_ADDRESS_PREFIX))).build();

VirtualNetwork vn = api().createOrUpdate(virtualNetworkName, LOCATION, virtualNetworkProperties);
VirtualNetwork vn = api().createOrUpdate(virtualNetworkName, LOCATION, null, virtualNetworkProperties);

assertEquals(vn.name(), virtualNetworkName);
assertEquals(vn.location(), LOCATION);
@@ -101,7 +101,7 @@ public void createVirtualNetwork() throws InterruptedException {
VirtualNetwork.AddressSpace.create(Arrays.asList("10.2.0.0/16")), null);


vnApi.createOrUpdate(virtualNetwork, location, virtualNetworkProperties);
vnApi.createOrUpdate(virtualNetwork, location, null, virtualNetworkProperties);

String path = String.format("/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/virtualNetworks/%s?%s", subscriptionid, resourcegroup, virtualNetwork, apiVersion);
String json = String.format("{\"location\":\"%s\",\"properties\":{\"addressSpace\":{\"addressPrefixes\":[\"%s\"]}}}", location, "10.2.0.0/16");
@@ -132,7 +132,7 @@ protected VirtualNetwork createDefaultVirtualNetwork(final String resourceGroupN
final VirtualNetwork.VirtualNetworkProperties virtualNetworkProperties =
VirtualNetwork.VirtualNetworkProperties.create(null, null,
VirtualNetwork.AddressSpace.create(Arrays.asList(virtualnetworkAddressPrefix)), null);
VirtualNetwork virtualNetwork = api.getVirtualNetworkApi(resourceGroupName).createOrUpdate(virtualNetworkName, location, virtualNetworkProperties);
VirtualNetwork virtualNetwork = api.getVirtualNetworkApi(resourceGroupName).createOrUpdate(virtualNetworkName, location, null, virtualNetworkProperties);
retry(new Predicate<String>() {
@Override
public boolean apply(final String name) {

0 comments on commit c9cd6ea

Please sign in to comment.