From 139fe394f76e8ffb6e3c9bb89ba4aa3367ec51e3 Mon Sep 17 00:00:00 2001 From: Adam Lowe Date: Mon, 5 Mar 2012 21:34:56 +0000 Subject: [PATCH] VCloud Director 1.5: vAppTemplate client - expect tests for most methods and supporting domain objects --- .../v1_5/VCloudDirectorMediaType.java | 6 +- .../director/v1_5/domain/DhcpService.java | 173 +++++++ .../director/v1_5/domain/FirewallRule.java | 392 ++++++++++++++++ .../v1_5/domain/FirewallRuleProtocols.java | 190 ++++++++ .../director/v1_5/domain/FirewallService.java | 195 ++++++++ .../v1_5/domain/IpsecVpnLocalPeer.java | 93 ++++ .../v1_5/domain/IpsecVpnManagedPeerType.java | 111 +++++ .../v1_5/domain/IpsecVpnPeerType.java | 31 ++ .../v1_5/domain/IpsecVpnRemotePeer.java | 205 +++++++++ .../director/v1_5/domain/IpsecVpnService.java | 195 ++++++++ .../v1_5/domain/IpsecVpnThirdPartyPeer.java | 68 +++ .../director/v1_5/domain/IpsecVpnTunnel.java | 431 ++++++++++++++++++ .../domain/IpsecVpnUnmanagedPeerType.java | 29 ++ .../v1_5/domain/NatOneToOneBasicRule.java | 185 ++++++++ .../v1_5/domain/NatOneToOneVmRule.java | 209 +++++++++ .../v1_5/domain/NatPortForwardingRule.java | 234 ++++++++++ .../vcloud/director/v1_5/domain/NatRule.java | 242 ++++++++++ .../director/v1_5/domain/NatService.java | 179 ++++++++ .../director/v1_5/domain/NatVmRule.java | 262 +++++++++++ ...rkService.java => NetworkServiceType.java} | 44 +- .../director/v1_5/domain/StaticRoute.java | 214 +++++++++ .../v1_5/domain/StaticRoutingService.java | 141 ++++++ .../director/v1_5/domain/VAppTemplate.java | 30 +- .../v1_5/domain/VAppTemplateChildren.java | 3 +- .../director/v1_5/domain/ovf/SectionType.java | 2 +- .../features/VAppTemplateAsyncClient.java | 72 +-- .../v1_5/features/VAppTemplateClient.java | 24 +- .../vcloud/director/v1_5/domain/Checks.java | 4 +- .../VAppTemplateClientExpectTest.java | 334 +++++++++++++- .../vapptemplate/customizationSection.xml | 11 + .../guestCustomizationSection.xml | 19 + .../vapptemplate/leaseSettingsSection.xml | 12 + .../test/resources/vapptemplate/metadata.xml | 8 + .../resources/vapptemplate/metadataValue.xml | 4 + .../vapptemplate/networkConfigSection.xml | 64 +++ .../resources/vapptemplate/relocateParams.xml | 6 + 36 files changed, 4322 insertions(+), 100 deletions(-) create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/DhcpService.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallRule.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallRuleProtocols.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallService.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnLocalPeer.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnManagedPeerType.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnPeerType.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnRemotePeer.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnService.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnThirdPartyPeer.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnTunnel.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnUnmanagedPeerType.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatOneToOneBasicRule.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatOneToOneVmRule.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatPortForwardingRule.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatRule.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatService.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatVmRule.java rename labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/{NetworkService.java => NetworkServiceType.java} (67%) create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/StaticRoute.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/StaticRoutingService.java create mode 100644 labs/vcloud-director/src/test/resources/vapptemplate/customizationSection.xml create mode 100644 labs/vcloud-director/src/test/resources/vapptemplate/guestCustomizationSection.xml create mode 100644 labs/vcloud-director/src/test/resources/vapptemplate/leaseSettingsSection.xml create mode 100644 labs/vcloud-director/src/test/resources/vapptemplate/metadata.xml create mode 100644 labs/vcloud-director/src/test/resources/vapptemplate/metadataValue.xml create mode 100644 labs/vcloud-director/src/test/resources/vapptemplate/networkConfigSection.xml create mode 100644 labs/vcloud-director/src/test/resources/vapptemplate/relocateParams.xml diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java index f9622b0723..6d4c3a0f90 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java @@ -109,9 +109,9 @@ public class VCloudDirectorMediaType { public static final String VAPP_TEMPLATE = "application/vnd.vmware.vcloud.vAppTemplate+xml"; - public static final String CUSTOMIZATION_SECTION = "application/vnd.vmware.vcloud.vAppTemplate+xml"; + public static final String CUSTOMIZATION_SECTION = "application/vnd.vmware.vcloud.customizationSection+xml"; - public static final String GUEST_CUSTOMIZATION_SECTION = "application/vnd.vmware.vcloud.vAppTemplate+xml"; + public static final String GUEST_CUSTOMIZATION_SECTION = "application/vnd.vmware.vcloud.guestCustomizationSection+xml"; public static final String NETWORK_SECTION = "application/vnd.vmware.vcloud.vAppTemplate+xml"; @@ -123,7 +123,7 @@ public class VCloudDirectorMediaType { public static final String RELOCATE_TEMPLATE = "application/vnd.vmware.vcloud.relocateTemplate+xml"; - public static final String LEASE_SETTINGS_SECTION = "application/vnd.vmware.vcloud.leastSettingsSection+xml"; + public static final String LEASE_SETTINGS_SECTION = "application/vnd.vmware.vcloud.leaseSettingsSection+xml"; public static final String ENVELOPE = "application/vnd.???"; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/DhcpService.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/DhcpService.java new file mode 100644 index 0000000000..bbe8f04679 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/DhcpService.java @@ -0,0 +1,173 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + +/** + * Represents a DHCP network service. + * + *

Java class for DhcpService complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="DhcpService">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
+ *       <sequence>
+ *         <element name="DefaultLeaseTime" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="MaxLeaseTime" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="IpRange" type="{http://www.vmware.com/vcloud/v1.5}IpRangeType" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * @author Adam Lowe + */ +@XmlRootElement(name = "DhcpService") +@XmlType(propOrder = { + "defaultLeaseTime", + "maxLeaseTime", + "ipRange" +}) +public class DhcpService extends NetworkServiceType { + + public static Builder builder() { + return new Builder(); + } + + @Override + public Builder toBuilder() { + return new Builder().fromDhcpService(this); + } + + public static class Builder extends NetworkServiceType.Builder { + private int defaultLeaseTime; + private int maxLeaseTime; + private IpRange ipRange; + + public Builder defaultLeaseTime(int defaultLeaseTime) { + this.defaultLeaseTime = defaultLeaseTime; + return this; + } + + public Builder maxLeaseTime(int maxLeaseTime) { + this.maxLeaseTime = maxLeaseTime; + return this; + } + + public Builder ipRange(IpRange ipRange) { + this.ipRange = ipRange; + return this; + } + + public DhcpService build() { + return new DhcpService(isEnabled, defaultLeaseTime, maxLeaseTime, ipRange); + } + + public Builder fromDhcpService(DhcpService in) { + return fromNetworkService(in).defaultLeaseTime(in.getDefaultLeaseTime()).maxLeaseTime(in.getMaxLeaseTime()) + .ipRange(in.getIpRange()); + } + + public Builder fromNetworkService(NetworkServiceType in) { + return Builder.class.cast(super.fromNetworkServiceType(in)); + } + + @Override + public Builder enabled(boolean enabled) { + this.isEnabled = enabled; + return this; + } + + } + + @XmlElement(name = "DefaultLeaseTime") + private int defaultLeaseTime; + @XmlElement(name = "MaxLeaseTime") + private int maxLeaseTime; + @XmlElement(name = "IpRange") + private IpRange ipRange; + + private DhcpService(boolean enabled, int defaultLeaseTime, int maxLeaseTime, IpRange ipRange) { + super(enabled); + this.defaultLeaseTime = defaultLeaseTime; + this.maxLeaseTime = maxLeaseTime; + this.ipRange = ipRange; + } + + private DhcpService() { + // for JAXB + } + + /** + * @return default lease in seconds for DHCP addresses. + */ + public int getDefaultLeaseTime() { + return defaultLeaseTime; + } + + /** + * @return Max lease in seconds for DHCP addresses. + */ + public int getMaxLeaseTime() { + return maxLeaseTime; + } + + /** + * @return IP range for DHCP addresses. + */ + public IpRange getIpRange() { + return ipRange; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + DhcpService that = DhcpService.class.cast(o); + return super.equals(that) + && equal(defaultLeaseTime, that.defaultLeaseTime) + && equal(maxLeaseTime, that.maxLeaseTime) + && equal(ipRange, that.ipRange); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), defaultLeaseTime, maxLeaseTime, ipRange); + } + + @Override + protected Objects.ToStringHelper string() { + return super.string().add("defaultLeastTime", defaultLeaseTime).add("maxLeaseTime", maxLeaseTime).add("ipRange", ipRange); + } +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallRule.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallRule.java new file mode 100644 index 0000000000..2956bc6117 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallRule.java @@ -0,0 +1,392 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * Represents a firewall rule. + *

+ *

+ *

Java class for FirewallRule complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType name="FirewallRule">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="IsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *         <element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Policy" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Protocols" minOccurs="0">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <choice>
+ *                   <sequence>
+ *                     <element name="Tcp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *                     <element name="Udp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *                   </sequence>
+ *                   <element name="Icmp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *                   <element name="Any" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *                 </choice>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element name="Port" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="DestinationIp" type="{http://www.vmware.com/vcloud/v1.5}FirewallIpAddressType"/>
+ *         <element name="SourcePort" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="SourceIp" type="{http://www.vmware.com/vcloud/v1.5}FirewallIpAddressType"/>
+ *         <element name="Direction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="EnableLogging" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlType(name = "FirewallRule", propOrder = { + "isEnabled", + "description", + "policy", + "protocols", + "port", + "destinationIp", + "sourcePort", + "sourceIp", + "direction", + "enableLogging" +}) +public class FirewallRule { + + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromFirewallRule(this); + } + + public static class Builder { + + private Boolean isEnabled; + private String description; + private String policy; + private FirewallRuleProtocols protocols; + private Integer port; + private String destinationIp; + private Integer sourcePort; + private String sourceIp; + private String direction; + private Boolean enableLogging; + + /** + * @see FirewallRule#isEnabled() + */ + public Builder isEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * @see FirewallRule#getDescription() + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * @see FirewallRule#getPolicy() + */ + public Builder policy(String policy) { + this.policy = policy; + return this; + } + + /** + * @see FirewallRule#getProtocols() + */ + public Builder protocols(FirewallRuleProtocols protocols) { + this.protocols = protocols; + return this; + } + + /** + * @see FirewallRule#getPort() + */ + public Builder port(int port) { + this.port = port; + return this; + } + + /** + * @see FirewallRule#getDestinationIp() + */ + public Builder destinationIp(String destinationIp) { + this.destinationIp = destinationIp; + return this; + } + + /** + * @see FirewallRule#getSourcePort() + */ + public Builder sourcePort(int sourcePort) { + this.sourcePort = sourcePort; + return this; + } + + /** + * @see FirewallRule#getSourceIp() + */ + public Builder sourceIp(String sourceIp) { + this.sourceIp = sourceIp; + return this; + } + + /** + * @see FirewallRule#getDirection() + */ + public Builder direction(String direction) { + this.direction = direction; + return this; + } + + /** + * @see FirewallRule#isEnableLogging() + */ + public Builder enableLogging(Boolean enableLogging) { + this.enableLogging = enableLogging; + return this; + } + + public FirewallRule build() { + return new FirewallRule( + isEnabled, description, policy, protocols, port, destinationIp, sourcePort, sourceIp, direction, enableLogging); + } + + public Builder fromFirewallRule(FirewallRule in) { + return isEnabled(in.isEnabled()) + .description(in.getDescription()) + .policy(in.getPolicy()) + .protocols(in.getProtocols()) + .port(in.getPort()) + .destinationIp(in.getDestinationIp()) + .sourcePort(in.getSourcePort()) + .sourceIp(in.getSourceIp()) + .direction(in.getDirection()) + .enableLogging(in.isEnableLogging()); + } + } + + private FirewallRule(Boolean enabled, String description, String policy, FirewallRuleProtocols protocols, Integer port, + String destinationIp, Integer sourcePort, String sourceIp, String direction, Boolean enableLogging) { + isEnabled = enabled; + this.description = description; + this.policy = policy; + this.protocols = protocols; + this.port = port; + this.destinationIp = destinationIp; + this.sourcePort = sourcePort; + this.sourceIp = sourceIp; + this.direction = direction; + this.enableLogging = enableLogging; + } + + private FirewallRule() { + // For JAXB + } + + @XmlElement(name = "IsEnabled") + protected Boolean isEnabled; + @XmlElement(name = "Description") + protected String description; + @XmlElement(name = "Policy") + protected String policy; + @XmlElement(name = "Protocols") + protected FirewallRuleProtocols protocols; + @XmlElement(name = "Port") + protected Integer port; + @XmlElement(name = "DestinationIp", required = true) + protected String destinationIp; + @XmlElement(name = "SourcePort") + protected Integer sourcePort; + @XmlElement(name = "SourceIp", required = true) + protected String sourceIp; + @XmlElement(name = "Direction") + protected String direction; + @XmlElement(name = "EnableLogging") + protected Boolean enableLogging; + + /** + * Gets the value of the isEnabled property. + * + * @return possible object is + * {@link Boolean } + */ + public Boolean isEnabled() { + return isEnabled; + } + + /** + * Gets the value of the description property. + * + * @return possible object is + * {@link String } + */ + public String getDescription() { + return description; + } + + /** + * Gets the value of the policy property. + * + * @return possible object is + * {@link String } + */ + public String getPolicy() { + return policy; + } + + /** + * Gets the value of the protocols property. + * + * @return possible object is + * {@link FirewallRuleProtocols } + */ + public FirewallRuleProtocols getProtocols() { + return protocols; + } + + /** + * Gets the value of the port property. + */ + public int getPort() { + return port; + } + + /** + * Gets the value of the destinationIp property. + * + * @return possible object is + * {@link String } + */ + public String getDestinationIp() { + return destinationIp; + } + + /** + * Gets the value of the sourcePort property. + */ + public int getSourcePort() { + return sourcePort; + } + + /** + * Gets the value of the sourceIp property. + * + * @return possible object is + * {@link String } + */ + public String getSourceIp() { + return sourceIp; + } + + /** + * Gets the value of the direction property. + * + * @return possible object is + * {@link String } + */ + public String getDirection() { + return direction; + } + + /** + * Gets the value of the enableLogging property. + * + * @return possible object is + * {@link Boolean } + */ + public Boolean isEnableLogging() { + return enableLogging; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + FirewallRule that = FirewallRule.class.cast(o); + return equal(isEnabled, that.isEnabled) && + equal(description, that.description) && + equal(policy, that.policy) && + equal(protocols, that.protocols) && + equal(port, that.port) && + equal(destinationIp, that.destinationIp) && + equal(sourcePort, that.sourcePort) && + equal(sourceIp, that.sourceIp) && + equal(direction, that.direction) && + equal(enableLogging, that.enableLogging); + } + + @Override + public int hashCode() { + return Objects.hashCode(isEnabled, + description, + policy, + protocols, + port, + destinationIp, + sourcePort, + sourceIp, + direction, + enableLogging); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("isEnabled", isEnabled) + .add("description", description) + .add("policy", policy) + .add("protocols", protocols) + .add("port", port) + .add("destinationIp", destinationIp) + .add("sourcePort", sourcePort) + .add("sourceIp", sourceIp) + .add("direction", direction) + .add("enableLogging", enableLogging).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallRuleProtocols.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallRuleProtocols.java new file mode 100644 index 0000000000..be2486a61d --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallRuleProtocols.java @@ -0,0 +1,190 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + *

Java class for anonymous complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <choice>
+ *         <sequence>
+ *           <element name="Tcp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *           <element name="Udp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *         </sequence>
+ *         <element name="Icmp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *         <element name="Any" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *       </choice>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlType(propOrder = { + "tcp", + "udp", + "icmp", + "any" +}) +public class FirewallRuleProtocols { + + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromProtocols(this); + } + + public static class Builder { + private Boolean tcp; + private Boolean udp; + private Boolean icmp; + private Boolean any; + + public Builder tcp(Boolean tcp) { + this.tcp = tcp; + return this; + } + + public Builder udp(Boolean udp) { + this.udp = udp; + return this; + } + + public Builder icmp(Boolean icmp) { + this.icmp = icmp; + return this; + } + + public Builder any(Boolean any) { + this.any = any; + return this; + } + + public Builder fromProtocols(FirewallRuleProtocols in) { + return tcp(in.isTcp()).udp(in.isUdp()).icmp(in.isIcmp()).any(in.isAny()); + } + + public FirewallRuleProtocols build() { + return new FirewallRuleProtocols(tcp, udp, icmp, any); + } + } + + @XmlElement(name = "Tcp") + private Boolean tcp; + @XmlElement(name = "Udp") + private Boolean udp; + @XmlElement(name = "Icmp") + private Boolean icmp; + @XmlElement(name = "Any") + private Boolean any; + + private FirewallRuleProtocols(Boolean tcp, Boolean udp, Boolean icmp, Boolean any) { + this.tcp = tcp; + this.udp = udp; + this.icmp = icmp; + this.any = any; + } + + private FirewallRuleProtocols() { + // for JAXB + } + + /** + * Gets the value of the tcp property. + * + * @return possible object is + * {@link Boolean } + */ + public Boolean isTcp() { + return tcp; + } + + /** + * Gets the value of the udp property. + * + * @return possible object is + * {@link Boolean } + */ + public Boolean isUdp() { + return udp; + } + + /** + * Gets the value of the icmp property. + * + * @return possible object is + * {@link Boolean } + */ + public Boolean isIcmp() { + return icmp; + } + + /** + * Gets the value of the any property. + * + * @return possible object is + * {@link Boolean } + */ + public Boolean isAny() { + return any; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + FirewallRuleProtocols that = FirewallRuleProtocols.class.cast(o); + return equal(tcp, that.tcp) && + equal(udp, that.udp) && + equal(icmp, that.icmp) && + equal(any, that.any); + } + + @Override + public int hashCode() { + return Objects.hashCode(tcp, udp, icmp, any); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("tcp", tcp) + .add("udp", udp) + .add("icmp", icmp) + .add("any", any).toString(); + } +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallService.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallService.java new file mode 100644 index 0000000000..5e261c6633 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallService.java @@ -0,0 +1,195 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; + +import java.util.Collections; +import java.util.Set; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; + + +/** + * Represents a network firewall service. + *

+ *

+ *

Java class for FirewallService complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType name="FirewallService">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
+ *       <sequence>
+ *         <element name="DefaultAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="LogDefaultAction" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *         <element name="FirewallRule" type="{http://www.vmware.com/vcloud/v1.5}FirewallRuleType" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlRootElement(name = "FirewallService") +@XmlType(propOrder = { + "defaultAction", + "logDefaultAction", + "firewallRules" +}) +public class FirewallService extends NetworkServiceType { + + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromFirewallService(this); + } + + public static class Builder extends NetworkServiceType.Builder { + private String defaultAction; + private Boolean logDefaultAction; + private Set firewallRules = Sets.newLinkedHashSet(); + + /** + * @see FirewallService#getDefaultAction() + */ + public Builder defaultAction(String defaultAction) { + this.defaultAction = defaultAction; + return this; + } + + /** + * @see FirewallService#isLogDefaultAction() + */ + public Builder logDefaultAction(Boolean logDefaultAction) { + this.logDefaultAction = logDefaultAction; + return this; + } + + /** + * @see FirewallService#getFirewallRules() + */ + public Builder firewallRules(Set firewallRules) { + this.firewallRules = checkNotNull(firewallRules, "firewallRules"); + return this; + } + + public FirewallService build() { + return new FirewallService(isEnabled, defaultAction, logDefaultAction, firewallRules); + + } + + @Override + public Builder fromNetworkServiceType(NetworkServiceType in) { + return Builder.class.cast(super.fromNetworkServiceType(in)); + } + + public Builder fromFirewallService(FirewallService in) { + return fromNetworkServiceType(in) + .defaultAction(in.getDefaultAction()) + .logDefaultAction(in.isLogDefaultAction()) + .firewallRules(in.getFirewallRules()); + } + } + + private FirewallService(boolean enabled, String defaultAction, Boolean logDefaultAction, Set firewallRules) { + super(enabled); + this.defaultAction = defaultAction; + this.logDefaultAction = logDefaultAction; + this.firewallRules = ImmutableSet.copyOf(firewallRules); + } + + private FirewallService() { + // For JAXB and builder use + } + + @XmlElement(name = "DefaultAction") + protected String defaultAction; + @XmlElement(name = "LogDefaultAction") + protected Boolean logDefaultAction; + @XmlElement(name = "FirewallRule") + protected Set firewallRules = Sets.newLinkedHashSet(); + + /** + * Gets the value of the defaultAction property. + * + * @return possible object is + * {@link String } + */ + public String getDefaultAction() { + return defaultAction; + } + + /** + * Gets the value of the logDefaultAction property. + * + * @return possible object is + * {@link Boolean } + */ + public Boolean isLogDefaultAction() { + return logDefaultAction; + } + + /** + * Gets the value of the firewallRule property. + */ + public Set getFirewallRules() { + return Collections.unmodifiableSet(this.firewallRules); + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + FirewallService that = FirewallService.class.cast(o); + return equal(defaultAction, that.defaultAction) && + equal(logDefaultAction, that.logDefaultAction) && + equal(firewallRules, that.firewallRules); + } + + @Override + public int hashCode() { + return Objects.hashCode(defaultAction, + logDefaultAction, + firewallRules); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("defaultAction", defaultAction) + .add("logDefaultAction", logDefaultAction) + .add("firewallRules", firewallRules).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnLocalPeer.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnLocalPeer.java new file mode 100644 index 0000000000..27ca6519d2 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnLocalPeer.java @@ -0,0 +1,93 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * + * Gives more details of local peer end point. + * + * + *

Java class for IpsecVpnLocalPeer complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="IpsecVpnLocalPeer">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}IpsecVpnManagedPeerType">
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlRootElement(name = "IpsecVpnLocalPeer") +public class IpsecVpnLocalPeer + extends IpsecVpnManagedPeerType + +{ + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromIpsecVpnLocalPeer(this); + } + + public static class Builder extends IpsecVpnManagedPeerType.Builder { + public IpsecVpnLocalPeer build() { + return new IpsecVpnLocalPeer(id, name); + } + + @Override + public Builder fromIpsecVpnManagedPeerType(IpsecVpnManagedPeerType in) { + return Builder.class.cast(super.fromIpsecVpnManagedPeerType(in)); + } + + public Builder fromIpsecVpnLocalPeer(IpsecVpnLocalPeer in) { + return fromIpsecVpnManagedPeerType(in); + } + + @Override + public Builder id(String id) { + return Builder.class.cast(super.id(id)); + } + + @Override + public Builder name(String name) { + return Builder.class.cast(super.name(name)); + } + + } + + private IpsecVpnLocalPeer(String id, String name) { + super(id, name); + } + + private IpsecVpnLocalPeer() { + // For JAXB + } +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnManagedPeerType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnManagedPeerType.java new file mode 100644 index 0000000000..c1f30df663 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnManagedPeerType.java @@ -0,0 +1,111 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSeeAlso; + +import com.google.common.base.Objects; + +/** + */ +@XmlSeeAlso( + IpsecVpnLocalPeer.class +) +public abstract class IpsecVpnManagedPeerType> extends IpsecVpnPeerType { + + public static abstract class Builder> { + protected String id; + protected String name; + + /** + * @see IpRange#getStartAddress() + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * @see IpRange#getEndAddress() + */ + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder fromIpsecVpnManagedPeerType(IpsecVpnManagedPeerType in) { + return id(in.getId()).name(in.getName()); + } + } + + @XmlElement(name = "Id", required = true) + protected String id; + @XmlElement(name = "Name", required = true) + protected String name; + + protected IpsecVpnManagedPeerType(String id, String name) { + this.id = id; + this.name = name; + } + + protected IpsecVpnManagedPeerType() { + // for JAXB + } + + /** + * @return id of peer network + */ + public String getId() { + return id; + } + + /** + * @return the name of the peer network + */ + public String getName() { + return name; + } + + @Override + public int hashCode() { + return Objects.hashCode(id, name); + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + IpsecVpnManagedPeerType that = IpsecVpnManagedPeerType.class.cast(o); + return equal(id, that.id) && equal(name, that.name); + } + + @Override + public String toString() { + return string().toString(); + } + + protected Objects.ToStringHelper string() { + return Objects.toStringHelper("").add("id", id).add("name", name); + } +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnPeerType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnPeerType.java new file mode 100644 index 0000000000..03128b0d32 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnPeerType.java @@ -0,0 +1,31 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import javax.xml.bind.annotation.XmlSeeAlso; + +/** + */ +@XmlSeeAlso({ + IpsecVpnLocalPeer.class, + IpsecVpnRemotePeer.class, + IpsecVpnThirdPartyPeer.class +}) +public abstract class IpsecVpnPeerType> { +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnRemotePeer.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnRemotePeer.java new file mode 100644 index 0000000000..46f7631792 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnRemotePeer.java @@ -0,0 +1,205 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * Gives more details of remote peer end point. + *

+ *

+ *

Java class for IpsecVpnRemotePeer complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType name="IpsecVpnRemotePeer">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}IpsecVpnManagedPeerType">
+ *       <sequence>
+ *         <element name="VcdUrl" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="VcdOrganization" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="VcdUsername" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlRootElement(name = "IpsecVpnRemotePeer") +@XmlType(propOrder = { + "vcdUrl", + "vcdOrganization", + "vcdUsername" +}) +public class IpsecVpnRemotePeer extends IpsecVpnManagedPeerType { + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromIpsecVpnRemotePeer(this); + } + + public static class Builder extends IpsecVpnManagedPeerType.Builder { + private String vcdUrl; + private String vcdOrganization; + private String vcdUsername; + + /** + * @see IpsecVpnRemotePeer#getVcdUrl() + */ + public Builder vcdUrl(String vcdUrl) { + this.vcdUrl = vcdUrl; + return this; + } + + /** + * @see IpsecVpnRemotePeer#getVcdOrganization() + */ + public Builder vcdOrganization(String vcdOrganization) { + this.vcdOrganization = vcdOrganization; + return this; + } + + /** + * @see IpsecVpnRemotePeer#getVcdUsername() + */ + public Builder vcdUsername(String vcdUsername) { + this.vcdUsername = vcdUsername; + return this; + } + + public IpsecVpnRemotePeer build() { + return new IpsecVpnRemotePeer(id, name, vcdUrl, vcdOrganization, vcdUsername); + } + + @Override + public Builder fromIpsecVpnManagedPeerType(IpsecVpnManagedPeerType in) { + return Builder.class.cast(super.fromIpsecVpnManagedPeerType(in)); + } + + public Builder fromIpsecVpnRemotePeer(IpsecVpnRemotePeer in) { + return fromIpsecVpnManagedPeerType(in) + .vcdUrl(in.getVcdUrl()) + .vcdOrganization(in.getVcdOrganization()) + .vcdUsername(in.getVcdUsername()); + } + + + @Override + public Builder id(String id) { + return Builder.class.cast(super.id(id)); + } + + @Override + public Builder name(String name) { + return Builder.class.cast(super.name(name)); + } + + } + + private IpsecVpnRemotePeer(String id, String name, String vcdUrl, String vcdOrganization, String vcdUsername) { + super(id, name); + this.vcdUrl = vcdUrl; + this.vcdOrganization = vcdOrganization; + this.vcdUsername = vcdUsername; + } + + private IpsecVpnRemotePeer() { + // For JAXB and builder use + } + + @XmlElement(name = "VcdUrl", required = true) + protected String vcdUrl; + @XmlElement(name = "VcdOrganization", required = true) + protected String vcdOrganization; + @XmlElement(name = "VcdUsername", required = true) + protected String vcdUsername; + + /** + * Gets the value of the vcdUrl property. + * + * @return possible object is + * {@link String } + */ + public String getVcdUrl() { + return vcdUrl; + } + + /** + * Gets the value of the vcdOrganization property. + * + * @return possible object is + * {@link String } + */ + public String getVcdOrganization() { + return vcdOrganization; + } + + /** + * Gets the value of the vcdUsername property. + * + * @return possible object is + * {@link String } + */ + public String getVcdUsername() { + return vcdUsername; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + IpsecVpnRemotePeer that = IpsecVpnRemotePeer.class.cast(o); + return super.equals(that) + && equal(vcdUrl, that.vcdUrl) + && equal(vcdOrganization, that.vcdOrganization) + && equal(vcdUsername, that.vcdUsername); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), + vcdUrl, + vcdOrganization, + vcdUsername); + } + + @Override + protected Objects.ToStringHelper string() { + return super.string() + .add("vcdUrl", vcdUrl) + .add("vcdOrganization", vcdOrganization) + .add("vcdUsername", vcdUsername); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnService.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnService.java new file mode 100644 index 0000000000..060d3a2ba3 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnService.java @@ -0,0 +1,195 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; + +import java.util.Collections; +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; + + +/** + * Represents an IPSec-VPN network service. + *

+ *

+ *

Java class for IpsecVpnService complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType name="IpsecVpnService">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
+ *       <sequence>
+ *         <element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType" minOccurs="0"/>
+ *         <element name="PublicIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType" minOccurs="0"/>
+ *         <element name="IpsecVpnTunnel" type="{http://www.vmware.com/vcloud/v1.5}IpsecVpnTunnelType" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlRootElement(name = "IpsecVpnService") +@XmlType(propOrder = { + "externalIpAddress", + "publicIpAddress", + "ipsecVpnTunnels" +}) +public class IpsecVpnService extends NetworkServiceType { + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromIpsecVpnService(this); + } + + public static class Builder extends NetworkServiceType.Builder { + + private String externalIpAddress; + private String publicIpAddress; + private List ipsecVpnTunnels; + + /** + * @see IpsecVpnService#getExternalIpAddress() + */ + public Builder externalIpAddress(String externalIpAddress) { + this.externalIpAddress = externalIpAddress; + return this; + } + + /** + * @see IpsecVpnService#getPublicIpAddress() + */ + public Builder publicIpAddress(String publicIpAddress) { + this.publicIpAddress = publicIpAddress; + return this; + } + + /** + * @see IpsecVpnService#getIpsecVpnTunnels() + */ + public Builder ipsecVpnTunnels(List ipsecVpnTunnels) { + this.ipsecVpnTunnels = checkNotNull(ipsecVpnTunnels, "ipsecVpnTunnels"); + return this; + } + + public IpsecVpnService build() { + return new IpsecVpnService(isEnabled, externalIpAddress, publicIpAddress, ipsecVpnTunnels); + } + + @Override + public Builder fromNetworkServiceType(NetworkServiceType in) { + return Builder.class.cast(super.fromNetworkServiceType(in)); + } + + public Builder fromIpsecVpnService(IpsecVpnService in) { + return fromNetworkServiceType(in) + .externalIpAddress(in.getExternalIpAddress()) + .publicIpAddress(in.getPublicIpAddress()) + .ipsecVpnTunnels(in.getIpsecVpnTunnels()); + } + } + + private IpsecVpnService(boolean enabled, String externalIpAddress, String publicIpAddress, List ipsecVpnTunnel) { + super(enabled); + this.externalIpAddress = externalIpAddress; + this.publicIpAddress = publicIpAddress; + this.ipsecVpnTunnels = ImmutableList.copyOf(ipsecVpnTunnel); + } + + private IpsecVpnService() { + // For JAXB and builder use + } + + @XmlElement(name = "ExternalIpAddress") + protected String externalIpAddress; + @XmlElement(name = "PublicIpAddress") + protected String publicIpAddress; + @XmlElement(name = "IpsecVpnTunnel") + protected List ipsecVpnTunnels = Lists.newArrayList(); + + /** + * Gets the value of the externalIpAddress property. + * + * @return possible object is + * {@link String } + */ + public String getExternalIpAddress() { + return externalIpAddress; + } + + /** + * Gets the value of the publicIpAddress property. + * + * @return possible object is + * {@link String } + */ + public String getPublicIpAddress() { + return publicIpAddress; + } + + /** + * Gets the value of the ipsecVpnTunnel property. + */ + public List getIpsecVpnTunnels() { + return Collections.unmodifiableList(this.ipsecVpnTunnels); + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + IpsecVpnService that = IpsecVpnService.class.cast(o); + return equal(externalIpAddress, that.externalIpAddress) && + equal(publicIpAddress, that.publicIpAddress) && + equal(ipsecVpnTunnels, that.ipsecVpnTunnels); + } + + @Override + public int hashCode() { + return Objects.hashCode(externalIpAddress, + publicIpAddress, + ipsecVpnTunnels); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("externalIpAddress", externalIpAddress) + .add("publicIpAddress", publicIpAddress) + .add("ipsecVpnTunnels", ipsecVpnTunnels).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnThirdPartyPeer.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnThirdPartyPeer.java new file mode 100644 index 0000000000..d9ccd8d015 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnThirdPartyPeer.java @@ -0,0 +1,68 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import javax.xml.bind.annotation.XmlRootElement; + +/** + * + * Gives more details of third party peer end point. + * + * + *

Java class for IpsecVpnThirdPartyPeer complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="IpsecVpnThirdPartyPeer">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}IpsecVpnUnmanagedPeerType">
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlRootElement(name = "IpsecVpnThirdPartyPeer") +public class IpsecVpnThirdPartyPeer extends IpsecVpnUnmanagedPeerType { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromIpsecVpnThirdPartyPeer(this); + } + + public static class Builder { + public IpsecVpnThirdPartyPeer build() { + return new IpsecVpnThirdPartyPeer(); + } + + public Builder fromIpsecVpnThirdPartyPeer(IpsecVpnThirdPartyPeer in) { + return new Builder(); + } + } + + private IpsecVpnThirdPartyPeer() { + // For JAXB and builder use + } +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnTunnel.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnTunnel.java new file mode 100644 index 0000000000..25d4f628e8 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnTunnel.java @@ -0,0 +1,431 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * Represents details of an IPSec-VPN tunnel. + *

+ *

+ *

Java class for IpsecVpnTunnel complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType name="IpsecVpnTunnel">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element ref="{http://www.vmware.com/vcloud/v1.5}IpsecVpnPeer"/>
+ *         <element name="PeerIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
+ *         <element name="PeerNetworkAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
+ *         <element name="PeerNetworkMask" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
+ *         <element name="SharedSecret" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="EncryptionProtocol" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="Mtu" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="IsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="IsOperational" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *         <element name="ErrorDetails" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlType(name = "IpsecVpnTunnel", propOrder = { + "name", + "description", + "ipsecVpnPeer", + "peerIpAddress", + "peerNetworkAddress", + "peerNetworkMask", + "sharedSecret", + "encryptionProtocol", + "mtu", + "isEnabled", + "isOperational", + "errorDetails" +}) +public class IpsecVpnTunnel + + +{ + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromIpsecVpnTunnel(this); + } + + public static class Builder { + + private String name; + private String description; + private IpsecVpnPeerType ipsecVpnPeer; + private String peerIpAddress; + private String peerNetworkAddress; + private String peerNetworkMask; + private String sharedSecret; + private String encryptionProtocol; + private int mtu; + private boolean isEnabled; + private Boolean isOperational; + private String errorDetails; + + /** + * @see IpsecVpnTunnel#getName() + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * @see IpsecVpnTunnel#getDescription() + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * @see IpsecVpnTunnel#getIpsecVpnPeer() + */ + public Builder ipsecVpnPeer(IpsecVpnPeerType ipsecVpnPeer) { + this.ipsecVpnPeer = ipsecVpnPeer; + return this; + } + + /** + * @see IpsecVpnTunnel#getPeerIpAddress() + */ + public Builder peerIpAddress(String peerIpAddress) { + this.peerIpAddress = peerIpAddress; + return this; + } + + /** + * @see IpsecVpnTunnel#getPeerNetworkAddress() + */ + public Builder peerNetworkAddress(String peerNetworkAddress) { + this.peerNetworkAddress = peerNetworkAddress; + return this; + } + + /** + * @see IpsecVpnTunnel#getPeerNetworkMask() + */ + public Builder peerNetworkMask(String peerNetworkMask) { + this.peerNetworkMask = peerNetworkMask; + return this; + } + + /** + * @see IpsecVpnTunnel#getSharedSecret() + */ + public Builder sharedSecret(String sharedSecret) { + this.sharedSecret = sharedSecret; + return this; + } + + /** + * @see IpsecVpnTunnel#getEncryptionProtocol() + */ + public Builder encryptionProtocol(String encryptionProtocol) { + this.encryptionProtocol = encryptionProtocol; + return this; + } + + /** + * @see IpsecVpnTunnel#getMtu() + */ + public Builder mtu(int mtu) { + this.mtu = mtu; + return this; + } + + /** + * @see IpsecVpnTunnel#isEnabled() + */ + public Builder isEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * @see IpsecVpnTunnel#isOperational() + */ + public Builder isOperational(Boolean isOperational) { + this.isOperational = isOperational; + return this; + } + + /** + * @see IpsecVpnTunnel#getErrorDetails() + */ + public Builder errorDetails(String errorDetails) { + this.errorDetails = errorDetails; + return this; + } + + + public IpsecVpnTunnel build() { + return new IpsecVpnTunnel + (name, description, ipsecVpnPeer, peerIpAddress, peerNetworkAddress, peerNetworkMask, sharedSecret, + encryptionProtocol, mtu, isEnabled, isOperational, errorDetails); + } + + + public Builder fromIpsecVpnTunnel(IpsecVpnTunnel in) { + return name(in.getName()) + .description(in.getDescription()) + .peerIpAddress(in.getPeerIpAddress()) + .peerNetworkAddress(in.getPeerNetworkAddress()) + .peerNetworkMask(in.getPeerNetworkMask()) + .sharedSecret(in.getSharedSecret()) + .encryptionProtocol(in.getEncryptionProtocol()) + .mtu(in.getMtu()) + .isEnabled(in.isEnabled()) + .isOperational(in.isOperational()) + .errorDetails(in.getErrorDetails()); + } + } + + private IpsecVpnTunnel(String name, String description, IpsecVpnPeerType ipsecVpnPeer, String peerIpAddress, + String peerNetworkAddress, String peerNetworkMask, String sharedSecret, String encryptionProtocol, int mtu, boolean enabled, Boolean operational, String errorDetails) { + this.name = name; + this.description = description; + this.ipsecVpnPeer = ipsecVpnPeer; + this.peerIpAddress = peerIpAddress; + this.peerNetworkAddress = peerNetworkAddress; + this.peerNetworkMask = peerNetworkMask; + this.sharedSecret = sharedSecret; + this.encryptionProtocol = encryptionProtocol; + this.mtu = mtu; + isEnabled = enabled; + isOperational = operational; + this.errorDetails = errorDetails; + } + + private IpsecVpnTunnel() { + // For JAXB and builder use + } + + @XmlElement(name = "Name", required = true) + protected String name; + @XmlElement(name = "Description") + protected String description; + @XmlElementRef + protected IpsecVpnPeerType ipsecVpnPeer; + @XmlElement(name = "PeerIpAddress", required = true) + protected String peerIpAddress; + @XmlElement(name = "PeerNetworkAddress", required = true) + protected String peerNetworkAddress; + @XmlElement(name = "PeerNetworkMask", required = true) + protected String peerNetworkMask; + @XmlElement(name = "SharedSecret", required = true) + protected String sharedSecret; + @XmlElement(name = "EncryptionProtocol", required = true) + protected String encryptionProtocol; + @XmlElement(name = "Mtu") + protected int mtu; + @XmlElement(name = "IsEnabled") + protected boolean isEnabled; + @XmlElement(name = "IsOperational") + protected Boolean isOperational; + @XmlElement(name = "ErrorDetails") + protected String errorDetails; + + /** + * Gets the value of the name property. + * + * @return possible object is + * {@link String } + */ + public String getName() { + return name; + } + + /** + * Gets the value of the description property. + * + * @return possible object is + * {@link String } + */ + public String getDescription() { + return description; + } + + /** + * Details about the peer network. + */ + public IpsecVpnPeerType getIpsecVpnPeer() { + return ipsecVpnPeer; + } + + /** + * Gets the value of the peerIpAddress property. + * + * @return possible object is + * {@link String } + */ + public String getPeerIpAddress() { + return peerIpAddress; + } + + /** + * Gets the value of the peerNetworkAddress property. + * + * @return possible object is + * {@link String } + */ + public String getPeerNetworkAddress() { + return peerNetworkAddress; + } + + /** + * Gets the value of the peerNetworkMask property. + * + * @return possible object is + * {@link String } + */ + public String getPeerNetworkMask() { + return peerNetworkMask; + } + + /** + * Gets the value of the sharedSecret property. + * + * @return possible object is + * {@link String } + */ + public String getSharedSecret() { + return sharedSecret; + } + + /** + * Gets the value of the encryptionProtocol property. + * + * @return possible object is + * {@link String } + */ + public String getEncryptionProtocol() { + return encryptionProtocol; + } + + /** + * Gets the value of the mtu property. + */ + public int getMtu() { + return mtu; + } + + /** + * Gets the value of the isEnabled property. + */ + public boolean isEnabled() { + return isEnabled; + } + + /** + * Gets the value of the isOperational property. + * + * @return possible object is + * {@link Boolean } + */ + public Boolean isOperational() { + return isOperational; + } + + /** + * Gets the value of the errorDetails property. + * + * @return possible object is + * {@link String } + */ + public String getErrorDetails() { + return errorDetails; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + IpsecVpnTunnel that = IpsecVpnTunnel.class.cast(o); + return equal(name, that.name) && + equal(description, that.description) && + equal(peerIpAddress, that.peerIpAddress) && + equal(peerNetworkAddress, that.peerNetworkAddress) && + equal(peerNetworkMask, that.peerNetworkMask) && + equal(sharedSecret, that.sharedSecret) && + equal(encryptionProtocol, that.encryptionProtocol) && + equal(mtu, that.mtu) && + equal(isEnabled, that.isEnabled) && + equal(isOperational, that.isOperational) && + equal(errorDetails, that.errorDetails); + } + + @Override + public int hashCode() { + return Objects.hashCode(name, + description, + peerIpAddress, + peerNetworkAddress, + peerNetworkMask, + sharedSecret, + encryptionProtocol, + mtu, + isEnabled, + isOperational, + errorDetails); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("name", name) + .add("description", description) + .add("peerIpAddress", peerIpAddress) + .add("peerNetworkAddress", peerNetworkAddress) + .add("peerNetworkMask", peerNetworkMask) + .add("sharedSecret", sharedSecret) + .add("encryptionProtocol", encryptionProtocol) + .add("mtu", mtu) + .add("isEnabled", isEnabled) + .add("isOperational", isOperational) + .add("errorDetails", errorDetails).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnUnmanagedPeerType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnUnmanagedPeerType.java new file mode 100644 index 0000000000..ed92c5d415 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnUnmanagedPeerType.java @@ -0,0 +1,29 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import javax.xml.bind.annotation.XmlSeeAlso; + +/** + */ +@XmlSeeAlso( + IpsecVpnThirdPartyPeer.class +) +public abstract class IpsecVpnUnmanagedPeerType> extends IpsecVpnPeerType { +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatOneToOneBasicRule.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatOneToOneBasicRule.java new file mode 100644 index 0000000000..7792d5f91f --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatOneToOneBasicRule.java @@ -0,0 +1,185 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * Represents the NAT basic rule for one to one mapping of internal + * and external IP addresses from a network. + *

+ *

+ *

Java class for NatOneToOneBasicRule complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType name="NatOneToOneBasicRule">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="MappingMode" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
+ *         <element name="InternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlType(name = "NatOneToOneBasicRule", propOrder = { + "mappingMode", + "externalIpAddress", + "internalIpAddress" +}) +public class NatOneToOneBasicRule { + + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromNatOneToOneBasicRule(this); + } + + public static class Builder { + + private String mappingMode; + private String externalIpAddress; + private String internalIpAddress; + + /** + * @see NatOneToOneBasicRule#getMappingMode() + */ + public Builder mappingMode(String mappingMode) { + this.mappingMode = mappingMode; + return this; + } + + /** + * @see NatOneToOneBasicRule#getExternalIpAddress() + */ + public Builder externalIpAddress(String externalIpAddress) { + this.externalIpAddress = externalIpAddress; + return this; + } + + /** + * @see NatOneToOneBasicRule#getInternalIpAddress() + */ + public Builder internalIpAddress(String internalIpAddress) { + this.internalIpAddress = internalIpAddress; + return this; + } + + public NatOneToOneBasicRule build() { + return new NatOneToOneBasicRule(mappingMode, externalIpAddress, internalIpAddress); + } + + public Builder fromNatOneToOneBasicRule(NatOneToOneBasicRule in) { + return mappingMode(in.getMappingMode()) + .externalIpAddress(in.getExternalIpAddress()) + .internalIpAddress(in.getInternalIpAddress()); + } + } + + private NatOneToOneBasicRule(String mappingMode, String externalIpAddress, String internalIpAddress) { + this.mappingMode = mappingMode; + this.externalIpAddress = externalIpAddress; + this.internalIpAddress = internalIpAddress; + } + + private NatOneToOneBasicRule() { + // For JAXB + } + + + @XmlElement(name = "MappingMode", required = true) + protected String mappingMode; + @XmlElement(name = "ExternalIpAddress", required = true) + protected String externalIpAddress; + @XmlElement(name = "InternalIpAddress", required = true) + protected String internalIpAddress; + + /** + * Gets the value of the mappingMode property. + * + * @return possible object is + * {@link String } + */ + public String getMappingMode() { + return mappingMode; + } + + /** + * Gets the value of the externalIpAddress property. + * + * @return possible object is + * {@link String } + */ + public String getExternalIpAddress() { + return externalIpAddress; + } + + /** + * Gets the value of the internalIpAddress property. + * + * @return possible object is + * {@link String } + */ + public String getInternalIpAddress() { + return internalIpAddress; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + NatOneToOneBasicRule that = NatOneToOneBasicRule.class.cast(o); + return equal(mappingMode, that.mappingMode) && + equal(externalIpAddress, that.externalIpAddress) && + equal(internalIpAddress, that.internalIpAddress); + } + + @Override + public int hashCode() { + return Objects.hashCode(mappingMode, + externalIpAddress, + internalIpAddress); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("mappingMode", mappingMode) + .add("externalIpAddress", externalIpAddress) + .add("internalIpAddress", internalIpAddress).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatOneToOneVmRule.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatOneToOneVmRule.java new file mode 100644 index 0000000000..2aeade3071 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatOneToOneVmRule.java @@ -0,0 +1,209 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * Represents the NAT rule for one to one mapping of VM NIC and + * external IP addresses from a network. + *

+ *

+ *

Java class for NatOneToOneVmRule complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType name="NatOneToOneVmRule">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="MappingMode" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType" minOccurs="0"/>
+ *         <element name="VAppScopedVmId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="VmNicId" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlType(name = "NatOneToOneVmRule", propOrder = { + "mappingMode", + "externalIpAddress", + "vAppScopedVmId", + "vmNicId" +}) +public class NatOneToOneVmRule { + + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromNatOneToOneVmRule(this); + } + + public static class Builder { + + private String mappingMode; + private String externalIpAddress; + private String vAppScopedVmId; + private int vmNicId; + + /** + * @see NatOneToOneVmRule#getMappingMode() + */ + public Builder mappingMode(String mappingMode) { + this.mappingMode = mappingMode; + return this; + } + + /** + * @see NatOneToOneVmRule#getExternalIpAddress() + */ + public Builder externalIpAddress(String externalIpAddress) { + this.externalIpAddress = externalIpAddress; + return this; + } + + /** + * @see NatOneToOneVmRule#getVAppScopedVmId() + */ + public Builder vAppScopedVmId(String vAppScopedVmId) { + this.vAppScopedVmId = vAppScopedVmId; + return this; + } + + /** + * @see NatOneToOneVmRule#getVmNicId() + */ + public Builder vmNicId(int vmNicId) { + this.vmNicId = vmNicId; + return this; + } + + public NatOneToOneVmRule build() { + return new NatOneToOneVmRule(mappingMode, externalIpAddress, vAppScopedVmId, vmNicId); + } + + public Builder fromNatOneToOneVmRule(NatOneToOneVmRule in) { + return mappingMode(in.getMappingMode()) + .externalIpAddress(in.getExternalIpAddress()) + .vAppScopedVmId(in.getVAppScopedVmId()) + .vmNicId(in.getVmNicId()); + } + } + + private NatOneToOneVmRule(String mappingMode, String externalIpAddress, String vAppScopedVmId, int vmNicId) { + this.mappingMode = mappingMode; + this.externalIpAddress = externalIpAddress; + this.vAppScopedVmId = vAppScopedVmId; + this.vmNicId = vmNicId; + } + + private NatOneToOneVmRule() { + // For JAXB + } + + @XmlElement(name = "MappingMode", required = true) + protected String mappingMode; + @XmlElement(name = "ExternalIpAddress") + protected String externalIpAddress; + @XmlElement(name = "VAppScopedVmId", required = true) + protected String vAppScopedVmId; + @XmlElement(name = "VmNicId") + protected int vmNicId; + + /** + * Gets the value of the mappingMode property. + * + * @return possible object is + * {@link String } + */ + public String getMappingMode() { + return mappingMode; + } + + /** + * Gets the value of the externalIpAddress property. + * + * @return possible object is + * {@link String } + */ + public String getExternalIpAddress() { + return externalIpAddress; + } + + /** + * Gets the value of the vAppScopedVmId property. + * + * @return possible object is + * {@link String } + */ + public String getVAppScopedVmId() { + return vAppScopedVmId; + } + + /** + * Gets the value of the vmNicId property. + */ + public int getVmNicId() { + return vmNicId; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + NatOneToOneVmRule that = NatOneToOneVmRule.class.cast(o); + return equal(mappingMode, that.mappingMode) && + equal(externalIpAddress, that.externalIpAddress) && + equal(vAppScopedVmId, that.vAppScopedVmId) && + equal(vmNicId, that.vmNicId); + } + + @Override + public int hashCode() { + return Objects.hashCode(mappingMode, + externalIpAddress, + vAppScopedVmId, + vmNicId); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("mappingMode", mappingMode) + .add("externalIpAddress", externalIpAddress) + .add("vAppScopedVmId", vAppScopedVmId) + .add("vmNicId", vmNicId).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatPortForwardingRule.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatPortForwardingRule.java new file mode 100644 index 0000000000..11f5afb9ed --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatPortForwardingRule.java @@ -0,0 +1,234 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * Represents the NAT rule for port forwarding between internal + * IP/port and external IP/port. + *

+ *

+ *

Java class for NatPortForwardingRule complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType name="NatPortForwardingRule">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
+ *         <element name="ExternalPort" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="InternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
+ *         <element name="InternalPort" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="Protocol" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlType(name = "NatPortForwardingRule", propOrder = { + "externalIpAddress", + "externalPort", + "internalIpAddress", + "internalPort", + "protocol" +}) +public class NatPortForwardingRule { + + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromNatPortForwardingRule(this); + } + + public static class Builder { + + private String externalIpAddress; + private int externalPort; + private String internalIpAddress; + private int internalPort; + private String protocol; + + /** + * @see NatPortForwardingRule#getExternalIpAddress() + */ + public Builder externalIpAddress(String externalIpAddress) { + this.externalIpAddress = externalIpAddress; + return this; + } + + /** + * @see NatPortForwardingRule#getExternalPort() + */ + public Builder externalPort(int externalPort) { + this.externalPort = externalPort; + return this; + } + + /** + * @see NatPortForwardingRule#getInternalIpAddress() + */ + public Builder internalIpAddress(String internalIpAddress) { + this.internalIpAddress = internalIpAddress; + return this; + } + + /** + * @see NatPortForwardingRule#getInternalPort() + */ + public Builder internalPort(int internalPort) { + this.internalPort = internalPort; + return this; + } + + /** + * @see NatPortForwardingRule#getProtocol() + */ + public Builder protocol(String protocol) { + this.protocol = protocol; + return this; + } + + public NatPortForwardingRule build() { + return new NatPortForwardingRule(externalIpAddress, externalPort, internalIpAddress, internalPort, protocol); + } + + public Builder fromNatPortForwardingRule(NatPortForwardingRule in) { + return externalIpAddress(in.getExternalIpAddress()) + .externalPort(in.getExternalPort()) + .internalIpAddress(in.getInternalIpAddress()) + .internalPort(in.getInternalPort()) + .protocol(in.getProtocol()); + } + } + + private NatPortForwardingRule(String externalIpAddress, int externalPort, String internalIpAddress, int internalPort, String protocol) { + this.externalIpAddress = externalIpAddress; + this.externalPort = externalPort; + this.internalIpAddress = internalIpAddress; + this.internalPort = internalPort; + this.protocol = protocol; + } + + private NatPortForwardingRule() { + // For JAXB + } + + @XmlElement(name = "ExternalIpAddress", required = true) + protected String externalIpAddress; + @XmlElement(name = "ExternalPort") + protected int externalPort; + @XmlElement(name = "InternalIpAddress", required = true) + protected String internalIpAddress; + @XmlElement(name = "InternalPort") + protected int internalPort; + @XmlElement(name = "Protocol", required = true) + protected String protocol; + + /** + * Gets the value of the externalIpAddress property. + * + * @return possible object is + * {@link String } + */ + public String getExternalIpAddress() { + return externalIpAddress; + } + + /** + * Gets the value of the externalPort property. + */ + public int getExternalPort() { + return externalPort; + } + + /** + * Gets the value of the internalIpAddress property. + * + * @return possible object is + * {@link String } + */ + public String getInternalIpAddress() { + return internalIpAddress; + } + + /** + * Gets the value of the internalPort property. + */ + public int getInternalPort() { + return internalPort; + } + + /** + * Gets the value of the protocol property. + * + * @return possible object is + * {@link String } + */ + public String getProtocol() { + return protocol; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + NatPortForwardingRule that = NatPortForwardingRule.class.cast(o); + return equal(externalIpAddress, that.externalIpAddress) && + equal(externalPort, that.externalPort) && + equal(internalIpAddress, that.internalIpAddress) && + equal(internalPort, that.internalPort) && + equal(protocol, that.protocol); + } + + @Override + public int hashCode() { + return Objects.hashCode(externalIpAddress, + externalPort, + internalIpAddress, + internalPort, + protocol); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("externalIpAddress", externalIpAddress) + .add("externalPort", externalPort) + .add("internalIpAddress", internalIpAddress) + .add("internalPort", internalPort) + .add("protocol", protocol).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatRule.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatRule.java new file mode 100644 index 0000000000..11deef91a7 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatRule.java @@ -0,0 +1,242 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * Represents a NAT rule. + *

+ *

+ *

Java class for NatRule complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType name="NatRule">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <choice>
+ *           <element name="OneToOneBasicRule" type="{http://www.vmware.com/vcloud/v1.5}NatOneToOneBasicRuleType"/>
+ *           <element name="OneToOneVmRule" type="{http://www.vmware.com/vcloud/v1.5}NatOneToOneVmRuleType"/>
+ *           <element name="PortForwardingRule" type="{http://www.vmware.com/vcloud/v1.5}NatPortForwardingRuleType"/>
+ *           <element name="VmRule" type="{http://www.vmware.com/vcloud/v1.5}NatVmRuleType"/>
+ *         </choice>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlType(name = "NatRule", propOrder = { + "description", + "oneToOneBasicRule", + "oneToOneVmRule", + "portForwardingRule", + "vmRule" +}) +public class NatRule { + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromNatRule(this); + } + + public static class Builder { + private String description; + private NatOneToOneBasicRule oneToOneBasicRule; + private NatOneToOneVmRule oneToOneVmRule; + private NatPortForwardingRule portForwardingRule; + private NatVmRule vmRule; + + /** + * @see NatRule#getDescription() + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * @see NatRule#getOneToOneBasicRule() + */ + public Builder oneToOneBasicRule(NatOneToOneBasicRule oneToOneBasicRule) { + this.oneToOneBasicRule = oneToOneBasicRule; + return this; + } + + /** + * @see NatRule#getOneToOneVmRule() + */ + public Builder oneToOneVmRule(NatOneToOneVmRule oneToOneVmRule) { + this.oneToOneVmRule = oneToOneVmRule; + return this; + } + + /** + * @see NatRule#getPortForwardingRule() + */ + public Builder portForwardingRule(NatPortForwardingRule portForwardingRule) { + this.portForwardingRule = portForwardingRule; + return this; + } + + /** + * @see NatRule#getVmRule() + */ + public Builder vmRule(NatVmRule vmRule) { + this.vmRule = vmRule; + return this; + } + + public NatRule build() { + return new NatRule(description, oneToOneBasicRule, oneToOneVmRule, portForwardingRule, vmRule); + } + + public Builder fromNatRule(NatRule in) { + return description(in.getDescription()) + .oneToOneBasicRule(in.getOneToOneBasicRule()) + .oneToOneVmRule(in.getOneToOneVmRule()) + .portForwardingRule(in.getPortForwardingRule()) + .vmRule(in.getVmRule()); + } + } + + public NatRule(String description, NatOneToOneBasicRule oneToOneBasicRule, NatOneToOneVmRule oneToOneVmRule, + NatPortForwardingRule portForwardingRule, NatVmRule vmRule) { + this.description = description; + this.oneToOneBasicRule = oneToOneBasicRule; + this.oneToOneVmRule = oneToOneVmRule; + this.portForwardingRule = portForwardingRule; + this.vmRule = vmRule; + } + + private NatRule() { + // For JAXB and builder use + } + + @XmlElement(name = "Description") + protected String description; + @XmlElement(name = "OneToOneBasicRule") + protected NatOneToOneBasicRule oneToOneBasicRule; + @XmlElement(name = "OneToOneVmRule") + protected NatOneToOneVmRule oneToOneVmRule; + @XmlElement(name = "PortForwardingRule") + protected NatPortForwardingRule portForwardingRule; + @XmlElement(name = "VmRule") + protected NatVmRule vmRule; + + /** + * Gets the value of the description property. + * + * @return possible object is + * {@link String } + */ + public String getDescription() { + return description; + } + + /** + * Gets the value of the oneToOneBasicRule property. + * + * @return possible object is + * {@link NatOneToOneBasicRule } + */ + public NatOneToOneBasicRule getOneToOneBasicRule() { + return oneToOneBasicRule; + } + + + /** + * Gets the value of the oneToOneVmRule property. + * + * @return possible object is + * {@link NatOneToOneVmRule } + */ + public NatOneToOneVmRule getOneToOneVmRule() { + return oneToOneVmRule; + } + + /** + * Gets the value of the portForwardingRule property. + * + * @return possible object is + * {@link NatPortForwardingRule } + */ + public NatPortForwardingRule getPortForwardingRule() { + return portForwardingRule; + } + + /** + * Gets the value of the vmRule property. + * + * @return possible object is + * {@link NatVmRule } + */ + public NatVmRule getVmRule() { + return vmRule; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + NatRule that = NatRule.class.cast(o); + return equal(description, that.description) && + equal(oneToOneBasicRule, that.oneToOneBasicRule) && + equal(oneToOneVmRule, that.oneToOneVmRule) && + equal(portForwardingRule, that.portForwardingRule) && + equal(vmRule, that.vmRule); + } + + @Override + public int hashCode() { + return Objects.hashCode(description, + oneToOneBasicRule, + oneToOneVmRule, + portForwardingRule, + vmRule); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("description", description) + .add("oneToOneBasicRule", oneToOneBasicRule) + .add("oneToOneVmRule", oneToOneVmRule) + .add("portForwardingRule", portForwardingRule) + .add("vmRule", vmRule).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatService.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatService.java new file mode 100644 index 0000000000..5b0c756a80 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatService.java @@ -0,0 +1,179 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Set; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; + +/** + * Represents a NAT network service. + *

+ *

+ *

Java class for NatService complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType name="NatService">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
+ *       <sequence>
+ *         <element name="NatType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Policy" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NatRule" type="{http://www.vmware.com/vcloud/v1.5}NatRuleType" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlRootElement(name = "NatService") +@XmlType(propOrder = { + "natType", + "policy", + "natRules" +}) +public class NatService extends NetworkServiceType { + + public static Builder builder() { + return new Builder(); + } + + @Override + public Builder toBuilder() { + return new Builder().fromNatService(this); + } + + public static class Builder extends NetworkServiceType.Builder { + private String natType; + private String policy; + private Set natRules = Sets.newLinkedHashSet(); + + /** + * @see NatService#getNatType() + */ + public Builder natType(String natType) { + this.natType = natType; + return this; + } + + /** + * @see NatService#getPolicy() + */ + public Builder policy(String policy) { + this.policy = policy; + return this; + } + + /** + * @see NatService#getNatRules() + */ + public Builder natRules(Set natRules) { + this.natRules = checkNotNull(natRules, "natRules"); + return this; + } + + public NatService build() { + return new NatService(isEnabled, natType, policy, natRules); + } + + public Builder fromNatService(NatService in) { + return fromNetworkService(in).natType(in.getNatType()).policy(in.getPolicy()) + .natRules(in.getNatRules()); + } + + public Builder fromNetworkService(NetworkServiceType in) { + return Builder.class.cast(super.fromNetworkServiceType(in)); + } + + @Override + public Builder enabled(boolean enabled) { + this.isEnabled = enabled; + return this; + } + } + + @XmlElement(name = "NatType") + private String natType; + @XmlElement(name = "Policy") + private String policy; + @XmlElement(name = "NatRule") + private Set natRules = Sets.newLinkedHashSet(); + + private NatService(boolean enabled, String natType, String policy, Set natRules) { + super(enabled); + this.natType = natType; + this.policy = policy; + this.natRules = ImmutableSet.copyOf(natRules); + } + + private NatService() { + // for JAXB + } + + public String getNatType() { + return natType; + } + + public String getPolicy() { + return policy; + } + + public Set getNatRules() { + return Collections.unmodifiableSet(natRules); + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + NatService that = NatService.class.cast(o); + return super.equals(that) + && equal(natType, that.natType) + && equal(natRules, that.natRules) + && equal(policy, that.policy); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), natType, natRules, policy); + } + + @Override + protected Objects.ToStringHelper string() { + return super.string().add("natType", natType).add("natRules", natRules).add("policy", policy); + } +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatVmRule.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatVmRule.java new file mode 100644 index 0000000000..06695b48ed --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatVmRule.java @@ -0,0 +1,262 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * Represents the NAT rule for port forwarding between VM NIC/port + * and external IP/port. + *

+ *

+ *

Java class for NatVmRule complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType name="NatVmRule">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType" minOccurs="0"/>
+ *         <element name="ExternalPort" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="VAppScopedVmId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="VmNicId" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="InternalPort" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="Protocol" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlType(name = "NatVmRule", propOrder = { + "externalIpAddress", + "externalPort", + "vAppScopedVmId", + "vmNicId", + "internalPort", + "protocol" +}) +public class NatVmRule { + + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromNatVmRule(this); + } + + public static class Builder { + + private String externalIpAddress; + private int externalPort; + private String vAppScopedVmId; + private int vmNicId; + private int internalPort; + private String protocol; + + /** + * @see NatVmRule#getExternalIpAddress() + */ + public Builder externalIpAddress(String externalIpAddress) { + this.externalIpAddress = externalIpAddress; + return this; + } + + /** + * @see NatVmRule#getExternalPort() + */ + public Builder externalPort(int externalPort) { + this.externalPort = externalPort; + return this; + } + + /** + * @see NatVmRule#getVAppScopedVmId() + */ + public Builder vAppScopedVmId(String vAppScopedVmId) { + this.vAppScopedVmId = vAppScopedVmId; + return this; + } + + /** + * @see NatVmRule#getVmNicId() + */ + public Builder vmNicId(int vmNicId) { + this.vmNicId = vmNicId; + return this; + } + + /** + * @see NatVmRule#getInternalPort() + */ + public Builder internalPort(int internalPort) { + this.internalPort = internalPort; + return this; + } + + /** + * @see NatVmRule#getProtocol() + */ + public Builder protocol(String protocol) { + this.protocol = protocol; + return this; + } + + public NatVmRule build() { + return new NatVmRule(externalIpAddress, externalPort, vAppScopedVmId, vmNicId, internalPort, protocol); + } + + public Builder fromNatVmRule(NatVmRule in) { + return externalIpAddress(in.getExternalIpAddress()) + .externalPort(in.getExternalPort()) + .vAppScopedVmId(in.getVAppScopedVmId()) + .vmNicId(in.getVmNicId()) + .internalPort(in.getInternalPort()) + .protocol(in.getProtocol()); + } + } + + private NatVmRule(String externalIpAddress, int externalPort, String vAppScopedVmId, int vmNicId, + int internalPort, String protocol) { + this.externalIpAddress = externalIpAddress; + this.externalPort = externalPort; + this.vAppScopedVmId = vAppScopedVmId; + this.vmNicId = vmNicId; + this.internalPort = internalPort; + this.protocol = protocol; + } + + private NatVmRule() { + // For JAXB and builder use + } + + + @XmlElement(name = "ExternalIpAddress") + protected String externalIpAddress; + @XmlElement(name = "ExternalPort") + protected int externalPort; + @XmlElement(name = "VAppScopedVmId", required = true) + protected String vAppScopedVmId; + @XmlElement(name = "VmNicId") + protected int vmNicId; + @XmlElement(name = "InternalPort") + protected int internalPort; + @XmlElement(name = "Protocol", required = true) + protected String protocol; + + /** + * Gets the value of the externalIpAddress property. + * + * @return possible object is + * {@link String } + */ + public String getExternalIpAddress() { + return externalIpAddress; + } + + /** + * Gets the value of the externalPort property. + */ + public int getExternalPort() { + return externalPort; + } + + /** + * Gets the value of the vAppScopedVmId property. + * + * @return possible object is + * {@link String } + */ + public String getVAppScopedVmId() { + return vAppScopedVmId; + } + + /** + * Gets the value of the vmNicId property. + */ + public int getVmNicId() { + return vmNicId; + } + + /** + * Gets the value of the internalPort property. + */ + public int getInternalPort() { + return internalPort; + } + + + /** + * Gets the value of the protocol property. + * + * @return possible object is + * {@link String } + */ + public String getProtocol() { + return protocol; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + NatVmRule that = NatVmRule.class.cast(o); + return equal(externalIpAddress, that.externalIpAddress) && + equal(externalPort, that.externalPort) && + equal(vAppScopedVmId, that.vAppScopedVmId) && + equal(vmNicId, that.vmNicId) && + equal(internalPort, that.internalPort) && + equal(protocol, that.protocol); + } + + @Override + public int hashCode() { + return Objects.hashCode(externalIpAddress, + externalPort, + vAppScopedVmId, + vmNicId, + internalPort, + protocol); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("externalIpAddress", externalIpAddress) + .add("externalPort", externalPort) + .add("vAppScopedVmId", vAppScopedVmId) + .add("vmNicId", vmNicId) + .add("internalPort", internalPort) + .add("protocol", protocol).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkService.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkServiceType.java similarity index 67% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkService.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkServiceType.java index 56111c741d..58a814c506 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkService.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkServiceType.java @@ -21,52 +21,58 @@ package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.equal; import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSeeAlso; import com.google.common.base.Objects; /** * Represents a network service * - * @author danikov + * @author Adam Lowe */ -@XmlRootElement(name = "NetworkService") -public class NetworkService { +@XmlSeeAlso({ + DhcpService.class, + IpsecVpnService.class, + FirewallService.class, + DhcpService.class, + StaticRoutingService.class, + NatService.class +}) +public class NetworkServiceType> { public static Builder builder() { return new Builder(); } public Builder toBuilder() { - return new Builder().fromNetworkService(this); + return new Builder().fromNetworkServiceType(this); } - public static class Builder { - - private boolean isEnabled; + public static class Builder> { + protected boolean isEnabled; /** - * @see NetworkService#isEnabled() + * @see NetworkServiceType#isEnabled() */ - public Builder enabled(boolean isEnabled) { + public Builder enabled(boolean isEnabled) { this.isEnabled = isEnabled; return this; } - public NetworkService build() { - return new NetworkService(isEnabled); + public NetworkServiceType build() { + return new NetworkServiceType(isEnabled); } - public Builder fromNetworkService(NetworkService in) { + public Builder fromNetworkServiceType(NetworkServiceType in) { return enabled(in.isEnabled()); } } - private NetworkService(boolean enabled) { + protected NetworkServiceType(boolean enabled) { isEnabled = enabled; } - private NetworkService() { + protected NetworkServiceType() { // For JAXB and builder use } @@ -86,7 +92,7 @@ public class NetworkService { return true; if (o == null || getClass() != o.getClass()) return false; - NetworkService that = NetworkService.class.cast(o); + NetworkServiceType that = NetworkServiceType.class.cast(o); return equal(isEnabled, that.isEnabled); } @@ -97,6 +103,10 @@ public class NetworkService { @Override public String toString() { - return Objects.toStringHelper("").add("isEnabled", isEnabled).toString(); + return string().toString(); + } + + protected Objects.ToStringHelper string() { + return Objects.toStringHelper("").add("isEnabled", isEnabled); } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/StaticRoute.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/StaticRoute.java new file mode 100644 index 0000000000..8429af77cc --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/StaticRoute.java @@ -0,0 +1,214 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + *

Java class for StaticRoute complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType name="StaticRoute">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="Network" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="NextHopIp" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
+ *         <element name="Interface" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "StaticRoute", propOrder = { + "name", + "network", + "nextHopIp", + "_interface" +}) +public class StaticRoute { + + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromStaticRoute(this); + } + + public static class Builder { + private String name; + private String network; + private String nextHopIp; + private String _interface; + + /** + * @see StaticRoute#getName() + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * @see StaticRoute#getNetwork() + */ + public Builder network(String network) { + this.network = network; + return this; + } + + /** + * @see StaticRoute#getNextHopIp() + */ + public Builder nextHopIp(String nextHopIp) { + this.nextHopIp = nextHopIp; + return this; + } + + /** + * @see StaticRoute#getInterface() + */ + public Builder _interface(String _interface) { + this._interface = _interface; + return this; + } + + public StaticRoute build() { + return new StaticRoute(name, network, nextHopIp, _interface); + } + + public Builder fromStaticRoute(StaticRoute in) { + return name(in.getName()) + .network(in.getNetwork()) + .nextHopIp(in.getNextHopIp()) + ._interface(in.getInterface()); + } + } + + private StaticRoute(String name, String network, String nextHopIp, String _interface) { + this.name = checkNotNull(name, "name"); + this.network = checkNotNull(network, "network"); + this.nextHopIp = checkNotNull(nextHopIp, "nextHopIp"); + this._interface = checkNotNull(_interface, "interface"); + } + + private StaticRoute() { + // For JAXB and builder use + } + + private StaticRoute(String _interface) { + this._interface = _interface; + } + + @XmlElement(name = "Name", required = true) + protected String name; + @XmlElement(name = "Network", required = true) + protected String network; + @XmlElement(name = "NextHopIp", required = true) + protected String nextHopIp; + @XmlElement(name = "Interface", required = true) + protected String _interface; + + /** + * Gets the value of the name property. + * + * @return possible object is + * {@link String } + */ + public String getName() { + return name; + } + + /** + * Gets the value of the network property. + * + * @return possible object is + * {@link String } + */ + public String getNetwork() { + return network; + } + + /** + * Gets the value of the nextHopIp property. + * + * @return possible object is + * {@link String } + */ + public String getNextHopIp() { + return nextHopIp; + } + + /** + * Gets the value of the interface property. + * + * @return possible object is + * {@link String } + */ + public String getInterface() { + return _interface; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + StaticRoute that = StaticRoute.class.cast(o); + return equal(name, that.name) && + equal(network, that.network) && + equal(nextHopIp, that.nextHopIp) && + equal(_interface, that._interface); + } + + @Override + public int hashCode() { + return Objects.hashCode(name, + network, + nextHopIp, + _interface); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("name", name) + .add("network", network) + .add("nextHopIp", nextHopIp) + .add("_interface", _interface).toString(); + } +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/StaticRoutingService.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/StaticRoutingService.java new file mode 100644 index 0000000000..a5648c2c82 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/StaticRoutingService.java @@ -0,0 +1,141 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; + +import java.util.Collections; +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; + + +/** + * Represents Static Routing network service. + *

+ *

+ *

Java class for StaticRoutingService complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType name="StaticRoutingService">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
+ *       <sequence>
+ *         <element name="StaticRoute" type="{http://www.vmware.com/vcloud/v1.5}StaticRouteType" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlRootElement(name = "StaticRoutingService") +@XmlType(propOrder = { + "staticRoutes" +}) +public class StaticRoutingService extends NetworkServiceType { + + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromStaticRoutingService(this); + } + + public static class Builder extends NetworkServiceType.Builder { + + private List staticRoutes; + + /** + * @see StaticRoutingService#getStaticRoutes() + */ + public Builder staticRoutes(List staticRoutes) { + this.staticRoutes = checkNotNull(staticRoutes, "staticRoutes"); + return this; + } + + + public StaticRoutingService build() { + return new StaticRoutingService(isEnabled, staticRoutes); + } + + + @Override + public Builder fromNetworkServiceType(NetworkServiceType in) { + return Builder.class.cast(super.fromNetworkServiceType(in)); + } + + public Builder fromStaticRoutingService(StaticRoutingService in) { + return fromNetworkServiceType(in) + .staticRoutes(in.getStaticRoutes()); + } + } + + private StaticRoutingService(boolean enabled, List staticRoutes) { + super(enabled); + this.staticRoutes = ImmutableList.copyOf(staticRoutes); + } + + private StaticRoutingService() { + // For JAXB and builder use + } + + @XmlElement(name = "StaticRoute") + protected List staticRoutes = Lists.newArrayList(); + + /** + * Gets the value of the staticRoutes property. + */ + public List getStaticRoutes() { + return Collections.unmodifiableList(this.staticRoutes); + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + StaticRoutingService that = StaticRoutingService.class.cast(o); + return equal(staticRoutes, that.staticRoutes); + } + + @Override + public int hashCode() { + return Objects.hashCode(staticRoutes); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("staticRoutes", staticRoutes).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java index 7ff348efc9..3c6752862f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java @@ -23,6 +23,7 @@ import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; import java.net.URI; +import java.util.Collections; import java.util.Set; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; @@ -88,7 +89,7 @@ public class VAppTemplate extends ResourceEntityType { public static class Builder extends ResourceEntityType.Builder { private Owner owner; private Set children = Sets.newLinkedHashSet(); - private Set sections = Sets.newLinkedHashSet(); + private Set> sections = Sets.newLinkedHashSet(); private String vAppScopedLocalId; private Boolean ovfDescriptorUploaded; private Boolean goldMaster; @@ -112,8 +113,8 @@ public class VAppTemplate extends ResourceEntityType { /** * @see VAppTemplate#getSections() */ - public Builder sections(Set sections) { - this.sections = sections; + public Builder sections(Set> sections) { + this.sections = checkNotNull(sections, "sections"); return this; } @@ -258,7 +259,7 @@ public class VAppTemplate extends ResourceEntityType { @XmlElementRef protected VAppTemplateChildren children = VAppTemplateChildren.builder().build(); @XmlElementRef - protected Set sections = Sets.newLinkedHashSet(); + protected Set> sections = Sets.newLinkedHashSet(); @XmlElement(name = "VAppScopedLocalId") protected String vAppScopedLocalId; @XmlAttribute @@ -267,7 +268,8 @@ public class VAppTemplate extends ResourceEntityType { protected Boolean goldMaster; private VAppTemplate(URI href, String type, Set links, String description, TasksInProgress tasksInProgress, - String id, String name, FilesList files, Integer status, Owner owner, Set children, Set sections, String vAppScopedLocalId, Boolean ovfDescriptorUploaded, Boolean goldMaster) { + String id, String name, FilesList files, Integer status, Owner owner, Set children, + Set> sections, String vAppScopedLocalId, Boolean ovfDescriptorUploaded, Boolean goldMaster) { super(href, type, links, description, tasksInProgress, id, name, files, status); this.owner = owner; this.children = VAppTemplateChildren.builder().vms(children).build(); @@ -305,20 +307,6 @@ public class VAppTemplate extends ResourceEntityType { * Contains ovf sections for vApp template. * Gets the value of the section property. *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the section property. - *

- *

- * For example, to add a new item, do as follows: - *

-    *    getSection().add(newItem);
-    * 
- *

- *

- *

* Objects of the following type(s) are allowed in the list * {@link JAXBElement }{@code <}{@link SectionType }{@code >} * {@link JAXBElement }{@code <}{@link VirtualHardwareSection }{@code >} @@ -339,8 +327,8 @@ public class VAppTemplate extends ResourceEntityType { * {@link JAXBElement }{@code <}{@link DiskSection }{@code >} * {@link JAXBElement }{@code <}{@link InstallSection }{@code >} */ - public Set getSections() { - return this.sections; + public Set> getSections() { + return Collections.unmodifiableSet(this.sections); } /** diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplateChildren.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplateChildren.java index 6a39be85c8..2d87f7b934 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplateChildren.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplateChildren.java @@ -22,6 +22,7 @@ package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; +import java.util.Collections; import java.util.Set; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -103,7 +104,7 @@ public class VAppTemplateChildren { * Gets the value of the vm property. */ public Set getVms() { - return this.vms; + return Collections.unmodifiableSet(this.vms); } @Override diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java index 30235d377b..144bee79a9 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java @@ -89,7 +89,7 @@ public abstract class SectionType> { @XmlElement(name = "Info") private String info; @XmlAttribute(namespace = VCLOUD_OVF_NS) - private boolean required; + private Boolean required; protected SectionType(@Nullable String info, @Nullable Boolean required) { this.info = info; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateAsyncClient.java index a6e19b44c2..adfd70e28f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateAsyncClient.java @@ -73,7 +73,7 @@ public interface VAppTemplateAsyncClient { */ @POST @Consumes(TASK) - @Path("/consolidate") + @Path("/action/consolidate") @JAXBResponseParser ListenableFuture consolidateVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); @@ -113,7 +113,7 @@ public interface VAppTemplateAsyncClient { @Consumes(CUSTOMIZATION_SECTION) @Path("/customizationSection") @JAXBResponseParser - CustomizationSection getVAppTemplateCustomizationSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); + ListenableFuture getVAppTemplateCustomizationSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); /** * @see VAppTemplateClient#editVAppTemplateCustomizationSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.CustomizationSection) @@ -133,7 +133,7 @@ public interface VAppTemplateAsyncClient { @Consumes(GUEST_CUSTOMIZATION_SECTION) @Path("/guestCustomizationSection") @JAXBResponseParser - GuestCustomizationSection getVAppTemplateGuestCustomizationSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); + ListenableFuture getVAppTemplateGuestCustomizationSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); /** * @see VAppTemplateClient#editVAppTemplateGuestCustomizationSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection) @@ -143,7 +143,7 @@ public interface VAppTemplateAsyncClient { @Consumes(TASK) @Path("/guestCustomizationSection") @JAXBResponseParser - Task editVAppTemplateGuestCustomizationSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, + ListenableFuture editVAppTemplateGuestCustomizationSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, @BinderParam(BindToXMLPayload.class) GuestCustomizationSection section); /** @@ -153,7 +153,7 @@ public interface VAppTemplateAsyncClient { @Consumes(LEASE_SETTINGS_SECTION) @Path("/leaseSettingsSection") @JAXBResponseParser - LeaseSettingsSection getVappTemplateLeaseSettingsSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); + ListenableFuture getVappTemplateLeaseSettingsSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); /** * @see VAppTemplateClient#editVappTemplateLeaseSettingsSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection) @@ -167,109 +167,122 @@ public interface VAppTemplateAsyncClient { @BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection); /** - * @see VAppTemplateClient#getMetadataForVappTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier) + * @see VAppTemplateClient#getVAppTemplateMetadata(org.jclouds.vcloud.director.v1_5.domain.URISupplier) */ @GET @Consumes(METADATA) @Path("/metadata") @JAXBResponseParser - ListenableFuture getMetadataForVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); + ListenableFuture getVAppTemplateMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); @PUT @Produces(METADATA) @Consumes(TASK) @Path("/metadata") @JAXBResponseParser - ListenableFuture editMetadataForVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, + ListenableFuture editVAppTemplateMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, @BinderParam(BindToXMLPayload.class) Metadata metadata); /** - * @see VAppTemplateClient#editMetadataEntryForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, String, org.jclouds.vcloud.director.v1_5.domain.MetadataEntry) + * @see VAppTemplateClient#getVAppTemplateMetadataValue(org.jclouds.vcloud.director.v1_5.domain.URISupplier, String) */ @GET @Consumes(METADATA_ENTRY) @Path("/metadata/{key}") - ListenableFuture getMetadataEntryForVAppTemplateAndKey(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, + @JAXBResponseParser + ListenableFuture getVAppTemplateMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, @PathParam("key") String key); /** - * @see VAppTemplateClient#editMetadataEntryForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, String, org.jclouds.vcloud.director.v1_5.domain.MetadataEntry) + * @see VAppTemplateClient#editVAppTemplateMetadataValue(org.jclouds.vcloud.director.v1_5.domain.URISupplier, String, org.jclouds.vcloud.director.v1_5.domain.MetadataValue) */ @PUT @Produces(METADATA_ENTRY) @Consumes(TASK) @Path("/metadata/{key}") - ListenableFuture editMetadataEntryForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, + @JAXBResponseParser + ListenableFuture editVAppTemplateMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, @PathParam("key") String key, - @BinderParam(BindToXMLPayload.class) MetadataEntry entry); + @BinderParam(BindToXMLPayload.class) MetadataValue value); /** - * @see VAppTemplateClient#deleteMetadataEntryForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, String) + * @see VAppTemplateClient#deleteVAppTemplateMetadataValue(URISupplier, String) */ @DELETE @Consumes(TASK) @Path("/metadata/{key}") - ListenableFuture deleteMetadataEntryForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, + @JAXBResponseParser + ListenableFuture deleteVAppTemplateMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, @PathParam("key") String key); /** - * @see VAppTemplateClient#getNetworkConfigSectionForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier) + * @see VAppTemplateClient#getVAppTemplateNetworkConfigSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier) */ @GET @Consumes(NETWORK_CONFIG_SECTION) @Path("/networkConfigSection") - ListenableFuture getNetworkConfigSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); + @JAXBResponseParser + ListenableFuture getVAppTemplateNetworkConfigSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); /** - * @see VAppTemplateClient#editNetworkConfigSectionForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection) + * @see VAppTemplateClient#editVAppTemplateNetworkConfigSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection) */ @PUT @Produces(NETWORK_CONFIG_SECTION) @Consumes(TASK) @Path("/networkConfigSection") - ListenableFuture editNetworkConfigSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, + @JAXBResponseParser + ListenableFuture editVAppTemplateNetworkConfigSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, @BinderParam(BindToXMLPayload.class) NetworkConfigSection section); /** - * @see VAppTemplateClient#getNetworkConnectionSectionForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier) + * @see VAppTemplateClient#getVAppTemplateNetworkConnectionSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier) */ @GET @Consumes(NETWORK_CONNECTION_SECTION) @Path("/networkConnectionSection") - ListenableFuture getNetworkConnectionSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); + @JAXBResponseParser + ListenableFuture getVAppTemplateNetworkConnectionSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); /** - * @see VAppTemplateClient#editNetworkConnectionSectionForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection) + * @see VAppTemplateClient#editVAppTemplateNetworkConnectionSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection) */ @PUT @Produces(NETWORK_CONNECTION_SECTION) @Consumes(TASK) @Path("/networkConnectionSection") - ListenableFuture editNetworkConnectionSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, + @JAXBResponseParser + ListenableFuture editVAppTemplateNetworkConnectionSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, @BinderParam(BindToXMLPayload.class) NetworkConnectionSection section); /** - * @see VAppTemplateClient#getNetworkSectionForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier) + * @see VAppTemplateClient#getVAppTemplateNetworkSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier) */ @GET @Consumes(NETWORK_SECTION) @Path("/networkSection") - ListenableFuture getNetworkSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); + @JAXBResponseParser + ListenableFuture getVAppTemplateNetworkSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); + /** + * @see VAppTemplateClient#editVAppTemplateNetworkSection(URISupplier, NetworkSection) + */ @PUT @Produces(NETWORK_SECTION) @Consumes(TASK) @Path("/networkSection") - ListenableFuture editNetworkSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, + @JAXBResponseParser + ListenableFuture editVAppTemplateNetworkSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, @BinderParam(BindToXMLPayload.class) NetworkSection section); /** - * @see VAppTemplateClient#getOvfForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier) + * @see VAppTemplateClient#getVAppTemplateOvf(org.jclouds.vcloud.director.v1_5.domain.URISupplier) */ @GET @Consumes(ENVELOPE) @Path("/ovf") - ListenableFuture getOvfForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); + @JAXBResponseParser + ListenableFuture getVAppTemplateOvf(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); /** * @see VAppTemplateClient#getOwnerOfVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier) @@ -277,6 +290,7 @@ public interface VAppTemplateAsyncClient { @GET @Consumes(OWNER) @Path("/owner") + @JAXBResponseParser ListenableFuture getOwnerOfVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); /** @@ -285,6 +299,7 @@ public interface VAppTemplateAsyncClient { @GET @Consumes(PRODUCT_SECTION_LIST) @Path("/productSections") + @JAXBResponseParser ListenableFuture getProductSectionsForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference); /** @@ -294,6 +309,7 @@ public interface VAppTemplateAsyncClient { @Produces(PRODUCT_SECTION_LIST) @Consumes(TASK) @Path("/productSections") + @JAXBResponseParser ListenableFuture editProductSectionsForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference, @BinderParam(BindToXMLPayload.class) ProductSectionList sections); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClient.java index 6e0408cf38..949c12aa4d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClient.java @@ -146,7 +146,7 @@ public interface VAppTemplateClient { * @param templateReference the reference to the template * @return the requested metadata */ - Metadata getMetadataForVappTemplate(URISupplier templateReference); + Metadata getVAppTemplateMetadata(URISupplier templateReference); /** * Merges the metadata for a vApp Template with the information provided. @@ -154,7 +154,7 @@ public interface VAppTemplateClient { * @param templateReference the reference to the template * @return the task performing the action */ - Task editMetadataForVappTemplate(URISupplier templateReference, Metadata metadata); + Task editVAppTemplateMetadata(URISupplier templateReference, Metadata metadata); /** * Consolidates a VM @@ -162,7 +162,7 @@ public interface VAppTemplateClient { * @param templateReference the reference to the template * @return the task performing the action */ - MetadataEntry getMetadataEntryForVAppTemplateAndKey(URISupplier templateReference, String key); + MetadataValue getVAppTemplateMetadataValue(URISupplier templateReference, String key); /** * Consolidates a VM @@ -170,7 +170,7 @@ public interface VAppTemplateClient { * @param templateReference the reference to the template * @return the task performing the action */ - Task editMetadataEntryForVAppTemplate(URISupplier templateReference, String key, MetadataEntry entry); + Task editVAppTemplateMetadataValue(URISupplier templateReference, String key, MetadataValue value); /** * Consolidates a VM @@ -178,7 +178,7 @@ public interface VAppTemplateClient { * @param templateReference the reference to the template * @return the task performing the action */ - Task deleteMetadataEntryForVAppTemplate(URISupplier templateReference, String key); + Task deleteVAppTemplateMetadataValue(URISupplier templateReference, String key); /** * Retrieves the network config section of a vApp or vApp template. @@ -186,7 +186,7 @@ public interface VAppTemplateClient { * @param templateReference the reference to the template * @return the network config section requested */ - NetworkConfigSection getNetworkConfigSectionForVAppTemplate(URISupplier templateReference); + NetworkConfigSection getVAppTemplateNetworkConfigSection(URISupplier templateReference); /** * Modifies the network config section of a vApp or vApp template. @@ -194,7 +194,7 @@ public interface VAppTemplateClient { * @param templateReference the reference to the template * @return the task performing the action */ - Task editNetworkConfigSectionForVAppTemplate(URISupplier templateReference, NetworkConfigSection section); + Task editVAppTemplateNetworkConfigSection(URISupplier templateReference, NetworkConfigSection section); /** * Retrieves the network connection section of a vApp or vApp template. @@ -202,7 +202,7 @@ public interface VAppTemplateClient { * @param templateReference the reference to the template * @return the network connection section requested */ - NetworkConnectionSection getNetworkConnectionSectionForVAppTemplate(URISupplier templateReference); + NetworkConnectionSection getVAppTemplateNetworkConnectionSection(URISupplier templateReference); /** * Modifies the network connection section of a vApp or vApp template. @@ -210,7 +210,7 @@ public interface VAppTemplateClient { * @param templateReference the reference to the template * @return the task performing the action */ - Task editNetworkConnectionSectionForVAppTemplate(URISupplier templateReference, NetworkConnectionSection section); + Task editVAppTemplateNetworkConnectionSection(URISupplier templateReference, NetworkConnectionSection section); /** * Retrieves the network section of a vApp or vApp template. @@ -218,7 +218,7 @@ public interface VAppTemplateClient { * @param templateReference the reference to the template * @return the network section requested */ - NetworkSection getNetworkSectionForVAppTemplate(URISupplier templateReference); + NetworkSection getVAppTemplateNetworkSection(URISupplier templateReference); /** * Modifies the network section of a vApp or vApp template. @@ -226,7 +226,7 @@ public interface VAppTemplateClient { * @param templateReference the reference to the template * @return the task performing the action */ - Task editNetworkSectionForVAppTemplate(URISupplier templateReference, NetworkSection section); + Task editVAppTemplateNetworkSection(URISupplier templateReference, NetworkSection section); /** * Retrieves an OVF descriptor of a vApp template. @@ -234,7 +234,7 @@ public interface VAppTemplateClient { * @param templateReference the reference to the template * @return the task performing the action */ - Envelope getOvfForVAppTemplate(URISupplier templateReference); + Envelope getVAppTemplateOvf(URISupplier templateReference); /** * Retrieves vApp template owner. diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java index 409e34e873..697bfbb720 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java @@ -329,7 +329,7 @@ public class Checks { public static void checkNetworkFeatures(NetworkFeatures features) { // Check optional fields if (features.getNetworkServices() != null) { - for (NetworkService service : features.getNetworkServices()) { + for (NetworkServiceType service : features.getNetworkServices()) { checkNetworkService(service); } } @@ -352,7 +352,7 @@ public class Checks { checkIpAddress(routerInfo.getExternalIp()); } - public static void checkNetworkService(NetworkService service) { + public static void checkNetworkService(NetworkServiceType service) { // NOTE isEnabled cannot be checked } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientExpectTest.java index 3cf590e9e5..99a833caa7 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientExpectTest.java @@ -19,20 +19,19 @@ package org.jclouds.vcloud.director.v1_5.features; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; +import java.net.URI; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Locale; import org.jclouds.vcloud.director.v1_5.domain.*; -import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; import org.testng.annotations.Test; -import java.net.URI; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.fail; +import com.google.common.collect.ImmutableSet; /** * Tests the request/response behavior of {@link org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient} @@ -43,7 +42,7 @@ import static org.testng.Assert.fail; public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public void testVAppTemplate() { - final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-xxxx-xxxx-xxxx-xxx"; + final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"; Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build(); VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse, @@ -53,12 +52,13 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build(), new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId).acceptMedia(TASK).httpRequestBuilder().build(), new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build() - ).getVAppTemplateClient(); + ).getVAppTemplateClient(); assertNotNull(client); VAppTemplate template = client.getVAppTemplate(vappTemplateRef); + assertEquals(template, exampleTemplate()); - + Task task = client.editVAppTemplate(vappTemplateRef, template); assertNotNull(task); @@ -66,12 +66,198 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx assertNotNull(task); } + public void testConsolidateVAppTemplate() { + final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"; + Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build(); + + VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/consolidate").acceptMedia(TASK).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build() + ).getVAppTemplateClient(); + + assertNotNull(client); + Task task = client.consolidateVappTemplate(vappTemplateRef); + assertNotNull(task); + } + + public void testDisableDownloadVAppTemplate() { + final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"; + Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build(); + + VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/disableDownload").acceptMedia(TASK).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build() + ).getVAppTemplateClient(); + + assertNotNull(client); + Task task = client.disableDownloadVappTemplate(vappTemplateRef); + assertNotNull(task); + } + + public void testEnableDownloadVAppTemplate() { + final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"; + Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build(); + + VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/enableDownload").acceptMedia(TASK).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build() + ).getVAppTemplateClient(); + + assertNotNull(client); + Task task = client.enableDownloadVappTemplate(vappTemplateRef); + assertNotNull(task); + } + + public void testRelocateVAppTemplate() { + final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"; + Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build(); + + VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/enableDownload").xmlFilePayload("/vappTemplate/relocateParams.xml", RELOCATE_TEMPLATE).acceptMedia(TASK).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build() + ).getVAppTemplateClient(); + + assertNotNull(client); + + Reference datastore = Reference.builder().href(URI.create("https://vcloud.example.com/api/admin/extension/datastore/607")).build(); + RelocateParams params = RelocateParams.builder().datastore(datastore).build(); + + Task task = client.relocateVappTemplate(vappTemplateRef, params); + assertNotNull(task); + } + + public void testCustomizationSection() { + final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"; + Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build(); + + VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/customizationSection").acceptMedia(CUSTOMIZATION_SECTION).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/customizationSection.xml", CUSTOMIZATION_SECTION).httpResponseBuilder().build(), + new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/customizationSection").xmlFilePayload("/vapptemplate/customizationSection.xml", CUSTOMIZATION_SECTION).acceptMedia(TASK).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build() + ).getVAppTemplateClient(); + + assertNotNull(client); + CustomizationSection section = client.getVAppTemplateCustomizationSection(vappTemplateRef); + + assertEquals(section, exampleCustomizationSection()); + + Task task = client.editVAppTemplateCustomizationSection(vappTemplateRef, section); + assertNotNull(task); + } + + public void testGuestCustomizationSection() { + final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"; + Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build(); + + VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/guestCustomizationSection").acceptMedia(GUEST_CUSTOMIZATION_SECTION).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/guestCustomizationSection.xml", GUEST_CUSTOMIZATION_SECTION).httpResponseBuilder().build(), + new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/guestCustomizationSection").xmlFilePayload("/vapptemplate/guestCustomizationSection.xml", GUEST_CUSTOMIZATION_SECTION).acceptMedia(TASK).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build() + ).getVAppTemplateClient(); + + assertNotNull(client); + GuestCustomizationSection section = client.getVAppTemplateGuestCustomizationSection(vappTemplateRef); + + assertEquals(section, exampleGuestCustomizationSection()); + + Task task = client.editVAppTemplateGuestCustomizationSection(vappTemplateRef, section); + assertNotNull(task); + } + + public void testLeaseSettingsSection() throws ParseException { + final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"; + Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build(); + + VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/leaseSettingsSection").acceptMedia(LEASE_SETTINGS_SECTION).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/leaseSettingsSection.xml", LEASE_SETTINGS_SECTION).httpResponseBuilder().build(), + new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/leaseSettingsSection").xmlFilePayload("/vapptemplate/leaseSettingsSection.xml", LEASE_SETTINGS_SECTION).acceptMedia(TASK).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build() + ).getVAppTemplateClient(); + + assertNotNull(client); + LeaseSettingsSection section = client.getVappTemplateLeaseSettingsSection(vappTemplateRef); + + assertEquals(section, exampleLeaseSettingsSection()); + + Task task = client.editVappTemplateLeaseSettingsSection(vappTemplateRef, section); + assertNotNull(task); + } + + public void testVappTemplateMetadata() { + final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"; + Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build(); + + VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata").acceptMedia(METADATA).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/metadata.xml", METADATA).httpResponseBuilder().build(), + new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/metadata").xmlFilePayload("/vapptemplate/metadata.xml", METADATA).acceptMedia(TASK).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build() + ).getVAppTemplateClient(); + + assertNotNull(client); + Metadata metadata = client.getVAppTemplateMetadata(vappTemplateRef); + + assertEquals(metadata, exampleMetadata()); + + Task task = client.editVAppTemplateMetadata(vappTemplateRef, metadata); + assertNotNull(task); + } + + public void testVappTemplateMetadataValue() { + final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"; + Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build(); + + VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata/12345").acceptMedia(METADATA_ENTRY).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/metadataValue.xml", METADATA_ENTRY).httpResponseBuilder().build(), + new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/metadata/12345").xmlFilePayload("/vapptemplate/metadataValue.xml", METADATA_ENTRY).acceptMedia(TASK).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build(), + new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId + "/metadata/12345").acceptMedia(TASK).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build() + ).getVAppTemplateClient(); + + assertNotNull(client); + MetadataValue metadata = client.getVAppTemplateMetadataValue(vappTemplateRef, "12345"); + + assertEquals(metadata, exampleMetadataValue()); + + Task task = client.editVAppTemplateMetadataValue(vappTemplateRef, "12345", metadata); + assertNotNull(task); + + task = client.deleteVAppTemplateMetadataValue(vappTemplateRef, "12345"); + assertNotNull(task); + } + + public void testNetworkConfigSection() throws ParseException { + final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"; + Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build(); + + VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/networkConfigSection").acceptMedia(NETWORK_CONFIG_SECTION).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/networkConfigSection.xml", NETWORK_CONFIG_SECTION).httpResponseBuilder().build(), + new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/networkConfigSection").xmlFilePayload("/vapptemplate/networkConfigSection.xml", NETWORK_CONFIG_SECTION).acceptMedia(TASK).httpRequestBuilder().build(), + new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build() + ).getVAppTemplateClient(); + + assertNotNull(client); + + NetworkConfigSection section = client.getVAppTemplateNetworkConfigSection(vappTemplateRef); + + assertEquals(section, exampleNetworkConfigSection()); + + Task task = client.editVAppTemplateNetworkConfigSection(vappTemplateRef, section); + assertNotNull(task); + } + private VAppTemplate exampleTemplate() { Link aLink = Link.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/vdc/d16d333b-e3c0-4176-845d-a5ee6392df07")) .type("application/vnd.vmware.vcloud.vdc+xml").rel("up").build(); Link bLink = Link.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9")) .rel("remove").build(); - + Owner owner = Owner.builder().user(Reference.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69")).name("x@jclouds.org").type("application/vnd.vmware.admin.user+xml").build()).build(); LeaseSettingsSection leaseSettings = LeaseSettingsSection.builder().type("application/vnd.vmware.vcloud.leaseSettingsSection+xml") @@ -82,14 +268,14 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx .storageLeaseInSeconds(0) .required(false) .build(); - CustomizationSection customization = CustomizationSection.builder() + CustomizationSection customizationSection = CustomizationSection.builder() .type("application/vnd.vmware.vcloud.customizationSection+xml") .info("VApp template customization section") .customizeOnInstantiate(true) .href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/customizationSection/")) .required(false) .build(); - + return VAppTemplate.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9")) .links(ImmutableSet.of(aLink, bLink)) .children(ImmutableSet.of()) @@ -97,12 +283,130 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx .description("For testing") .id("urn:vcloud:vapptemplate:ef4415e6-d413-4cbb-9262-f9bbec5f2ea9") .name("ubuntu10") - .sections(ImmutableSet.of(leaseSettings, customization)) + .sections(ImmutableSet.of(leaseSettings, customizationSection)) .status(-1) .owner(owner) .ovfDescriptorUploaded(true) .goldMaster(false) .build(); + } + private CustomizationSection exampleCustomizationSection() { + return CustomizationSection.builder() + .links(ImmutableSet.of( + Link.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/customizationSection/")) + .type("application/vnd.vmware.vcloud.customizationSection+xml").rel("edit").build() + )) + .type("application/vnd.vmware.vcloud.customizationSection+xml") + .info("VApp template customization section") + .customizeOnInstantiate(true) + .href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/customizationSection/")) + .required(false) + .build(); + } + + private GuestCustomizationSection exampleGuestCustomizationSection() { + return GuestCustomizationSection.builder() + .links(ImmutableSet.of( + Link.builder().href(URI.create("http://vcloud.example.com/api/v1.5/vAppTemplate/vAppTemplate-12/guestCustomizationSection/")) + .type("application/vnd.vmware.vcloud.guestCustomizationSection+xml").rel("edit").build() + )) + .enabled(false) + .changeSid(false) + .virtualMachineId("4") + .joinDomainEnabled(false) + .useOrgSettings(false) + .adminPasswordEnabled(false) + .adminPasswordAuto(true) + .resetPasswordRequired(false) + .type("application/vnd.vmware.vcloud.guestCustomizationSection+xml") + .info("Specifies Guest OS Customization Settings") + .computerName("ubuntu10-x86") + .customizationScript("ls") + .href(URI.create("http://vcloud.example.com/api/v1.5/vAppTemplate/vAppTemplate-12/guestCustomizationSection/")) + .required(false) + .build(); + } + + private LeaseSettingsSection exampleLeaseSettingsSection() throws ParseException { + SimpleDateFormat iso8601SimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US); + return LeaseSettingsSection.builder().type("application/vnd.vmware.vcloud.leaseSettingsSection+xml") + .href(URI.create("http://vcloud.example.com/api/v1.5/vAppTemplate/vAppTemplate-7/leaseSettingsSection/")) + .info("VApp lease settings") + .links(ImmutableSet.of(Link.builder().rel("edit").type("application/vnd.vmware.vcloud.leaseSettingsSection+xml") + .href(URI.create("http://vcloud.example.com/api/v1.5/vAppTemplate/vAppTemplate-7/leaseSettingsSection/")).build())) + .storageLeaseInSeconds(3600) + .deploymentLeaseInSeconds(3600) + // note adjusted to UTC + .deploymentLeaseExpiration(iso8601SimpleDateFormat.parse("2010-01-21T21:50:59.764")) + .required(false) + .build(); + } + + private Metadata exampleMetadata() { + return Metadata.builder() + .href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/metadata")) + .type("application/vnd.vmware.vcloud.metadata+xml") + .link(Link.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9")) + .type("application/vnd.vmware.vcloud.vAppTemplate+xml").rel("up").build()) + .entry(MetadataEntry.builder().key("key").value("value").build()).build(); + } + + private MetadataValue exampleMetadataValue() { + return MetadataValue.builder().value("some value").build(); + } + + private NetworkConfigSection exampleNetworkConfigSection() throws ParseException { + + FirewallService firewallService = + FirewallService.builder().firewallRules( + ImmutableSet.of( + FirewallRule.builder() + .isEnabled(true) + .description("FTP Rule") + .policy("allow") + .protocols(FirewallRuleProtocols.builder().tcp(true).build()) + .port(21) + .destinationIp("10.147.115.1") + .build(), + FirewallRule.builder() + .isEnabled(true) + .description("SSH Rule") + .policy("allow") + .protocols(FirewallRuleProtocols.builder().tcp(true).build()) + .port(22) + .destinationIp("10.147.115.1") + .build())).build(); + + NatService natService = NatService.builder().enabled(true).natType("ipTranslation").policy("allowTraffic") + .natRules(ImmutableSet.of(NatRule.builder().oneToOneVmRule( + NatOneToOneVmRule.builder().mappingMode("manual").externalIpAddress("64.100.10.1").vAppScopedVmId("20ea086f-1a6a-4fb2-8e2e-23372facf7de").vmNicId(0).build()).build() + )).build(); + + NetworkConfiguration networkConfiguration = NetworkConfiguration.builder().ipScope( + IpScope.builder() + .isInherited(false) + .gateway("10.147.56.253") + .netmask("255.255.255.0") + .dns1("10.147.115.1") + .dns2("10.147.115.2") + .dnsSuffix("example.com") + .ipRanges(IpRanges.builder().ipRange(IpRange.builder().startAddress("10.147.56.1").endAddress("10.147.56.1").build()).build()) + .build()) + .parentNetwork(Reference.builder().href(URI.create("http://vcloud.example.com/api/v1.0/network/54")).type("application/vnd.vmware.vcloud.network+xml").name("Internet").build()) + .fenceMode("natRouted") + .features(NetworkFeatures.builder().services(ImmutableSet.of(firewallService, natService)).build()) + .build(); + + return NetworkConfigSection.builder() + .info("Configuration parameters for logical networks") + .networkConfigs( + ImmutableSet.of( + VAppNetworkConfiguration.builder() + .networkName("vAppNetwork") + .configuration( + networkConfiguration + ).build() + )).build(); } } diff --git a/labs/vcloud-director/src/test/resources/vapptemplate/customizationSection.xml b/labs/vcloud-director/src/test/resources/vapptemplate/customizationSection.xml new file mode 100644 index 0000000000..08569393a1 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/vapptemplate/customizationSection.xml @@ -0,0 +1,11 @@ + + + VApp template customization section + true + + diff --git a/labs/vcloud-director/src/test/resources/vapptemplate/guestCustomizationSection.xml b/labs/vcloud-director/src/test/resources/vapptemplate/guestCustomizationSection.xml new file mode 100644 index 0000000000..8b92156233 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/vapptemplate/guestCustomizationSection.xml @@ -0,0 +1,19 @@ + + Specifies Guest OS Customization Settings + false + false + 4 + false + false + false + true + false + ls + ubuntu10-x86 + + \ No newline at end of file diff --git a/labs/vcloud-director/src/test/resources/vapptemplate/leaseSettingsSection.xml b/labs/vcloud-director/src/test/resources/vapptemplate/leaseSettingsSection.xml new file mode 100644 index 0000000000..6cc1dc41d7 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/vapptemplate/leaseSettingsSection.xml @@ -0,0 +1,12 @@ + + VApp lease settings + + 3600 + 3600 + 2010-01-21T21:50:59.764Z + \ No newline at end of file diff --git a/labs/vcloud-director/src/test/resources/vapptemplate/metadata.xml b/labs/vcloud-director/src/test/resources/vapptemplate/metadata.xml new file mode 100644 index 0000000000..e97742462e --- /dev/null +++ b/labs/vcloud-director/src/test/resources/vapptemplate/metadata.xml @@ -0,0 +1,8 @@ + + + + + key + value + + diff --git a/labs/vcloud-director/src/test/resources/vapptemplate/metadataValue.xml b/labs/vcloud-director/src/test/resources/vapptemplate/metadataValue.xml new file mode 100644 index 0000000000..96d29f23b1 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/vapptemplate/metadataValue.xml @@ -0,0 +1,4 @@ + + some value + \ No newline at end of file diff --git a/labs/vcloud-director/src/test/resources/vapptemplate/networkConfigSection.xml b/labs/vcloud-director/src/test/resources/vapptemplate/networkConfigSection.xml new file mode 100644 index 0000000000..541a99ba3c --- /dev/null +++ b/labs/vcloud-director/src/test/resources/vapptemplate/networkConfigSection.xml @@ -0,0 +1,64 @@ + + Configuration parameters for logical networks + + + + false + 10.147.56.253 + 255.255.255.0 + 10.147.115.1 + 10.147.115.2 + example.com + + + 10.147.56.1 + 10.147.56.1 + + + + + natRouted + + + true + + true + FTP Rule + allow + + true + + 21 + 10.147.115.1 + + + true + SSH Rule + allow + + true + + 22 + 10.147.115.1 + + + + true + ipTranslation + allowTraffic + + + manual + 64.100.10.1 + 20ea086f-1a6a-4fb2-8e2e-23372facf7de + 0 + + + + + + + \ No newline at end of file diff --git a/labs/vcloud-director/src/test/resources/vapptemplate/relocateParams.xml b/labs/vcloud-director/src/test/resources/vapptemplate/relocateParams.xml new file mode 100644 index 0000000000..175bb37914 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/vapptemplate/relocateParams.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file