You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2014/11/25 16:39:38 UTC
[13/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/DhcpService.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/DhcpService.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/DhcpService.java
new file mode 100644
index 0000000..628a7d1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/DhcpService.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network;
+
+import static com.google.common.base.Objects.equal;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+
+/**
+ * specifies the properties of the network’s DHCP service
+ */
+public class DhcpService {
+ private final boolean enabled;
+ @Nullable
+ private final Integer defaultLeaseTime;
+ @Nullable
+ private final Integer maxLeaseTime;
+ @Nullable
+ private final IpRange ipRange;
+
+ public DhcpService(boolean enabled, @Nullable Integer defaultLeaseTime, @Nullable Integer maxLeaseTime,
+ @Nullable IpRange ipRange) {
+ this.enabled = enabled;
+ this.defaultLeaseTime = defaultLeaseTime;
+ this.maxLeaseTime = maxLeaseTime;
+ this.ipRange = ipRange;
+ }
+
+ /**
+ * @return true if the service is enabled
+ *
+ * @since vcloud api 0.8
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * default duration of a DHCP address lease
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public Integer getDefaultLeaseTime() {
+ return defaultLeaseTime;
+ }
+
+ /**
+ * maximum duration of a DHCP address lease.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public Integer getMaxLeaseTime() {
+ return maxLeaseTime;
+ }
+
+ /**
+ * @return range of IP addresses available to DHCP clients
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ 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 equal(this.enabled, that.enabled) && equal(this.defaultLeaseTime, that.defaultLeaseTime)
+ && equal(this.maxLeaseTime, that.maxLeaseTime) && equal(this.ipRange, that.ipRange);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(enabled, defaultLeaseTime, maxLeaseTime, ipRange);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("enabled", enabled)
+ .add("defaultLeaseTime", defaultLeaseTime).add("maxLeaseTime", maxLeaseTime).add("ipRange", ipRange)
+ .toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/Features.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/Features.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/Features.java
new file mode 100644
index 0000000..24eb38e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/Features.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network;
+
+import static com.google.common.base.Objects.equal;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+
+/**
+ * The Features element defines the DHCP and firewall features of a network.
+ */
+public class Features {
+ @Nullable
+ private final DhcpService dhcpService;
+ @Nullable
+ private final FirewallService firewallService;
+ @Nullable
+ private final NatService natService;
+
+ public Features(@Nullable DhcpService dhcpService, @Nullable FirewallService firewallService,
+ @Nullable NatService natService) {
+ this.dhcpService = dhcpService;
+ this.firewallService = firewallService;
+ this.natService = natService;
+ }
+
+ /**
+ * specifies the properties of the network’s DHCP service
+ *
+ * @since vcloud api 0.9, but emulated for 0.8
+ */
+ @Nullable
+ public DhcpService getDhcpService() {
+ return dhcpService;
+ }
+
+ /**
+ * defines the firewall service capabilities of the network
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ public FirewallService getFirewallService() {
+ return firewallService;
+ }
+
+ /**
+ * defines the NAT service capabilities of the network
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ public NatService getNatService() {
+ return natService;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ Features that = Features.class.cast(o);
+ return equal(this.dhcpService, that.dhcpService) && equal(this.firewallService, that.firewallService)
+ && equal(this.natService, that.natService);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(dhcpService, firewallService, natService);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("dhcpService", dhcpService)
+ .add("firewallService", firewallService).add("natService", natService).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FenceMode.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FenceMode.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FenceMode.java
new file mode 100644
index 0000000..a531b0d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FenceMode.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ *
+ * The FenceMode element contains one of the following strings that specify how a network is
+ * connected to its parent network.
+ */
+public enum FenceMode {
+ /**
+ * The two networks are bridged.
+ * <p/>
+ * Note that in vcloud 0.8 this was called ALLOW_IN_OUT, and so our implementation automatically
+ * converts this for you. Use bridged instead of allowInOut.
+ *
+ * @since vcloud api 0.9
+ */
+ BRIDGED,
+ /**
+ * The two networks are not connected.
+ *
+ * @since vcloud api 0.8
+ */
+ ISOLATED,
+ /**
+ * The two networks are connected as specified in their NatService elements.
+ *
+ * @since vcloud api 0.8
+ */
+ NAT_ROUTED, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static FenceMode fromValue(String fenceMode) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(fenceMode, "fenceMode")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FirewallService.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FirewallService.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FirewallService.java
new file mode 100644
index 0000000..63212b2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FirewallService.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.network.firewall.FirewallRule;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * The FirewallService element defines the firewall service capabilities of a network.
+ */
+public class FirewallService {
+ private final boolean enabled;
+
+ List<FirewallRule> firewallRules = Lists.newArrayList();
+
+ public FirewallService(boolean enabled, Iterable<FirewallRule> firewallRules) {
+ this.enabled = enabled;
+ Iterables.addAll(this.firewallRules, checkNotNull(firewallRules, "firewallRules"));
+ }
+
+ /**
+ * @return Firewall rules for the network
+ *
+ * @since vcloud api 0.8
+ */
+ public List<FirewallRule> getFirewallRules() {
+ return firewallRules;
+ }
+
+ /**
+ * @return true if the service is enabled
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ @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(this.enabled, that.enabled) && equal(this.firewallRules, that.firewallRules);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(enabled, firewallRules);
+ }
+
+ @Override
+ public String toString() {
+ ToStringHelper helper = Objects.toStringHelper("").omitNullValues().add("enabled", enabled);
+ if (firewallRules.size() > 0)
+ helper.add("firewallRules", firewallRules);
+ return helper.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpAddressAllocationMode.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpAddressAllocationMode.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpAddressAllocationMode.java
new file mode 100644
index 0000000..2b32691
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpAddressAllocationMode.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network;
+
+
+/**
+ *
+ * The IpAddressAllocationMode element specifies how an IP address is allocated to this connection.
+ */
+public enum IpAddressAllocationMode {
+ /**
+ * no IP addressing mode specified
+ *
+ * @since vcloud api 1.0
+ */
+ NONE,
+ /**
+ * static IP address assigned manually
+ *
+ * @since vcloud api 1.0
+ */
+ MANUAL,
+ /**
+ * static IP address allocated from a pool
+ *
+ * @since vcloud api 1.0
+ */
+ POOL,
+ /**
+ * IP address assigned by DHCP
+ *
+ * @since vcloud api 1.0
+ */
+ DHCP;
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpRange.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpRange.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpRange.java
new file mode 100644
index 0000000..180d13d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpRange.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.Objects;
+
+/**
+ * The IpRange element defines a range of IP addresses available on a network.
+ */
+public class IpRange {
+ private final String startAddress;
+ private final String endAddress;
+
+ public IpRange(String startAddress, String endAddress) {
+ this.startAddress = checkNotNull(startAddress, "startAddress");
+ this.endAddress = checkNotNull(endAddress, "endAddress");
+ }
+
+ /**
+ * @return lowest IP address in the range
+ *
+ * @since vcloud api 0.9
+ */
+ public String getStartAddress() {
+ return startAddress;
+ }
+
+ /**
+ * @return highest IP address in the range
+ *
+ * @since vcloud api 0.9
+ */
+ public String getEndAddress() {
+ return endAddress;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ IpRange that = IpRange.class.cast(o);
+ return equal(this.startAddress, that.startAddress) && equal(this.endAddress, that.endAddress);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(startAddress, endAddress);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("startAddress", startAddress)
+ .add("endAddress", endAddress).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpScope.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpScope.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpScope.java
new file mode 100644
index 0000000..e5af063
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpScope.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Sets;
+
+/**
+ * The IpScope element defines the address range, gateway, netmask, and other properties of the
+ * network.
+ */
+public class IpScope {
+ private final boolean inherited;
+ @Nullable
+ private final String gateway;
+ @Nullable
+ private final String netmask;
+ @Nullable
+ private final String dns1;
+ @Nullable
+ private final String dns2;
+ @Nullable
+ private final String dnsSuffix;
+ private final Set<IpRange> ipRanges = Sets.newLinkedHashSet();
+ private final Set<String> allocatedIpAddresses = Sets.newLinkedHashSet();
+
+ public IpScope(boolean inherited, @Nullable String gateway, @Nullable String netmask, @Nullable String dns1,
+ @Nullable String dns2, @Nullable String dnsSuffix, Iterable<IpRange> ipRanges,
+ Iterable<String> allocatedIpAddresses) {
+ this.inherited = inherited;
+ this.gateway = gateway;
+ this.netmask = netmask;
+ this.dns1 = dns1;
+ this.dns2 = dns2;
+ this.dnsSuffix = dnsSuffix;
+ Iterables.addAll(this.ipRanges, checkNotNull(ipRanges, "ipRanges"));
+ Iterables.addAll(this.allocatedIpAddresses, checkNotNull(allocatedIpAddresses, "allocatedIpAddresses"));
+ }
+
+ /**
+ * @return true of the values in this IpScope element are inherited from the ParentNetwork of the
+ * containing Configuration
+ * @since vcloud api 0.9
+ */
+ public boolean isInherited() {
+ return inherited;
+ }
+
+ /**
+ * @return IP address of the network gateway
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ public String getGateway() {
+ return gateway;
+ }
+
+ /**
+ * @return netmask to apply to addresses on the network
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ public String getNetmask() {
+ return netmask;
+ }
+
+ /**
+ * @return IP address of the primary DNS server for this network
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public String getDns1() {
+ return dns1;
+ }
+
+ /**
+ * @return IP address of the secondary DNS server for this network
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public String getDns2() {
+ return dns2;
+ }
+
+ /**
+ * @return suffix to be applied when resolving hostnames that are not fully‐qualified.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public String getDnsSuffix() {
+ return dnsSuffix;
+ }
+
+ /**
+ * @return A container for IpRange elements.
+ *
+ * @since vcloud api 0.9
+ */
+ public Set<IpRange> getIpRanges() {
+ return ipRanges;
+ }
+
+ /**
+ * @return A list of addresses allocated from any of the specified IpRanges
+ *
+ * @since vcloud api 0.9
+ */
+ public Set<String> getAllocatedIpAddresses() {
+ return allocatedIpAddresses;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ IpScope that = IpScope.class.cast(o);
+ return equal(this.inherited, that.inherited) && equal(this.gateway, that.gateway)
+ && equal(this.netmask, that.netmask) && equal(this.dns1, that.dns1) && equal(this.dns2, that.dns2)
+ && equal(this.dnsSuffix, that.dnsSuffix)
+ && equal(this.ipRanges, that.ipRanges)
+ && equal(this.allocatedIpAddresses, that.allocatedIpAddresses);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(inherited, gateway, netmask, dns1, dns2, dnsSuffix, ipRanges, allocatedIpAddresses);
+ }
+
+ @Override
+ public String toString() {
+ ToStringHelper helper = Objects.toStringHelper("").omitNullValues().add("inherited", inherited).add("gateway", gateway)
+ .add("netmask", netmask).add("dns1", dns1).add("dns2", dns2).add("dnsSuffix", dnsSuffix);
+ if (ipRanges.size() > 0)
+ helper.add("ipRanges", ipRanges);
+ if (allocatedIpAddresses.size() > 0)
+ helper.add("allocatedIpAddresses", allocatedIpAddresses);
+ return helper.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NatService.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NatService.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NatService.java
new file mode 100644
index 0000000..ea4c388
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NatService.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.network.nat.NatPolicy;
+import org.jclouds.vcloud.domain.network.nat.NatRule;
+import org.jclouds.vcloud.domain.network.nat.NatType;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * The NatService element defines the network address translation capabilities of a network.
+ */
+public class NatService {
+ private final boolean enabled;
+ @Nullable
+ private final NatType type;
+ @Nullable
+ private final NatPolicy policy;
+ private final List<NatRule> natRules = Lists.newArrayList();
+
+ public NatService(boolean enabled, @Nullable NatType type, @Nullable NatPolicy policy,
+ Iterable<NatRule> natRules) {
+ this.enabled = enabled;
+ this.type = type;
+ this.policy = policy;
+ Iterables.addAll(this.natRules, checkNotNull(natRules, "natRules"));
+ }
+
+ /**
+ * @return Nat rules for the network
+ *
+ * @since vcloud api 0.8
+ */
+ public List<NatRule> getNatRules() {
+ return natRules;
+ }
+
+ /**
+ * @return true if the service is enabled
+ *
+ * @since vcloud api 0.9
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * @return specifies how Network Address Translation is implemented by the NAT service
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public NatType getType() {
+ return type;
+ }
+
+ /**
+ * @return specifies how packets are handled by the NAT service.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public NatPolicy getPolicy() {
+ return policy;
+ }
+
+ @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 equal(this.enabled, that.enabled) && equal(this.type, that.type)
+ && equal(this.policy, that.policy) && equal(this.natRules, that.natRules);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(enabled, type, policy, natRules);
+ }
+
+ @Override
+ public String toString() {
+ ToStringHelper helper = Objects.toStringHelper("").omitNullValues().add("enabled", enabled)
+ .add("type", type).add("policy", policy);
+ if (natRules.size() > 0)
+ helper.add("natRules", natRules);
+ return helper.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NetworkConfig.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NetworkConfig.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NetworkConfig.java
new file mode 100644
index 0000000..79e6461
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NetworkConfig.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+
+import org.jclouds.javax.annotation.Nullable;
+
+public class NetworkConfig {
+
+ public Builder toBuilder() {
+ return builder().fromNetworkConfig(this);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+ private String networkName;
+ private URI parentNetwork;
+ private FenceMode fenceMode;
+
+ public Builder networkName(String networkName) {
+ this.networkName = networkName;
+ return this;
+ }
+
+ public Builder parentNetwork(URI parentNetwork) {
+ this.parentNetwork = parentNetwork;
+ return this;
+ }
+
+ public Builder fenceMode(FenceMode fenceMode) {
+ this.fenceMode = fenceMode;
+ return this;
+ }
+
+ public Builder fromNetworkConfig(NetworkConfig in) {
+ return networkName(in.getNetworkName()).parentNetwork(in.getParentNetwork()).fenceMode(in.getFenceMode());
+ }
+
+ public NetworkConfig build() {
+ return new NetworkConfig(networkName, parentNetwork, fenceMode);
+ }
+ }
+
+ @Nullable
+ private final String networkName;
+ private final URI parentNetwork;
+ @Nullable
+ private final FenceMode fenceMode;
+
+ /**
+ *
+ * Create a new NetworkConfig.
+ *
+ * @param networkName
+ * a valid {@networkConfig
+ * org.jclouds.vcloud.domain.VAppTemplate#getNetworkSection network in the vapp
+ * template}, or null to have us choose default
+ * @param parentNetwork
+ * a valid {@networkConfig org.jclouds.vcloud.domain.Org#getNetworks in
+ * the Org}
+ * @param fenceMode
+ * how to manage the relationship between the two networks
+ */
+ public NetworkConfig(String networkName, URI parentNetwork, FenceMode fenceMode) {
+ this.networkName = networkName;
+ this.parentNetwork = checkNotNull(parentNetwork, "parentNetwork");
+ this.fenceMode = fenceMode;
+ }
+
+ public NetworkConfig(URI parentNetwork) {
+ this(null, parentNetwork, null);
+ }
+
+ /**
+ * A name for the network. If the
+ * {@link org.jclouds.vcloud.domain.VAppTemplate#getNetworkSection} includes a
+ * {@link NetworkSection.Network} network element, the name you specify for the vApp network must
+ * match the name specified in that element’s name attribute.
+ *
+ * @return
+ */
+ public String getNetworkName() {
+ return networkName;
+ }
+
+ /**
+ *
+ * @return A reference to the organization network to which this network connects.
+ */
+ public URI getParentNetwork() {
+ return parentNetwork;
+ }
+
+ /**
+ * A value of bridged indicates that this vApp network is connected directly to the organization
+ * network.
+ */
+ public FenceMode getFenceMode() {
+ return fenceMode;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((fenceMode == null) ? 0 : fenceMode.hashCode());
+ result = prime * result + ((parentNetwork == null) ? 0 : parentNetwork.hashCode());
+ result = prime * result + ((networkName == null) ? 0 : networkName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ NetworkConfig other = (NetworkConfig) obj;
+ if (fenceMode == null) {
+ if (other.fenceMode != null)
+ return false;
+ } else if (!fenceMode.equals(other.fenceMode))
+ return false;
+ if (parentNetwork == null) {
+ if (other.parentNetwork != null)
+ return false;
+ } else if (!parentNetwork.equals(other.parentNetwork))
+ return false;
+ if (networkName == null) {
+ if (other.networkName != null)
+ return false;
+ } else if (!networkName.equals(other.networkName))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[networkName=" + networkName + ", parentNetwork=" + parentNetwork + ", fenceMode=" + fenceMode + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java
new file mode 100644
index 0000000..f50d18c
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network;
+
+import java.util.List;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.network.internal.OrgNetworkImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * A vDC is a deployment environment for vApps. A Vdc element provides a user view of a vDC.
+ */
+@org.jclouds.vcloud.endpoints.Network
+@ImplementedBy(OrgNetworkImpl.class)
+public interface OrgNetwork extends ReferenceType {
+ /**
+ * The org this network belongs to.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ ReferenceType getOrg();
+
+ /**
+ * optional description
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ * read‐only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 0.9
+ */
+ List<Task> getTasks();
+
+ /**
+ *
+ * @return properties of the network
+ *
+ * @since vcloud api 0.9, but emulated for 0.8
+ */
+ Configuration getConfiguration();
+
+ /**
+ * A reference the network pool from which this network is provisioned. This element, which is
+ * required when creating a NatRouted or Isolated network, is returned in response to a creation
+ * request but not shown in subsequent GET requests.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ ReferenceType getNetworkPool();
+
+ /**
+ * list of external IP addresses that this network can use for NAT.
+ *
+ * @since vcloud api 0.9
+ */
+ Set<String> getAllowedExternalIpAddresses();
+
+ /**
+ * The Configuration element specifies properties of a network.
+ */
+ interface Configuration {
+ /**
+ * defines the address range, gateway, netmask, and other properties of the network.
+ *
+ * @since vcloud api 0.9, but emulated for 0.8
+ */
+ @Nullable
+ IpScope getIpScope();
+
+ /**
+ * reference to a network to which this network connects
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ ReferenceType getParentNetwork();
+
+ /**
+ * defines how this network is connected to its ParentNetwork
+ *
+ * @since vcloud api 0.8
+ */
+ FenceMode getFenceMode();
+
+ /**
+ * defines a set of network features.
+ *
+ * @since vcloud api 0.9, but emulated for 0.8
+ */
+ @Nullable Features getFeatures();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallPolicy.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallPolicy.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallPolicy.java
new file mode 100644
index 0000000..44a5e81
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallPolicy.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network.firewall;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ * specifies how packets are handled by the firewall
+ */
+public enum FirewallPolicy {
+ /**
+ * drop packets of this type
+ */
+ DROP,
+ /**
+ * allow packets of this type to pass through the firewall
+ */
+ ALLOW, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static FirewallPolicy fromValue(String policy) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(policy, "policy")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallProtocols.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallProtocols.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallProtocols.java
new file mode 100644
index 0000000..8b09dc2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallProtocols.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network.firewall;
+
+import static com.google.common.base.Objects.equal;
+
+import com.google.common.base.Objects;
+
+/**
+ * The Protocols element specifies the protocols to which firewall rules apply.
+ *
+ * @since vcloud api 0.9 emulated for 0.8
+ */
+public class FirewallProtocols {
+ private final boolean tcp;
+ private final boolean udp;
+
+ public FirewallProtocols(boolean tcp, boolean udp) {
+ this.tcp = tcp;
+ this.udp = udp;
+ }
+
+ /**
+ * @return true if the firewall rules apply to the TCP protocol
+ */
+ public boolean isTcp() {
+ return tcp;
+ }
+
+ /**
+ * @return true if the firewall rules apply to the UDP protocol
+ */
+ public boolean isUdp() {
+ return udp;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ FirewallProtocols that = FirewallProtocols.class.cast(o);
+ return equal(this.tcp, that.tcp) && equal(this.udp, that.udp);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(tcp, udp);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("tcp", tcp).add("udp", udp).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallRule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallRule.java
new file mode 100644
index 0000000..dfb578b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallRule.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network.firewall;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+
+/**
+ * The FirewallRule element defines a single firewall rule.
+ *
+ * @since vcloud api 0.8
+ */
+public class FirewallRule {
+
+ private final boolean enabled;
+ @Nullable
+ private final String description;
+ @Nullable
+ private final FirewallPolicy policy;
+ @Nullable
+ private final FirewallProtocols protocols;
+ private final int port;
+ private final String destinationIp;
+
+ public FirewallRule(boolean enabled, @Nullable String description, @Nullable FirewallPolicy policy,
+ @Nullable FirewallProtocols protocols, int port, String destinationIp) {
+ this.enabled = enabled;
+ this.description = description;
+ this.policy = policy;
+ this.protocols = protocols;
+ this.port = port;
+ this.destinationIp = checkNotNull(destinationIp, "destinationIp");
+ }
+
+ /**
+ * @return true if the rule is enabled
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * @return description of the rule
+ */
+ @Nullable
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @return specifies how packets are handled by the firewall
+ */
+ @Nullable
+ public FirewallPolicy getPolicy() {
+ return policy;
+ }
+
+ /**
+ * @return specifies the protocols to which this firewall rule applies
+ */
+ @Nullable
+ public FirewallProtocols getProtocols() {
+ return protocols;
+ }
+
+ /**
+ * @return specifies the network port to which this firewall rule applies. A value of ‐1 matches
+ * any port.
+ */
+ public int getPort() {
+ return port;
+ }
+
+ /**
+ * @return specifies the destination IP address, inside the firewall, to which this firewall rule
+ * applies
+ */
+ public String getDestinationIp() {
+ return destinationIp;
+ }
+
+ @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(this.enabled, that.enabled) && equal(this.description, that.description)
+ && equal(this.policy, that.policy) && equal(this.protocols, that.protocols) && equal(this.port, that.port)
+ && equal(this.destinationIp, that.destinationIp);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(enabled, description, policy, protocols, port, destinationIp);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("enabled", enabled).add("description", description)
+ .add("policy", policy).add("protocols", protocols).add("port", port).add("destinationIp", destinationIp)
+ .toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java
new file mode 100644
index 0000000..76a394f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network.internal;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.network.Features;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.IpScope;
+import org.jclouds.vcloud.domain.network.OrgNetwork;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+public class OrgNetworkImpl extends ReferenceTypeImpl implements OrgNetwork {
+ @Nullable
+ private final ReferenceType org;
+ @Nullable
+ private final String description;
+ private final List<Task> tasks = Lists.newArrayList();
+ private final Configuration configuration;
+ @Nullable
+ private final ReferenceType networkPool;
+ private final Set<String> allowedExternalIpAddresses = Sets.newLinkedHashSet();
+
+ public OrgNetworkImpl(String name, String type, URI id, @Nullable ReferenceType org, @Nullable String description,
+ Iterable<Task> tasks, Configuration configuration, @Nullable ReferenceType networkPool,
+ Iterable<String> allowedExternalIpAddresses) {
+ super(name, type, id);
+ this.org = org;
+ this.description = description;
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ this.configuration = checkNotNull(configuration, "configuration");
+ this.networkPool = networkPool;
+ Iterables.addAll(this.allowedExternalIpAddresses, checkNotNull(allowedExternalIpAddresses,
+ "allowedExternalIpAddresses"));
+ }
+
+ public static class ConfigurationImpl implements Configuration {
+
+ @Nullable
+ private final IpScope ipScope;
+ @Nullable
+ private final ReferenceType parentNetwork;
+ private final FenceMode fenceMode;
+ private final Features features;
+
+ public ConfigurationImpl(@Nullable IpScope ipScope, @Nullable ReferenceType parentNetwork, FenceMode fenceMode,
+ @Nullable Features features) {
+ this.ipScope = ipScope;
+ this.parentNetwork = parentNetwork;
+ this.fenceMode = checkNotNull(fenceMode, "fenceMode");
+ this.features = features;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IpScope getIpScope() {
+ return ipScope;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getParentNetwork() {
+ return parentNetwork;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public FenceMode getFenceMode() {
+ return fenceMode;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @Nullable
+ public Features getFeatures() {
+ return features;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ ConfigurationImpl that = ConfigurationImpl.class.cast(o);
+ return equal(this.ipScope, that.ipScope) && equal(this.parentNetwork, that.parentNetwork)
+ && equal(this.fenceMode, that.fenceMode) && equal(this.features, that.features);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(ipScope, parentNetwork, fenceMode, features);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("ipScope", ipScope).add("parentNetwork", parentNetwork)
+ .add("fenceMode", fenceMode).add("features", features).toString();
+ }
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getOrg() {
+ return org;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getNetworkPool() {
+ return networkPool;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getAllowedExternalIpAddresses() {
+ return allowedExternalIpAddresses;
+ }
+
+ @Override
+ public ToStringHelper string() {
+ ToStringHelper helper = super.string().add("org", org).add("description", description)
+ .add("configuration", configuration).add("networkPool", networkPool);
+ if (allowedExternalIpAddresses.size() > 0)
+ helper.add("allowedExternalIpAddresses", allowedExternalIpAddresses);
+ if (tasks.size() > 0)
+ helper.add("tasks", tasks);
+ return helper;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatPolicy.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatPolicy.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatPolicy.java
new file mode 100644
index 0000000..8a49b33
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatPolicy.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network.nat;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ * The Policy element of a NatService element specifies how packets are handled by the NAT service.
+ */
+public enum NatPolicy {
+ /**
+ * packets of this type pass through the firewall in both directions
+ */
+ ALLOW_TRAFFIC,
+ /**
+ * only inbound packets of this type pass through the firewall
+ */
+ ALLOW_TRAFFIC_IN, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static NatPolicy fromValue(String policy) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(policy, "policy")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatProtocol.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatProtocol.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatProtocol.java
new file mode 100644
index 0000000..7204bae
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatProtocol.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network.nat;
+
+
+/**
+ *
+ * The Protocol specifies the network protocol to which this rule applies
+ *
+ * @since vcloud api 0.9
+ */
+public enum NatProtocol {
+ /**
+ * the rule applies to the TCP protocol
+ *
+ * @since vcloud api 0.9
+ */
+ TCP,
+ /**
+ * the rule applies to the UDP protocol
+ *
+ * @since vcloud api 0.9
+ */
+ UDP,
+ /**
+ * the rule applies to the TCP and UDP protocols.
+ *
+ * @since vcloud api 0.9
+ */
+ TCP_UDP;
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatRule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatRule.java
new file mode 100644
index 0000000..b9ca510
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatRule.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network.nat;
+
+import org.jclouds.javax.annotation.Nullable;
+
+/**
+ *
+ * Defines a rule associated with Nat
+ *
+ * @since vcloud api 0.9
+ */
+public interface NatRule {
+ /**
+ * IP address to which this NAT rule maps the IP address specified in the InternalIp element.
+ */
+ @Nullable
+ String getExternalIP();
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatType.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatType.java
new file mode 100644
index 0000000..98b95e2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatType.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network.nat;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ *
+ * The NatType element specifies how network address translation is implemented by the NAT service.
+ *
+ * @since vcloud api 0.9
+ */
+public enum NatType {
+ /**
+ * NAT service implemented by IP address translation
+ *
+ * @since vcloud api 0.9
+ */
+ IP_TRANSLATION,
+ /**
+ * NAT service implemented by network port forwarding
+ *
+ * @since vcloud api 0.9
+ */
+ PORT_FORWARDING, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static NatType fromValue(String natType) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(natType, "natType")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/MappingMode.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/MappingMode.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/MappingMode.java
new file mode 100644
index 0000000..6d71116
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/MappingMode.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network.nat.rules;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ * The MappingMode element specifies how IP address mapping is implemented by the NAT service.
+ */
+public enum MappingMode {
+ /**
+ * the external IP address is specified in the ExternalIP element
+ */
+ MANUAL,
+ /**
+ * the external IP address is assigned automatically
+ */
+ AUTOMATIC, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static MappingMode fromValue(String mode) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(mode, "mode")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/OneToOneVmRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/OneToOneVmRule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/OneToOneVmRule.java
new file mode 100644
index 0000000..c2b1b4b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/OneToOneVmRule.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network.nat.rules;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.network.nat.NatRule;
+
+import com.google.common.base.Objects;
+
+/**
+ * The OneToOneVmRule element describes a NAT rule that specifies network address translation
+ * details for a single virtual machine. The external IP address can be specified manually or
+ * assigned automatically at deployment time. The internal IP address is discovered by looking up
+ * the specified VmReference and NIC ID.
+ *
+ * @since vcloud 0.9
+ */
+public class OneToOneVmRule implements NatRule {
+ private final MappingMode mappingMode;
+ @Nullable
+ private final String externalIP;
+ @Nullable
+ private final String vAppScopedVmId;
+ private final int vmNicId;
+
+ public OneToOneVmRule(MappingMode mappingMode, @Nullable String externalIp, @Nullable String vAppScopedVmId,
+ int vmNicId) {
+ this.mappingMode = checkNotNull(mappingMode, "mappingMode");
+ this.externalIP = externalIp;
+ this.vAppScopedVmId = vAppScopedVmId;
+ this.vmNicId = vmNicId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ OneToOneVmRule that = OneToOneVmRule.class.cast(o);
+ return equal(this.mappingMode, that.mappingMode) && equal(this.externalIP, that.externalIP)
+ && equal(this.vAppScopedVmId, that.vAppScopedVmId) && equal(this.vmNicId, that.vmNicId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(mappingMode, externalIP, vAppScopedVmId, vmNicId);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("mappingMode", mappingMode).add("externalIP", externalIP)
+ .add("vAppScopedVmId", vAppScopedVmId).add("vmNicId", vmNicId).toString();
+ }
+
+ /**
+ * @return how IP address mapping is implemented by the NAT service
+ * @since vcloud 0.9
+ */
+ public MappingMode getMappingMode() {
+ return mappingMode;
+ }
+
+ /**
+ * @return if MappingMode is manual, specifies the external IP address of this Vm, otherwise
+ * null.
+ * @since vcloud 0.9
+ */
+ @Nullable
+ @Override
+ public String getExternalIP() {
+ return externalIP;
+ }
+
+ /**
+ * @return read‐only identifier created on import
+ * @since vcloud 0.9
+ */
+ @Nullable
+ public String getVAppScopedVmId() {
+ return vAppScopedVmId;
+ }
+
+ /**
+ * @return device number of the NIC on the referenced virtual machine
+ * @since vcloud 0.9
+ */
+ public int getVmNicId() {
+ return vmNicId;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/PortForwardingRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/PortForwardingRule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/PortForwardingRule.java
new file mode 100644
index 0000000..3170a73
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/PortForwardingRule.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network.nat.rules;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.vcloud.domain.network.nat.NatProtocol;
+import org.jclouds.vcloud.domain.network.nat.NatRule;
+
+import com.google.common.base.Objects;
+
+/**
+ * The PortForwardingRule element describes a NAT rule that maps an IP address and port in an
+ * organization network to an external IP address and port.
+ *
+ * @since vcloud 0.8
+ */
+public class PortForwardingRule implements NatRule {
+ private final String externalIP;
+ private final int externalPort;
+ private final String internalIP;
+ private final int internalPort;
+ private final NatProtocol protocol;
+
+ public PortForwardingRule(String externalIP, int externalPort, String internalIP, int internalPort,
+ NatProtocol protocol) {
+ this.externalIP = checkNotNull(externalIP, "externalIP");
+ this.externalPort = externalPort;
+ this.internalIP = checkNotNull(internalIP, "internalIP");
+ this.internalPort = internalPort;
+ this.protocol = checkNotNull(protocol, "protocol");
+ }
+
+ /**
+ * IP address to which this NAT rule maps the IP address specified in the InternalIp element.
+ */
+ @Override
+ public String getExternalIP() {
+ return externalIP;
+ }
+
+ /**
+ * network port to which this NAT rule maps the port number specified in the InternalPort element
+ */
+ public int getExternalPort() {
+ return externalPort;
+ }
+
+ /**
+ * IP address to which this NAT rule maps the IP address specified in the ExternalIp element.
+ */
+ public String getInternalIP() {
+ return internalIP;
+ }
+
+ /**
+ * network port to which this NAT rule maps the port number specified in the ExternalPort
+ * element.
+ */
+ public int getInternalPort() {
+ return internalPort;
+ }
+
+ /**
+ * specifies the network protocol to which this rule applies
+ */
+ public NatProtocol getProtocol() {
+ return protocol;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ PortForwardingRule that = PortForwardingRule.class.cast(o);
+ return equal(this.externalIP, that.externalIP) && equal(this.externalPort, that.externalPort)
+ && equal(this.internalIP, that.internalIP) && equal(this.internalPort, that.internalPort)
+ && equal(this.protocol, that.protocol);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(externalIP, externalPort, internalIP, internalPort, protocol);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("externalIP", externalIP)
+ .add("externalPort", externalPort).add("internalIP", internalIP).add("internalPort", internalPort)
+ .add("protocol", protocol).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/VmRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/VmRule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/VmRule.java
new file mode 100644
index 0000000..8793a58
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/VmRule.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.vcloud.domain.network.nat.rules;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.network.nat.NatProtocol;
+import org.jclouds.vcloud.domain.network.nat.NatRule;
+
+import com.google.common.base.Objects;
+
+/**
+ * The VmRule element describes a NAT rule that maps an IP address and port in a vApp network to an
+ * external IP address and port. The external IP address, external port, and internal port are
+ * specified in the element. The internal IP address is discovered by looking up the specified
+ * VmReference and VmNicId.
+ *
+ * @since vcloud 0.9
+ */
+public class VmRule implements NatRule {
+ @Nullable
+ private final String externalIP;
+ private final int externalPort;
+ @Nullable
+ private final String vAppScopedLocalId;
+ private final int vmNicId;
+ private final int internalPort;
+ private final NatProtocol protocol;
+
+ public VmRule(@Nullable String externalIP, int externalPort, @Nullable String vAppScopedLocalId, int vmNicId,
+ int internalPort, NatProtocol protocol) {
+ this.externalIP = externalIP;
+ this.externalPort = externalPort;
+ this.vAppScopedLocalId = vAppScopedLocalId;
+ this.vmNicId = vmNicId;
+ this.internalPort = internalPort;
+ this.protocol = checkNotNull(protocol, "protocol");
+ }
+
+ /**
+ * IP address to which this NAT rule maps the IP address specified in the vAppScopedLocalId element.
+ */
+ @Nullable
+ public String getExternalIP() {
+ return externalIP;
+ }
+
+ /**
+ * network port to which this NAT rule maps the port number specified in the InternalPort element
+ */
+ public Integer getExternalPort() {
+ return externalPort;
+ }
+
+ /**
+ * @return read‐only identifier created on import
+ * @since vcloud 0.9
+ */
+ @Nullable
+ public String getVAppScopedLocalId() {
+ return vAppScopedLocalId;
+ }
+
+ /**
+ * @return device number of the NIC on the referenced virtual machine
+ * @since vcloud 0.9
+ */
+ public int getVmNicId() {
+ return vmNicId;
+ }
+
+ /**
+ * network port to which this NAT rule maps the port number specified in the ExternalPort
+ * element.
+ */
+ public Integer getInternalPort() {
+ return internalPort;
+ }
+
+ /**
+ * specifies the network protocol to which this rule applies
+ */
+ public NatProtocol getProtocol() {
+ return protocol;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ VmRule that = VmRule.class.cast(o);
+ return equal(this.externalIP, that.externalIP) && equal(this.externalPort, that.externalPort)
+ && equal(this.vAppScopedLocalId, that.vAppScopedLocalId) && equal(this.vmNicId, that.vmNicId)
+ && equal(this.internalPort, that.internalPort) && equal(this.protocol, that.protocol);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(externalIP, externalPort, vAppScopedLocalId, vmNicId, internalPort, protocol);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("externalIP", externalIP)
+ .add("externalPort", externalPort).add("vAppScopedLocalId", vAppScopedLocalId).add("vmNicId", vmNicId)
+ .add("internalPort", internalPort).add("protocol", protocol).toString();
+ }
+
+}