Add tags to virtual network creation

This commit is contained in:
Ignasi Barrera 2017-11-06 09:09:30 +01:00
parent af79f8f812
commit 8b33c44078
5 changed files with 7 additions and 4 deletions

View File

@ -159,7 +159,7 @@ public class CreateResourcesThenCreateNodes extends CreateNodesWithGroupEncodedI
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());

View File

@ -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.Fallbacks.NullOnNotFoundOr404;
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")

View File

@ -55,7 +55,7 @@ public class VirtualNetworkApiLiveTest extends BaseAzureComputeApiLiveTest {
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);

View File

@ -101,7 +101,7 @@ public class VirtualNetworkApiMockTest extends BaseAzureComputeApiMockTest {
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");

View File

@ -132,7 +132,7 @@ public class BaseAzureComputeApiLiveTest extends BaseApiLiveTest<AzureComputeApi
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) {