mirror of https://github.com/apache/jclouds.git
Added Virtual Network Gateway API
This commit is contained in:
parent
ff95137faa
commit
9705aa7fb8
|
@ -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);
|
||||
|
@ -271,6 +272,14 @@ public interface AzureComputeApi extends Closeable {
|
|||
@Delegate
|
||||
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.
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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;
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,30 +18,19 @@ 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 {
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.azurecompute.arm.domain;
|
||||
package org.jclouds.azurecompute.arm.domain.vpn;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -42,14 +42,13 @@ public abstract class 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();
|
||||
return builder(name, location, properties).id(id).type(type).tags(tags).etag(etag).build();
|
||||
}
|
||||
|
||||
public abstract Builder toBuilder();
|
||||
|
||||
public static Builder builder() {
|
||||
return new AutoValue_LocalNetworkGateway.Builder();
|
||||
public static Builder builder(String name, String location, LocalNetworkGatewayProperties properties) {
|
||||
return new AutoValue_LocalNetworkGateway.Builder().name(name).location(location).properties(properties);
|
||||
}
|
||||
|
||||
@AutoValue.Builder
|
||||
|
@ -62,13 +61,11 @@ public abstract class LocalNetworkGateway {
|
|||
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();
|
||||
}
|
||||
}
|
|
@ -14,15 +14,14 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.azurecompute.arm.domain;
|
||||
|
||||
import java.util.List;
|
||||
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;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
@AutoValue
|
||||
public abstract class LocalNetworkGatewayProperties implements Provisionable {
|
||||
|
@ -37,9 +36,8 @@ public abstract class LocalNetworkGatewayProperties implements Provisionable {
|
|||
"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();
|
||||
return builder(gatewayIpAddress).bgpSettings(bgpSettings).localNetworkAddressSpace(localNetworkAddressSpace)
|
||||
.provisioningState(provisioningState).resourceGuid(resourceGuid).build();
|
||||
}
|
||||
|
||||
LocalNetworkGatewayProperties() {
|
||||
|
@ -48,8 +46,8 @@ public abstract class LocalNetworkGatewayProperties implements Provisionable {
|
|||
|
||||
public abstract LocalNetworkGatewayProperties.Builder toBuilder();
|
||||
|
||||
public static LocalNetworkGatewayProperties.Builder builder() {
|
||||
return new AutoValue_LocalNetworkGatewayProperties.Builder();
|
||||
public static LocalNetworkGatewayProperties.Builder builder(String gatewayIpAddress) {
|
||||
return new AutoValue_LocalNetworkGatewayProperties.Builder().gatewayIpAddress(gatewayIpAddress);
|
||||
}
|
||||
|
||||
@AutoValue.Builder
|
||||
|
@ -62,35 +60,4 @@ public abstract class LocalNetworkGatewayProperties implements Provisionable {
|
|||
|
||||
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() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 static com.google.common.collect.Iterables.isEmpty;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
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 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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -17,19 +17,19 @@
|
|||
package org.jclouds.azurecompute.arm.internal;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
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_KEY_DELETED_STATUS;
|
||||
import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.VAULT_KEY_RECOVERABLE_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 static org.jclouds.azurecompute.arm.config.AzureComputeProperties.TIMEOUT_RESOURCE_DELETED;
|
||||
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 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.VaultKeyPredicates.DeletedKeyStatusPredicateFactory;
|
||||
import org.jclouds.azurecompute.arm.compute.config.AzurePredicatesModule.VaultKeyPredicates.RecoverableKeyStatusPredicateFactory;
|
||||
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.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.PublicIpAvailablePredicateFactory;
|
||||
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.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
|
||||
|
|
|
@ -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": []
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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": []
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue