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/03 10:51:58 UTC
[1/3] jclouds git commit: Added Virtual Network Gateway API
Repository: jclouds
Updated Branches:
refs/heads/master 39d770ffc -> ea5b899de
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/test/resources/virtualnetworkgatewaycreate.json
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/resources/virtualnetworkgatewaycreate.json b/providers/azurecompute-arm/src/test/resources/virtualnetworkgatewaycreate.json
new file mode 100644
index 0000000..6775283
--- /dev/null
+++ b/providers/azurecompute-arm/src/test/resources/virtualnetworkgatewaycreate.json
@@ -0,0 +1,45 @@
+{
+ "name": "myvirtualgw",
+ "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/virtualNetworkGateways/myvirtualgw",
+ "etag": "W/\"7d15735c-35b4-4e22-a281-d7d54c6fdecf\"",
+ "type": "Microsoft.Network/virtualNetworkGateways",
+ "location": "westeurope",
+ "properties": {
+ "provisioningState": "Updating",
+ "resourceGuid": "36998db6-e664-4683-ad8d-9afb2e23b1d8",
+ "ipConfigurations": [
+ {
+ "name": "myvirtualgw-ipconf",
+ "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/virtualNetworkGateways/myvirtualgw/ipConfigurations/myvirtualgw-ipconf",
+ "etag": "W/\"7d15735c-35b4-4e22-a281-d7d54c6fdecf\"",
+ "properties": {
+ "provisioningState": "Updating",
+ "privateIPAllocationMethod": "Dynamic",
+ "publicIPAddress": {
+ "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/publicIPAddresses/myvirtualgw-publicip"
+ },
+ "subnet": {
+ "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/virtualNetworks/myvirtualgw-net/subnets/GatewaySubnet"
+ }
+ }
+ }
+ ],
+ "sku": {
+ "name": "Basic",
+ "tier": "Basic",
+ "capacity": 2
+ },
+ "gatewayType": "Vpn",
+ "vpnType": "PolicyBased",
+ "enableBgp": false,
+ "activeActive": false,
+ "vpnClientConfiguration": {
+ "vpnClientProtocols": [
+ "SSTP"
+ ],
+ "vpnClientRootCertificates": [],
+ "vpnClientRevokedCertificates": [],
+ "vpnClientIpsecPolicies": []
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/test/resources/virtualnetworkgatewayget.json
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/resources/virtualnetworkgatewayget.json b/providers/azurecompute-arm/src/test/resources/virtualnetworkgatewayget.json
new file mode 100644
index 0000000..9dcfb47
--- /dev/null
+++ b/providers/azurecompute-arm/src/test/resources/virtualnetworkgatewayget.json
@@ -0,0 +1,37 @@
+{
+ "name": "myvirtualgw",
+ "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/virtualNetworkGateways/myvirtualgw",
+ "etag": "W/\"7d15735c-35b4-4e22-a281-d7d54c6fdecf\"",
+ "type": "Microsoft.Network/virtualNetworkGateways",
+ "location": "westeurope",
+ "properties": {
+ "provisioningState": "Updating",
+ "resourceGuid": "36998db6-e664-4683-ad8d-9afb2e23b1d8",
+ "ipConfigurations": [
+ {
+ "name": "myvirtualgw-ipconf",
+ "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/virtualNetworkGateways/myvirtualgw/ipConfigurations/myvirtualgw-ipconf",
+ "etag": "W/\"7d15735c-35b4-4e22-a281-d7d54c6fdecf\"",
+ "properties": {
+ "provisioningState": "Updating",
+ "privateIPAllocationMethod": "Dynamic",
+ "publicIPAddress": {
+ "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/publicIPAddresses/myvirtualgw-publicip"
+ },
+ "subnet": {
+ "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/virtualNetworks/myvirtualgw-net/subnets/GatewaySubnet"
+ }
+ }
+ }
+ ],
+ "sku": {
+ "name": "Basic",
+ "tier": "Basic",
+ "capacity": 2
+ },
+ "gatewayType": "Vpn",
+ "vpnType": "PolicyBased",
+ "enableBgp": false,
+ "activeActive": false
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/test/resources/virtualnetworkgatewaylist.json
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/resources/virtualnetworkgatewaylist.json b/providers/azurecompute-arm/src/test/resources/virtualnetworkgatewaylist.json
new file mode 100644
index 0000000..b3218b9
--- /dev/null
+++ b/providers/azurecompute-arm/src/test/resources/virtualnetworkgatewaylist.json
@@ -0,0 +1,49 @@
+{
+ "value": [
+ {
+ "name": "myvirtualgw",
+ "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/virtualNetworkGateways/myvirtualgw",
+ "etag": "W/\"7d15735c-35b4-4e22-a281-d7d54c6fdecf\"",
+ "type": "Microsoft.Network/virtualNetworkGateways",
+ "location": "westeurope",
+ "properties": {
+ "provisioningState": "Updating",
+ "resourceGuid": "36998db6-e664-4683-ad8d-9afb2e23b1d8",
+ "ipConfigurations": [
+ {
+ "name": "myvirtualgw-ipconf",
+ "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/virtualNetworkGateways/myvirtualgw/ipConfigurations/myvirtualgw-ipconf",
+ "etag": "W/\"7d15735c-35b4-4e22-a281-d7d54c6fdecf\"",
+ "properties": {
+ "provisioningState": "Updating",
+ "privateIPAllocationMethod": "Dynamic",
+ "publicIPAddress": {
+ "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/publicIPAddresses/myvirtualgw-publicip"
+ },
+ "subnet": {
+ "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/virtualNetworks/myvirtualgw-net/subnets/GatewaySubnet"
+ }
+ }
+ }
+ ],
+ "sku": {
+ "name": "Basic",
+ "tier": "Basic",
+ "capacity": 2
+ },
+ "gatewayType": "Vpn",
+ "vpnType": "PolicyBased",
+ "enableBgp": false,
+ "activeActive": false,
+ "vpnClientConfiguration": {
+ "vpnClientProtocols": [
+ "SSTP"
+ ],
+ "vpnClientRootCertificates": [],
+ "vpnClientRevokedCertificates": [],
+ "vpnClientIpsecPolicies": []
+ }
+ }
+ }
+ ]
+}
\ No newline at end of file
[2/3] jclouds git commit: Added Virtual Network Gateway API
Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IPSecEncryption.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IPSecEncryption.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IPSecEncryption.java
new file mode 100644
index 0000000..a9405c5
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IPSecEncryption.java
@@ -0,0 +1,28 @@
+/*
+ * 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.util.GetEnumValue;
+
+public enum IPSecEncryption {
+
+ AES128, AES192, AES256, DES, DES3, GCMAES128, GCMAES192, GCMAES256, None, Unrecognized;
+
+ public static IPSecEncryption fromValue(final String text) {
+ return (IPSecEncryption) GetEnumValue.fromValueOrDefault(text, IPSecEncryption.Unrecognized);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IPSecIntegrity.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IPSecIntegrity.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IPSecIntegrity.java
new file mode 100644
index 0000000..02dc6ee
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IPSecIntegrity.java
@@ -0,0 +1,28 @@
+/*
+ * 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.util.GetEnumValue;
+
+public enum IPSecIntegrity {
+
+ GCMAES128, GCMAES192, GCMAES256, MD5, SHA1, SHA256, Unrecognized;
+
+ public static IPSecIntegrity fromValue(final String text) {
+ return (IPSecIntegrity) GetEnumValue.fromValueOrDefault(text, IPSecIntegrity.Unrecognized);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IPSecPolicy.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IPSecPolicy.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IPSecPolicy.java
new file mode 100644
index 0000000..d744fb0
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IPSecPolicy.java
@@ -0,0 +1,77 @@
+/*
+ * 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.AddressSpace;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class IPSecPolicy {
+ @Nullable public abstract String radiusServerAddress();
+ @Nullable public abstract String radiusServerSecret();
+ @Nullable public abstract AddressSpace vpnClientAddressPool();
+ @Nullable public abstract DHGroup dhGroup();
+ @Nullable public abstract IkeEncryption ikeEncryption();
+ @Nullable public abstract IkeIntegrity ikeIntegrity();
+ @Nullable public abstract IPSecEncryption ipsecEncryption();
+ @Nullable public abstract IPSecIntegrity ipsecIntegrity();
+ @Nullable public abstract PFSGroup pfsGroup();
+ @Nullable public abstract Integer saDataSizeKilobytes();
+ @Nullable public abstract Integer saLifeTimeSeconds();
+
+ IPSecPolicy() {
+
+ }
+
+ @SerializedNames({ "radiusServerAddress", "radiusServerSecret", "vpnClientAddressPool", "dhGroup", "ikeEncryption",
+ "ikeIntegrity", "ipsecEncryption", "ipsecIntegrity", "pfsGroup", "saDataSizeKilobytes", "saLifeTimeSeconds" })
+ public static IPSecPolicy create(String radiusServerAddress, String radiusServerSecret,
+ AddressSpace vpnClientAddressPool, DHGroup dhGroup, IkeEncryption ikeEncryption, IkeIntegrity ikeIntegrity,
+ IPSecEncryption ipsecEncryption, IPSecIntegrity ipsecIntegrity, PFSGroup pfsGroup,
+ Integer saDataSizeKilobytes, Integer saLifeTimeSeconds) {
+ return builder().radiusServerAddress(radiusServerAddress).radiusServerSecret(radiusServerSecret)
+ .vpnClientAddressPool(vpnClientAddressPool).dhGroup(dhGroup).ikeEncryption(ikeEncryption)
+ .ikeIntegrity(ikeIntegrity).ipsecEncryption(ipsecEncryption).ipsecIntegrity(ipsecIntegrity)
+ .pfsGroup(pfsGroup).saDataSizeKilobytes(saDataSizeKilobytes).saLifeTimeSeconds(saLifeTimeSeconds).build();
+ }
+
+ public static Builder builder() {
+ return new AutoValue_IPSecPolicy.Builder();
+ }
+
+ public abstract Builder toBuilder();
+
+ @AutoValue.Builder
+ public abstract static class Builder {
+ public abstract Builder radiusServerAddress(String radiusServerAddress);
+ public abstract Builder radiusServerSecret(String radiusServerSecret);
+ public abstract Builder vpnClientAddressPool(AddressSpace vpnClientAddressPool);
+ public abstract Builder dhGroup(DHGroup dhGroup);
+ public abstract Builder ikeEncryption(IkeEncryption ikeEncryption);
+ public abstract Builder ikeIntegrity(IkeIntegrity ikeIntegrity);
+ public abstract Builder ipsecEncryption(IPSecEncryption ipsecEncryption);
+ public abstract Builder ipsecIntegrity(IPSecIntegrity ipsecIntegrity);
+ public abstract Builder pfsGroup(PFSGroup pfsGroup);
+ public abstract Builder saDataSizeKilobytes(Integer saDataSizeKilobytes);
+ public abstract Builder saLifeTimeSeconds(Integer saLifeTimeSeconds);
+
+ public abstract IPSecPolicy build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IkeEncryption.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IkeEncryption.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IkeEncryption.java
new file mode 100644
index 0000000..0ac8637
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IkeEncryption.java
@@ -0,0 +1,28 @@
+/*
+ * 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.util.GetEnumValue;
+
+public enum IkeEncryption {
+
+ AES128, AES192, AES256, DES, DES3, GCMAES128, GCMAES256, Unrecognized;
+
+ public static IkeEncryption fromValue(final String text) {
+ return (IkeEncryption) GetEnumValue.fromValueOrDefault(text, IkeEncryption.Unrecognized);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IkeIntegrity.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IkeIntegrity.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IkeIntegrity.java
new file mode 100644
index 0000000..1697347
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/IkeIntegrity.java
@@ -0,0 +1,28 @@
+/*
+ * 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.util.GetEnumValue;
+
+public enum IkeIntegrity {
+
+ GCMAES128, GCMAES256, MD5, SHA1, SHA256, SHA384, Unrecognized;
+
+ public static IkeIntegrity fromValue(final String text) {
+ return (IkeIntegrity) GetEnumValue.fromValueOrDefault(text, IkeIntegrity.Unrecognized);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/LocalNetworkGateway.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/LocalNetworkGateway.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/LocalNetworkGateway.java
new file mode 100644
index 0000000..95d8fcd
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/LocalNetworkGateway.java
@@ -0,0 +1,72 @@
+/*
+ * 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.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableMap;
+
+@AutoValue
+public abstract class LocalNetworkGateway {
+
+ @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 LocalNetworkGatewayProperties properties();
+
+ LocalNetworkGateway() {
+
+ }
+
+ @SerializedNames({ "id", "name", "location", "type", "tags", "etag", "properties" })
+ public static LocalNetworkGateway create(String id, String name, String location, String type,
+ Map<String, String> tags, String etag, LocalNetworkGatewayProperties 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, LocalNetworkGatewayProperties properties) {
+ return new AutoValue_LocalNetworkGateway.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(LocalNetworkGatewayProperties properties);
+
+ abstract Map<String, String> tags();
+ abstract LocalNetworkGateway autoBuild();
+
+ public LocalNetworkGateway build() {
+ tags(tags() != null ? ImmutableMap.copyOf(tags()) : null);
+ return autoBuild();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/LocalNetworkGatewayProperties.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/LocalNetworkGatewayProperties.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/LocalNetworkGatewayProperties.java
new file mode 100644
index 0000000..031dcb9
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/LocalNetworkGatewayProperties.java
@@ -0,0 +1,63 @@
+/*
+ * 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.AddressSpace;
+import org.jclouds.azurecompute.arm.domain.Provisionable;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class LocalNetworkGatewayProperties implements Provisionable {
+
+ @Nullable public abstract BGPSettings bgpSettings();
+ public abstract String gatewayIpAddress();
+ @Nullable public abstract AddressSpace localNetworkAddressSpace();
+ @Nullable public abstract String provisioningState();
+ @Nullable public abstract String resourceGuid();
+
+ @SerializedNames({ "bgpSettings", "gatewayIpAddress", "localNetworkAddressSpace", "provisioningState",
+ "resourceGuid" })
+ public static LocalNetworkGatewayProperties create(BGPSettings bgpSettings, String gatewayIpAddress,
+ AddressSpace localNetworkAddressSpace, String provisioningState, String resourceGuid) {
+ return builder(gatewayIpAddress).bgpSettings(bgpSettings).localNetworkAddressSpace(localNetworkAddressSpace)
+ .provisioningState(provisioningState).resourceGuid(resourceGuid).build();
+ }
+
+ LocalNetworkGatewayProperties() {
+
+ }
+
+ public abstract LocalNetworkGatewayProperties.Builder toBuilder();
+
+ public static LocalNetworkGatewayProperties.Builder builder(String gatewayIpAddress) {
+ return new AutoValue_LocalNetworkGatewayProperties.Builder().gatewayIpAddress(gatewayIpAddress);
+ }
+
+ @AutoValue.Builder
+ public abstract static class Builder {
+ public abstract Builder bgpSettings(BGPSettings bgpSettings);
+ public abstract Builder gatewayIpAddress(String gatewayIpAddress);
+ public abstract Builder localNetworkAddressSpace(AddressSpace localNetworkAddressSpace);
+ public abstract Builder provisioningState(String provisioningState);
+ public abstract Builder resourceGuid(String resourceGuid);
+
+ public abstract LocalNetworkGatewayProperties build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/PFSGroup.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/PFSGroup.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/PFSGroup.java
new file mode 100644
index 0000000..5ff43ae
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/PFSGroup.java
@@ -0,0 +1,28 @@
+/*
+ * 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.util.GetEnumValue;
+
+public enum PFSGroup {
+
+ ECP256, ECP384, PFS1, PFS14, PFS2, PFS2048, PFS24, PFSMM, None, Unrecognized;
+
+ public static PFSGroup fromValue(final String text) {
+ return (PFSGroup) GetEnumValue.fromValueOrDefault(text, PFSGroup.Unrecognized);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/SKU.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/SKU.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/SKU.java
new file mode 100644
index 0000000..9ddf18a
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/SKU.java
@@ -0,0 +1,55 @@
+/*
+ * 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.util.GetEnumValue;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class SKU {
+
+ public static enum SKUName {
+ Basic, HighPerformance, Standard, UltraPerformance, VpnGw1, VpnGw2, VpnGw3, Unrecognized;
+
+ public static SKUName fromValue(final String text) {
+ return (SKUName) GetEnumValue.fromValueOrDefault(text, SKUName.Unrecognized);
+ }
+ }
+
+ public static enum SKUTier {
+ Basic, HighPerformance, Standard, UltraPerformance, VpnGw1, VpnGw2, VpnGw3, Unrecognized;
+
+ public static SKUTier fromValue(final String text) {
+ return (SKUTier) GetEnumValue.fromValueOrDefault(text, SKUTier.Unrecognized);
+ }
+ }
+
+ public abstract int capacity();
+ public abstract SKUName name();
+ public abstract SKUTier tier();
+
+ SKU() {
+
+ }
+
+ @SerializedNames({ "capacity", "name", "tier" })
+ public static SKU create(int capacity, SKUName name, SKUTier tier) {
+ return new AutoValue_SKU(capacity, name, tier);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNClientConfiguration.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNClientConfiguration.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNClientConfiguration.java
new file mode 100644
index 0000000..14871c0
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNClientConfiguration.java
@@ -0,0 +1,89 @@
+/*
+ * 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.AddressSpace;
+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 VPNClientConfiguration {
+ @Nullable public abstract String radiusServerAddress();
+ @Nullable public abstract String radiusServerSecret();
+ @Nullable public abstract AddressSpace vpnClientAddressPool();
+ public abstract List<IPSecPolicy> vpnClientIpsecPolicies();
+ public abstract List<String> vpnClientProtocols();
+ public abstract List<VPNClientRevokedCertificate> vpnClientRevokedCertificates();
+ public abstract List<VPNClientRootCertificate> vpnClientRootCertificates();
+
+ VPNClientConfiguration() {
+
+ }
+
+ @SerializedNames({ "radiusServerAddress", "radiusServerSecret", "vpnClientAddressPool", "vpnClientIpsecPolicies",
+ "vpnClientProtocols", "vpnClientRevokedCertificates", "vpnClientRootCertificates" })
+ public static VPNClientConfiguration create(String radiusServerAddress, String radiusServerSecret,
+ AddressSpace vpnClientAddressPool, List<IPSecPolicy> vpnClientIpsecPolicies, List<String> vpnClientProtocols,
+ List<VPNClientRevokedCertificate> vpnClientRevokedCertificates,
+ List<VPNClientRootCertificate> vpnClientRootCertificates) {
+ return builder().radiusServerAddress(radiusServerAddress).radiusServerSecret(radiusServerSecret)
+ .vpnClientAddressPool(vpnClientAddressPool).vpnClientIpsecPolicies(vpnClientIpsecPolicies)
+ .vpnClientProtocols(vpnClientProtocols).vpnClientRevokedCertificates(vpnClientRevokedCertificates)
+ .vpnClientRootCertificates(vpnClientRootCertificates).build();
+ }
+
+ public static Builder builder() {
+ return new AutoValue_VPNClientConfiguration.Builder();
+ }
+
+ public abstract Builder toBuilder();
+
+ @AutoValue.Builder
+ public abstract static class Builder {
+ public abstract Builder radiusServerAddress(String radiusServerAddress);
+ public abstract Builder radiusServerSecret(String radiusServerSecret);
+ public abstract Builder vpnClientAddressPool(AddressSpace vpnClientAddressPool);
+ public abstract Builder vpnClientIpsecPolicies(List<IPSecPolicy> vpnClientIpsecPolicies);
+ public abstract Builder vpnClientProtocols(List<String> vpnClientProtocols);
+ public abstract Builder vpnClientRevokedCertificates(List<VPNClientRevokedCertificate> vpnClientRevokedCertificates);
+ public abstract Builder vpnClientRootCertificates(List<VPNClientRootCertificate> vpnClientRootCertificates);
+
+ abstract List<IPSecPolicy> vpnClientIpsecPolicies();
+ abstract List<String> vpnClientProtocols();
+ abstract List<VPNClientRevokedCertificate> vpnClientRevokedCertificates();
+ abstract List<VPNClientRootCertificate> vpnClientRootCertificates();
+ abstract VPNClientConfiguration autoBuild();
+
+ public VPNClientConfiguration build() {
+ vpnClientIpsecPolicies(vpnClientIpsecPolicies() == null ? ImmutableList.<IPSecPolicy> of() : ImmutableList
+ .copyOf(vpnClientIpsecPolicies()));
+ vpnClientProtocols(vpnClientProtocols() == null ? ImmutableList.<String> of() : ImmutableList
+ .copyOf(vpnClientProtocols()));
+ vpnClientRevokedCertificates(vpnClientRevokedCertificates() == null ? ImmutableList
+ .<VPNClientRevokedCertificate> of() : ImmutableList.copyOf(vpnClientRevokedCertificates()));
+ vpnClientRootCertificates(vpnClientRootCertificates() == null ? ImmutableList.<VPNClientRootCertificate> of()
+ : ImmutableList.copyOf(vpnClientRootCertificates()));
+
+ return autoBuild();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNClientRevokedCertificate.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNClientRevokedCertificate.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNClientRevokedCertificate.java
new file mode 100644
index 0000000..39232cc
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNClientRevokedCertificate.java
@@ -0,0 +1,57 @@
+/*
+ * 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.Provisionable;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class VPNClientRevokedCertificate {
+ @Nullable public abstract String id();
+ public abstract String name();
+ @Nullable public abstract String etag();
+ public abstract VPNClientRevokedCertificateProperties properties();
+
+ VPNClientRevokedCertificate() {
+
+ }
+
+ @SerializedNames({ "id", "name", "etag", "properties" })
+ public static VPNClientRevokedCertificate create(String id, String name, String etag,
+ VPNClientRevokedCertificateProperties properties) {
+ return new AutoValue_VPNClientRevokedCertificate(id, name, etag, properties);
+ }
+
+ @AutoValue
+ public abstract static class VPNClientRevokedCertificateProperties implements Provisionable {
+ public abstract String provisioningState();
+ public abstract String thumbprint();
+
+ VPNClientRevokedCertificateProperties() {
+
+ }
+
+ @SerializedNames({ "provisioningState", "thumbprint" })
+ public static VPNClientRevokedCertificateProperties create(String provisioningState, String thumbprint) {
+ return new AutoValue_VPNClientRevokedCertificate_VPNClientRevokedCertificateProperties(provisioningState,
+ thumbprint);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNClientRootCertificate.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNClientRootCertificate.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNClientRootCertificate.java
new file mode 100644
index 0000000..0271c32
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNClientRootCertificate.java
@@ -0,0 +1,57 @@
+/*
+ * 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.Provisionable;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class VPNClientRootCertificate {
+ @Nullable public abstract String id();
+ public abstract String name();
+ @Nullable public abstract String etag();
+ public abstract VPNClientRootCertificateProperties properties();
+
+ VPNClientRootCertificate() {
+
+ }
+
+ @SerializedNames({ "id", "name", "etag", "properties" })
+ public static VPNClientRootCertificate create(String id, String name, String etag,
+ VPNClientRootCertificateProperties properties) {
+ return new AutoValue_VPNClientRootCertificate(id, name, etag, properties);
+ }
+
+ @AutoValue
+ public abstract static class VPNClientRootCertificateProperties implements Provisionable {
+ public abstract String provisioningState();
+ public abstract String publicCertData();
+
+ VPNClientRootCertificateProperties() {
+
+ }
+
+ @SerializedNames({ "provisioningState", "publicCertData" })
+ public static VPNClientRootCertificateProperties create(String provisioningState, String publicCertData) {
+ return new AutoValue_VPNClientRootCertificate_VPNClientRootCertificateProperties(provisioningState,
+ publicCertData);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNType.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNType.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNType.java
new file mode 100644
index 0000000..d65cacf
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VPNType.java
@@ -0,0 +1,27 @@
+/*
+ * 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.util.GetEnumValue;
+
+public enum VPNType {
+ PolicyBased, RouteBased, Unrecognized;
+
+ public static VPNType fromValue(final String text) {
+ return (VPNType) GetEnumValue.fromValueOrDefault(text, VPNType.Unrecognized);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGateway.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGateway.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGateway.java
new file mode 100644
index 0000000..68f9579
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGateway.java
@@ -0,0 +1,72 @@
+/*
+ * 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.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableMap;
+
+@AutoValue
+public abstract class VirtualNetworkGateway {
+
+ @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 VirtualNetworkGatewayProperties properties();
+
+ VirtualNetworkGateway() {
+
+ }
+
+ @SerializedNames({ "id", "name", "location", "type", "tags", "etag", "properties" })
+ public static VirtualNetworkGateway create(String id, String name, String location, String type,
+ Map<String, String> tags, String etag, VirtualNetworkGatewayProperties 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, VirtualNetworkGatewayProperties properties) {
+ return new AutoValue_VirtualNetworkGateway.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(VirtualNetworkGatewayProperties properties);
+
+ abstract Map<String, String> tags();
+ abstract VirtualNetworkGateway autoBuild();
+
+ public VirtualNetworkGateway build() {
+ tags(tags() != null ? ImmutableMap.copyOf(tags()) : null);
+ return autoBuild();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/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
new file mode 100644
index 0000000..1d30f5f
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayProperties.java
@@ -0,0 +1,144 @@
+/*
+ * 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.IpAllocationMethod;
+import org.jclouds.azurecompute.arm.domain.Provisionable;
+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 VirtualNetworkGatewayProperties implements Provisionable {
+
+ @Nullable public abstract Boolean activeActive();
+ @Nullable public abstract BGPSettings bgpSettings();
+ public abstract boolean enableBGP();
+ @Nullable public abstract IdReference gatewayDefaultSite();
+ public abstract VirtualNetworkGatewayType gatewayType();
+ public abstract List<IpConfiguration> ipConfigurations();
+ @Nullable public abstract String provisioningState();
+ @Nullable public abstract String resourceGuid();
+ public abstract SKU sku();
+ @Nullable public abstract VPNClientConfiguration vpnClientConfiguration();
+ @Nullable public abstract VPNType vpnType();
+
+ VirtualNetworkGatewayProperties() {
+
+ }
+
+ @SerializedNames({ "activeActive", "bgpSettings", "enableBgp", "gatewayDefaultSite", "gatewayType",
+ "ipConfigurations", "provisioningState", "resourceGuid", "sku", "vpnClientConfiguration", "vpnType" })
+ public static VirtualNetworkGatewayProperties create(Boolean activeActive, BGPSettings bgpSettings,
+ boolean enableBGP, IdReference gatewayDefaultSite, VirtualNetworkGatewayType gatewayType,
+ List<IpConfiguration> ipConfigurations, String provisioningState, String resourceGuid, SKU sku,
+ VPNClientConfiguration vpnClientConfiguration, VPNType vpnType) {
+ return builder(enableBGP, gatewayType, sku).activeActive(activeActive).bgpSettings(bgpSettings)
+ .gatewayDefaultSite(gatewayDefaultSite).ipConfigurations(ipConfigurations)
+ .provisioningState(provisioningState).resourceGuid(resourceGuid)
+ .vpnClientConfiguration(vpnClientConfiguration).vpnType(vpnType).build();
+ }
+
+ public static Builder builder(boolean enableBGP, VirtualNetworkGatewayType virtualNetworkGatewayType, SKU sku) {
+ return new AutoValue_VirtualNetworkGatewayProperties.Builder().enableBGP(enableBGP)
+ .gatewayType(virtualNetworkGatewayType).sku(sku);
+ }
+
+ public abstract Builder toBuilder();
+
+ @AutoValue.Builder
+ public abstract static class Builder {
+ public abstract Builder activeActive( Boolean activeActive);
+ public abstract Builder bgpSettings(BGPSettings bgpSettings);
+ public abstract Builder enableBGP(boolean enableBG);
+ public abstract Builder gatewayDefaultSite(IdReference gatewayDefaultSite);
+ public abstract Builder gatewayType(VirtualNetworkGatewayType gatewayType);
+ public abstract Builder ipConfigurations(List<IpConfiguration> ipConfigurations);
+ public abstract Builder provisioningState(String provisioningState);
+ public abstract Builder resourceGuid(String resourceGuid);
+ public abstract Builder sku(SKU sku);
+ public abstract Builder vpnClientConfiguration(VPNClientConfiguration vpnClientConfiguration);
+ public abstract Builder vpnType(VPNType vpnType);
+
+ abstract List<IpConfiguration> ipConfigurations();
+ abstract VirtualNetworkGatewayProperties autoBuild();
+
+ public VirtualNetworkGatewayProperties build() {
+ ipConfigurations(ipConfigurations() == null ? ImmutableList.<IpConfiguration> of() : ImmutableList
+ .copyOf(ipConfigurations()));
+ return autoBuild();
+ }
+ }
+
+ @AutoValue
+ public abstract static class IpConfiguration {
+ @Nullable public abstract String id();
+ public abstract String name();
+ @Nullable public abstract String etag();
+ public abstract IpConfigurationProperties properties();
+
+ IpConfiguration() {
+
+ }
+
+ @SerializedNames({ "id", "name", "etag", "properties" })
+ public static IpConfiguration create(String id, String name, String etag, IpConfigurationProperties properties) {
+ return new AutoValue_VirtualNetworkGatewayProperties_IpConfiguration(id, name, etag, properties);
+ }
+
+ @AutoValue
+ public abstract static class IpConfigurationProperties implements Provisionable {
+ public abstract IpAllocationMethod privateIPAllocationMethod();
+ @Nullable public abstract String provisioningState();
+ @Nullable public abstract IdReference publicIPAddress();
+ @Nullable public abstract IdReference subnet();
+
+ @SerializedNames({ "privateIPAllocationMethod", "provisioningState", "publicIPAddress", "subnet" })
+ public static IpConfigurationProperties create(IpAllocationMethod privateIPAllocationMethod,
+ String provisioningState, IdReference publicIPAddress, IdReference subnet) {
+ return builder(privateIPAllocationMethod).provisioningState(provisioningState)
+ .publicIPAddress(publicIPAddress).subnet(subnet).build();
+ }
+
+ IpConfigurationProperties() {
+
+ }
+
+ public static Builder builder(IpAllocationMethod privateIPAllocationMethod) {
+ return new AutoValue_VirtualNetworkGatewayProperties_IpConfiguration_IpConfigurationProperties.Builder()
+ .privateIPAllocationMethod(privateIPAllocationMethod);
+ }
+
+ public abstract Builder toBuilder();
+
+ @AutoValue.Builder
+ public abstract static class Builder {
+ public abstract Builder privateIPAllocationMethod(IpAllocationMethod privateIPAllocationMethod);
+ public abstract Builder provisioningState(String provisioningState);
+ public abstract Builder publicIPAddress(IdReference publicIPAddress);
+ public abstract Builder subnet(IdReference subnet);
+
+ public abstract IpConfigurationProperties build();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayType.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayType.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayType.java
new file mode 100644
index 0000000..46ec025
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/VirtualNetworkGatewayType.java
@@ -0,0 +1,28 @@
+/*
+ * 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.util.GetEnumValue;
+
+public enum VirtualNetworkGatewayType {
+ ExpressRoute, Vpn, Unrecognized;
+
+ public static VirtualNetworkGatewayType fromValue(final String text) {
+ return (VirtualNetworkGatewayType) GetEnumValue.fromValueOrDefault(text,
+ VirtualNetworkGatewayType.Unrecognized);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApi.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApi.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApi.java
index a868e40..4d8af39 100644
--- a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApi.java
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApi.java
@@ -32,8 +32,8 @@ import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.azurecompute.arm.domain.LocalNetworkGateway;
-import org.jclouds.azurecompute.arm.domain.LocalNetworkGatewayProperties;
+import org.jclouds.azurecompute.arm.domain.vpn.LocalNetworkGateway;
+import org.jclouds.azurecompute.arm.domain.vpn.LocalNetworkGatewayProperties;
import org.jclouds.azurecompute.arm.filters.ApiVersionFilter;
import org.jclouds.azurecompute.arm.functions.URIParser;
import org.jclouds.javax.annotation.Nullable;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApi.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApi.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApi.java
new file mode 100644
index 0000000..0fb62c3
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApi.java
@@ -0,0 +1,80 @@
+/*
+ * 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.VirtualNetworkGateway;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGatewayProperties;
+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/virtualNetworkGateways")
+@RequestFilters({ OAuthFilter.class, ApiVersionFilter.class })
+@Consumes(MediaType.APPLICATION_JSON)
+public interface VirtualNetworkGatewayApi extends Closeable {
+
+ @Named("virtualnetworkgateway:list")
+ @GET
+ @SelectJson("value")
+ @Fallback(EmptyListOnNotFoundOr404.class)
+ List<VirtualNetworkGateway> list();
+
+ @Named("virtualnetworkgateway:get")
+ @Path("/{name}")
+ @GET
+ @Fallback(NullOnNotFoundOr404.class)
+ VirtualNetworkGateway get(@PathParam("name") String name);
+
+ @Named("virtualnetworkgateway:createOrUpdate")
+ @MapBinder(BindToJsonPayload.class)
+ @Path("/{name}")
+ @PUT
+ VirtualNetworkGateway createOrUpdate(@PathParam("name") String name, @PayloadParam("location") String location,
+ @Nullable @PayloadParam("tags") Map<String, String> tags,
+ @PayloadParam("properties") VirtualNetworkGatewayProperties properties);
+
+ @Named("virtualnetworkgateway: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/ea5b899d/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 301df03..bdf26ee 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
@@ -23,10 +23,10 @@ import static org.testng.Assert.assertTrue;
import java.net.URI;
-import org.jclouds.azurecompute.arm.domain.LocalNetworkGateway;
-import org.jclouds.azurecompute.arm.domain.LocalNetworkGatewayProperties;
-import org.jclouds.azurecompute.arm.domain.LocalNetworkGatewayProperties.AddressSpace;
+import org.jclouds.azurecompute.arm.domain.AddressSpace;
import org.jclouds.azurecompute.arm.domain.Provisionable;
+import org.jclouds.azurecompute.arm.domain.vpn.LocalNetworkGateway;
+import org.jclouds.azurecompute.arm.domain.vpn.LocalNetworkGatewayProperties;
import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiLiveTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -52,7 +52,7 @@ public class LocalNetworkGatewayApiLiveTest extends BaseAzureComputeApiLiveTest
@Test
public void createLocalNetworkGateway() {
AddressSpace localAddresses = AddressSpace.create(ImmutableList.of("192.168.0.0/24"));
- LocalNetworkGatewayProperties props = LocalNetworkGatewayProperties.builder().gatewayIpAddress("1.2.3.4")
+ LocalNetworkGatewayProperties props = LocalNetworkGatewayProperties.builder("1.2.3.4")
.localNetworkAddressSpace(localAddresses).build();
LocalNetworkGateway gw = api().createOrUpdate(name, LOCATION, null, props);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApiMockTest.java b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApiMockTest.java
index 840c872..e7efa71 100644
--- a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApiMockTest.java
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocalNetworkGatewayApiMockTest.java
@@ -25,9 +25,9 @@ import static org.testng.Assert.assertTrue;
import java.net.URI;
import java.util.List;
-import org.jclouds.azurecompute.arm.domain.LocalNetworkGateway;
-import org.jclouds.azurecompute.arm.domain.LocalNetworkGatewayProperties;
-import org.jclouds.azurecompute.arm.domain.LocalNetworkGatewayProperties.AddressSpace;
+import org.jclouds.azurecompute.arm.domain.AddressSpace;
+import org.jclouds.azurecompute.arm.domain.vpn.LocalNetworkGateway;
+import org.jclouds.azurecompute.arm.domain.vpn.LocalNetworkGatewayProperties;
import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiMockTest;
import org.testng.annotations.Test;
@@ -46,7 +46,7 @@ public class LocalNetworkGatewayApiMockTest extends BaseAzureComputeApiMockTest
LocalNetworkGatewayApi gwapi = api.getLocalNetworkGatewayApi(resourcegroup);
AddressSpace localAddresses = AddressSpace.create(ImmutableList.of("192.168.0.0/24"));
- LocalNetworkGatewayProperties props = LocalNetworkGatewayProperties.builder().gatewayIpAddress("1.2.3.4")
+ LocalNetworkGatewayProperties props = LocalNetworkGatewayProperties.builder("1.2.3.4")
.localNetworkAddressSpace(localAddresses).build();
LocalNetworkGateway gw = gwapi.createOrUpdate(name, "westeurope", null, props);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkInterfaceCardApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkInterfaceCardApiLiveTest.java b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkInterfaceCardApiLiveTest.java
index d7caab0..0d1e6ca 100644
--- a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkInterfaceCardApiLiveTest.java
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkInterfaceCardApiLiveTest.java
@@ -49,7 +49,6 @@ public class NetworkInterfaceCardApiLiveTest extends BaseAzureComputeApiLiveTest
public void setup() {
super.setup();
createTestResourceGroup();
- assertNotNull(api.getResourceGroupApi().create(resourceGroupName, LOCATION, ImmutableMap.<String, String>of()));
String virtualNetworkName = String.format("vn-%s-%s", this.getClass().getSimpleName().toLowerCase(), System.getProperty("user.name"));
nicName = String.format("nic-%s-%s", this.getClass().getSimpleName().toLowerCase(), System.getProperty("user.name"));
String subnetName = String.format("s-%s-%s", this.getClass().getSimpleName().toLowerCase(), System.getProperty("user.name"));
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiLiveTest.java b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiLiveTest.java
index c0271d3..5a89b07 100644
--- a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiLiveTest.java
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiLiveTest.java
@@ -24,6 +24,7 @@ import static org.testng.Assert.assertTrue;
import java.util.Arrays;
import java.util.List;
+import org.jclouds.azurecompute.arm.domain.AddressSpace;
import org.jclouds.azurecompute.arm.domain.VirtualNetwork;
import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiLiveTest;
import org.testng.annotations.BeforeClass;
@@ -53,7 +54,7 @@ public class VirtualNetworkApiLiveTest extends BaseAzureComputeApiLiveTest {
final VirtualNetwork.VirtualNetworkProperties virtualNetworkProperties =
VirtualNetwork.VirtualNetworkProperties.builder().addressSpace(
- VirtualNetwork.AddressSpace.create(Arrays.asList(DEFAULT_VIRTUALNETWORK_ADDRESS_PREFIX))).build();
+ AddressSpace.create(Arrays.asList(DEFAULT_VIRTUALNETWORK_ADDRESS_PREFIX))).build();
VirtualNetwork vn = api().createOrUpdate(virtualNetworkName, LOCATION, null, virtualNetworkProperties);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiMockTest.java b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiMockTest.java
index 8ba0406..2cf3a41 100644
--- a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiMockTest.java
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApiMockTest.java
@@ -16,21 +16,19 @@
*/
package org.jclouds.azurecompute.arm.features;
-import org.jclouds.azurecompute.arm.domain.VirtualNetwork;
-
-import org.testng.annotations.Test;
-
-import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiMockTest;
-
-import java.util.Arrays;
-import java.util.List;
-
import static com.google.common.collect.Iterables.isEmpty;
-
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.jclouds.azurecompute.arm.domain.AddressSpace;
+import org.jclouds.azurecompute.arm.domain.VirtualNetwork;
+import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiMockTest;
+import org.testng.annotations.Test;
@Test(groups = "unit", testName = "VirtualNetworkApiMockTest", singleThreaded = true)
public class VirtualNetworkApiMockTest extends BaseAzureComputeApiMockTest {
@@ -98,7 +96,7 @@ public class VirtualNetworkApiMockTest extends BaseAzureComputeApiMockTest {
final VirtualNetwork.VirtualNetworkProperties virtualNetworkProperties =
VirtualNetwork.VirtualNetworkProperties.create(null, null,
- VirtualNetwork.AddressSpace.create(Arrays.asList("10.2.0.0/16")), null);
+ AddressSpace.create(Arrays.asList("10.2.0.0/16")), null);
vnApi.createOrUpdate(virtualNetwork, location, null, virtualNetworkProperties);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/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
new file mode 100644
index 0000000..4faaf2d
--- /dev/null
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiLiveTest.java
@@ -0,0 +1,132 @@
+/*
+ * 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 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.IdReference;
+import org.jclouds.azurecompute.arm.domain.IpAllocationMethod;
+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.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.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.collect.ImmutableMap;
+
+@Test(groups = "live", testName = "VirtualNetworkGatewayApiLiveTest", singleThreaded = true)
+public class VirtualNetworkGatewayApiLiveTest extends BaseAzureComputeApiLiveTest {
+
+ private String name;
+ private String subnetId;
+ private PublicIPAddress publicIp;
+ private Predicate<String> virtualNetworkGatewayAvailable;
+
+ @BeforeClass
+ @Override
+ public void setup() {
+ super.setup();
+ createTestResourceGroup();
+ name = "jclouds-" + RAND;
+ virtualNetworkGatewayAvailable = virtualNetworkGatewayStatus.create(resourceGroupName);
+
+ 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");
+ subnetId = subnet.id();
+
+ PublicIPAddressProperties props = PublicIPAddressProperties.builder()
+ .publicIPAllocationMethod(IpAllocationMethod.Dynamic.name()).idleTimeoutInMinutes(4).build();
+ publicIp = api.getPublicIPAddressApi(resourceGroupName).createOrUpdate(name + "-publicip", LOCATION,
+ Collections.<String, String> emptyMap(), props);
+ }
+
+ @Test
+ public void createVirtualNetworkGateway() {
+ IpConfigurationProperties ipprops = IpConfigurationProperties.builder(IpAllocationMethod.Dynamic)
+ .subnet(IdReference.create(subnetId)).publicIPAddress(IdReference.create(publicIp.id())).build();
+ IpConfiguration ipconf = IpConfiguration.create(null, name + "-ipconf", null, ipprops);
+
+ VirtualNetworkGatewayProperties props = VirtualNetworkGatewayProperties
+ .builder(false, Vpn, SKU.create(1, SKUName.Basic, SKUTier.Basic)).vpnType(VPNType.PolicyBased)
+ .ipConfigurations(singletonList(ipconf)).build();
+
+ VirtualNetworkGateway gw = api().createOrUpdate(name, LOCATION, null, props);
+
+ assertNotNull(gw);
+ assertEquals(gw.name(), name);
+ assertNotNull(gw.properties());
+ }
+
+ @Test(dependsOnMethods = "createVirtualNetworkGateway")
+ public void getVirtualNetworkGateway() {
+ assertNotNull(api().get(name));
+ }
+
+ @Test(dependsOnMethods = "createVirtualNetworkGateway")
+ public void listVirtualNetworkGateways() {
+ assertTrue(any(api().list(), new Predicate<VirtualNetworkGateway>() {
+ @Override
+ public boolean apply(VirtualNetworkGateway input) {
+ return name.equals(input.name());
+ }
+ }));
+ }
+
+ @Test(dependsOnMethods = "createVirtualNetworkGateway")
+ public void updateVirtualNetworkGateway() {
+ // Make sure the resource is fully provisioned before modifying it
+ assertTrue(virtualNetworkGatewayAvailable.apply(name));
+
+ VirtualNetworkGateway gw = api().get(name);
+ gw = api().createOrUpdate(name, LOCATION, ImmutableMap.of("foo", "bar"), gw.properties());
+
+ assertNotNull(gw);
+ assertTrue(gw.tags().containsKey("foo"));
+ assertEquals(gw.tags().get("foo"), "bar");
+ }
+
+ @Test(dependsOnMethods = { "getVirtualNetworkGateway", "listVirtualNetworkGateways", "updateVirtualNetworkGateway" }, alwaysRun = true)
+ public void deleteVirtualNetworkGateway() {
+ // Make sure the resource is fully provisioned before deleting it
+ assertTrue(virtualNetworkGatewayAvailable.apply(name));
+ URI uri = api().delete(name);
+ assertResourceDeleted(uri);
+ }
+
+ private VirtualNetworkGatewayApi api() {
+ return api.getVirtualNetworkGatewayApi(resourceGroupName);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiMockTest.java b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiMockTest.java
new file mode 100644
index 0000000..1c8096f
--- /dev/null
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualNetworkGatewayApiMockTest.java
@@ -0,0 +1,161 @@
+/*
+ * 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 java.util.Collections.singletonList;
+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.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.IpAllocationMethod;
+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.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.domain.vpn.VirtualNetworkGatewayType;
+import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiMockTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "VirtualNetworkGatewayApiMockTest", singleThreaded = true)
+public class VirtualNetworkGatewayApiMockTest extends BaseAzureComputeApiMockTest {
+
+ private final String subscriptionid = "SUBSCRIPTIONID";
+ private final String resourcegroup = "myresourcegroup";
+ private final String name = "myvirtualgw";
+ private final String apiVersion = "api-version=2018-02-01";
+
+ private static final String SUBNET_ID = "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/virtualNetworks/myvirtualgw-net/subnets/GatewaySubnet";
+ private static final String PUBLIC_IP = "/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/publicIPAddresses/myvirtualgw-publicip";
+
+ public void createOrUpdateVirtualNetworkGateway() throws InterruptedException {
+ server.enqueue(jsonResponse("/virtualnetworkgatewaycreate.json").setResponseCode(200));
+ VirtualNetworkGatewayApi gwapi = api.getVirtualNetworkGatewayApi(resourcegroup);
+
+ IpConfigurationProperties ipprops = IpConfigurationProperties.builder(IpAllocationMethod.Dynamic)
+ .subnet(IdReference.create(SUBNET_ID)).publicIPAddress(IdReference.create(PUBLIC_IP)).build();
+ IpConfiguration ipconf = IpConfiguration.create(null, name + "-ipconf", null, ipprops);
+
+ VirtualNetworkGatewayProperties props = VirtualNetworkGatewayProperties
+ .builder(false, Vpn, SKU.create(1, SKUName.Basic, SKUTier.Basic)).vpnType(VPNType.PolicyBased)
+ .ipConfigurations(singletonList(ipconf)).build();
+
+ VirtualNetworkGateway gw = gwapi.createOrUpdate(name, "westeurope", null, props);
+
+ String path = String.format(
+ "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/virtualNetworkGateways/%s?%s",
+ subscriptionid, resourcegroup, name, apiVersion);
+ String json = "{\"location\":\"westeurope\",\"properties\":{\"enableBgp\":false,\"gatewayType\":\"Vpn\",\"ipConfigurations\":[{\"name\":\"myvirtualgw-ipconf\",\"properties\":{\"privateIPAllocationMethod\":\"Dynamic\",\"publicIPAddress\":{\"id\":\"/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/publicIPAddresses/myvirtualgw-publicip\"},\"subnet\":{\"id\":\"/subscriptions/SUBSCRIPTIONID/resourceGroups/rg-virtualnetworkgatewayapilivetest-nacx/providers/Microsoft.Network/virtualNetworks/myvirtualgw-net/subnets/GatewaySubnet\"}}}],\"sku\":{\"capacity\":1,\"name\":\"Basic\",\"tier\":\"Basic\"},\"vpnType\":\"PolicyBased\"}}";
+ assertSent(server, "PUT", path, json);
+
+ assertEquals(gw.name(), name);
+ assertNotNull(gw.properties());
+ assertEquals(gw.properties().gatewayType(), VirtualNetworkGatewayType.Vpn);
+ }
+
+ public void getVirtualNetworkGateway() throws InterruptedException {
+ server.enqueue(jsonResponse("/virtualnetworkgatewayget.json").setResponseCode(200));
+ VirtualNetworkGatewayApi gwapi = api.getVirtualNetworkGatewayApi(resourcegroup);
+
+ VirtualNetworkGateway gw = gwapi.get(name);
+
+ String path = String.format(
+ "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/virtualNetworkGateways/%s?%s",
+ subscriptionid, resourcegroup, name, apiVersion);
+ assertSent(server, "GET", path);
+
+ assertEquals(gw.name(), name);
+ }
+
+ public void getVirtualNetworkGatewayReturns404() throws InterruptedException {
+ server.enqueue(response404());
+ VirtualNetworkGatewayApi gwapi = api.getVirtualNetworkGatewayApi(resourcegroup);
+
+ VirtualNetworkGateway gw = gwapi.get(name);
+
+ String path = String.format(
+ "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/virtualNetworkGateways/%s?%s",
+ subscriptionid, resourcegroup, name, apiVersion);
+ assertSent(server, "GET", path);
+
+ assertNull(gw);
+ }
+
+ public void listVirtualNetworkGateways() throws InterruptedException {
+ server.enqueue(jsonResponse("/virtualnetworkgatewaylist.json").setResponseCode(200));
+ VirtualNetworkGatewayApi gwapi = api.getVirtualNetworkGatewayApi(resourcegroup);
+
+ List<VirtualNetworkGateway> gws = gwapi.list();
+
+ String path = String.format(
+ "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/virtualNetworkGateways?%s",
+ subscriptionid, resourcegroup, apiVersion);
+ assertSent(server, "GET", path);
+
+ assertTrue(gws.size() > 0);
+ }
+
+ public void listVirtualNetworkGatewaysReturns404() throws InterruptedException {
+ server.enqueue(response404());
+ VirtualNetworkGatewayApi gwapi = api.getVirtualNetworkGatewayApi(resourcegroup);
+
+ List<VirtualNetworkGateway> gws = gwapi.list();
+
+ String path = String.format(
+ "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/virtualNetworkGateways?%s",
+ subscriptionid, resourcegroup, apiVersion);
+ assertSent(server, "GET", path);
+
+ assertTrue(isEmpty(gws));
+ }
+
+ public void deleteVirtualNetworkGateway() throws InterruptedException {
+ server.enqueue(response202WithHeader());
+ VirtualNetworkGatewayApi gwapi = api.getVirtualNetworkGatewayApi(resourcegroup);
+
+ URI uri = gwapi.delete(name);
+ assertNotNull(uri);
+
+ String path = String.format(
+ "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/virtualNetworkGateways/%s?%s",
+ subscriptionid, resourcegroup, name, apiVersion);
+ assertSent(server, "DELETE", path);
+ }
+
+ public void deleteVirtualNetworkGatewayDoesNotExist() throws InterruptedException {
+ server.enqueue(response204());
+ VirtualNetworkGatewayApi gwapi = api.getVirtualNetworkGatewayApi(resourcegroup);
+
+ URI uri = gwapi.delete(name);
+ assertNull(uri);
+
+ String path = String.format(
+ "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/virtualNetworkGateways/%s?%s",
+ subscriptionid, resourcegroup, name, apiVersion);
+ assertSent(server, "DELETE", path);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiLiveTest.java b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiLiveTest.java
index 78d5425..5833834 100644
--- a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiLiveTest.java
+++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiLiveTest.java
@@ -17,19 +17,19 @@
package org.jclouds.azurecompute.arm.internal;
import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_IMAGE_AVAILABLE;
-import static org.jclouds.util.Predicates2.retry;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.TIMEOUT_RESOURCE_DELETED;
+import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.VAULT_CERTIFICATE_DELETE_STATUS;
+import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.VAULT_CERTIFICATE_OPERATION_STATUS;
+import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.VAULT_CERTIFICATE_RECOVERABLE_STATUS;
import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.VAULT_DELETE_STATUS;
-import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.VAULT_SECRET_DELETE_STATUS;
-import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.VAULT_SECRET_RECOVERABLE_STATUS;
import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.VAULT_KEY_DELETED_STATUS;
import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.VAULT_KEY_RECOVERABLE_STATUS;
-import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.VAULT_CERTIFICATE_DELETE_STATUS;
-import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.VAULT_CERTIFICATE_RECOVERABLE_STATUS;
-import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.VAULT_CERTIFICATE_OPERATION_STATUS;
+import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.VAULT_SECRET_DELETE_STATUS;
+import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.VAULT_SECRET_RECOVERABLE_STATUS;
+import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_IMAGE_AVAILABLE;
+import static org.jclouds.util.Predicates2.retry;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
import java.io.IOException;
import java.net.URI;
@@ -38,21 +38,20 @@ import java.util.List;
import java.util.Properties;
import java.util.Random;
-import com.google.common.base.Charsets;
-import com.google.common.base.Throwables;
-import com.google.common.io.Resources;
import org.jclouds.apis.BaseApiLiveTest;
import org.jclouds.azurecompute.arm.AzureComputeApi;
-import org.jclouds.azurecompute.arm.config.Tenant;
-import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.VaultPredicates.DeletedVaultStatusPredicateFactory;
+import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.PublicIpAvailablePredicateFactory;
+import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.VaultCertificatePredicates.CertificateOperationStatusPredicateFactory;
+import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.VaultCertificatePredicates.DeletedCertificateStatusPredicateFactory;
+import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.VaultCertificatePredicates.RecoverableCertificateStatusPredicateFactory;
import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.VaultKeyPredicates.DeletedKeyStatusPredicateFactory;
import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.VaultKeyPredicates.RecoverableKeyStatusPredicateFactory;
+import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.VaultPredicates.DeletedVaultStatusPredicateFactory;
import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.VaultSecretPredicates.DeletedSecretStatusPredicateFactory;
import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.VaultSecretPredicates.RecoverableSecretStatusPredicateFactory;
-import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.VaultCertificatePredicates.CertificateOperationStatusPredicateFactory;
-import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.VaultCertificatePredicates.DeletedCertificateStatusPredicateFactory;
-import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.VaultCertificatePredicates.RecoverableCertificateStatusPredicateFactory;
-import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.PublicIpAvailablePredicateFactory;
+import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.VirtualNetworkGatewayAvailablePredicateFactory;
+import org.jclouds.azurecompute.arm.config.Tenant;
+import org.jclouds.azurecompute.arm.domain.AddressSpace;
import org.jclouds.azurecompute.arm.domain.NetworkSecurityGroup;
import org.jclouds.azurecompute.arm.domain.NetworkSecurityGroupProperties;
import org.jclouds.azurecompute.arm.domain.NetworkSecurityRule;
@@ -64,15 +63,18 @@ import org.jclouds.azurecompute.arm.domain.VirtualNetwork;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
+import com.google.common.base.Charsets;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
+import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
-import com.google.inject.name.Names;
+import com.google.common.io.Resources;
import com.google.inject.Injector;
-import com.google.inject.Module;
import com.google.inject.Key;
+import com.google.inject.Module;
import com.google.inject.TypeLiteral;
+import com.google.inject.name.Names;
public class BaseAzureComputeApiLiveTest extends BaseApiLiveTest<AzureComputeApi> {
@@ -84,6 +86,7 @@ public class BaseAzureComputeApiLiveTest extends BaseApiLiveTest<AzureComputeApi
protected Predicate<URI> imageAvailablePredicate;
protected Predicate<URI> resourceDeleted;
protected PublicIpAvailablePredicateFactory publicIpAvailable;
+ protected VirtualNetworkGatewayAvailablePredicateFactory virtualNetworkGatewayStatus;
protected Predicate<Supplier<Provisionable>> resourceAvailable;
protected DeletedVaultStatusPredicateFactory deletedVaultStatus;
protected DeletedKeyStatusPredicateFactory deletedKeyStatus;
@@ -94,7 +97,6 @@ public class BaseAzureComputeApiLiveTest extends BaseApiLiveTest<AzureComputeApi
protected RecoverableCertificateStatusPredicateFactory recoverableCertificateStatus;
protected CertificateOperationStatusPredicateFactory certificateOperationStatus;
-
protected String resourceGroupName;
protected String vaultResourceGroup;
@@ -139,6 +141,7 @@ public class BaseAzureComputeApiLiveTest extends BaseApiLiveTest<AzureComputeApi
resourceDeleted = injector.getInstance(Key.get(new TypeLiteral<Predicate<URI>>() {
}, Names.named(TIMEOUT_RESOURCE_DELETED)));
publicIpAvailable = injector.getInstance(PublicIpAvailablePredicateFactory.class);
+ virtualNetworkGatewayStatus = injector.getInstance(VirtualNetworkGatewayAvailablePredicateFactory.class);
resourceAvailable = injector.getInstance(Key.get(new TypeLiteral<Predicate<Supplier<Provisionable>>>() {
}));
deletedVaultStatus = injector.getInstance(Key.get(DeletedVaultStatusPredicateFactory.class, Names.named(VAULT_DELETE_STATUS)));
@@ -172,7 +175,7 @@ public class BaseAzureComputeApiLiveTest extends BaseApiLiveTest<AzureComputeApi
protected VirtualNetwork createDefaultVirtualNetwork(final String resourceGroupName, final String virtualNetworkName, final String virtualnetworkAddressPrefix, final String location) {
final VirtualNetwork.VirtualNetworkProperties virtualNetworkProperties =
VirtualNetwork.VirtualNetworkProperties.create(null, null,
- VirtualNetwork.AddressSpace.create(Arrays.asList(virtualnetworkAddressPrefix)), null);
+ AddressSpace.create(Arrays.asList(virtualnetworkAddressPrefix)), null);
VirtualNetwork virtualNetwork = api.getVirtualNetworkApi(resourceGroupName).createOrUpdate(virtualNetworkName, location, null, virtualNetworkProperties);
retry(new Predicate<String>() {
@Override
[3/3] jclouds git commit: Added Virtual Network Gateway API
Posted by na...@apache.org.
Added Virtual Network Gateway API
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/ea5b899d
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/ea5b899d
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/ea5b899d
Branch: refs/heads/master
Commit: ea5b899def4b0c522a0cadc427568908e0cbe2a1
Parents: 39d770f
Author: Ignasi Barrera <na...@apache.org>
Authored: Mon Jul 2 13:19:46 2018 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Jul 3 12:51:15 2018 +0200
----------------------------------------------------------------------
.../azurecompute/arm/AzureComputeApi.java | 11 +-
.../arm/AzureComputeProviderMetadata.java | 2 +
.../compute/config/AzurePredicatesModule.java | 1055 +++++++++---------
.../CreateResourcesThenCreateNodes.java | 2 +-
.../arm/config/AzureComputeProperties.java | 2 +-
.../azurecompute/arm/domain/AddressSpace.java | 39 +
.../arm/domain/IpAllocationMethod.java | 28 +
.../arm/domain/LocalNetworkGateway.java | 75 --
.../domain/LocalNetworkGatewayProperties.java | 96 --
.../jclouds/azurecompute/arm/domain/Subnet.java | 10 +
.../azurecompute/arm/domain/VirtualNetwork.java | 21 +-
.../arm/domain/vpn/BGPSettings.java | 37 +
.../azurecompute/arm/domain/vpn/DHGroup.java | 28 +
.../arm/domain/vpn/IPSecEncryption.java | 28 +
.../arm/domain/vpn/IPSecIntegrity.java | 28 +
.../arm/domain/vpn/IPSecPolicy.java | 77 ++
.../arm/domain/vpn/IkeEncryption.java | 28 +
.../arm/domain/vpn/IkeIntegrity.java | 28 +
.../arm/domain/vpn/LocalNetworkGateway.java | 72 ++
.../vpn/LocalNetworkGatewayProperties.java | 63 ++
.../azurecompute/arm/domain/vpn/PFSGroup.java | 28 +
.../azurecompute/arm/domain/vpn/SKU.java | 55 +
.../arm/domain/vpn/VPNClientConfiguration.java | 89 ++
.../domain/vpn/VPNClientRevokedCertificate.java | 57 +
.../domain/vpn/VPNClientRootCertificate.java | 57 +
.../azurecompute/arm/domain/vpn/VPNType.java | 27 +
.../arm/domain/vpn/VirtualNetworkGateway.java | 72 ++
.../vpn/VirtualNetworkGatewayProperties.java | 144 +++
.../domain/vpn/VirtualNetworkGatewayType.java | 28 +
.../arm/features/LocalNetworkGatewayApi.java | 4 +-
.../arm/features/VirtualNetworkGatewayApi.java | 80 ++
.../LocalNetworkGatewayApiLiveTest.java | 8 +-
.../LocalNetworkGatewayApiMockTest.java | 8 +-
.../NetworkInterfaceCardApiLiveTest.java | 1 -
.../arm/features/VirtualNetworkApiLiveTest.java | 3 +-
.../arm/features/VirtualNetworkApiMockTest.java | 22 +-
.../VirtualNetworkGatewayApiLiveTest.java | 132 +++
.../VirtualNetworkGatewayApiMockTest.java | 161 +++
.../internal/BaseAzureComputeApiLiveTest.java | 47 +-
.../resources/virtualnetworkgatewaycreate.json | 45 +
.../resources/virtualnetworkgatewayget.json | 37 +
.../resources/virtualnetworkgatewaylist.json | 49 +
42 files changed, 2146 insertions(+), 738 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/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 a4b6282..d14f7e1 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
@@ -46,6 +46,7 @@ import org.jclouds.azurecompute.arm.features.VaultApi;
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.rest.annotations.Delegate;
import com.google.common.base.Supplier;
@@ -151,7 +152,7 @@ public interface AzureComputeApi extends Closeable {
/**
* The Azure Resource Manager API gets all the OS images in your subscription.
*
- * @see <a href="http://msdn.microsoft.com/en-us/library/jj157175">docs</a>
+ * @see <a href="https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages">docs</a>
*/
@Delegate
OSImageApi getOSImageApi(@PathParam("location") String location);
@@ -272,6 +273,14 @@ public interface AzureComputeApi extends Closeable {
LocalNetworkGatewayApi getLocalNetworkGatewayApi(@PathParam("resourcegroup") String resourcegroup);
/**
+ * Management features for Virtual Network Gateways.
+ *
+ * @see <a href="https://docs.microsoft.com/en-us/rest/api/network-gateway/virtualnetworkgateways">docs</a>
+ */
+ @Delegate
+ VirtualNetworkGatewayApi getVirtualNetworkGatewayApi(@PathParam("resourcegroup") String resourcegroup);
+
+ /**
* Returns the information about the current service principal.
*/
@Provides
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/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 3038f8e..b16557a 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
@@ -63,6 +63,7 @@ import org.jclouds.azurecompute.arm.features.VaultApi;
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.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
@@ -132,6 +133,7 @@ public class AzureComputeProviderMetadata extends BaseProviderMetadata {
properties.put(API_VERSION_PREFIX + GraphRBACApi.class.getSimpleName(), "1.6");
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");
return properties;
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/config/AzurePredicatesModule.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/config/AzurePredicatesModule.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/config/AzurePredicatesModule.java
index d02909b..6d7f8ac 100644
--- a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/config/AzurePredicatesModule.java
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/config/AzurePredicatesModule.java
@@ -35,6 +35,7 @@ import static org.jclouds.util.Predicates2.retry;
import java.net.URI;
import java.util.List;
+import java.util.concurrent.TimeUnit;
import org.jclouds.azurecompute.arm.AzureComputeApi;
import org.jclouds.azurecompute.arm.domain.Certificate.CertificateBundle;
@@ -52,6 +53,7 @@ import org.jclouds.azurecompute.arm.domain.Secret.SecretBundle;
import org.jclouds.azurecompute.arm.domain.Vault;
import org.jclouds.azurecompute.arm.domain.VirtualMachineInstance;
import org.jclouds.azurecompute.arm.domain.VirtualNetwork;
+import org.jclouds.azurecompute.arm.domain.vpn.VirtualNetworkGateway;
import org.jclouds.azurecompute.arm.functions.ParseJobStatus;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.compute.reference.ComputeServiceConstants.PollPeriod;
@@ -65,74 +67,84 @@ import com.google.inject.Provides;
import com.google.inject.name.Named;
public class AzurePredicatesModule extends AbstractModule {
- protected void configure() {
- }
-
- @Provides
- @Named(TIMEOUT_NODE_RUNNING)
- protected VirtualMachineInStatePredicateFactory provideVirtualMachineRunningPredicate(final AzureComputeApi api,
- final ComputeServiceConstants.Timeouts timeouts, final PollPeriod pollPeriod) {
- return new VirtualMachineInStatePredicateFactory(api, VirtualMachineInstance.PowerState.RUNNING, timeouts.nodeRunning,
- pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
- }
-
- @Provides
- @Named(TIMEOUT_NODE_TERMINATED)
- protected Predicate<URI> provideNodeTerminatedPredicate(final AzureComputeApi api, final ComputeServiceConstants.Timeouts timeouts,
- final PollPeriod pollPeriod) {
- return retry(new ActionDonePredicate(api), timeouts.nodeTerminated, pollPeriod.pollInitialPeriod,
- pollPeriod.pollMaxPeriod);
- }
-
- @Provides
- @Named(TIMEOUT_IMAGE_AVAILABLE)
- protected Predicate<URI> provideImageCapturedPredicate(final AzureComputeApi api, final ComputeServiceConstants.Timeouts timeouts,
- final PollPeriod pollPeriod) {
- return retry(new ImageCapturedPredicate(api), timeouts.imageAvailable, pollPeriod.pollInitialPeriod,
- pollPeriod.pollMaxPeriod);
- }
-
- @Provides
- @Named(TIMEOUT_RESOURCE_DELETED)
- protected Predicate<URI> provideResourceDeletedPredicate(final AzureComputeApi api, final ComputeServiceConstants.Timeouts timeouts,
- final PollPeriod pollPeriod) {
- return retry(new ActionDonePredicate(api), timeouts.nodeTerminated, pollPeriod.pollInitialPeriod,
- pollPeriod.pollMaxPeriod);
- }
-
- @Provides
- @Named(TIMEOUT_NODE_SUSPENDED)
- protected VirtualMachineInStatePredicateFactory provideNodeSuspendedPredicate(final AzureComputeApi api,
- final ComputeServiceConstants.Timeouts timeouts, final PollPeriod pollPeriod) {
- return new VirtualMachineInStatePredicateFactory(api, VirtualMachineInstance.PowerState.STOPPED, timeouts.nodeTerminated,
- pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
- }
-
- @Provides
- protected PublicIpAvailablePredicateFactory providePublicIpAvailablePredicate(final AzureComputeApi api,
- Predicate<Supplier<Provisionable>> resourceAvailable) {
- return new PublicIpAvailablePredicateFactory(api, resourceAvailable);
- }
-
- @Provides
- protected SecurityGroupAvailablePredicateFactory provideSecurityGroupAvailablePredicate(final AzureComputeApi api,
- Predicate<Supplier<Provisionable>> resourceAvailable) {
- return new SecurityGroupAvailablePredicateFactory(api, resourceAvailable);
- }
-
- @Provides
- protected ImageAvailablePredicateFactory provideImageAvailablePredicate(final AzureComputeApi api,
- Predicate<Supplier<Provisionable>> resourceAvailable, final ComputeServiceConstants.Timeouts timeouts, final PollPeriod pollPeriod) {
- return new ImageAvailablePredicateFactory(api, retry(new ResourceInStatusPredicate("Succeeded"),
- timeouts.imageAvailable, pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod));
- }
-
- @Provides
- protected Predicate<Supplier<Provisionable>> provideResourceAvailablePredicate(final AzureComputeApi api,
- @Named(OPERATION_TIMEOUT) Integer operationTimeout, PollPeriod pollPeriod) {
- return retry(new ResourceInStatusPredicate("Succeeded"), operationTimeout, pollPeriod.pollInitialPeriod,
- pollPeriod.pollMaxPeriod);
- }
+ protected void configure() {
+ }
+
+ @Provides
+ @Named(TIMEOUT_NODE_RUNNING)
+ protected VirtualMachineInStatePredicateFactory provideVirtualMachineRunningPredicate(final AzureComputeApi api,
+ final ComputeServiceConstants.Timeouts timeouts, final PollPeriod pollPeriod) {
+ return new VirtualMachineInStatePredicateFactory(api, VirtualMachineInstance.PowerState.RUNNING,
+ timeouts.nodeRunning, pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
+ }
+
+ @Provides
+ @Named(TIMEOUT_NODE_TERMINATED)
+ protected Predicate<URI> provideNodeTerminatedPredicate(final AzureComputeApi api,
+ final ComputeServiceConstants.Timeouts timeouts, final PollPeriod pollPeriod) {
+ return retry(new ActionDonePredicate(api), timeouts.nodeTerminated, pollPeriod.pollInitialPeriod,
+ pollPeriod.pollMaxPeriod);
+ }
+
+ @Provides
+ @Named(TIMEOUT_IMAGE_AVAILABLE)
+ protected Predicate<URI> provideImageCapturedPredicate(final AzureComputeApi api,
+ final ComputeServiceConstants.Timeouts timeouts, final PollPeriod pollPeriod) {
+ return retry(new ImageCapturedPredicate(api), timeouts.imageAvailable, pollPeriod.pollInitialPeriod,
+ pollPeriod.pollMaxPeriod);
+ }
+
+ @Provides
+ @Named(TIMEOUT_RESOURCE_DELETED)
+ protected Predicate<URI> provideResourceDeletedPredicate(final AzureComputeApi api,
+ final ComputeServiceConstants.Timeouts timeouts, final PollPeriod pollPeriod) {
+ return retry(new ActionDonePredicate(api), timeouts.nodeTerminated, pollPeriod.pollInitialPeriod,
+ pollPeriod.pollMaxPeriod);
+ }
+
+ @Provides
+ @Named(TIMEOUT_NODE_SUSPENDED)
+ protected VirtualMachineInStatePredicateFactory provideNodeSuspendedPredicate(final AzureComputeApi api,
+ final ComputeServiceConstants.Timeouts timeouts, final PollPeriod pollPeriod) {
+ return new VirtualMachineInStatePredicateFactory(api, VirtualMachineInstance.PowerState.STOPPED,
+ timeouts.nodeTerminated, pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
+ }
+
+ @Provides
+ protected PublicIpAvailablePredicateFactory providePublicIpAvailablePredicate(final AzureComputeApi api,
+ Predicate<Supplier<Provisionable>> resourceAvailable) {
+ return new PublicIpAvailablePredicateFactory(api, resourceAvailable);
+ }
+
+ @Provides
+ protected SecurityGroupAvailablePredicateFactory provideSecurityGroupAvailablePredicate(final AzureComputeApi api,
+ Predicate<Supplier<Provisionable>> resourceAvailable) {
+ return new SecurityGroupAvailablePredicateFactory(api, resourceAvailable);
+ }
+
+ @Provides
+ protected ImageAvailablePredicateFactory provideImageAvailablePredicate(final AzureComputeApi api,
+ final ComputeServiceConstants.Timeouts timeouts, final PollPeriod pollPeriod) {
+ return new ImageAvailablePredicateFactory(api, retry(new ResourceInStatusPredicate("Succeeded"),
+ timeouts.imageAvailable, pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod));
+ }
+
+ @Provides
+ protected VirtualNetworkGatewayAvailablePredicateFactory provideVirtualNetworkGatewayAvailablePredicate(
+ final AzureComputeApi api, Predicate<Supplier<Provisionable>> resourceAvailable,
+ final ComputeServiceConstants.Timeouts timeouts, final PollPeriod pollPeriod) {
+ // The Azure Virtual Gateways can take up to 45 minutes to be provisioned.
+ // Don't poll too aggressively
+ return new VirtualNetworkGatewayAvailablePredicateFactory(api, retry(new ResourceInStatusPredicate("Succeeded"),
+ 45, 1, 2, TimeUnit.MINUTES));
+ }
+
+ @Provides
+ protected Predicate<Supplier<Provisionable>> provideResourceAvailablePredicate(final AzureComputeApi api,
+ @Named(OPERATION_TIMEOUT) Integer operationTimeout, PollPeriod pollPeriod) {
+ return retry(new ResourceInStatusPredicate("Succeeded"), operationTimeout, pollPeriod.pollInitialPeriod,
+ pollPeriod.pollMaxPeriod);
+ }
@Provides
protected NetworkAvailablePredicateFactory provideNetworkAvailablePredicate(final AzureComputeApi api,
@@ -140,150 +152,123 @@ public class AzurePredicatesModule extends AbstractModule {
return new NetworkAvailablePredicateFactory(api, resourceAvailable);
}
- @VisibleForTesting
- static class ActionDonePredicate implements Predicate<URI> {
+ @VisibleForTesting
+ static class ActionDonePredicate implements Predicate<URI> {
+
+ private final AzureComputeApi api;
+
+ public ActionDonePredicate(final AzureComputeApi api) {
+ this.api = checkNotNull(api, "api must not be null");
+ }
+
+ @Override
+ public boolean apply(final URI uri) {
+ checkNotNull(uri, "uri cannot be null");
+ return ParseJobStatus.JobStatus.DONE == api.getJobApi().jobStatus(uri)
+ || ParseJobStatus.JobStatus.NO_CONTENT == api.getJobApi().jobStatus(uri);
+ }
+ }
- private final AzureComputeApi api;
+ @VisibleForTesting
+ static class ImageCapturedPredicate implements Predicate<URI> {
- public ActionDonePredicate(final AzureComputeApi api) {
- this.api = checkNotNull(api, "api must not be null");
- }
+ private final AzureComputeApi api;
- @Override
- public boolean apply(final URI uri) {
- checkNotNull(uri, "uri cannot be null");
- return ParseJobStatus.JobStatus.DONE == api.getJobApi().jobStatus(uri)
- || ParseJobStatus.JobStatus.NO_CONTENT == api.getJobApi().jobStatus(uri);
- }
- }
+ public ImageCapturedPredicate(final AzureComputeApi api) {
+ this.api = checkNotNull(api, "api must not be null");
+ }
- @VisibleForTesting
- static class ImageCapturedPredicate implements Predicate<URI> {
+ @Override
+ public boolean apply(final URI uri) {
+ checkNotNull(uri, "uri cannot be null");
+ if (api.getJobApi().jobStatus(uri) != ParseJobStatus.JobStatus.DONE) {
+ return false;
+ }
+ List<ResourceDefinition> definitions = api.getJobApi().captureStatus(uri);
+ return definitions != null;
+ }
+ }
- private final AzureComputeApi api;
+ public static class VirtualMachineInStatePredicateFactory {
- public ImageCapturedPredicate(final AzureComputeApi api) {
- this.api = checkNotNull(api, "api must not be null");
- }
+ private final AzureComputeApi api;
+ private final VirtualMachineInstance.PowerState powerState;
+ private final long timeout;
+ private final long period;
+ private final long maxPeriod;
+
+ VirtualMachineInStatePredicateFactory(final AzureComputeApi api,
+ final VirtualMachineInstance.PowerState powerState, final long timeout, final long period,
+ final long maxPeriod) {
+ this.api = checkNotNull(api, "api cannot be null");
+ this.powerState = checkNotNull(powerState, "powerState cannot be null");
+ this.timeout = timeout;
+ this.period = period;
+ this.maxPeriod = maxPeriod;
+ }
- @Override
- public boolean apply(final URI uri) {
- checkNotNull(uri, "uri cannot be null");
- if (api.getJobApi().jobStatus(uri) != ParseJobStatus.JobStatus.DONE) {
- return false;
+ public Predicate<String> create(final String azureGroup) {
+ return retry(new Predicate<String>() {
+ @Override
+ public boolean apply(final String name) {
+ checkNotNull(name, "name cannot be null");
+ VirtualMachineInstance vmInstance = api.getVirtualMachineApi(azureGroup).getInstanceDetails(name);
+ if (vmInstance == null) {
+ return false;
+ }
+ return powerState == vmInstance.powerState();
}
- List<ResourceDefinition> definitions = api.getJobApi().captureStatus(uri);
- return definitions != null;
- }
- }
+ }, timeout, period, maxPeriod);
+ }
+ }
- public static class VirtualMachineInStatePredicateFactory {
+ public static class ResourceInStatusPredicate implements Predicate<Supplier<Provisionable>> {
+ private final String expectedStatus;
- private final AzureComputeApi api;
- private final VirtualMachineInstance.PowerState powerState;
- private final long timeout;
- private final long period;
- private final long maxPeriod;
+ ResourceInStatusPredicate(String expectedStatus) {
+ this.expectedStatus = checkNotNull(expectedStatus, "expectedStatus cannot be null");
+ }
- VirtualMachineInStatePredicateFactory(final AzureComputeApi api, final VirtualMachineInstance.PowerState powerState, final long timeout,
- final long period, final long maxPeriod) {
- this.api = checkNotNull(api, "api cannot be null");
- this.powerState = checkNotNull(powerState, "powerState cannot be null");
- this.timeout = timeout;
- this.period = period;
- this.maxPeriod = maxPeriod;
- }
+ @Override
+ public boolean apply(Supplier<Provisionable> provisionableSupplier) {
+ checkNotNull(provisionableSupplier, "provisionableSupplier supplier cannot be null");
+ Provisionable provisionable = provisionableSupplier.get();
+ return provisionable != null && provisionable.provisioningState().equalsIgnoreCase(expectedStatus);
+ }
+ }
- public Predicate<String> create(final String azureGroup) {
- return retry(new Predicate<String>() {
- @Override
- public boolean apply(final String name) {
- checkNotNull(name, "name cannot be null");
- VirtualMachineInstance vmInstance = api.getVirtualMachineApi(azureGroup).getInstanceDetails(name);
- if (vmInstance == null) {
- return false;
- }
- return powerState == vmInstance.powerState();
- }
- }, timeout, period, maxPeriod);
- }
- }
-
- public static class ResourceInStatusPredicate implements Predicate<Supplier<Provisionable>> {
- private final String expectedStatus;
-
- ResourceInStatusPredicate(String expectedStatus) {
- this.expectedStatus = checkNotNull(expectedStatus, "expectedStatus cannot be null");
- }
-
- @Override
- public boolean apply(Supplier<Provisionable> provisionableSupplier) {
- checkNotNull(provisionableSupplier, "provisionableSupplier supplier cannot be null");
- Provisionable provisionable = provisionableSupplier.get();
- return provisionable != null && provisionable.provisioningState().equalsIgnoreCase(expectedStatus);
- }
- }
-
- public static class PublicIpAvailablePredicateFactory {
- private final AzureComputeApi api;
- private final Predicate<Supplier<Provisionable>> resourceAvailable;
-
- PublicIpAvailablePredicateFactory(final AzureComputeApi api, Predicate<Supplier<Provisionable>> resourceAvailable) {
- this.api = checkNotNull(api, "api cannot be null");
- this.resourceAvailable = resourceAvailable;
- }
-
- public Predicate<String> create(final String azureGroup) {
- checkNotNull(azureGroup, "azureGroup cannot be null");
- return new Predicate<String>() {
- @Override
- public boolean apply(final String name) {
- checkNotNull(name, "name cannot be null");
- return resourceAvailable.apply(new Supplier<Provisionable>() {
- @Override
- public Provisionable get() {
- PublicIPAddress publicIp = api.getPublicIPAddressApi(azureGroup).get(name);
- return publicIp == null ? null : publicIp.properties();
- }
- });
- }
- };
- }
- }
-
- public static class SecurityGroupAvailablePredicateFactory {
- private final AzureComputeApi api;
- private final Predicate<Supplier<Provisionable>> resourceAvailable;
-
- SecurityGroupAvailablePredicateFactory(final AzureComputeApi api,
- Predicate<Supplier<Provisionable>> resourceAvailable) {
- this.api = checkNotNull(api, "api cannot be null");
- this.resourceAvailable = resourceAvailable;
- }
+ public static class PublicIpAvailablePredicateFactory {
+ private final AzureComputeApi api;
+ private final Predicate<Supplier<Provisionable>> resourceAvailable;
- public Predicate<String> create(final String resourceGroup) {
- checkNotNull(resourceGroup, "resourceGroup cannot be null");
- return new Predicate<String>() {
- @Override
- public boolean apply(final String name) {
- checkNotNull(name, "name cannot be null");
- return resourceAvailable.apply(new Supplier<Provisionable>() {
- @Override
- public Provisionable get() {
- NetworkSecurityGroup sg = api.getNetworkSecurityGroupApi(resourceGroup).get(name);
- return sg == null ? null : sg.properties();
- }
- });
- }
- };
- }
- }
+ PublicIpAvailablePredicateFactory(final AzureComputeApi api, Predicate<Supplier<Provisionable>> resourceAvailable) {
+ this.api = checkNotNull(api, "api cannot be null");
+ this.resourceAvailable = resourceAvailable;
+ }
- public static class NetworkAvailablePredicateFactory {
+ public Predicate<String> create(final String azureGroup) {
+ checkNotNull(azureGroup, "azureGroup cannot be null");
+ return new Predicate<String>() {
+ @Override
+ public boolean apply(final String name) {
+ checkNotNull(name, "name cannot be null");
+ return resourceAvailable.apply(new Supplier<Provisionable>() {
+ @Override
+ public Provisionable get() {
+ PublicIPAddress publicIp = api.getPublicIPAddressApi(azureGroup).get(name);
+ return publicIp == null ? null : publicIp.properties();
+ }
+ });
+ }
+ };
+ }
+ }
+
+ public static class SecurityGroupAvailablePredicateFactory {
private final AzureComputeApi api;
private final Predicate<Supplier<Provisionable>> resourceAvailable;
- NetworkAvailablePredicateFactory(final AzureComputeApi api,
+ SecurityGroupAvailablePredicateFactory(final AzureComputeApi api,
Predicate<Supplier<Provisionable>> resourceAvailable) {
this.api = checkNotNull(api, "api cannot be null");
this.resourceAvailable = resourceAvailable;
@@ -298,6 +283,33 @@ public class AzurePredicatesModule extends AbstractModule {
return resourceAvailable.apply(new Supplier<Provisionable>() {
@Override
public Provisionable get() {
+ NetworkSecurityGroup sg = api.getNetworkSecurityGroupApi(resourceGroup).get(name);
+ return sg == null ? null : sg.properties();
+ }
+ });
+ }
+ };
+ }
+ }
+
+ public static class NetworkAvailablePredicateFactory {
+ private final AzureComputeApi api;
+ private final Predicate<Supplier<Provisionable>> resourceAvailable;
+
+ NetworkAvailablePredicateFactory(final AzureComputeApi api, Predicate<Supplier<Provisionable>> resourceAvailable) {
+ this.api = checkNotNull(api, "api cannot be null");
+ this.resourceAvailable = resourceAvailable;
+ }
+
+ public Predicate<String> create(final String resourceGroup) {
+ checkNotNull(resourceGroup, "resourceGroup cannot be null");
+ return new Predicate<String>() {
+ @Override
+ public boolean apply(final String name) {
+ checkNotNull(name, "name cannot be null");
+ return resourceAvailable.apply(new Supplier<Provisionable>() {
+ @Override
+ public Provisionable get() {
VirtualNetwork vnet = api.getVirtualNetworkApi(resourceGroup).get(name);
return vnet == null ? null : vnet.properties();
}
@@ -307,324 +319,363 @@ public class AzurePredicatesModule extends AbstractModule {
}
}
+ public static class ImageAvailablePredicateFactory {
+ private final AzureComputeApi api;
+ private final Predicate<Supplier<Provisionable>> resourceAvailable;
+
+ ImageAvailablePredicateFactory(final AzureComputeApi api, Predicate<Supplier<Provisionable>> resourceAvailable) {
+ this.api = checkNotNull(api, "api cannot be null");
+ this.resourceAvailable = resourceAvailable;
+ }
+
+ public Predicate<String> create(final String resourceGroup) {
+ checkNotNull(resourceGroup, "resourceGroup cannot be null");
+ return new Predicate<String>() {
+ @Override
+ public boolean apply(final String name) {
+ checkNotNull(name, "name cannot be null");
+ return resourceAvailable.apply(new Supplier<Provisionable>() {
+ @Override
+ public Provisionable get() {
+ Image img = api.getVirtualMachineImageApi(resourceGroup).get(name);
+ return img == null ? null : img.properties();
+ }
+ });
+ }
+ };
+ }
+ }
+
+ public static class VirtualNetworkGatewayAvailablePredicateFactory {
+ private final AzureComputeApi api;
+ private final Predicate<Supplier<Provisionable>> resourceAvailable;
+
+ VirtualNetworkGatewayAvailablePredicateFactory(final AzureComputeApi api,
+ Predicate<Supplier<Provisionable>> resourceAvailable) {
+ this.api = checkNotNull(api, "api cannot be null");
+ this.resourceAvailable = resourceAvailable;
+ }
+
+ public Predicate<String> create(final String resourceGroup) {
+ checkNotNull(resourceGroup, "resourceGroup cannot be null");
+ return new Predicate<String>() {
+ @Override
+ public boolean apply(final String name) {
+ checkNotNull(name, "name cannot be null");
+ return resourceAvailable.apply(new Supplier<Provisionable>() {
+ @Override
+ public Provisionable get() {
+ VirtualNetworkGateway vng = api.getVirtualNetworkGatewayApi(resourceGroup).get(name);
+ return vng == null ? null : vng.properties();
+ }
+ });
+ }
+ };
+ }
+ }
+
+ @Provides
+ @Named(VAULT_DELETE_STATUS)
+ protected VaultPredicates.DeletedVaultStatusPredicateFactory provideDeletedVaultStatusPredicateFactory(
+ final AzureComputeApi api, @Named(OPERATION_TIMEOUT) Integer operationTimeout, final PollPeriod pollPeriod) {
+ return new VaultPredicates.DeletedVaultStatusPredicateFactory(api, operationTimeout.longValue(),
+ pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
+ }
- public static class ImageAvailablePredicateFactory {
- private final AzureComputeApi api;
- private final Predicate<Supplier<Provisionable>> resourceAvailable;
+ public static class VaultPredicates {
+ public static class DeletedVaultStatusPredicateFactory {
+ private final AzureComputeApi api;
+ private final long operationTimeout;
+ private final long initialPeriod;
+ private final long maxPeriod;
- ImageAvailablePredicateFactory(final AzureComputeApi api,
- Predicate<Supplier<Provisionable>> resourceAvailable) {
+ DeletedVaultStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout,
+ final long initialPeriod, final long maxPeriod) {
this.api = checkNotNull(api, "api cannot be null");
- this.resourceAvailable = resourceAvailable;
- }
+ this.operationTimeout = operationTimeout;
+ this.initialPeriod = initialPeriod;
+ this.maxPeriod = maxPeriod;
+ }
- public Predicate<String> create(final String resourceGroup) {
+ public Predicate<String> create(final String resourceGroup, final boolean shouldBePresent) {
checkNotNull(resourceGroup, "resourceGroup cannot be null");
- return new Predicate<String>() {
- @Override
- public boolean apply(final String name) {
- checkNotNull(name, "name cannot be null");
- return resourceAvailable.apply(new Supplier<Provisionable>() {
- @Override
- public Provisionable get() {
- Image img = api.getVirtualMachineImageApi(resourceGroup).get(name);
- return img == null ? null : img.properties();
- }
- });
- }
- };
- }
- }
-
- @Provides
- @Named(VAULT_DELETE_STATUS)
- protected VaultPredicates.DeletedVaultStatusPredicateFactory provideDeletedVaultStatusPredicateFactory(final AzureComputeApi api,
- @Named(OPERATION_TIMEOUT) Integer operationTimeout,
- final PollPeriod pollPeriod) {
- return new VaultPredicates.DeletedVaultStatusPredicateFactory(api, operationTimeout.longValue(), pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
- }
-
- public static class VaultPredicates {
- public static class DeletedVaultStatusPredicateFactory {
- private final AzureComputeApi api;
- private final long operationTimeout;
- private final long initialPeriod;
- private final long maxPeriod;
-
- DeletedVaultStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout, final long initialPeriod, final long maxPeriod) {
- this.api = checkNotNull(api, "api cannot be null");
- this.operationTimeout = operationTimeout;
- this.initialPeriod = initialPeriod;
- this.maxPeriod = maxPeriod;
- }
+ return retry(new Predicate<String>() {
+ @Override
+ public boolean apply(final String name) {
+ checkNotNull(name, "name cannot be null");
+ List<Vault.DeletedVault> vaults = api.getVaultApi(resourceGroup).listDeletedVaults();
+ return shouldBePresent == Iterables.any(vaults, new Predicate<Vault.DeletedVault>() {
+ @Override
+ public boolean apply(Vault.DeletedVault input) {
+ return input.name().equals(name);
+ }
+ });
+ }
+ }, operationTimeout, initialPeriod, maxPeriod);
+ }
+ }
+ }
- public Predicate<String> create(final String resourceGroup, final boolean shouldBePresent) {
- checkNotNull(resourceGroup, "resourceGroup cannot be null");
- return retry(new Predicate<String>() {
- @Override
- public boolean apply(final String name) {
- checkNotNull(name, "name cannot be null");
- List<Vault.DeletedVault> vaults = api.getVaultApi(resourceGroup).listDeletedVaults();
- return shouldBePresent == Iterables.any(vaults, new Predicate<Vault.DeletedVault>() {
- @Override public boolean apply(Vault.DeletedVault input) {
- return input.name().equals(name);
- }
- });
- }
- }, operationTimeout, initialPeriod, maxPeriod);
- }
- }
- }
-
- @Provides
- @Named(VAULT_KEY_DELETED_STATUS)
- protected VaultKeyPredicates.DeletedKeyStatusPredicateFactory provideDeletedKeyStatusPredicateFactory(final AzureComputeApi api,
- @Named(OPERATION_TIMEOUT) Integer operationTimeout,
- final PollPeriod pollPeriod) {
- return new VaultKeyPredicates.DeletedKeyStatusPredicateFactory(api, operationTimeout.longValue(), pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
- }
-
- @Provides
- @Named(VAULT_KEY_RECOVERABLE_STATUS)
- protected VaultKeyPredicates.RecoverableKeyStatusPredicateFactory provideRecoverableKeyStatusPredicateFactory(final AzureComputeApi api,
- @Named(OPERATION_TIMEOUT) Integer operationTimeout,
- final PollPeriod pollPeriod) {
- return new VaultKeyPredicates.RecoverableKeyStatusPredicateFactory(api, operationTimeout.longValue(), pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
- }
-
- public static class VaultKeyPredicates {
- public static class DeletedKeyStatusPredicateFactory {
- private final AzureComputeApi api;
- private final long operationTimeout;
- private final long initialPeriod;
- private final long maxPeriod;
-
- DeletedKeyStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout, final long initialPeriod, final long maxPeriod) {
- this.api = checkNotNull(api, "api cannot be null");
- this.operationTimeout = operationTimeout;
- this.initialPeriod = initialPeriod;
- this.maxPeriod = maxPeriod;
- }
+ @Provides
+ @Named(VAULT_KEY_DELETED_STATUS)
+ protected VaultKeyPredicates.DeletedKeyStatusPredicateFactory provideDeletedKeyStatusPredicateFactory(
+ final AzureComputeApi api, @Named(OPERATION_TIMEOUT) Integer operationTimeout, final PollPeriod pollPeriod) {
+ return new VaultKeyPredicates.DeletedKeyStatusPredicateFactory(api, operationTimeout.longValue(),
+ pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
+ }
- public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean shouldBePresent) {
- checkNotNull(resourceGroup, "resourceGroup cannot be null");
- checkNotNull(vaultUri, "vaultUri cannot be null");
- return retry(new Predicate<String>() {
- @Override
- public boolean apply(final String name) {
- checkNotNull(name, "name cannot be null");
- DeletedKeyBundle key = api.getVaultApi(resourceGroup).getDeletedKey(vaultUri, name);
- return shouldBePresent == (key != null);
- }
- }, operationTimeout, initialPeriod, maxPeriod);
- }
- }
-
- public static class RecoverableKeyStatusPredicateFactory {
- private final AzureComputeApi api;
- private final long operationTimeout;
- private final long initialPeriod;
- private final long maxPeriod;
-
- RecoverableKeyStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout, final long initialPeriod, final long maxPeriod) {
- this.api = checkNotNull(api, "api cannot be null");
- this.operationTimeout = operationTimeout;
- this.initialPeriod = initialPeriod;
- this.maxPeriod = maxPeriod;
- }
+ @Provides
+ @Named(VAULT_KEY_RECOVERABLE_STATUS)
+ protected VaultKeyPredicates.RecoverableKeyStatusPredicateFactory provideRecoverableKeyStatusPredicateFactory(
+ final AzureComputeApi api, @Named(OPERATION_TIMEOUT) Integer operationTimeout, final PollPeriod pollPeriod) {
+ return new VaultKeyPredicates.RecoverableKeyStatusPredicateFactory(api, operationTimeout.longValue(),
+ pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
+ }
- public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean isRecovered) {
- checkNotNull(resourceGroup, "resourceGroup cannot be null");
- checkNotNull(vaultUri, "vaultUri cannot be null");
- return retry(new Predicate<String>() {
- @Override
- public boolean apply(final String name) {
- checkNotNull(name, "name cannot be null");
- KeyBundle key = api.getVaultApi(resourceGroup).getKey(vaultUri, name);
- return key != null ? (isRecovered ? true : key.attributes().recoveryLevel().contains("Recoverable")) : false;
- }
- }, operationTimeout, initialPeriod, maxPeriod);
- }
- }
- }
-
- @Provides
- @Named(VAULT_SECRET_DELETE_STATUS)
- protected VaultSecretPredicates.DeletedSecretStatusPredicateFactory provideDeletedSecretStatusPredicateFactory(final AzureComputeApi api,
- @Named(OPERATION_TIMEOUT) Integer operationTimeout,
- final PollPeriod pollPeriod) {
- return new VaultSecretPredicates.DeletedSecretStatusPredicateFactory(api, operationTimeout.longValue(), pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
- }
-
- @Provides
- @Named(VAULT_SECRET_RECOVERABLE_STATUS)
- protected VaultSecretPredicates.RecoverableSecretStatusPredicateFactory provideRecoverableSecretStatusPredicateFactory(final AzureComputeApi api,
- @Named(OPERATION_TIMEOUT) Integer operationTimeout,
- final PollPeriod pollPeriod) {
- return new VaultSecretPredicates.RecoverableSecretStatusPredicateFactory(api, operationTimeout.longValue(), pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
- }
-
- public static class VaultSecretPredicates {
- public static class DeletedSecretStatusPredicateFactory {
- private final AzureComputeApi api;
- private final long operationTimeout;
- private final long initialPeriod;
- private final long maxPeriod;
-
- DeletedSecretStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout, final long initialPeriod, final long maxPeriod) {
- this.api = checkNotNull(api, "api cannot be null");
- this.operationTimeout = operationTimeout;
- this.initialPeriod = initialPeriod;
- this.maxPeriod = maxPeriod;
- }
+ public static class VaultKeyPredicates {
+ public static class DeletedKeyStatusPredicateFactory {
+ private final AzureComputeApi api;
+ private final long operationTimeout;
+ private final long initialPeriod;
+ private final long maxPeriod;
- public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean shouldBePresent) {
- checkNotNull(resourceGroup, "resourceGroup cannot be null");
- checkNotNull(vaultUri, "vaultUri cannot be null");
- return retry(new Predicate<String>() {
- @Override
- public boolean apply(final String name) {
- checkNotNull(name, "name cannot be null");
- DeletedSecretBundle secret = api.getVaultApi(resourceGroup).getDeletedSecret(vaultUri, name);
- return shouldBePresent == (secret != null);
- }
- }, operationTimeout, initialPeriod, maxPeriod);
- }
- }
-
- public static class RecoverableSecretStatusPredicateFactory {
- private final AzureComputeApi api;
- private final long operationTimeout;
- private final long initialPeriod;
- private final long maxPeriod;
-
- RecoverableSecretStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout, final long initialPeriod, final long maxPeriod) {
- this.api = checkNotNull(api, "api cannot be null");
- this.operationTimeout = operationTimeout;
- this.initialPeriod = initialPeriod;
- this.maxPeriod = maxPeriod;
- }
+ DeletedKeyStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout,
+ final long initialPeriod, final long maxPeriod) {
+ this.api = checkNotNull(api, "api cannot be null");
+ this.operationTimeout = operationTimeout;
+ this.initialPeriod = initialPeriod;
+ this.maxPeriod = maxPeriod;
+ }
- public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean isRecovered) {
- checkNotNull(resourceGroup, "resourceGroup cannot be null");
- checkNotNull(vaultUri, "vaultUri cannot be null");
- return retry(new Predicate<String>() {
- @Override
- public boolean apply(final String name) {
- checkNotNull(name, "name cannot be null");
- SecretBundle secret = api.getVaultApi(resourceGroup).getSecret(vaultUri, name, null);
- return secret != null ? (isRecovered ? true : secret.attributes().recoveryLevel().contains("Recoverable")) : false;
- }
- }, operationTimeout, initialPeriod, maxPeriod);
- }
- }
- }
-
- @Provides
- @Named(VAULT_CERTIFICATE_DELETE_STATUS)
- protected VaultCertificatePredicates.DeletedCertificateStatusPredicateFactory provideDeletedCertificateStatusPredicateFactory(final AzureComputeApi api,
- @Named(OPERATION_TIMEOUT) Integer operationTimeout,
- final PollPeriod pollPeriod) {
- return new VaultCertificatePredicates.DeletedCertificateStatusPredicateFactory(api, operationTimeout.longValue(), pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
- }
-
- @Provides
- @Named(VAULT_CERTIFICATE_RECOVERABLE_STATUS)
- protected VaultCertificatePredicates.RecoverableCertificateStatusPredicateFactory provideRecoverableCertificateStatusPredicateFactory(final AzureComputeApi api,
- @Named(OPERATION_TIMEOUT) Integer operationTimeout,
- final PollPeriod pollPeriod) {
- return new VaultCertificatePredicates.RecoverableCertificateStatusPredicateFactory(api, operationTimeout.longValue(), pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
- }
-
- @Provides
- @Named(VAULT_CERTIFICATE_OPERATION_STATUS)
- protected VaultCertificatePredicates.CertificateOperationStatusPredicateFactory provideCertificateOperationStatusPredicateFactory(final AzureComputeApi api,
- @Named(OPERATION_TIMEOUT) Integer operationTimeout,
- final PollPeriod pollPeriod) {
- return new VaultCertificatePredicates.CertificateOperationStatusPredicateFactory(api, operationTimeout.longValue(), pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
- }
-
- public static class VaultCertificatePredicates {
- public static class DeletedCertificateStatusPredicateFactory {
- private final AzureComputeApi api;
- private final long operationTimeout;
- private final long initialPeriod;
- private final long maxPeriod;
-
- DeletedCertificateStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout, final long initialPeriod, final long maxPeriod) {
- this.api = checkNotNull(api, "api cannot be null");
- this.operationTimeout = operationTimeout;
- this.initialPeriod = initialPeriod;
- this.maxPeriod = maxPeriod;
- }
+ public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean shouldBePresent) {
+ checkNotNull(resourceGroup, "resourceGroup cannot be null");
+ checkNotNull(vaultUri, "vaultUri cannot be null");
+ return retry(new Predicate<String>() {
+ @Override
+ public boolean apply(final String name) {
+ checkNotNull(name, "name cannot be null");
+ DeletedKeyBundle key = api.getVaultApi(resourceGroup).getDeletedKey(vaultUri, name);
+ return shouldBePresent == (key != null);
+ }
+ }, operationTimeout, initialPeriod, maxPeriod);
+ }
+ }
- public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean shouldBePresent) {
- checkNotNull(resourceGroup, "resourceGroup cannot be null");
- checkNotNull(vaultUri, "vaultUri cannot be null");
- return retry(new Predicate<String>() {
- @Override
- public boolean apply(final String name) {
- checkNotNull(name, "name cannot be null");
- DeletedCertificateBundle cert = api.getVaultApi(resourceGroup).getDeletedCertificate(vaultUri, name);
- return shouldBePresent == (cert != null);
- }
- }, operationTimeout, initialPeriod, maxPeriod);
- }
- }
-
- public static class RecoverableCertificateStatusPredicateFactory {
- private final AzureComputeApi api;
- private final long operationTimeout;
- private final long initialPeriod;
- private final long maxPeriod;
-
- RecoverableCertificateStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout, final long initialPeriod, final long maxPeriod) {
- this.api = checkNotNull(api, "api cannot be null");
- this.operationTimeout = operationTimeout;
- this.initialPeriod = initialPeriod;
- this.maxPeriod = maxPeriod;
- }
+ public static class RecoverableKeyStatusPredicateFactory {
+ private final AzureComputeApi api;
+ private final long operationTimeout;
+ private final long initialPeriod;
+ private final long maxPeriod;
- public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean isImport) {
- checkNotNull(resourceGroup, "resourceGroup cannot be null");
- checkNotNull(vaultUri, "vaultUri cannot be null");
- return retry(new Predicate<String>() {
- @Override
- public boolean apply(final String name) {
- checkNotNull(name, "name cannot be null");
- CertificateBundle cert = api.getVaultApi(resourceGroup).getCertificate(vaultUri, name, null);
- return cert != null ? (isImport ? true : cert.attributes().recoveryLevel().contains("Recoverable")) : false;
-
- }
- }, operationTimeout, initialPeriod, maxPeriod);
- }
- }
-
- public static class CertificateOperationStatusPredicateFactory {
- private final AzureComputeApi api;
- private final long operationTimeout;
- private final long initialPeriod;
- private final long maxPeriod;
-
- CertificateOperationStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout, final long initialPeriod, final long maxPeriod) {
- this.api = checkNotNull(api, "api cannot be null");
- this.operationTimeout = operationTimeout;
- this.initialPeriod = initialPeriod;
- this.maxPeriod = maxPeriod;
- }
+ RecoverableKeyStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout,
+ final long initialPeriod, final long maxPeriod) {
+ this.api = checkNotNull(api, "api cannot be null");
+ this.operationTimeout = operationTimeout;
+ this.initialPeriod = initialPeriod;
+ this.maxPeriod = maxPeriod;
+ }
- public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean isCreate) {
- checkNotNull(resourceGroup, "resourceGroup cannot be null");
- checkNotNull(vaultUri, "vaultUri cannot be null");
- return retry(new Predicate<String>() {
- @Override
- public boolean apply(final String name) {
- checkNotNull(name, "name cannot be null");
- CertificateOperation certOp = api.getVaultApi(resourceGroup).getCertificateOperation(vaultUri, name);
- return isCreate ? ((certOp != null) ? !certOp.status().equals("inProgress") : false) : (certOp == null);
- }
- }, operationTimeout, initialPeriod, maxPeriod);
- }
- }
- }
+ public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean isRecovered) {
+ checkNotNull(resourceGroup, "resourceGroup cannot be null");
+ checkNotNull(vaultUri, "vaultUri cannot be null");
+ return retry(new Predicate<String>() {
+ @Override
+ public boolean apply(final String name) {
+ checkNotNull(name, "name cannot be null");
+ KeyBundle key = api.getVaultApi(resourceGroup).getKey(vaultUri, name);
+ return key != null ? (isRecovered ? true : key.attributes().recoveryLevel().contains("Recoverable"))
+ : false;
+ }
+ }, operationTimeout, initialPeriod, maxPeriod);
+ }
+ }
+ }
+
+ @Provides
+ @Named(VAULT_SECRET_DELETE_STATUS)
+ protected VaultSecretPredicates.DeletedSecretStatusPredicateFactory provideDeletedSecretStatusPredicateFactory(
+ final AzureComputeApi api, @Named(OPERATION_TIMEOUT) Integer operationTimeout, final PollPeriod pollPeriod) {
+ return new VaultSecretPredicates.DeletedSecretStatusPredicateFactory(api, operationTimeout.longValue(),
+ pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
+ }
+
+ @Provides
+ @Named(VAULT_SECRET_RECOVERABLE_STATUS)
+ protected VaultSecretPredicates.RecoverableSecretStatusPredicateFactory provideRecoverableSecretStatusPredicateFactory(
+ final AzureComputeApi api, @Named(OPERATION_TIMEOUT) Integer operationTimeout, final PollPeriod pollPeriod) {
+ return new VaultSecretPredicates.RecoverableSecretStatusPredicateFactory(api, operationTimeout.longValue(),
+ pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
+ }
+
+ public static class VaultSecretPredicates {
+ public static class DeletedSecretStatusPredicateFactory {
+ private final AzureComputeApi api;
+ private final long operationTimeout;
+ private final long initialPeriod;
+ private final long maxPeriod;
+
+ DeletedSecretStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout,
+ final long initialPeriod, final long maxPeriod) {
+ this.api = checkNotNull(api, "api cannot be null");
+ this.operationTimeout = operationTimeout;
+ this.initialPeriod = initialPeriod;
+ this.maxPeriod = maxPeriod;
+ }
+
+ public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean shouldBePresent) {
+ checkNotNull(resourceGroup, "resourceGroup cannot be null");
+ checkNotNull(vaultUri, "vaultUri cannot be null");
+ return retry(new Predicate<String>() {
+ @Override
+ public boolean apply(final String name) {
+ checkNotNull(name, "name cannot be null");
+ DeletedSecretBundle secret = api.getVaultApi(resourceGroup).getDeletedSecret(vaultUri, name);
+ return shouldBePresent == (secret != null);
+ }
+ }, operationTimeout, initialPeriod, maxPeriod);
+ }
+ }
+
+ public static class RecoverableSecretStatusPredicateFactory {
+ private final AzureComputeApi api;
+ private final long operationTimeout;
+ private final long initialPeriod;
+ private final long maxPeriod;
+
+ RecoverableSecretStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout,
+ final long initialPeriod, final long maxPeriod) {
+ this.api = checkNotNull(api, "api cannot be null");
+ this.operationTimeout = operationTimeout;
+ this.initialPeriod = initialPeriod;
+ this.maxPeriod = maxPeriod;
+ }
+
+ public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean isRecovered) {
+ checkNotNull(resourceGroup, "resourceGroup cannot be null");
+ checkNotNull(vaultUri, "vaultUri cannot be null");
+ return retry(new Predicate<String>() {
+ @Override
+ public boolean apply(final String name) {
+ checkNotNull(name, "name cannot be null");
+ SecretBundle secret = api.getVaultApi(resourceGroup).getSecret(vaultUri, name, null);
+ return secret != null ? (isRecovered ? true : secret.attributes().recoveryLevel()
+ .contains("Recoverable")) : false;
+ }
+ }, operationTimeout, initialPeriod, maxPeriod);
+ }
+ }
+ }
+
+ @Provides
+ @Named(VAULT_CERTIFICATE_DELETE_STATUS)
+ protected VaultCertificatePredicates.DeletedCertificateStatusPredicateFactory provideDeletedCertificateStatusPredicateFactory(
+ final AzureComputeApi api, @Named(OPERATION_TIMEOUT) Integer operationTimeout, final PollPeriod pollPeriod) {
+ return new VaultCertificatePredicates.DeletedCertificateStatusPredicateFactory(api, operationTimeout.longValue(),
+ pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
+ }
+
+ @Provides
+ @Named(VAULT_CERTIFICATE_RECOVERABLE_STATUS)
+ protected VaultCertificatePredicates.RecoverableCertificateStatusPredicateFactory provideRecoverableCertificateStatusPredicateFactory(
+ final AzureComputeApi api, @Named(OPERATION_TIMEOUT) Integer operationTimeout, final PollPeriod pollPeriod) {
+ return new VaultCertificatePredicates.RecoverableCertificateStatusPredicateFactory(api,
+ operationTimeout.longValue(), pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
+ }
+
+ @Provides
+ @Named(VAULT_CERTIFICATE_OPERATION_STATUS)
+ protected VaultCertificatePredicates.CertificateOperationStatusPredicateFactory provideCertificateOperationStatusPredicateFactory(
+ final AzureComputeApi api, @Named(OPERATION_TIMEOUT) Integer operationTimeout, final PollPeriod pollPeriod) {
+ return new VaultCertificatePredicates.CertificateOperationStatusPredicateFactory(api,
+ operationTimeout.longValue(), pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
+ }
+
+ public static class VaultCertificatePredicates {
+ public static class DeletedCertificateStatusPredicateFactory {
+ private final AzureComputeApi api;
+ private final long operationTimeout;
+ private final long initialPeriod;
+ private final long maxPeriod;
+
+ DeletedCertificateStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout,
+ final long initialPeriod, final long maxPeriod) {
+ this.api = checkNotNull(api, "api cannot be null");
+ this.operationTimeout = operationTimeout;
+ this.initialPeriod = initialPeriod;
+ this.maxPeriod = maxPeriod;
+ }
+
+ public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean shouldBePresent) {
+ checkNotNull(resourceGroup, "resourceGroup cannot be null");
+ checkNotNull(vaultUri, "vaultUri cannot be null");
+ return retry(new Predicate<String>() {
+ @Override
+ public boolean apply(final String name) {
+ checkNotNull(name, "name cannot be null");
+ DeletedCertificateBundle cert = api.getVaultApi(resourceGroup).getDeletedCertificate(vaultUri, name);
+ return shouldBePresent == (cert != null);
+ }
+ }, operationTimeout, initialPeriod, maxPeriod);
+ }
+ }
+
+ public static class RecoverableCertificateStatusPredicateFactory {
+ private final AzureComputeApi api;
+ private final long operationTimeout;
+ private final long initialPeriod;
+ private final long maxPeriod;
+
+ RecoverableCertificateStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout,
+ final long initialPeriod, final long maxPeriod) {
+ this.api = checkNotNull(api, "api cannot be null");
+ this.operationTimeout = operationTimeout;
+ this.initialPeriod = initialPeriod;
+ this.maxPeriod = maxPeriod;
+ }
+
+ public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean isImport) {
+ checkNotNull(resourceGroup, "resourceGroup cannot be null");
+ checkNotNull(vaultUri, "vaultUri cannot be null");
+ return retry(new Predicate<String>() {
+ @Override
+ public boolean apply(final String name) {
+ checkNotNull(name, "name cannot be null");
+ CertificateBundle cert = api.getVaultApi(resourceGroup).getCertificate(vaultUri, name, null);
+ return cert != null ? (isImport ? true : cert.attributes().recoveryLevel().contains("Recoverable"))
+ : false;
+
+ }
+ }, operationTimeout, initialPeriod, maxPeriod);
+ }
+ }
+
+ public static class CertificateOperationStatusPredicateFactory {
+ private final AzureComputeApi api;
+ private final long operationTimeout;
+ private final long initialPeriod;
+ private final long maxPeriod;
+
+ CertificateOperationStatusPredicateFactory(final AzureComputeApi api, final long operationTimeout,
+ final long initialPeriod, final long maxPeriod) {
+ this.api = checkNotNull(api, "api cannot be null");
+ this.operationTimeout = operationTimeout;
+ this.initialPeriod = initialPeriod;
+ this.maxPeriod = maxPeriod;
+ }
+
+ public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean isCreate) {
+ checkNotNull(resourceGroup, "resourceGroup cannot be null");
+ checkNotNull(vaultUri, "vaultUri cannot be null");
+ return retry(new Predicate<String>() {
+ @Override
+ public boolean apply(final String name) {
+ checkNotNull(name, "name cannot be null");
+ CertificateOperation certOp = api.getVaultApi(resourceGroup).getCertificateOperation(vaultUri, name);
+ return isCreate ? ((certOp != null) ? !certOp.status().equals("inProgress") : false)
+ : (certOp == null);
+ }
+ }, operationTimeout, initialPeriod, maxPeriod);
+ }
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/strategy/CreateResourcesThenCreateNodes.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/strategy/CreateResourcesThenCreateNodes.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/strategy/CreateResourcesThenCreateNodes.java
index 436dff0..a2f2919 100644
--- a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/strategy/CreateResourcesThenCreateNodes.java
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/strategy/CreateResourcesThenCreateNodes.java
@@ -41,13 +41,13 @@ import org.jclouds.azurecompute.arm.compute.domain.ResourceGroupAndNameAndIngres
import org.jclouds.azurecompute.arm.compute.functions.TemplateToAvailabilitySet;
import org.jclouds.azurecompute.arm.compute.options.AzureTemplateOptions;
import org.jclouds.azurecompute.arm.compute.options.IpOptions;
+import org.jclouds.azurecompute.arm.domain.AddressSpace;
import org.jclouds.azurecompute.arm.domain.AvailabilitySet;
import org.jclouds.azurecompute.arm.domain.NetworkSecurityGroup;
import org.jclouds.azurecompute.arm.domain.PublicIPAddress;
import org.jclouds.azurecompute.arm.domain.ResourceGroup;
import org.jclouds.azurecompute.arm.domain.Subnet;
import org.jclouds.azurecompute.arm.domain.Subnet.SubnetProperties;
-import org.jclouds.azurecompute.arm.domain.VirtualNetwork.AddressSpace;
import org.jclouds.azurecompute.arm.domain.VirtualNetwork.VirtualNetworkProperties;
import org.jclouds.compute.config.CustomizationResponse;
import org.jclouds.compute.domain.NodeMetadata;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/config/AzureComputeProperties.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/config/AzureComputeProperties.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/config/AzureComputeProperties.java
index abe057d..80fa8f1 100644
--- a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/config/AzureComputeProperties.java
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/config/AzureComputeProperties.java
@@ -23,7 +23,7 @@ package org.jclouds.azurecompute.arm.config;
public class AzureComputeProperties {
public static final String OPERATION_TIMEOUT = "jclouds.azurecompute.arm.operation.timeout";
-
+
public static final String IMAGE_PUBLISHERS = "jclouds.azurecompute.arm.publishers";
public static final String TIMEOUT_RESOURCE_DELETED = "jclouds.azurecompute.arm.timeout.resourcedeleted";
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/AddressSpace.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/AddressSpace.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/AddressSpace.java
new file mode 100644
index 0000000..1b7f434
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/AddressSpace.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableList;
+
+@AutoValue
+public abstract class AddressSpace {
+ public abstract List<String> addressPrefixes();
+
+ @SerializedNames({ "addressPrefixes" })
+ public static AddressSpace create(List<String> addressPrefixes) {
+ return new AutoValue_AddressSpace(addressPrefixes == null ? ImmutableList.<String> of()
+ : ImmutableList.copyOf(addressPrefixes));
+ }
+
+ AddressSpace() {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IpAllocationMethod.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IpAllocationMethod.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IpAllocationMethod.java
new file mode 100644
index 0000000..43911f9
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IpAllocationMethod.java
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+import org.jclouds.azurecompute.arm.util.GetEnumValue;
+
+public enum IpAllocationMethod {
+
+ Static, Dynamic, Unrecognized;
+
+ public static IpAllocationMethod fromValue(final String text) {
+ return (IpAllocationMethod) GetEnumValue.fromValueOrDefault(text, IpAllocationMethod.Unrecognized);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/LocalNetworkGateway.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/LocalNetworkGateway.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/LocalNetworkGateway.java
deleted file mode 100644
index b8e95ab..0000000
--- a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/LocalNetworkGateway.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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;
-
-import java.util.Map;
-
-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 LocalNetworkGateway {
-
- @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 LocalNetworkGatewayProperties properties();
-
- LocalNetworkGateway() {
-
- }
-
- @SerializedNames({ "id", "name", "location", "type", "tags", "etag", "properties" })
- public static LocalNetworkGateway create(String id, String name, String location, String type,
- Map<String, String> tags, String etag, LocalNetworkGatewayProperties properties) {
- return builder().id(id).name(name).location(location).type(type).tags(tags).etag(etag).properties(properties)
- .build();
- }
-
- public abstract Builder toBuilder();
-
- public static Builder builder() {
- return new AutoValue_LocalNetworkGateway.Builder();
- }
-
- @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(LocalNetworkGatewayProperties properties);
-
- abstract String location();
- abstract Map<String, String> tags();
- abstract LocalNetworkGateway autoBuild();
-
- public LocalNetworkGateway build() {
- tags(tags() != null ? ImmutableMap.copyOf(tags()) : null);
- location(location().toLowerCase()); // Avoid issues in regions such as CanadaEast
- return autoBuild();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/LocalNetworkGatewayProperties.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/LocalNetworkGatewayProperties.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/LocalNetworkGatewayProperties.java
deleted file mode 100644
index 56b773f..0000000
--- a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/LocalNetworkGatewayProperties.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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;
-
-import java.util.List;
-
-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 LocalNetworkGatewayProperties implements Provisionable {
-
- @Nullable public abstract BGPSettings bgpSettings();
- public abstract String gatewayIpAddress();
- @Nullable public abstract AddressSpace localNetworkAddressSpace();
- @Nullable public abstract String provisioningState();
- @Nullable public abstract String resourceGuid();
-
- @SerializedNames({ "bgpSettings", "gatewayIpAddress", "localNetworkAddressSpace", "provisioningState",
- "resourceGuid" })
- public static LocalNetworkGatewayProperties create(BGPSettings bgpSettings, String gatewayIpAddress,
- AddressSpace localNetworkAddressSpace, String provisioningState, String resourceGuid) {
- return builder().bgpSettings(bgpSettings).gatewayIpAddress(gatewayIpAddress)
- .localNetworkAddressSpace(localNetworkAddressSpace).provisioningState(provisioningState)
- .resourceGuid(resourceGuid).build();
- }
-
- LocalNetworkGatewayProperties() {
-
- }
-
- public abstract LocalNetworkGatewayProperties.Builder toBuilder();
-
- public static LocalNetworkGatewayProperties.Builder builder() {
- return new AutoValue_LocalNetworkGatewayProperties.Builder();
- }
-
- @AutoValue.Builder
- public abstract static class Builder {
- public abstract Builder bgpSettings(BGPSettings bgpSettings);
- public abstract Builder gatewayIpAddress(String gatewayIpAddress);
- public abstract Builder localNetworkAddressSpace(AddressSpace localNetworkAddressSpace);
- public abstract Builder provisioningState(String provisioningState);
- public abstract Builder resourceGuid(String resourceGuid);
-
- public abstract LocalNetworkGatewayProperties build();
- }
-
- @AutoValue
- public abstract static class BGPSettings {
- public abstract int asn();
- public abstract String bgpPeeringAddress();
- public abstract int peerWeight();
-
- @SerializedNames({ "asn", "bgpPeeringAddress", "peerWeight" })
- public static LocalNetworkGatewayProperties.BGPSettings create(int asn, String bgpPeeringAddress, int peerWeight) {
- return new AutoValue_LocalNetworkGatewayProperties_BGPSettings(asn, bgpPeeringAddress, peerWeight);
- }
-
- BGPSettings() {
-
- }
- }
-
- @AutoValue
- public abstract static class AddressSpace {
- public abstract List<String> addressPrefixes();
-
- @SerializedNames({ "addressPrefixes" })
- public static LocalNetworkGatewayProperties.AddressSpace create(List<String> addressPrefixes) {
- return new AutoValue_LocalNetworkGatewayProperties_AddressSpace(
- addressPrefixes == null ? ImmutableList.<String> of() : ImmutableList.copyOf(addressPrefixes));
- }
-
- AddressSpace() {
-
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Subnet.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Subnet.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Subnet.java
index 80460b8..ec57cbb 100644
--- a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Subnet.java
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Subnet.java
@@ -31,6 +31,10 @@ import org.jclouds.json.SerializedNames;
@AutoValue
public abstract class Subnet {
+ // To create VPN endpoints, a "GatewaySubnet" is required. Azure identifies
+ // such networks by name, and they have to be named exactly "GatewaySubnet".
+ public static final String GATEWAY_SUBNET_NAME = "GatewaySubnet";
+
private static final Pattern NETWORK_PATTERN = Pattern.compile("^.*/virtualNetworks/([^/]+)(/.*)?$");
@AutoValue
@@ -131,6 +135,12 @@ public abstract class Subnet {
public abstract Builder id(String id);
public abstract Builder etag(String etag);
public abstract Builder properties(SubnetProperties properties);
+
+ // Gateway subnets are identified by name
+ public Builder setGatewaySubnet() {
+ return name(GATEWAY_SUBNET_NAME);
+ }
+
public abstract Subnet build();
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualNetwork.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualNetwork.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualNetwork.java
index a0f5c3e..6b01532 100644
--- a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualNetwork.java
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualNetwork.java
@@ -18,31 +18,20 @@ package org.jclouds.azurecompute.arm.domain;
import static com.google.common.collect.ImmutableList.copyOf;
-import java.util.Map;
import java.util.List;
-import com.google.common.collect.ImmutableList;
-
-import com.google.auto.value.AutoValue;
-import com.google.common.collect.ImmutableMap;
+import java.util.Map;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
+import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
@AutoValue
public abstract class VirtualNetwork {
@AutoValue
- public abstract static class AddressSpace {
-
- public abstract List<String> addressPrefixes();
-
- @SerializedNames({"addressPrefixes"})
- public static AddressSpace create(final List<String> addressPrefixes) {
- return new AutoValue_VirtualNetwork_AddressSpace(addressPrefixes == null ? ImmutableList.<String>of() : ImmutableList.copyOf(addressPrefixes));
- }
- }
-
- @AutoValue
public abstract static class VirtualNetworkProperties implements Provisionable {
@Nullable
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/BGPSettings.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/BGPSettings.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/BGPSettings.java
new file mode 100644
index 0000000..740cf62
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/BGPSettings.java
@@ -0,0 +1,37 @@
+/*
+ * 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.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class BGPSettings {
+ public abstract int asn();
+ public abstract String bgpPeeringAddress();
+ public abstract int peerWeight();
+
+ @SerializedNames({ "asn", "bgpPeeringAddress", "peerWeight" })
+ public static BGPSettings create(int asn, String bgpPeeringAddress, int peerWeight) {
+ return new AutoValue_BGPSettings(asn, bgpPeeringAddress, peerWeight);
+ }
+
+ BGPSettings() {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ea5b899d/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/DHGroup.java
----------------------------------------------------------------------
diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/DHGroup.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/DHGroup.java
new file mode 100644
index 0000000..66f7a7f
--- /dev/null
+++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/vpn/DHGroup.java
@@ -0,0 +1,28 @@
+/*
+ * 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.util.GetEnumValue;
+
+public enum DHGroup {
+
+ DHGroup1, DHGroup14, DHGroup2, DHGroup2048, DHGroup24, ECP256, ECP384, None, Unrecognized;
+
+ public static DHGroup fromValue(final String text) {
+ return (DHGroup) GetEnumValue.fromValueOrDefault(text, DHGroup.Unrecognized);
+ }
+}