You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2018/07/06 08:05:59 UTC

jclouds git commit: Added Virtual Network Gateway Connection API

Repository: jclouds
Updated Branches:
  refs/heads/master f572304ac -> 975aca534


Added Virtual Network Gateway Connection API


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/975aca53
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/975aca53
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/975aca53

Branch: refs/heads/master
Commit: 975aca5346800bded2f86748c474c5d2b71b9eb8
Parents: f572304
Author: Ignasi Barrera <na...@apache.org>
Authored: Tue Jul 3 18:36:52 2018 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Fri Jul 6 10:05:43 2018 +0200

----------------------------------------------------------------------
 .../azurecompute/arm/AzureComputeApi.java       |   9 +
 .../arm/AzureComputeProviderMetadata.java       |   2 +
 .../arm/domain/vpn/TunnelConnectionHealth.java  |  45 +++++
 .../vpn/VirtualNetworkGatewayConnection.java    |  90 +++++++++
 ...rtualNetworkGatewayConnectionProperties.java | 117 ++++++++++++
 .../vpn/VirtualNetworkGatewayProperties.java    |   2 +-
 .../VirtualNetworkGatewayConnectionApi.java     |  86 +++++++++
 .../LocalNetworkGatewayApiLiveTest.java         |   8 +-
 .../VirtualNetworkGatewayApiLiveTest.java       |   4 +-
 ...tualNetworkGatewayConnectionApiLiveTest.java | 181 +++++++++++++++++++
 ...tualNetworkGatewayConnectionApiMockTest.java | 149 +++++++++++++++
 .../src/test/resources/connectioncreate.json    |  26 +++
 .../src/test/resources/connectionget.json       |  26 +++
 .../src/test/resources/connectionlist.json      |  29 +++
 14 files changed, 768 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/975aca53/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java
index d14f7e1..ba2fdd4 100644
--- a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java
@@ -47,6 +47,7 @@ import org.jclouds.azurecompute.arm.features.VirtualMachineApi;
 import org.jclouds.azurecompute.arm.features.VirtualMachineScaleSetApi;
 import org.jclouds.azurecompute.arm.features.VirtualNetworkApi;
 import org.jclouds.azurecompute.arm.features.VirtualNetworkGatewayApi;
+import org.jclouds.azurecompute.arm.features.VirtualNetworkGatewayConnectionApi;
 import org.jclouds.rest.annotations.Delegate;
 
 import com.google.common.base.Supplier;
@@ -281,6 +282,14 @@ public interface AzureComputeApi extends Closeable {
    VirtualNetworkGatewayApi getVirtualNetworkGatewayApi(@PathParam("resourcegroup") String resourcegroup);
    
    /**
+    * Management features for Virtual Network Gateway Connections.
+    * 
+    * @see <a href="https://docs.microsoft.com/en-us/rest/api/network-gateway/virtualnetworkgatewayconnections">docs</a>
+    */
+   @Delegate
+   VirtualNetworkGatewayConnectionApi getVirtualNetworkGatewayConnectionApi(@PathParam("resourcegroup") String resourcegroup);
+   
+   /**
     * Returns the information about the current service principal.
     */
    @Provides

http://git-wip-us.apache.org/repos/asf/jclouds/blob/975aca53/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java
index b16557a..95856e6 100644
--- a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java
@@ -64,6 +64,7 @@ import org.jclouds.azurecompute.arm.features.VirtualMachineApi;
 import org.jclouds.azurecompute.arm.features.VirtualMachineScaleSetApi;
 import org.jclouds.azurecompute.arm.features.VirtualNetworkApi;
 import org.jclouds.azurecompute.arm.features.VirtualNetworkGatewayApi;
+import org.jclouds.azurecompute.arm.features.VirtualNetworkGatewayConnectionApi;
 import org.jclouds.providers.ProviderMetadata;
 import org.jclouds.providers.internal.BaseProviderMetadata;
 
@@ -134,6 +135,7 @@ public class AzureComputeProviderMetadata extends BaseProviderMetadata {
       properties.put(API_VERSION_PREFIX + VaultApi.class.getSimpleName(), "2016-10-01");
       properties.put(API_VERSION_PREFIX + LocalNetworkGatewayApi.class.getSimpleName(), "2018-02-01");
       properties.put(API_VERSION_PREFIX + VirtualNetworkGatewayApi.class.getSimpleName(), "2018-02-01");
+      properties.put(API_VERSION_PREFIX + VirtualNetworkGatewayConnectionApi.class.getSimpleName(), "2018-02-01");
       
       return properties;
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/975aca53/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/TunnelConnectionHealth.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/TunnelConnectionHealth.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/TunnelConnectionHealth.java
new file mode 100644
index 0000000..430b50d
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/TunnelConnectionHealth.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.arm.domain.vpn;
+
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayConnection.Status;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class TunnelConnectionHealth {
+
+   public abstract Status connectionStatus();
+   public abstract int egressBytesTransferred();
+   public abstract int ingressBytesTransferred();
+   @Nullable public abstract String lastConnectionEstablishedUtcTime();
+   public abstract String tunnel();
+
+   TunnelConnectionHealth() {
+
+   }
+
+   @SerializedNames({ "connectionStatus", "egressBytesTransferred", "ingressBytesTransferred",
+         "lastConnectionEstablishedUtcTime", "tunnel" })
+   public static TunnelConnectionHealth create(Status connectionStatus, int egressBytesTransferred,
+         int ingressBytesTransferred, String lastConnectionEstablishedUtcTime, String tunnel) {
+      return new AutoValue_TunnelConnectionHealth(connectionStatus, egressBytesTransferred, ingressBytesTransferred,
+            lastConnectionEstablishedUtcTime, tunnel);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/975aca53/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayConnection.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayConnection.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayConnection.java
new file mode 100644
index 0000000..85dff2a
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayConnection.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.arm.domain.vpn;
+
+import java.util.Map;
+
+import org.jclouds.azurecompute.arm.util.GetEnumValue;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableMap;
+
+@AutoValue
+public abstract class VirtualNetworkGatewayConnection {
+   
+   public static enum Status {
+      Connected, Connecting, NotConnected, Unknown;
+
+      public static Status fromValue(final String text) {
+         return (Status) GetEnumValue.fromValueOrDefault(text, Status.Unknown);
+      }
+   }
+
+   public static enum Type {
+      ExpressRoute, IPsec, VPNClient, Vnet2Vnet, Unrecognized;
+
+      public static Type fromValue(final String text) {
+         return (Type) GetEnumValue.fromValueOrDefault(text, Type.Unrecognized);
+      }
+   }
+
+   @Nullable public abstract String id();
+   public abstract String name();
+   public abstract String location();
+   @Nullable public abstract String type();
+   @Nullable public abstract Map<String, String> tags();
+   @Nullable public abstract String etag();
+   public abstract VirtualNetworkGatewayConnectionProperties properties();
+
+   VirtualNetworkGatewayConnection() {
+
+   }
+
+   @SerializedNames({ "id", "name", "location", "type", "tags", "etag", "properties" })
+   public static VirtualNetworkGatewayConnection create(String id, String name, String location, String type,
+         Map<String, String> tags, String etag, VirtualNetworkGatewayConnectionProperties properties) {
+      return builder(name, location, properties).id(id).type(type).tags(tags).etag(etag).build();
+   }
+
+   public abstract Builder toBuilder();
+
+   public static Builder builder(String name, String location, VirtualNetworkGatewayConnectionProperties properties) {
+      return new AutoValue_VirtualNetworkGatewayConnection.Builder().name(name).location(location)
+            .properties(properties);
+   }
+
+   @AutoValue.Builder
+   public abstract static class Builder {
+      public abstract Builder id(String id);
+      public abstract Builder name(String name);
+      public abstract Builder location(String location);
+      public abstract Builder type(String type);
+      public abstract Builder tags(Map<String, String> tags);
+      public abstract Builder etag(String etag);
+      public abstract Builder properties(VirtualNetworkGatewayConnectionProperties properties);
+
+      abstract Map<String, String> tags();
+      abstract VirtualNetworkGatewayConnection autoBuild();
+
+      public VirtualNetworkGatewayConnection build() {
+         tags(tags() != null ? ImmutableMap.copyOf(tags()) : null);
+         return autoBuild();
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/975aca53/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayConnectionProperties.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayConnectionProperties.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayConnectionProperties.java
new file mode 100644
index 0000000..99db045
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayConnectionProperties.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.arm.domain.vpn;
+
+import java.util.List;
+
+import org.jclouds.azurecompute.arm.domain.IdReference;
+import org.jclouds.azurecompute.arm.domain.Provisionable;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayConnection.Status;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayConnection.Type;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableList;
+
+@AutoValue
+public abstract class VirtualNetworkGatewayConnectionProperties implements Provisionable {
+
+   @Nullable public abstract String authorizationKey();
+   @Nullable public abstract Status connectionStatus();
+   public abstract Type connectionType();
+   @Nullable public abstract Integer egressBytesTransferred();
+   @Nullable public abstract Integer ingressBytesTransferred();
+   public abstract boolean enableBGP();
+   public abstract List<IPSecPolicy> ipsecPolicies();
+   @Nullable public abstract IdReference peer();
+   @Nullable public abstract String provisioningState();
+   @Nullable public abstract String resourceGuid();
+   @Nullable public abstract Integer routingWeight();
+   @Nullable public abstract String sharedKey();
+   public abstract List<TunnelConnectionHealth> tunnelConnectionStatus();
+   public abstract boolean usePolicyBasedTrafficSelectors();
+   public abstract IdReference localNetworkGateway2();
+   public abstract IdReference virtualNetworkGateway1();
+   @Nullable public abstract IdReference virtualNetworkGateway2();
+
+   VirtualNetworkGatewayConnectionProperties() {
+
+   }
+   
+   @SerializedNames({ "authorizationKey", "connectionStatus", "connectionType", "egressBytesTransferred",
+         "ingressBytesTransferred", "enableBGP", "ipsecPolicies", "peer", "provisioningState", "resourceGuid",
+         "routingWeight", "sharedKey", "tunnelConnectionStatus", "usePolicyBasedTrafficSelectors",
+         "localNetworkGateway2", "virtualNetworkGateway1", "virtualNetworkGateway2" })
+   public static VirtualNetworkGatewayConnectionProperties create(String authorizationKey, Status connectionStatus,
+         Type connectionType, Integer egressBytesTransferred, Integer ingressBytesTransferred, boolean enableBGP,
+         List<IPSecPolicy> ipsecPolicies, IdReference peer, String provisioningState, String resourceGuid,
+         Integer routingWeight, String sharedKey, List<TunnelConnectionHealth> tunnelConnectionStatus,
+         boolean usePolicyBasedTrafficSelectors, IdReference localNetworkGateway2, IdReference virtualNetworkGateway1,
+         IdReference virtualNetworkGateway2) {
+      return builder(connectionType, enableBGP, usePolicyBasedTrafficSelectors, localNetworkGateway2,
+            virtualNetworkGateway1).authorizationKey(authorizationKey).connectionStatus(connectionStatus)
+            .egressBytesTransferred(egressBytesTransferred).ingressBytesTransferred(ingressBytesTransferred)
+            .ipsecPolicies(ipsecPolicies).peer(peer).provisioningState(provisioningState).resourceGuid(resourceGuid)
+            .routingWeight(routingWeight).sharedKey(sharedKey).tunnelConnectionStatus(tunnelConnectionStatus)
+            .virtualNetworkGateway2(virtualNetworkGateway2).build();
+   }
+   
+   public static Builder builder(Type connectionType, boolean enableBGP, boolean usePolicyBasedTrafficSelectors,
+         IdReference localNetworkGateway2, IdReference virtualNetworkGateway1) {
+      return new AutoValue_VirtualNetworkGatewayConnectionProperties.Builder().connectionType(connectionType)
+            .enableBGP(enableBGP).usePolicyBasedTrafficSelectors(usePolicyBasedTrafficSelectors)
+            .localNetworkGateway2(localNetworkGateway2).virtualNetworkGateway1(virtualNetworkGateway1)
+            .ipsecPolicies(ImmutableList.<IPSecPolicy> of())
+            .tunnelConnectionStatus(ImmutableList.<TunnelConnectionHealth> of());
+   }
+
+   public abstract Builder toBuilder();
+
+   @AutoValue.Builder
+   public abstract static class Builder {
+      public abstract Builder authorizationKey(String authorizationKey);
+      public abstract Builder connectionStatus(Status connectionStatus);
+      public abstract Builder connectionType(Type connectionType);
+      public abstract Builder egressBytesTransferred(Integer egressBytesTransferred);
+      public abstract Builder ingressBytesTransferred(Integer ingressBytesTransferred);
+      public abstract Builder enableBGP(boolean enableBGP);
+      public abstract Builder ipsecPolicies(List<IPSecPolicy> ipsecPolicies);
+      public abstract Builder peer(IdReference peer);
+      public abstract Builder provisioningState(String provisioningState);
+      public abstract Builder resourceGuid(String resourceGuid);
+      public abstract Builder routingWeight(Integer routingWeight);
+      public abstract Builder sharedKey(String sharedKey);
+      public abstract Builder tunnelConnectionStatus(List<TunnelConnectionHealth> tunnelConnectionStatus);
+      public abstract Builder usePolicyBasedTrafficSelectors(boolean usePolicyBasedTrafficSelectors);
+      public abstract Builder localNetworkGateway2(IdReference localNetworkGateway2);
+      public abstract Builder virtualNetworkGateway1(IdReference virtualNetworkGateway1);
+      public abstract Builder virtualNetworkGateway2(IdReference virtualNetworkGateway2);
+
+      abstract List<IPSecPolicy> ipsecPolicies();
+      abstract List<TunnelConnectionHealth> tunnelConnectionStatus();
+      abstract VirtualNetworkGatewayConnectionProperties autoBuild();
+
+      public VirtualNetworkGatewayConnectionProperties build() {
+         ipsecPolicies(ipsecPolicies() == null ? ImmutableList.<IPSecPolicy> of() : ImmutableList
+               .copyOf(ipsecPolicies()));
+         tunnelConnectionStatus(tunnelConnectionStatus() == null ? ImmutableList.<TunnelConnectionHealth> of()
+               : ImmutableList.copyOf(tunnelConnectionStatus()));
+         return autoBuild();
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/975aca53/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayProperties.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayProperties.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayProperties.java
index 1d30f5f..2905f41 100644
--- a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayProperties.java
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayProperties.java
@@ -60,7 +60,7 @@ public abstract class VirtualNetworkGatewayProperties implements Provisionable {
    
    public static Builder builder(boolean enableBGP, VirtualNetworkGatewayType virtualNetworkGatewayType, SKU sku) {
       return new AutoValue_VirtualNetworkGatewayProperties.Builder().enableBGP(enableBGP)
-            .gatewayType(virtualNetworkGatewayType).sku(sku);
+            .gatewayType(virtualNetworkGatewayType).sku(sku).ipConfigurations(ImmutableList.<IpConfiguration> of());
    }
    
    public abstract Builder toBuilder();

http://git-wip-us.apache.org/repos/asf/jclouds/blob/975aca53/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApi.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApi.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApi.java
new file mode 100644
index 0000000..3daaa97
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApi.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.arm.features;
+
+import java.io.Closeable;
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayConnection;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayConnectionProperties;
+import org.jclouds.azurecompute.arm.filters.ApiVersionFilter;
+import org.jclouds.azurecompute.arm.functions.URIParser;
+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;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+@Path("/resourcegroups/{resourcegroup}/providers/Microsoft.Network/connections")
+@RequestFilters({ OAuthFilter.class, ApiVersionFilter.class })
+@Consumes(MediaType.APPLICATION_JSON)
+public interface VirtualNetworkGatewayConnectionApi extends Closeable {
+
+   @Named("virtualnetworkgatewayconnection:list")
+   @GET
+   @SelectJson("value")
+   @Fallback(EmptyListOnNotFoundOr404.class)
+   List<VirtualNetworkGatewayConnection> list();
+
+   @Named("virtualnetworkgatewayconnection:get")
+   @Path("/{name}")
+   @GET
+   @Fallback(NullOnNotFoundOr404.class)
+   VirtualNetworkGatewayConnection get(@PathParam("name") String name);
+   
+   @Named("virtualnetworkgatewayconnection:getSharedKey")
+   @Path("/{name}/sharedkey")
+   @GET
+   @Fallback(NullOnNotFoundOr404.class)
+   String getSharedKey(@PathParam("name") String name);
+
+   @Named("virtualnetworkgatewayconnection:createOrUpdate")
+   @MapBinder(BindToJsonPayload.class)
+   @Path("/{name}")
+   @PUT
+   VirtualNetworkGatewayConnection createOrUpdate(@PathParam("name") String name,
+         @PayloadParam("location") String location, @Nullable @PayloadParam("tags") Map<String, String> tags,
+         @PayloadParam("properties") VirtualNetworkGatewayConnectionProperties properties);
+
+   @Named("virtualnetworkgatewayconnection:delete")
+   @Path("/{name}")
+   @DELETE
+   @ResponseParser(URIParser.class)
+   @Fallback(NullOnNotFoundOr404.class)
+   URI delete(@PathParam("name") String name);
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/975aca53/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApiLiveTest.java b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApiLiveTest.java
index bdf26ee..b139369 100644
--- a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApiLiveTest.java
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApiLiveTest.java
@@ -98,7 +98,7 @@ public class LocalNetworkGatewayApiLiveTest extends BaseAzureComputeApiLiveTest
       assertTrue(gw.properties().localNetworkAddressSpace().addressPrefixes().contains("192.168.1.0/24"));
    }
 
-   @Test(dependsOnMethods = { "getLocalNetworkGateway", "listLocalNetworkGateways", "updateLocalNetworkGateway" }, alwaysRun = true)
+   @Test(dependsOnMethods = { "getLocalNetworkGateway", "listLocalNetworkGateways", "updateLocalNetworkGateway" })
    public void deleteLocalNetworkGateway() {
       // Make sure the resource is fully provisioned before deleting it
       waitUntilAvailable(name);
@@ -110,13 +110,13 @@ public class LocalNetworkGatewayApiLiveTest extends BaseAzureComputeApiLiveTest
       return api.getLocalNetworkGatewayApi(resourceGroupName);
    }
 
-   private boolean waitUntilAvailable(final String name) {
-      return resourceAvailable.apply(new Supplier<Provisionable>() {
+   private void waitUntilAvailable(final String name) {
+      assertTrue(resourceAvailable.apply(new Supplier<Provisionable>() {
          @Override
          public Provisionable get() {
             LocalNetworkGateway gw = api().get(name);
             return gw == null ? null : gw.properties();
          }
-      });
+      }));
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/975aca53/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiLiveTest.java b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiLiveTest.java
index 4faaf2d..e1dfad8 100644
--- a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiLiveTest.java
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiLiveTest.java
@@ -18,6 +18,7 @@ package org.jclouds.azurecompute.arm.features;
 
 import static com.google.common.collect.Iterables.any;
 import static java.util.Collections.singletonList;
+import static java.util.logging.Logger.getAnonymousLogger;
 import static org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayType.Vpn;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
@@ -83,6 +84,7 @@ public class VirtualNetworkGatewayApiLiveTest extends BaseAzureComputeApiLiveTes
             .builder(false, Vpn, SKU.create(1, SKUName.Basic, SKUTier.Basic)).vpnType(VPNType.PolicyBased)
             .ipConfigurations(singletonList(ipconf)).build();
 
+      getAnonymousLogger().info(String.format("Creating virtual network gateway %s. This may take a while...", name));
       VirtualNetworkGateway gw = api().createOrUpdate(name, LOCATION, null, props);
 
       assertNotNull(gw);
@@ -118,7 +120,7 @@ public class VirtualNetworkGatewayApiLiveTest extends BaseAzureComputeApiLiveTes
       assertEquals(gw.tags().get("foo"), "bar");
    }
 
-   @Test(dependsOnMethods = { "getVirtualNetworkGateway", "listVirtualNetworkGateways", "updateVirtualNetworkGateway" }, alwaysRun = true)
+   @Test(dependsOnMethods = { "getVirtualNetworkGateway", "listVirtualNetworkGateways", "updateVirtualNetworkGateway" })
    public void deleteVirtualNetworkGateway() {
       // Make sure the resource is fully provisioned before deleting it
       assertTrue(virtualNetworkGatewayAvailable.apply(name));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/975aca53/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApiLiveTest.java b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApiLiveTest.java
new file mode 100644
index 0000000..b16250a
--- /dev/null
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApiLiveTest.java
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.arm.features;
+
+import static com.google.common.collect.Iterables.any;
+import static java.util.Collections.singletonList;
+import static java.util.logging.Logger.getAnonymousLogger;
+import static org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayConnection.Type.IPsec;
+import static org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayType.Vpn;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+import java.util.Collections;
+
+import org.jclouds.azurecompute.arm.domain.AddressSpace;
+import org.jclouds.azurecompute.arm.domain.IdReference;
+import org.jclouds.azurecompute.arm.domain.IpAllocationMethod;
+import org.jclouds.azurecompute.arm.domain.Provisionable;
+import org.jclouds.azurecompute.arm.domain.PublicIPAddress;
+import org.jclouds.azurecompute.arm.domain.PublicIPAddressProperties;
+import org.jclouds.azurecompute.arm.domain.Subnet;
+import org.jclouds.azurecompute.arm.domain.VirtualNetwork;
+import org.jclouds.azurecompute.arm.domain.vpn.LocalNetworkGateway;
+import org.jclouds.azurecompute.arm.domain.vpn.LocalNetworkGatewayProperties;
+import org.jclouds.azurecompute.arm.domain.vpn.SKU;
+import org.jclouds.azurecompute.arm.domain.vpn.SKU.SKUName;
+import org.jclouds.azurecompute.arm.domain.vpn.SKU.SKUTier;
+import org.jclouds.azurecompute.arm.domain.vpn.VPNType;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGateway;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayConnection;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayConnectionProperties;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayProperties;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayProperties.IpConfiguration;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayProperties.IpConfiguration.IpConfigurationProperties;
+import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiLiveTest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+@Test(groups = "live", testName = "VirtualNetworkGatewayConnectionApiLiveTest", singleThreaded = true)
+public class VirtualNetworkGatewayConnectionApiLiveTest extends BaseAzureComputeApiLiveTest {
+
+   private String name;
+   private LocalNetworkGateway localGateway;
+   private VirtualNetworkGateway virtualGateway;
+
+   @BeforeClass
+   @Override
+   public void setup() {
+      super.setup();
+      createTestResourceGroup();
+      name = "jclouds-" + RAND;
+      setupLocalGateway();
+      setupVirtualGateway();
+   }
+
+   private void setupLocalGateway() {
+      AddressSpace localAddresses = AddressSpace.create(ImmutableList.of("192.168.0.0/24"));
+      LocalNetworkGatewayProperties props = LocalNetworkGatewayProperties.builder("1.2.3.4")
+            .localNetworkAddressSpace(localAddresses).build();
+
+      final LocalNetworkGatewayApi lgwApi = api.getLocalNetworkGatewayApi(resourceGroupName);
+      localGateway = lgwApi.createOrUpdate(name + "-lgw", LOCATION, null, props);
+
+      assertTrue(resourceAvailable.apply(new Supplier<Provisionable>() {
+         @Override
+         public Provisionable get() {
+            LocalNetworkGateway gw = lgwApi.get(localGateway.name());
+            return gw == null ? null : gw.properties();
+         }
+      }));
+   }
+
+   private void setupVirtualGateway() {
+      VirtualNetwork vnet = createDefaultVirtualNetwork(resourceGroupName, name + "-net", "10.2.0.0/16", LOCATION);
+      Subnet subnet = createDefaultSubnet(resourceGroupName, Subnet.GATEWAY_SUBNET_NAME, vnet.name(), "10.2.0.0/23");
+
+      PublicIPAddressProperties props = PublicIPAddressProperties.builder()
+            .publicIPAllocationMethod(IpAllocationMethod.Dynamic.name()).idleTimeoutInMinutes(4).build();
+      PublicIPAddress publicIp = api.getPublicIPAddressApi(resourceGroupName).createOrUpdate(name + "-publicip",
+            LOCATION, Collections.<String, String> emptyMap(), props);
+
+      IpConfigurationProperties ipprops = IpConfigurationProperties.builder(IpAllocationMethod.Dynamic)
+            .subnet(IdReference.create(subnet.id())).publicIPAddress(IdReference.create(publicIp.id())).build();
+      IpConfiguration ipconf = IpConfiguration.create(null, name + "-ipconf", null, ipprops);
+
+      VirtualNetworkGatewayProperties gwProps = VirtualNetworkGatewayProperties
+            .builder(false, Vpn, SKU.create(1, SKUName.Basic, SKUTier.Basic)).vpnType(VPNType.PolicyBased)
+            .ipConfigurations(singletonList(ipconf)).build();
+
+      getAnonymousLogger().info(
+            String.format("Creating virtual network gateway %s-vgw. This may take a while...", name));
+      virtualGateway = api.getVirtualNetworkGatewayApi(resourceGroupName).createOrUpdate(name + "-vgw", LOCATION, null,
+            gwProps);
+      assertTrue(virtualNetworkGatewayStatus.create(resourceGroupName).apply(virtualGateway.name()));
+   }
+
+   @Test
+   public void createVirtualNetworkGatewayConnection() {
+      VirtualNetworkGatewayConnectionProperties props = VirtualNetworkGatewayConnectionProperties
+            .builder(IPsec, false, false, IdReference.create(localGateway.id()),
+                  IdReference.create(virtualGateway.id())).sharedKey("jcl0uds").build();
+
+      VirtualNetworkGatewayConnection conn = api().createOrUpdate(name, LOCATION, null, props);
+
+      assertNotNull(conn);
+      assertEquals(conn.name(), name);
+      assertNotNull(conn.properties());
+   }
+
+   @Test(dependsOnMethods = "createVirtualNetworkGatewayConnection")
+   public void getVirtualNetworkGatewayConnection() {
+      assertNotNull(api().get(name));
+   }
+
+   @Test(dependsOnMethods = "createVirtualNetworkGatewayConnection")
+   public void listVirtualNetworkGatewayConnections() {
+      assertTrue(any(api().list(), new Predicate<VirtualNetworkGatewayConnection>() {
+         @Override
+         public boolean apply(VirtualNetworkGatewayConnection input) {
+            return name.equals(input.name());
+         }
+      }));
+   }
+
+   @Test(dependsOnMethods = "createVirtualNetworkGatewayConnection")
+   public void updateVirtualNetworkGatewayConnection() {
+      // Make sure the resource is fully provisioned before modifying it
+      waitUntilAvailable(name);
+
+      VirtualNetworkGatewayConnection conn = api().get(name);
+      conn = api().createOrUpdate(name, LOCATION, ImmutableMap.of("foo", "bar"), conn.properties());
+
+      assertNotNull(conn);
+      assertTrue(conn.tags().containsKey("foo"));
+      assertEquals(conn.tags().get("foo"), "bar");
+   }
+
+   @Test(dependsOnMethods = { "getVirtualNetworkGatewayConnection", "listVirtualNetworkGatewayConnections",
+         "updateVirtualNetworkGatewayConnection" })
+   public void deleteVirtualNetworkGatewayConnection() {
+      // Make sure the resource is fully provisioned before deleting it
+      waitUntilAvailable(name);
+      URI uri = api().delete(name);
+      assertResourceDeleted(uri);
+   }
+
+   private void waitUntilAvailable(final String name) {
+      assertTrue(resourceAvailable.apply(new Supplier<Provisionable>() {
+         @Override
+         public Provisionable get() {
+            VirtualNetworkGatewayConnection gw = api().get(name);
+            return gw == null ? null : gw.properties();
+         }
+      }));
+   }
+
+   private VirtualNetworkGatewayConnectionApi api() {
+      return api.getVirtualNetworkGatewayConnectionApi(resourceGroupName);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/975aca53/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApiMockTest.java b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApiMockTest.java
new file mode 100644
index 0000000..7c8a230
--- /dev/null
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayConnectionApiMockTest.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.arm.features;
+
+import static com.google.common.collect.Iterables.isEmpty;
+import static org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayConnection.Type.IPsec;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+import java.util.List;
+
+import org.jclouds.azurecompute.arm.domain.IdReference;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayConnection;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayConnection.Type;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayConnectionProperties;
+import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiMockTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "VirtualNetworkGatewayConnectionApiMockTest", singleThreaded = true)
+public class VirtualNetworkGatewayConnectionApiMockTest extends BaseAzureComputeApiMockTest {
+
+   private final String subscriptionid = "SUBSCRIPTIONID";
+   private final String resourcegroup = "myresourcegroup";
+   private final String name = "myconn";
+   private final String apiVersion = "api-version=2018-02-01";
+
+   private static final String LG_ID = "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayconnectionapilivetest-nacx/providers/Microsoft.Network/localNetworkGateways/jclouds-827-lgw";
+   private static final String VG_ID = "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayconnectionapilivetest-nacx/providers/Microsoft.Network/virtualNetworkGateways/jclouds-827-vgw";
+
+   public void createOrUpdateVirtualNetworkGateway() throws InterruptedException {
+      server.enqueue(jsonResponse("/connectioncreate.json").setResponseCode(200));
+      VirtualNetworkGatewayConnectionApi connapi = api.getVirtualNetworkGatewayConnectionApi(resourcegroup);
+
+      VirtualNetworkGatewayConnectionProperties props = VirtualNetworkGatewayConnectionProperties
+            .builder(IPsec, false, false, IdReference.create(LG_ID), IdReference.create(VG_ID)).sharedKey("jcl0uds")
+            .build();
+
+      VirtualNetworkGatewayConnection conn = connapi.createOrUpdate(name, "westeurope", null, props);
+
+      String path = String.format(
+            "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/connections/%s?%s",
+            subscriptionid, resourcegroup, name, apiVersion);
+      String json = "{\"location\":\"westeurope\",\"properties\":{\"connectionType\":\"IPsec\",\"enableBGP\":false,\"ipsecPolicies\":[],\"sharedKey\":\"jcl0uds\",\"tunnelConnectionStatus\":[],\"usePolicyBasedTrafficSelectors\":false,\"localNetworkGateway2\":{\"id\":\"/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayconnectionapilivetest-nacx/providers/Microsoft.Network/localNetworkGateways/jclouds-827-lgw\"},\"virtualNetworkGateway1\":{\"id\":\"/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayconnectionapilivetest-nacx/providers/Microsoft.Network/virtualNetworkGateways/jclouds-827-vgw\"}}}";
+      assertSent(server, "PUT", path, json);
+
+      assertEquals(conn.name(), name);
+      assertNotNull(conn.properties());
+      assertEquals(conn.properties().connectionType(), Type.IPsec);
+   }
+
+   public void getVirtualNetworkGateway() throws InterruptedException {
+      server.enqueue(jsonResponse("/connectionget.json").setResponseCode(200));
+      VirtualNetworkGatewayConnectionApi connapi = api.getVirtualNetworkGatewayConnectionApi(resourcegroup);
+
+      VirtualNetworkGatewayConnection conn = connapi.get(name);
+
+      String path = String.format(
+            "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/connections/%s?%s",
+            subscriptionid, resourcegroup, name, apiVersion);
+      assertSent(server, "GET", path);
+
+      assertEquals(conn.name(), name);
+   }
+
+   public void getVirtualNetworkGatewayReturns404() throws InterruptedException {
+      server.enqueue(response404());
+      VirtualNetworkGatewayConnectionApi connapi = api.getVirtualNetworkGatewayConnectionApi(resourcegroup);
+
+      VirtualNetworkGatewayConnection conn = connapi.get(name);
+
+      String path = String.format(
+            "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/connections/%s?%s",
+            subscriptionid, resourcegroup, name, apiVersion);
+      assertSent(server, "GET", path);
+
+      assertNull(conn);
+   }
+
+   public void listVirtualNetworkGateways() throws InterruptedException {
+      server.enqueue(jsonResponse("/connectionlist.json").setResponseCode(200));
+      VirtualNetworkGatewayConnectionApi connapi = api.getVirtualNetworkGatewayConnectionApi(resourcegroup);
+
+      List<VirtualNetworkGatewayConnection> conns = connapi.list();
+
+      String path = String.format(
+            "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/connections?%s",
+            subscriptionid, resourcegroup, apiVersion);
+      assertSent(server, "GET", path);
+
+      assertTrue(conns.size() > 0);
+   }
+
+   public void listVirtualNetworkGatewaysReturns404() throws InterruptedException {
+      server.enqueue(response404());
+      VirtualNetworkGatewayConnectionApi connapi = api.getVirtualNetworkGatewayConnectionApi(resourcegroup);
+
+      List<VirtualNetworkGatewayConnection> conns = connapi.list();
+
+      String path = String.format(
+            "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/connections?%s",
+            subscriptionid, resourcegroup, apiVersion);
+      assertSent(server, "GET", path);
+
+      assertTrue(isEmpty(conns));
+   }
+
+   public void deleteVirtualNetworkGateway() throws InterruptedException {
+      server.enqueue(response202WithHeader());
+      VirtualNetworkGatewayConnectionApi connapi = api.getVirtualNetworkGatewayConnectionApi(resourcegroup);
+
+      URI uri = connapi.delete(name);
+      assertNotNull(uri);
+
+      String path = String.format(
+            "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/connections/%s?%s",
+            subscriptionid, resourcegroup, name, apiVersion);
+      assertSent(server, "DELETE", path);
+   }
+
+   public void deleteVirtualNetworkGatewayDoesNotExist() throws InterruptedException {
+      server.enqueue(response204());
+      VirtualNetworkGatewayConnectionApi connapi = api.getVirtualNetworkGatewayConnectionApi(resourcegroup);
+
+      URI uri = connapi.delete(name);
+      assertNull(uri);
+
+      String path = String.format(
+            "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/connections/%s?%s",
+            subscriptionid, resourcegroup, name, apiVersion);
+      assertSent(server, "DELETE", path);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/975aca53/providers/azurecompute-arm/src/test/resources/connectioncreate.json
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/resources/connectioncreate.json b/providers/azurecompute-arm/src/test/resources/connectioncreate.json
new file mode 100644
index 0000000..6b859ec
--- /dev/null
+++ b/providers/azurecompute-arm/src/test/resources/connectioncreate.json
@@ -0,0 +1,26 @@
+{
+      "name": "myconn",
+      "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayconnectionapilivetest-nacx/providers/Microsoft.Network/connections/myconn",
+      "etag": "W/\"e6f08058-3815-4498-858b-0fe750e086c8\"",
+      "type": "Microsoft.Network/connections",
+      "location": "westeurope",
+      "properties": {
+        "provisioningState": "Updating",
+        "resourceGuid": "1c7fc4e8-5d48-476b-b951-38279aec7d63",
+        "virtualNetworkGateway1": {
+          "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayconnectionapilivetest-nacx/providers/Microsoft.Network/virtualNetworkGateways/jclouds-827-vgw"
+        },
+        "localNetworkGateway2": {
+          "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayconnectionapilivetest-nacx/providers/Microsoft.Network/localNetworkGateways/jclouds-827-lgw"
+        },
+        "connectionType": "IPsec",
+        "routingWeight": 0,
+        "sharedKey": "jcl0uds",
+        "enableBgp": false,
+        "usePolicyBasedTrafficSelectors": false,
+        "ipsecPolicies": [],
+        "ingressBytesTransferred": 0,
+        "egressBytesTransferred": 0,
+        "tunnelConnectionStatus": []
+      }
+    }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/975aca53/providers/azurecompute-arm/src/test/resources/connectionget.json
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/resources/connectionget.json b/providers/azurecompute-arm/src/test/resources/connectionget.json
new file mode 100644
index 0000000..2dd277e
--- /dev/null
+++ b/providers/azurecompute-arm/src/test/resources/connectionget.json
@@ -0,0 +1,26 @@
+{
+    "name": "myconn",
+    "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayconnectionapilivetest-nacx/providers/Microsoft.Network/connections/myconn",
+    "etag": "W/\"e6f08058-3815-4498-858b-0fe750e086c8\"",
+    "type": "Microsoft.Network/connections",
+    "location": "westeurope",
+    "properties": {
+      "provisioningState": "Updating",
+      "resourceGuid": "1c7fc4e8-5d48-476b-b951-38279aec7d63",
+      "virtualNetworkGateway1": {
+        "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayconnectionapilivetest-nacx/providers/Microsoft.Network/virtualNetworkGateways/jclouds-827-vgw"
+      },
+      "localNetworkGateway2": {
+        "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayconnectionapilivetest-nacx/providers/Microsoft.Network/localNetworkGateways/jclouds-827-lgw"
+      },
+      "connectionType": "IPsec",
+      "routingWeight": 0,
+      "sharedKey": "jcl0uds",
+      "enableBgp": false,
+      "usePolicyBasedTrafficSelectors": false,
+      "ipsecPolicies": [],
+      "ingressBytesTransferred": 0,
+      "egressBytesTransferred": 0,
+      "tunnelConnectionStatus": []
+    }
+  }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/975aca53/providers/azurecompute-arm/src/test/resources/connectionlist.json
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/resources/connectionlist.json b/providers/azurecompute-arm/src/test/resources/connectionlist.json
new file mode 100644
index 0000000..3f1ff07
--- /dev/null
+++ b/providers/azurecompute-arm/src/test/resources/connectionlist.json
@@ -0,0 +1,29 @@
+{
+    "value": [
+      {
+        "name": "myconn",
+        "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayconnectionapilivetest-nacx/providers/Microsoft.Network/connections/myconn",
+        "etag": "W/\"e6f08058-3815-4498-858b-0fe750e086c8\"",
+        "type": "Microsoft.Network/connections",
+        "location": "westeurope",
+        "properties": {
+          "provisioningState": "Updating",
+          "resourceGuid": "1c7fc4e8-5d48-476b-b951-38279aec7d63",
+          "virtualNetworkGateway1": {
+            "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayconnectionapilivetest-nacx/providers/Microsoft.Network/virtualNetworkGateways/jclouds-827-vgw"
+          },
+          "localNetworkGateway2": {
+            "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayconnectionapilivetest-nacx/providers/Microsoft.Network/localNetworkGateways/jclouds-827-lgw"
+          },
+          "connectionType": "IPsec",
+          "routingWeight": 0,
+          "enableBgp": false,
+          "usePolicyBasedTrafficSelectors": false,
+          "ipsecPolicies": [],
+          "ingressBytesTransferred": 0,
+          "egressBytesTransferred": 0,
+          "tunnelConnectionStatus": []
+        }
+      }
+    ]
+  }
\ No newline at end of file