VCloud Director 1.5: vAppTemplate client - expect tests for most methods and supporting domain objects

This commit is contained in:
Adam Lowe 2012-03-05 21:34:56 +00:00
parent d1b0da081d
commit 139fe394f7
36 changed files with 4322 additions and 100 deletions

View File

@ -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.???";

View File

@ -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.
*
* <p>Java class for DhcpService complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="DhcpService">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
* &lt;sequence>
* &lt;element name="DefaultLeaseTime" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
* &lt;element name="MaxLeaseTime" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
* &lt;element name="IpRange" type="{http://www.vmware.com/vcloud/v1.5}IpRangeType" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
* @author Adam Lowe
*/
@XmlRootElement(name = "DhcpService")
@XmlType(propOrder = {
"defaultLeaseTime",
"maxLeaseTime",
"ipRange"
})
public class DhcpService extends NetworkServiceType<DhcpService> {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromDhcpService(this);
}
public static class Builder extends NetworkServiceType.Builder<DhcpService> {
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<DhcpService> 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);
}
}

View File

@ -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.
* <p/>
* <p/>
* <p>Java class for FirewallRule complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="FirewallRule">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="IsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="Policy" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="Protocols" minOccurs="0">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;choice>
* &lt;sequence>
* &lt;element name="Tcp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="Udp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;/sequence>
* &lt;element name="Icmp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="Any" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;/choice>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;element name="Port" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="DestinationIp" type="{http://www.vmware.com/vcloud/v1.5}FirewallIpAddressType"/>
* &lt;element name="SourcePort" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="SourceIp" type="{http://www.vmware.com/vcloud/v1.5}FirewallIpAddressType"/>
* &lt;element name="Direction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="EnableLogging" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@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();
}
}

View File

@ -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;
/**
* <p>Java class for anonymous complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;choice>
* &lt;sequence>
* &lt;element name="Tcp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="Udp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;/sequence>
* &lt;element name="Icmp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="Any" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;/choice>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@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();
}
}

View File

@ -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.
* <p/>
* <p/>
* <p>Java class for FirewallService complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="FirewallService">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
* &lt;sequence>
* &lt;element name="DefaultAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="LogDefaultAction" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="FirewallRule" type="{http://www.vmware.com/vcloud/v1.5}FirewallRuleType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlRootElement(name = "FirewallService")
@XmlType(propOrder = {
"defaultAction",
"logDefaultAction",
"firewallRules"
})
public class FirewallService extends NetworkServiceType<FirewallService> {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromFirewallService(this);
}
public static class Builder extends NetworkServiceType.Builder<FirewallService> {
private String defaultAction;
private Boolean logDefaultAction;
private Set<FirewallRule> 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<FirewallRule> firewallRules) {
this.firewallRules = checkNotNull(firewallRules, "firewallRules");
return this;
}
public FirewallService build() {
return new FirewallService(isEnabled, defaultAction, logDefaultAction, firewallRules);
}
@Override
public Builder fromNetworkServiceType(NetworkServiceType<FirewallService> 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<FirewallRule> 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<FirewallRule> 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<FirewallRule> 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();
}
}

View File

@ -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.
*
*
* <p>Java class for IpsecVpnLocalPeer complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="IpsecVpnLocalPeer">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}IpsecVpnManagedPeerType">
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlRootElement(name = "IpsecVpnLocalPeer")
public class IpsecVpnLocalPeer
extends IpsecVpnManagedPeerType<IpsecVpnLocalPeer>
{
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromIpsecVpnLocalPeer(this);
}
public static class Builder extends IpsecVpnManagedPeerType.Builder<IpsecVpnLocalPeer> {
public IpsecVpnLocalPeer build() {
return new IpsecVpnLocalPeer(id, name);
}
@Override
public Builder fromIpsecVpnManagedPeerType(IpsecVpnManagedPeerType<IpsecVpnLocalPeer> 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
}
}

View File

@ -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<T extends IpsecVpnManagedPeerType<T>> extends IpsecVpnPeerType<T> {
public static abstract class Builder<T extends IpsecVpnManagedPeerType<T>> {
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<T> fromIpsecVpnManagedPeerType(IpsecVpnManagedPeerType<T> 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);
}
}

View File

@ -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<T extends IpsecVpnPeerType<T>> {
}

View File

@ -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.
* <p/>
* <p/>
* <p>Java class for IpsecVpnRemotePeer complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="IpsecVpnRemotePeer">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}IpsecVpnManagedPeerType">
* &lt;sequence>
* &lt;element name="VcdUrl" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="VcdOrganization" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="VcdUsername" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlRootElement(name = "IpsecVpnRemotePeer")
@XmlType(propOrder = {
"vcdUrl",
"vcdOrganization",
"vcdUsername"
})
public class IpsecVpnRemotePeer extends IpsecVpnManagedPeerType<IpsecVpnRemotePeer> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromIpsecVpnRemotePeer(this);
}
public static class Builder extends IpsecVpnManagedPeerType.Builder<IpsecVpnRemotePeer> {
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<IpsecVpnRemotePeer> 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);
}
}

View File

@ -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.
* <p/>
* <p/>
* <p>Java class for IpsecVpnService complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="IpsecVpnService">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
* &lt;sequence>
* &lt;element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType" minOccurs="0"/>
* &lt;element name="PublicIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType" minOccurs="0"/>
* &lt;element name="IpsecVpnTunnel" type="{http://www.vmware.com/vcloud/v1.5}IpsecVpnTunnelType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlRootElement(name = "IpsecVpnService")
@XmlType(propOrder = {
"externalIpAddress",
"publicIpAddress",
"ipsecVpnTunnels"
})
public class IpsecVpnService extends NetworkServiceType<IpsecVpnService> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromIpsecVpnService(this);
}
public static class Builder extends NetworkServiceType.Builder<IpsecVpnService> {
private String externalIpAddress;
private String publicIpAddress;
private List<IpsecVpnTunnel> 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<IpsecVpnTunnel> ipsecVpnTunnels) {
this.ipsecVpnTunnels = checkNotNull(ipsecVpnTunnels, "ipsecVpnTunnels");
return this;
}
public IpsecVpnService build() {
return new IpsecVpnService(isEnabled, externalIpAddress, publicIpAddress, ipsecVpnTunnels);
}
@Override
public Builder fromNetworkServiceType(NetworkServiceType<IpsecVpnService> 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> 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<IpsecVpnTunnel> 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<IpsecVpnTunnel> 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();
}
}

View File

@ -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.
*
*
* <p>Java class for IpsecVpnThirdPartyPeer complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="IpsecVpnThirdPartyPeer">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}IpsecVpnUnmanagedPeerType">
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlRootElement(name = "IpsecVpnThirdPartyPeer")
public class IpsecVpnThirdPartyPeer extends IpsecVpnUnmanagedPeerType<IpsecVpnThirdPartyPeer> {
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
}
}

View File

@ -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.
* <p/>
* <p/>
* <p>Java class for IpsecVpnTunnel complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="IpsecVpnTunnel">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element ref="{http://www.vmware.com/vcloud/v1.5}IpsecVpnPeer"/>
* &lt;element name="PeerIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;element name="PeerNetworkAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;element name="PeerNetworkMask" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;element name="SharedSecret" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="EncryptionProtocol" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="Mtu" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="IsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* &lt;element name="IsOperational" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="ErrorDetails" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@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();
}
}

View File

@ -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<T extends IpsecVpnUnmanagedPeerType<T>> extends IpsecVpnPeerType<T> {
}

View File

@ -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.
* <p/>
* <p/>
* <p>Java class for NatOneToOneBasicRule complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="NatOneToOneBasicRule">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="MappingMode" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;element name="InternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@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();
}
}

View File

@ -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.
* <p/>
* <p/>
* <p>Java class for NatOneToOneVmRule complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="NatOneToOneVmRule">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="MappingMode" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType" minOccurs="0"/>
* &lt;element name="VAppScopedVmId" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="VmNicId" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@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();
}
}

View File

@ -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.
* <p/>
* <p/>
* <p>Java class for NatPortForwardingRule complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="NatPortForwardingRule">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;element name="ExternalPort" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="InternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;element name="InternalPort" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="Protocol" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@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();
}
}

View File

@ -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.
* <p/>
* <p/>
* <p>Java class for NatRule complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="NatRule">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;choice>
* &lt;element name="OneToOneBasicRule" type="{http://www.vmware.com/vcloud/v1.5}NatOneToOneBasicRuleType"/>
* &lt;element name="OneToOneVmRule" type="{http://www.vmware.com/vcloud/v1.5}NatOneToOneVmRuleType"/>
* &lt;element name="PortForwardingRule" type="{http://www.vmware.com/vcloud/v1.5}NatPortForwardingRuleType"/>
* &lt;element name="VmRule" type="{http://www.vmware.com/vcloud/v1.5}NatVmRuleType"/>
* &lt;/choice>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@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();
}
}

View File

@ -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.
* <p/>
* <p/>
* <p>Java class for NatService complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="NatService">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
* &lt;sequence>
* &lt;element name="NatType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="Policy" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="NatRule" type="{http://www.vmware.com/vcloud/v1.5}NatRuleType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlRootElement(name = "NatService")
@XmlType(propOrder = {
"natType",
"policy",
"natRules"
})
public class NatService extends NetworkServiceType<NatService> {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromNatService(this);
}
public static class Builder extends NetworkServiceType.Builder<NatService> {
private String natType;
private String policy;
private Set<NatRule> 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<NatRule> 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<NatService> 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<NatRule> natRules = Sets.newLinkedHashSet();
private NatService(boolean enabled, String natType, String policy, Set<NatRule> 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<NatRule> 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);
}
}

View File

@ -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.
* <p/>
* <p/>
* <p>Java class for NatVmRule complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="NatVmRule">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType" minOccurs="0"/>
* &lt;element name="ExternalPort" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="VAppScopedVmId" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="VmNicId" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="InternalPort" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="Protocol" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@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();
}
}

View File

@ -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<T extends NetworkServiceType<T>> {
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<T extends NetworkServiceType<T>> {
protected boolean isEnabled;
/**
* @see NetworkService#isEnabled()
* @see NetworkServiceType#isEnabled()
*/
public Builder enabled(boolean isEnabled) {
public Builder<T> enabled(boolean isEnabled) {
this.isEnabled = isEnabled;
return this;
}
public NetworkService build() {
return new NetworkService(isEnabled);
public NetworkServiceType<T> build() {
return new NetworkServiceType<T>(isEnabled);
}
public Builder fromNetworkService(NetworkService in) {
public Builder<T> fromNetworkServiceType(NetworkServiceType<T> 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);
}
}

View File

@ -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;
/**
* <p>Java class for StaticRoute complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="StaticRoute">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="Network" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="NextHopIp" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;element name="Interface" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@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();
}
}

View File

@ -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.
* <p/>
* <p/>
* <p>Java class for StaticRoutingService complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="StaticRoutingService">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
* &lt;sequence>
* &lt;element name="StaticRoute" type="{http://www.vmware.com/vcloud/v1.5}StaticRouteType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlRootElement(name = "StaticRoutingService")
@XmlType(propOrder = {
"staticRoutes"
})
public class StaticRoutingService extends NetworkServiceType<StaticRoutingService> {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromStaticRoutingService(this);
}
public static class Builder extends NetworkServiceType.Builder<StaticRoutingService> {
private List<StaticRoute> staticRoutes;
/**
* @see StaticRoutingService#getStaticRoutes()
*/
public Builder staticRoutes(List<StaticRoute> staticRoutes) {
this.staticRoutes = checkNotNull(staticRoutes, "staticRoutes");
return this;
}
public StaticRoutingService build() {
return new StaticRoutingService(isEnabled, staticRoutes);
}
@Override
public Builder fromNetworkServiceType(NetworkServiceType<StaticRoutingService> in) {
return Builder.class.cast(super.fromNetworkServiceType(in));
}
public Builder fromStaticRoutingService(StaticRoutingService in) {
return fromNetworkServiceType(in)
.staticRoutes(in.getStaticRoutes());
}
}
private StaticRoutingService(boolean enabled, List<StaticRoute> staticRoutes) {
super(enabled);
this.staticRoutes = ImmutableList.copyOf(staticRoutes);
}
private StaticRoutingService() {
// For JAXB and builder use
}
@XmlElement(name = "StaticRoute")
protected List<StaticRoute> staticRoutes = Lists.newArrayList();
/**
* Gets the value of the staticRoutes property.
*/
public List<StaticRoute> 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();
}
}

View File

@ -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<VAppTemplate> {
public static class Builder extends ResourceEntityType.Builder<VAppTemplate> {
private Owner owner;
private Set<VAppTemplate> children = Sets.newLinkedHashSet();
private Set<SectionType> sections = Sets.newLinkedHashSet();
private Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
private String vAppScopedLocalId;
private Boolean ovfDescriptorUploaded;
private Boolean goldMaster;
@ -112,8 +113,8 @@ public class VAppTemplate extends ResourceEntityType<VAppTemplate> {
/**
* @see VAppTemplate#getSections()
*/
public Builder sections(Set<SectionType> sections) {
this.sections = sections;
public Builder sections(Set<? extends SectionType<?>> sections) {
this.sections = checkNotNull(sections, "sections");
return this;
}
@ -258,7 +259,7 @@ public class VAppTemplate extends ResourceEntityType<VAppTemplate> {
@XmlElementRef
protected VAppTemplateChildren children = VAppTemplateChildren.builder().build();
@XmlElementRef
protected Set<SectionType> sections = Sets.newLinkedHashSet();
protected Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
@XmlElement(name = "VAppScopedLocalId")
protected String vAppScopedLocalId;
@XmlAttribute
@ -267,7 +268,8 @@ public class VAppTemplate extends ResourceEntityType<VAppTemplate> {
protected Boolean goldMaster;
private VAppTemplate(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress,
String id, String name, FilesList files, Integer status, Owner owner, Set<VAppTemplate> children, Set<SectionType> sections, String vAppScopedLocalId, Boolean ovfDescriptorUploaded, Boolean goldMaster) {
String id, String name, FilesList files, Integer status, Owner owner, Set<VAppTemplate> children,
Set<? extends SectionType<?>> 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<VAppTemplate> {
* Contains ovf sections for vApp template.
* Gets the value of the section property.
* <p/>
* <p/>
* 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 <CODE>set</CODE> method for the section property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getSection().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* 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<VAppTemplate> {
* {@link JAXBElement }{@code <}{@link DiskSection }{@code >}
* {@link JAXBElement }{@code <}{@link InstallSection }{@code >}
*/
public Set<SectionType> getSections() {
return this.sections;
public Set<? extends SectionType<?>> getSections() {
return Collections.unmodifiableSet(this.sections);
}
/**

View File

@ -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<VAppTemplate> getVms() {
return this.vms;
return Collections.unmodifiableSet(this.vms);
}
@Override

View File

@ -89,7 +89,7 @@ public abstract class SectionType<T extends SectionType<T>> {
@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;

View File

@ -73,7 +73,7 @@ public interface VAppTemplateAsyncClient {
*/
@POST
@Consumes(TASK)
@Path("/consolidate")
@Path("/action/consolidate")
@JAXBResponseParser
ListenableFuture<Task> 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<CustomizationSection> 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<GuestCustomizationSection> 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<Task> 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<LeaseSettingsSection> 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<Metadata> getMetadataForVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
ListenableFuture<Metadata> getVAppTemplateMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
@PUT
@Produces(METADATA)
@Consumes(TASK)
@Path("/metadata")
@JAXBResponseParser
ListenableFuture<Task> editMetadataForVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
ListenableFuture<Task> 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<MetadataEntry> getMetadataEntryForVAppTemplateAndKey(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@JAXBResponseParser
ListenableFuture<MetadataValue> 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<Task> editMetadataEntryForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@JAXBResponseParser
ListenableFuture<Task> 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<Task> deleteMetadataEntryForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@JAXBResponseParser
ListenableFuture<Task> 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<NetworkConfigSection> getNetworkConfigSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
@JAXBResponseParser
ListenableFuture<NetworkConfigSection> 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<Task> editNetworkConfigSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@JAXBResponseParser
ListenableFuture<Task> 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<NetworkConnectionSection> getNetworkConnectionSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
@JAXBResponseParser
ListenableFuture<NetworkConnectionSection> 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<Task> editNetworkConnectionSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@JAXBResponseParser
ListenableFuture<Task> 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<NetworkSection> getNetworkSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
@JAXBResponseParser
ListenableFuture<NetworkSection> getVAppTemplateNetworkSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
* @see VAppTemplateClient#editVAppTemplateNetworkSection(URISupplier, NetworkSection)
*/
@PUT
@Produces(NETWORK_SECTION)
@Consumes(TASK)
@Path("/networkSection")
ListenableFuture<Task> editNetworkSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@JAXBResponseParser
ListenableFuture<Task> 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<Envelope> getOvfForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
@JAXBResponseParser
ListenableFuture<Envelope> 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<Owner> getOwnerOfVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
@ -285,6 +299,7 @@ public interface VAppTemplateAsyncClient {
@GET
@Consumes(PRODUCT_SECTION_LIST)
@Path("/productSections")
@JAXBResponseParser
ListenableFuture<ProductSectionList> getProductSectionsForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
@ -294,6 +309,7 @@ public interface VAppTemplateAsyncClient {
@Produces(PRODUCT_SECTION_LIST)
@Consumes(TASK)
@Path("/productSections")
@JAXBResponseParser
ListenableFuture<Task> editProductSectionsForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@BinderParam(BindToXMLPayload.class) ProductSectionList sections);

View File

@ -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.

View File

@ -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
}

View File

@ -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.<VAppTemplate>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.<SectionType>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.<NetworkServiceType>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();
}
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomizationSection xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
type="application/vnd.vmware.vcloud.customizationSection+xml"
href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/customizationSection/"
ovf:required="false" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
<ovf:Info>VApp template customization section</ovf:Info>
<CustomizeOnInstantiate>true</CustomizeOnInstantiate>
<Link rel="edit" type="application/vnd.vmware.vcloud.customizationSection+xml"
href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/customizationSection/"/>
</CustomizationSection>

View File

@ -0,0 +1,19 @@
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
href="http://vcloud.example.com/api/v1.5/vAppTemplate/vAppTemplate-12/guestCustomizationSection/"
xmlns="http://www.vmware.com/vcloud/v1.5"
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
ovf:required="false">
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
<Enabled>false</Enabled>
<ChangeSid>false</ChangeSid>
<VirtualMachineId>4</VirtualMachineId>
<JoinDomainEnabled>false</JoinDomainEnabled>
<UseOrgSettings>false</UseOrgSettings>
<AdminPasswordEnabled>false</AdminPasswordEnabled>
<AdminPasswordAuto>true</AdminPasswordAuto>
<ResetPasswordRequired>false</ResetPasswordRequired>
<CustomizationScript>ls</CustomizationScript>
<ComputerName>ubuntu10-x86</ComputerName>
<Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
href="http://vcloud.example.com/api/v1.5/vAppTemplate/vAppTemplate-12/guestCustomizationSection/"/>
</GuestCustomizationSection>

View File

@ -0,0 +1,12 @@
<LeaseSettingsSection
href="http://vcloud.example.com/api/v1.5/vAppTemplate/vAppTemplate-7/leaseSettingsSection/"
ovf:required="false"
xmlns="http://www.vmware.com/vcloud/v1.5"
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
type="application/vnd.vmware.vcloud.leaseSettingsSection+xml">
<ovf:Info>VApp lease settings</ovf:Info>
<Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="http://vcloud.example.com/api/v1.5/vAppTemplate/vAppTemplate-7/leaseSettingsSection/"/>
<DeploymentLeaseInSeconds>3600</DeploymentLeaseInSeconds>
<StorageLeaseInSeconds>3600</StorageLeaseInSeconds>
<DeploymentLeaseExpiration>2010-01-21T21:50:59.764Z</DeploymentLeaseExpiration>
</LeaseSettingsSection>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<Metadata xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
<Link rel="up" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"/>
<MetadataEntry>
<Key>key</Key>
<Value>value</Value>
</MetadataEntry>
</Metadata>

View File

@ -0,0 +1,4 @@
<MetadataValue
xmlns="http://www.vmware.com/vcloud/v1.5">
<Value>some value</Value>
</MetadataValue>

View File

@ -0,0 +1,64 @@
<NetworkConfigSection
xmlns="http://www.vmware.com/vcloud/v1.5"
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">
<ovf:Info>Configuration parameters for logical networks</ovf:Info>
<NetworkConfig networkName="vAppNetwork">
<Configuration>
<IpScope>
<IsInherited>false</IsInherited>
<Gateway>10.147.56.253</Gateway>
<Netmask>255.255.255.0</Netmask>
<Dns1>10.147.115.1</Dns1>
<Dns2>10.147.115.2</Dns2>
<DnsSuffix>example.com</DnsSuffix>
<IpRanges>
<IpRange>
<StartAddress>10.147.56.1</StartAddress>
<EndAddress>10.147.56.1</EndAddress>
</IpRange>
</IpRanges>
</IpScope>
<ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="Internet"
href="http://vcloud.example.com/api/v1.0/network/54"/>
<FenceMode>natRouted</FenceMode>
<Features>
<FirewallService>
<IsEnabled>true</IsEnabled>
<FirewallRule>
<IsEnabled>true</IsEnabled>
<Description>FTP Rule</Description>
<Policy>allow</Policy>
<Protocols>
<Tcp>true</Tcp>
</Protocols>
<Port>21</Port>
<DestinationIp>10.147.115.1</DestinationIp>
</FirewallRule>
<FirewallRule>
<IsEnabled>true</IsEnabled>
<Description>SSH Rule</Description>
<Policy>allow</Policy>
<Protocols>
<Tcp>true</Tcp>
</Protocols>
<Port>22</Port>
<DestinationIp>10.147.115.1</DestinationIp>
</FirewallRule>
</FirewallService>
<NatService>
<IsEnabled>true</IsEnabled>
<NatType>ipTranslation</NatType>
<Policy>allowTraffic</Policy>
<NatRule>
<OneToOneVmRule>
<MappingMode>manual</MappingMode>
<ExternalIpAddress>64.100.10.1</ExternalIpAddress>
<VAppScopedVmId>20ea086f-1a6a-4fb2-8e2e-23372facf7de</VAppScopedVmId>
<VmNicId>0</VmNicId>
</OneToOneVmRule>
</NatRule>
</NatService>
</Features>
</Configuration>
</NetworkConfig>
</NetworkConfigSection>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<RelocateParams
xmlns="http://www.vmware.com/vcloud/v1.5">
<Datastore
href="https://vcloud.example.com/api/admin/extension/datastore/607"/>
</RelocateParams>