http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallRules.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallRules.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallRules.java deleted file mode 100644 index 79281b8..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallRules.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.domain; - -import java.beans.ConstructorProperties; - -import org.jclouds.openstack.v2_0.domain.Link; -import org.jclouds.openstack.v2_0.domain.PaginatedCollection; - -import com.google.common.collect.ImmutableSet; - -/** - * A collection of FirewallRules - */ -public class FirewallRules extends PaginatedCollection<FirewallRule> { - public static final FirewallRules EMPTY = new FirewallRules(ImmutableSet.<FirewallRule> of(), ImmutableSet.<Link> of()); - - @ConstructorProperties({"firewall_rules", "firewall_rules_links"}) - protected FirewallRules(Iterable<FirewallRule> firewallRules, Iterable<Link> firewallRulesLinks) { - super(firewallRules, firewallRulesLinks); - } -}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Firewalls.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Firewalls.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Firewalls.java deleted file mode 100644 index 739e0e2..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Firewalls.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.domain; - -import java.beans.ConstructorProperties; - -import org.jclouds.openstack.v2_0.domain.Link; -import org.jclouds.openstack.v2_0.domain.PaginatedCollection; - -import com.google.common.collect.ImmutableSet; - -/** - * A collection of Firewalls - */ -public class Firewalls extends PaginatedCollection<Firewall> { - public static final Firewalls EMPTY = new Firewalls(ImmutableSet.<Firewall> of(), ImmutableSet.<Link> of()); - - @ConstructorProperties({"firewalls", "firewalls_links"}) - protected Firewalls(Iterable<Firewall> firewalls, Iterable<Link> firewallsLinks) { - super(firewalls, firewallsLinks); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FloatingIP.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FloatingIP.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FloatingIP.java deleted file mode 100644 index be61ad3..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FloatingIP.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.domain; - -import java.beans.ConstructorProperties; - -import javax.inject.Named; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; - -/** - * A Neutron Floating IP - * - */ -public class FloatingIP { - - private String id; - @Named("router_id") - private String routerId; - @Named("tenant_id") - private String tenantId; - // Only mandatory attribute when creating - @Named("floating_network_id") - private String floatingNetworkId; - @Named("fixed_ip_address") - private String fixedIpAddress; - @Named("floating_ip_address") - private String floatingIpAddress; - @Named("port_id") - private String portId; - - /** - * Deserialization constructor - */ - @ConstructorProperties({"id", "router_id", "tenant_id", "floating_network_id", "fixed_ip_address", - "floating_ip_address", "port_id"}) - private FloatingIP(String id, String routerId, String tenantId, String floatingNetworkId, String fixedIpAddress, - String floatingIpAddress, String portId) { - this.id = id; - this.routerId = routerId; - this.tenantId = tenantId; - this.floatingNetworkId = floatingNetworkId; - this.fixedIpAddress = fixedIpAddress; - this.floatingIpAddress = floatingIpAddress; - this.portId = portId; - } - - private FloatingIP() {} - - /** - * @param floatingIP The floating IP to copy from - */ - private FloatingIP(FloatingIP floatingIP) { - this(floatingIP.id, floatingIP.routerId, floatingIP.tenantId, floatingIP.floatingNetworkId, - floatingIP.fixedIpAddress, floatingIP.floatingIpAddress, floatingIP.portId); - } - - /** - * @return the id of the floating IP - */ - @Nullable - public String getId() { - return id; - } - - /** - * @return the router id of this floating IP - */ - @Nullable - public String getRouterId() { - return routerId; - } - - /** - * @return the tenant id of the Floating IP - */ - @Nullable - public String getTenantId() { - return tenantId; - } - - /** - * @return the floating network id for this floating IP - */ - @Nullable - public String getFloatingNetworkId() { - return floatingNetworkId; - } - - /** - * @return the fixed IP address for this floating IP - */ - @Nullable - public String getFixedIpAddress() { - return fixedIpAddress; - } - - /** - * @return the floating IP address for this floating IP - */ - @Nullable - public String getFloatingIpAddress() { - return floatingIpAddress; - } - - /** - * @return the port id for this floating IP - */ - @Nullable - public String getPortId() { - return portId; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - FloatingIP that = (FloatingIP) o; - - return Objects.equal(this.id, that.id) && - Objects.equal(this.routerId, that.routerId) && - Objects.equal(this.tenantId, that.tenantId) && - Objects.equal(this.floatingNetworkId, that.floatingNetworkId) && - Objects.equal(this.fixedIpAddress, that.fixedIpAddress) && - Objects.equal(this.floatingIpAddress, that.floatingIpAddress) && - Objects.equal(this.portId, that.portId); - } - - @Override - public int hashCode() { - return Objects.hashCode(id, routerId, tenantId, floatingNetworkId, fixedIpAddress, floatingIpAddress, - portId); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("id", id) - .add("routerId", routerId) - .add("tenantId", tenantId) - .add("floatingNetworkId", floatingNetworkId) - .add("fixedIpAddress", fixedIpAddress) - .add("floatingIpAddress", floatingIpAddress) - .add("portId", portId) - .toString(); - } - - /** - * @return the Builder for creating a new floating IP - */ - public static CreateBuilder createBuilder(String floatingNetworkId) { - return new CreateBuilder(floatingNetworkId); - } - - /** - * @return the Builder for updating a floating IP - */ - public static UpdateBuilder updateBuilder() { - return new UpdateBuilder(); - } - - private abstract static class Builder<ParameterizedBuilderType> { - protected FloatingIP floatingIP; - - /** - * No-parameters constructor. - * */ - private Builder() { - floatingIP = new FloatingIP(); - } - - protected abstract ParameterizedBuilderType self(); - - /** - * Provide the tenantId for this Floating IP. Admin-only. - * When keystone is enabled, it is not mandatory to specify tenant_id for resources in create requests, as the - * tenant identifier will be derived from the Authentication token. Please note that the default authorization - * settings only allow administrative users to create resources on behalf of a different tenant. - * - * @return the Builder. - * @see FloatingIP#getTenantId() - */ - public ParameterizedBuilderType tenantId(String tenantId) { - floatingIP.tenantId = tenantId; - return self(); - } - - /** - * Provides the floating network id for this Floating IP. - * Mandatory when creating a floating IP. - * Floating IPs can only be created on external networks. If the network specified by floating_network_id is not - * external (for example, router:external=false), a 400 error is returned. - * - * @return the Builder. - * @see FloatingIP#getFloatingNetworkId() () - */ - public ParameterizedBuilderType floatingNetworkId(String floatingNetworkId) { - floatingIP.floatingNetworkId = floatingNetworkId; - return self(); - } - - /** - * Provides the fixed ip address for this Floating IP. - * As an OpenStack Networking port might be associated with multiple IP addresses, the particular IP address to - * associate with the floating IP can be specified using the fixed_ip_address request body parameter. The default - * logic of this operation is to associate the floating IP with a single IP address configured on a port; hence, - * if a port has multiple IP addresses, it is mandatory to specify the fixed_ip_address attribute. If an invalid - * IP address is specified in fixed_ip_address a 400 error will be returned. - * - * @return the Builder. - * @see FloatingIP#getFixedIpAddress() - */ - public ParameterizedBuilderType fixedIpAddress(String fixedIpAddress) { - floatingIP.fixedIpAddress = fixedIpAddress; - return self(); - } - - /** - * Provides the port id for this Floating IP. - * Users can associate the floating IP with an internal port using the port_id attribute in the request body. - * If an invalid port identifier is specified, a 404 error will be returned. The internal OpenStack Networking - * port associated with the Floating IP must have at least an IP address configured, otherwise a 400 error will - * be returned. - * - * @return the Builder. - * @see FloatingIP#getPortId() - */ - public ParameterizedBuilderType portId(String portId) { - floatingIP.portId = portId; - return self(); - } - } - - public static class CreateBuilder extends Builder<CreateBuilder> { - /** - * Supply required properties for creating a Builder - */ - private CreateBuilder(String floatingNetworkId) { - floatingIP.floatingNetworkId = floatingNetworkId; - } - - /** - * @return a CreateFloatingIP constructed with this Builder. - */ - public CreateFloatingIP build() { - return new CreateFloatingIP(floatingIP); - } - - protected CreateBuilder self() { - return this; - } - } - - public static class UpdateBuilder extends Builder<UpdateBuilder> { - /** - * Supply required properties for updating a Builder - */ - private UpdateBuilder() { - } - - /** - * Provide the floating ip address for this Floating IP. - * An address for the floating ip will be automatically allocated, unless the floating_ip_address attribute is - * specified in the request body. If the requested floating IP address does not fall in the external network's - * subnet range, a 400 error will be returned. If the requested floating IP address is already in use, a 409 - * error code will be returned. - * - * @return the Builder. - * @see FloatingIP#getFloatingIpAddress() - */ - public UpdateBuilder floatingIpAddress(String floatingIpAddress) { - floatingIP.floatingIpAddress = floatingIpAddress; - return this; - } - - /** - * @return a UpdateFloatingIP constructed with this Builder. - */ - public UpdateFloatingIP build() { - return new UpdateFloatingIP(floatingIP); - } - - protected UpdateBuilder self() { - return this; - } - } - - public static class CreateFloatingIP extends FloatingIP { - private CreateFloatingIP(FloatingIP floatingIP) { - super(floatingIP); - } - } - public static class UpdateFloatingIP extends FloatingIP { - private UpdateFloatingIP(FloatingIP floatingIP) { - super(floatingIP); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FloatingIPs.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FloatingIPs.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FloatingIPs.java deleted file mode 100644 index 8befa3e..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FloatingIPs.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.domain; - -import java.beans.ConstructorProperties; - -import org.jclouds.openstack.v2_0.domain.Link; -import org.jclouds.openstack.v2_0.domain.PaginatedCollection; - -import com.google.common.collect.ImmutableSet; - -/** - * A collection of Floating IPs - */ -public class FloatingIPs extends PaginatedCollection<FloatingIP> { - public static final FloatingIPs EMPTY = new FloatingIPs(ImmutableSet.<FloatingIP> of(), ImmutableSet.<Link> of()); - - @ConstructorProperties({"floatingips", "floatingips_links"}) - protected FloatingIPs(Iterable<FloatingIP> floatingIPs, Iterable<Link> floatingIPsLinks) { - super(floatingIPs, floatingIPsLinks); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/HostRoute.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/HostRoute.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/HostRoute.java deleted file mode 100644 index 0d7cf4c..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/HostRoute.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.domain; - -import java.beans.ConstructorProperties; - -import javax.inject.Named; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; -import com.google.common.base.MoreObjects.ToStringHelper; - -/** - * A Neutron Subnet Host Route - * - * @see <a href="http://docs.openstack.org/api/openstack-network/2.0/content/Subnets.html">api doc</a> - */ -public class HostRoute { - - @Named("destination") - private final String destinationCidr; - @Named("nexthop") - private final String nextHop; - - @ConstructorProperties({"destination", "nexthop"}) - protected HostRoute(String destinationCidr, String nextHop) { - this.destinationCidr = destinationCidr; - this.nextHop = nextHop; - } - - /** - * @return the destination CIDR for this route. - */ - @Nullable - public String getDestinationCidr() { - return destinationCidr; - } - - /** - * @return the IP of the next hop to forward traffic to. - */ - @Nullable - public String getNextHop() { - return nextHop; - } - - @Override - public int hashCode() { - return Objects.hashCode(destinationCidr, nextHop); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - HostRoute that = HostRoute.class.cast(obj); - return Objects.equal(this.destinationCidr, that.destinationCidr) && Objects.equal(this.nextHop, that.nextHop); - } - - protected ToStringHelper string() { - return MoreObjects.toStringHelper(this) - .add("destinationCidr", destinationCidr).add("nextHop", nextHop); - } - - @Override - public String toString() { - return string().toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public Builder toBuilder() { - return new Builder().fromHostRoute(this); - } - - public static class Builder { - protected String destinationCidr; - protected String nextHop; - - /** - * This should be a valid CIDR. - * @see HostRoute#getDestinationCidr() - */ - public Builder destinationCidr(String destinationCidr) { - this.destinationCidr = destinationCidr; - return this; - } - - /** - * This should be a valid IP address. - * @see HostRoute#getNextHop() - */ - public Builder nextHop(String nextHop) { - this.nextHop = nextHop; - return this; - } - - public HostRoute build() { - return new HostRoute(destinationCidr, nextHop); - } - - public Builder fromHostRoute(HostRoute in) { - return this.destinationCidr(in.getDestinationCidr()).nextHop(in.getNextHop()); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IP.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IP.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IP.java deleted file mode 100644 index cb4264a..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IP.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.domain; - -import java.beans.ConstructorProperties; - -import javax.inject.Named; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; - -/** - * Describes an IP address - */ -public class IP { - - @Named("ip_address") - protected final String ipAddress; - @Named("subnet_id") - protected final String subnetId; - - @ConstructorProperties({"ip_address", "subnet_id"}) - protected IP(String ipAddress, String subnetId) { - this.ipAddress = ipAddress; - this.subnetId = subnetId; - } - - /** - * @return the ipAddress of the IP - */ - @Nullable - public String getIpAddress() { - return ipAddress; - } - - /** - * @return the subnetId of the IP - */ - @Nullable - public String getSubnetId() { - return subnetId; - } - - @Override - public int hashCode() { - return Objects.hashCode(ipAddress, subnetId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null || getClass() != obj.getClass()) - return false; - IP that = IP.class.cast(obj); - return Objects.equal(this.ipAddress, that.ipAddress) && Objects.equal(this.subnetId, that.subnetId); - } - - protected MoreObjects.ToStringHelper string() { - return MoreObjects.toStringHelper(this).add("ipAddress", ipAddress).add("subnetId", subnetId); - } - - @Override - public String toString() { - return string().toString(); - } - - /** - * @return the Builder for IP - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Gets a Builder configured as this object. - */ - public Builder toBuilder() { - return new Builder().fromIP(this); - } - - public static class Builder { - protected String ipAddress; - protected String subnetId; - - /** - * Provide the ipAddress to the IP's Builder. - * - * @return the Builder. - * @see IP#getIpAddress() - */ - public Builder ipAddress(String ipAddress) { - this.ipAddress = ipAddress; - return this; - } - - /** - * Provide the subnetId to the IP's Builder. - * - * @return the Builder. - * @see IP#getSubnetId() - */ - public Builder subnetId(String subnetId) { - this.subnetId = subnetId; - return this; - } - - /** - * @return a IP constructed with this Builder. - */ - public IP build() { - return new IP(ipAddress, subnetId); - } - - /** - * @return a Builder from another IP. - */ - public Builder fromIP(IP in) { - return this.ipAddress(in.getIpAddress()).subnetId(in.getSubnetId()); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IPv6DHCPMode.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IPv6DHCPMode.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IPv6DHCPMode.java deleted file mode 100644 index 654e053..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IPv6DHCPMode.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2.domain; - -/** - * Enumerates DHCP modes for UPv6 - */ -public enum IPv6DHCPMode { - OFF("off"), - SLAAC("slaac"), - DHCPV6_STATEFUL("dhcpv6-stateful"), - DHCPV6_STATELESS("dhcpv6-stateless"), - /** - * Used by jclouds when the service returns an unknown value other than null. - */ - UNRECOGNIZED("unrecognized"); - - private String name; - - private IPv6DHCPMode(String name) { - this.name = name; - } - - public String toString() { - return name; - } - - /* - * This provides GSON enum support in jclouds. - * */ - public static IPv6DHCPMode fromValue(String name){ - if (name != null) { - for (IPv6DHCPMode value : IPv6DHCPMode.values()) { - if (name.equalsIgnoreCase(value.name)) { - return value; - } - } - return UNRECOGNIZED; - } - return null; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IpVersion.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IpVersion.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IpVersion.java deleted file mode 100644 index c1be347..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IpVersion.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.domain; - -public enum IpVersion { - - IPV4(4), - IPV6(6), - UNRECOGNIZED(Integer.MAX_VALUE);; - - private final int version; - - IpVersion(int version) { - this.version = version; - } - - public int version() { - return this.version; - } - - public static IpVersion fromValue(String value) { - try { - int statusCode = Integer.parseInt(value); - switch (statusCode) { - case 4: - return IpVersion.IPV4; - case 6: - return IpVersion.IPV6; - default: - return IpVersion.IPV4; - } - } catch (NumberFormatException e) { - return IpVersion.UNRECOGNIZED; - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Network.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Network.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Network.java deleted file mode 100644 index c269593..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Network.java +++ /dev/null @@ -1,647 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.beans.ConstructorProperties; - -import javax.inject.Named; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableSet; - -/** - * A Neutron network - * - * @see <a - * href="http://docs.openstack.org/api/openstack-network/2.0/content/Networks.html">api - * doc</a> - */ -public class Network { - - private String id; - private NetworkStatus status; - private ImmutableSet<String> subnets; - - private String name; - @Named("admin_state_up") - private Boolean adminStateUp; - private Boolean shared; - @Named("tenant_id") - private String tenantId; - - // providernet.py: Provider Networks Extension - @Named("provider:network_type") - private NetworkType networkType; - @Named("provider:physical_network") - private String physicalNetworkName; - @Named("provider:segmentation_id") - private Integer segmentationId; - - // external_net.py: Configurable external gateway modes extension - @Named("router:external") - private Boolean external; - - // portsecurity.py: VMWare port security - @Named("port_security_enabled") - private Boolean portSecurity; - - // n1kv.py: Cisco plugin extension; admin rights might be needed - @Named("n1kv:profile_id") - // UUID - private String profileId; - @Named("n1kv:multicast_ip") - private String multicastIp; - @Named("n1kv:segment_add") - private String segmentAdd; - @Named("n1kv:segment_del") - private String segmentDel; - @Named("n1kv:member_segments") - private String memberSegments; - - // multiprovidernet.py: Multiprovider net extension; Segments and provider - // values cannot both be set. - private ImmutableSet<NetworkSegment> segments; - - // flavor.py: Flavor support for network and router - @Named("flavor:network") - private String networkFlavor; - - @ConstructorProperties({"id", "status", "subnets", "name", "admin_state_up", "shared", "tenant_id", - "provider:network_type", "provider:physical_network", "provider:segmentation_id", "router:external", - "port_security_enabled", "n1kv:profile_id", "n1kv:multicast_ip", "n1kv:segment_add", "n1kv:segment_del", - "n1kv:member_segments", "segments", "flavor:network"}) - private Network(String id, NetworkStatus status, ImmutableSet<String> subnets, String name, Boolean adminStateUp, - Boolean shared, String tenantId, NetworkType networkType, String physicalNetworkName, Integer segmentationId, - Boolean external, Boolean portSecurity, String profileId, String multicastIp, String segmentAdd, - String segmentDel, String memberSegments, ImmutableSet<NetworkSegment> segments, String networkFlavor) { - // No checkNotNulls. With Neutron, any of these properties can be left null when used in an update. - this.id = id; - this.status = status; - this.subnets = subnets; - this.name = name; - this.adminStateUp = adminStateUp; - this.shared = shared; - this.tenantId = tenantId; - this.networkType = networkType; - this.physicalNetworkName = physicalNetworkName; - this.segmentationId = segmentationId; - this.external = external; - this.portSecurity = portSecurity; - this.profileId = profileId; - this.multicastIp = multicastIp; - this.segmentAdd = segmentAdd; - this.segmentDel = segmentDel; - this.memberSegments = memberSegments; - this.segments = segments; - this.networkFlavor = networkFlavor; - } - - /** - * Default constructor. - */ - private Network() {} - - /** - * Copy constructor - * @param network - */ - private Network(Network network) { - this(network.id, - network.status, - network.subnets, - network.name, - network.adminStateUp, - network.shared, - network.tenantId, - network.networkType, - network.physicalNetworkName, - network.segmentationId, - network.external, - network.portSecurity, - network.profileId, - network.multicastIp, - network.segmentAdd, - network.segmentDel, - network.memberSegments, - network.segments, - network.networkFlavor); - } - - /** - * @return the id of the Network - */ - @Nullable - public String getId() { - return id; - } - - /** - * @return the status of the Network - */ - @Nullable - public NetworkStatus getStatus() { - return status; - } - - /** - * @return the subnets of the Network - */ - @Nullable - public ImmutableSet<String> getSubnets() { - return subnets; - } - - /** - * @return the name of the Network - */ - @Nullable - public String getName() { - return name; - } - - /** - * @return the adminStateUp of the Network - */ - @Nullable - public Boolean getAdminStateUp() { - return adminStateUp; - } - - /** - * The shared attribute can be used to create a public network, i.e.: a network which is shared with all other tenants. - * Control of the shared attribute could be reserved to particular users only, such as administrators. - * In this case, regular users trying to create a shared network will receive a 403 - Forbidden error. - * @return true if the network resource can be accessed by any tenant or not, false if not - */ - @Nullable - public Boolean getShared() { - return shared; - } - - /** - * @return the tenantId of the Network - */ - @Nullable - public String getTenantId() { - return tenantId; - } - - /** - * @return the networkType of the Network - */ - @Nullable - public NetworkType getNetworkType() { - return networkType; - } - - /** - * @return the physicalNetworkName of the Network - */ - @Nullable - public String getPhysicalNetworkName() { - return physicalNetworkName; - } - - /** - * @return the segmentationId of the Network - */ - @Nullable - public Integer getSegmentationId() { - return segmentationId; - } - - /** - * Adds external network attribute to network resource. - * @return the external of the Network - */ - @Nullable - public Boolean getExternal() { - return external; - } - - /** - * @return the portSecurity of the Network - */ - @Nullable - public Boolean getPortSecurity() { - return portSecurity; - } - - /** - * @return the profileId of the Network - */ - @Nullable - public String getProfileId() { - return profileId; - } - - /** - * @return the multicastIp of the Network - */ - @Nullable - public String getMulticastIp() { - return multicastIp; - } - - /** - * @return the segmentAdd of the Network - */ - @Nullable - public String getSegmentAdd() { - return segmentAdd; - } - - /** - * @return the segmentDel of the Network - */ - @Nullable - public String getSegmentDel() { - return segmentDel; - } - - /** - * @return the memberSegments of the Network - */ - @Nullable - public String getMemberSegments() { - return memberSegments; - } - - /** - * @return the segments of the Network - */ - @Nullable - public ImmutableSet<NetworkSegment> getSegments() { - return segments; - } - - /** - * @return the networkFlavor of the Network - */ - @Nullable - public String getNetworkFlavor() { - return networkFlavor; - } - - @Override - public int hashCode() { - return Objects.hashCode(id, status, subnets, name, adminStateUp, shared, tenantId, networkType, - physicalNetworkName, segmentationId, external, portSecurity, profileId, multicastIp, segmentAdd, segmentDel, - memberSegments, segments, networkFlavor); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null || getClass() != obj.getClass()) - return false; - Network that = Network.class.cast(obj); - return Objects.equal(this.id, that.id) - && Objects.equal(this.status, that.status) - && Objects.equal(this.subnets, that.subnets) - && Objects.equal(this.name, that.name) - && Objects.equal(this.adminStateUp, that.adminStateUp) - && Objects.equal(this.shared, that.shared) - && Objects.equal(this.tenantId, that.tenantId) - && Objects.equal(this.networkType, that.networkType) - && Objects.equal(this.physicalNetworkName, that.physicalNetworkName) - && Objects.equal(this.segmentationId, that.segmentationId) - && Objects.equal(this.external, that.external) - && Objects.equal(this.portSecurity, that.portSecurity) - && Objects.equal(this.profileId, that.profileId) - && Objects.equal(this.multicastIp, that.multicastIp) - && Objects.equal(this.segmentAdd, that.segmentAdd) - && Objects.equal(this.segmentDel, that.segmentDel) - && Objects.equal(this.memberSegments, that.memberSegments) - && Objects.equal(this.segments, that.segments) - && Objects.equal(this.networkFlavor, that.networkFlavor); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("id", id) - .add("status", status) - .add("subnets", subnets) - .add("name", name) - .add("adminStateUp", adminStateUp) - .add("shared", shared) - .add("tenantId", tenantId) - .add("networkType", networkType) - .add("physicalNetworkName", physicalNetworkName) - .add("segmentationId", segmentationId) - .add("external", external) - .add("portSecurity", portSecurity) - .add("profileId", profileId) - .add("multicastIp", multicastIp) - .add("segmentAdd", segmentAdd) - .add("segmentDel", segmentDel) - .add("memberSegments", memberSegments) - .add("segments", segments) - .add("networkFlavor", networkFlavor) - .toString(); - } - - /* - * Methods to get the Create and Update builders follow - */ - - /** - * @return the Builder for creating a new Router - */ - public static CreateBuilder createBuilder(String name) { - return new CreateBuilder(name); - } - - /** - * @return the Builder for updating a Router - */ - public static UpdateBuilder updateBuilder() { - return new UpdateBuilder(); - } - - private abstract static class Builder<ParameterizedBuilderType> { - protected Network network; - - /** - * No-parameters constructor used when updating. - * */ - private Builder() { - network = new Network(); - } - - protected abstract ParameterizedBuilderType self(); - - /** - * Provide the name to the Network's Builder. - * - * @return the Builder. - * @see Network#getName() - */ - public ParameterizedBuilderType name(String name) { - network.name = name; - return self(); - } - - /** - * Provide the adminStateUp to the Network's Builder. - * - * @return the Builder. - * @see Network#isAdminStateUp() - */ - public ParameterizedBuilderType adminStateUp(Boolean adminStateUp) { - network.adminStateUp = adminStateUp; - return self(); - } - - /** - * Provide the shared to the Network's Builder. - * - * @return the Builder. - * @see Network#isShared() - */ - public ParameterizedBuilderType shared(Boolean shared) { - network.shared = shared; - return self(); - } - - /** - * Provide the tenantId to the Network's Builder. - * - * @return the Builder. - * @see Network#getTenantId() - */ - public ParameterizedBuilderType tenantId(String tenantId) { - network.tenantId = tenantId; - return self(); - } - - /** - * Provide the networkType to the Network's Builder. - * - * @return the Builder. - * @see Network#getNetworkType() - */ - public ParameterizedBuilderType networkType(NetworkType networkType) { - network.networkType = networkType; - return self(); - } - - /** - * Provide the physicalNetworkName to the Network's Builder. - * - * @return the Builder. - * @see Network#getPhysicalNetworkName() - */ - public ParameterizedBuilderType physicalNetworkName(String physicalNetworkName) { - network.physicalNetworkName = physicalNetworkName; - return self(); - } - - /** - * Provide the segmentationId to the Network's Builder. - * - * @return the Builder. - * @see Network#getSegmentationId() - */ - public ParameterizedBuilderType segmentationId(Integer segmentationId) { - network.segmentationId = segmentationId; - return self(); - } - - /** - * Adds external network attribute to network resource. - * - * @return the Builder. - * @see Network#isExternal() - */ - public ParameterizedBuilderType external(Boolean external) { - network.external = external; - return self(); - } - - /** - * Provide the portSecurity to the Network's Builder. - * - * @return the Builder. - * @see Network#isPortSecurity() - */ - public ParameterizedBuilderType portSecurity(Boolean portSecurity) { - network.portSecurity = portSecurity; - return self(); - } - - /** - * Provide the profileId to the Network's Builder. - * - * @return the Builder. - * @see Network#getProfileId() - */ - public ParameterizedBuilderType profileId(String profileId) { - network.profileId = profileId; - return self(); - } - - /** - * Provide the multicastIp to the Network's Builder. - * - * @return the Builder. - * @see Network#getMulticastIp() - */ - public ParameterizedBuilderType multicastIp(String multicastIp) { - network.multicastIp = multicastIp; - return self(); - } - - /** - * Provide the segmentAdd to the Network's Builder. - * Cisco plugin extension; admin right might be needed to use this. - * - * @return the Builder. - * @see Network#getSegmentAdd() - */ - public ParameterizedBuilderType segmentAdd(String segmentAdd) { - network.segmentAdd = segmentAdd; - return self(); - } - - /** - * Provide the segmentDel to the Network's Builder. - * Cisco plugin extension; admin right might be needed to use this. - * - * @return the Builder. - * @see Network#getSegmentDel() - */ - public ParameterizedBuilderType segmentDel(String segmentDel) { - network.segmentDel = segmentDel; - return self(); - } - - /** - * Provide the memberSegments to the Network's Builder. - * Cisco plugin extension; admin right might be needed to use this. - * - * @return the Builder. - * @see Network#getMemberSegments() - */ - public ParameterizedBuilderType memberSegments(String memberSegments) { - network.memberSegments = memberSegments; - return self(); - } - - /** - * Provide the segments to the Network's Builder. - * Multiprovider extension. - * - * @return the Builder. - * @see Network#getSegments() - */ - public ParameterizedBuilderType segments(ImmutableSet<NetworkSegment> segments) { - network.segments = segments; - return self(); - } - - /** - * Provide the networkFlavor to the Network's Builder. - * - * @return the Builder. - * @see Network#getNetworkFlavor() - */ - public ParameterizedBuilderType networkFlavor(String networkFlavor) { - network.networkFlavor = networkFlavor; - return self(); - } - } - - /** - * Create and Update builders (inheriting from Builder) - */ - public static class CreateBuilder extends Builder<CreateBuilder> { - /** - * Supply required properties for creating a Builder - */ - private CreateBuilder(String name) { - network.name = name; - } - - /** - * @return a CreateNetwork constructed with this Builder. - */ - public CreateNetwork build() { - return new CreateNetwork(network); - } - - protected CreateBuilder self() { - return this; - } - } - - /** - * Create and Update builders (inheriting from Builder) - */ - public static class UpdateBuilder extends Builder<UpdateBuilder> { - /** - * Supply required properties for updating a Builder - */ - private UpdateBuilder() { - } - - /** - * @return a UpdateNetwork constructed with this Builder. - */ - public UpdateNetwork build() { - return new UpdateNetwork(network); - } - - protected UpdateBuilder self() { - return this; - } - } - - /** - * Create and Update options - extend the domain class, passed to API update and create calls. - * Essentially the same as the domain class. Ensure validation and safe typing. - */ - public static class CreateNetwork extends Network { - /** - * Copy constructor - */ - private CreateNetwork(Network network) { - super(network); - checkNotNull(network.name, "name should not be null"); - } - } - - /** - * Create and Update options - extend the domain class, passed to API update and create calls. - * Essentially the same as the domain class. Ensure validation and safe typing. - */ - public static class UpdateNetwork extends Network { - /** - * Copy constructor - */ - private UpdateNetwork(Network network) { - super(network); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkSegment.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkSegment.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkSegment.java deleted file mode 100644 index 8add465..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkSegment.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.domain; - -import java.beans.ConstructorProperties; - -import javax.inject.Named; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; - -/** - * A Neutron Network Segment - * Segments and provider values cannot both be set. - * - * @see <a - * href="http://docs.openstack.org/api/openstack-network/2.0/content/Subnets.html">api - * doc</a> - */ -public class NetworkSegment { - - @Named("provider:network_type") - protected final NetworkType networkType; - @Named("provider:physical_network") - protected final String physicalNetwork; - @Named("provider:segmentation_id") - protected final Integer segmentationId; - - @ConstructorProperties({"provider:network_type", "provider:physical_network", "provider:segmentation_id"}) - protected NetworkSegment(NetworkType networkType, String physicalNetwork, Integer segmentationId) { - this.networkType = networkType; - this.physicalNetwork = physicalNetwork; - this.segmentationId = segmentationId; - } - - /** - * @return the networkType of the NetworkSegment - */ - @Nullable - public NetworkType getNetworkType() { - return networkType; - } - - /** - * @return the physicalNetwork of the NetworkSegment - */ - @Nullable - public String getPhysicalNetwork() { - return physicalNetwork; - } - - /** - * @return the segmentationId of the NetworkSegment - */ - @Nullable - public Integer getSegmentationId() { - return segmentationId; - } - - @Override - public int hashCode() { - return Objects.hashCode(networkType, physicalNetwork, segmentationId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null || getClass() != obj.getClass()) - return false; - NetworkSegment that = NetworkSegment.class.cast(obj); - return Objects.equal(this.networkType, that.networkType) - && Objects.equal(this.physicalNetwork, that.physicalNetwork) - && Objects.equal(this.segmentationId, that.segmentationId); - } - - protected MoreObjects.ToStringHelper string() { - return MoreObjects.toStringHelper(this).add("networkType", networkType).add("physicalNetwork", physicalNetwork) - .add("segmentationId", segmentationId); - } - - @Override - public String toString() { - return string().toString(); - } - - /** - * @return the Builder for NetworkSegment - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Gets a Builder configured as this object. - */ - public Builder toBuilder() { - return new Builder().fromNetworkSegment(this); - } - - public static class Builder { - protected NetworkType networkType; - protected String physicalNetwork; - protected Integer segmentationId; - - /** - * Provide the networkType to the NetworkSegment's Builder. - * - * @return the Builder. - * @see NetworkSegment#getNetworkType() - */ - public Builder networkType(NetworkType networkType) { - this.networkType = networkType; - return this; - } - - /** - * Provide the physicalNetwork to the NetworkSegment's Builder. - * - * @return the Builder. - * @see NetworkSegment#getPhysicalNetwork() - */ - public Builder physicalNetwork(String physicalNetwork) { - this.physicalNetwork = physicalNetwork; - return this; - } - - /** - * Provide the segmentationId to the NetworkSegment's Builder. - * - * @return the Builder. - * @see NetworkSegment#getSegmentationId() - */ - public Builder segmentationId(int segmentationId) { - this.segmentationId = segmentationId; - return this; - } - - /** - * @return a NetworkSegment constructed with this Builder. - */ - public NetworkSegment build() { - return new NetworkSegment(networkType, physicalNetwork, segmentationId); - } - - /** - * @return a Builder from another NetworkSegment. - */ - public Builder fromNetworkSegment(NetworkSegment in) { - return this.networkType(in.getNetworkType()).physicalNetwork(in.getPhysicalNetwork()) - .segmentationId(in.getSegmentationId()); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkStatus.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkStatus.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkStatus.java deleted file mode 100644 index 04334d0..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkStatus.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2.domain; - -/** - * Enumerates Network Status. - */ -public enum NetworkStatus { - ACTIVE("active"), - DOWN("down"), - BUILD("build"), - ERROR("error"), - /** - * Used by jclouds when the service returns an unknown value other than null. - */ - UNRECOGNIZED("unrecognized"); - - private final String name; - - private NetworkStatus(String name) { - this.name = name; - } - - @Override - public String toString() { - return name(); - } - - /* - * This provides GSON enum support in jclouds. - * @param name The string representation of this enum value. - * @return The corresponding enum value. - */ - public static NetworkStatus fromValue(String name) { - if (name != null) { - for (NetworkStatus value : NetworkStatus.values()) { - if (name.equalsIgnoreCase(value.name)) { - return value; - } - } - return UNRECOGNIZED; - } - return null; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkType.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkType.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkType.java deleted file mode 100644 index 89c3e9a..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkType.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2.domain; - -/** - * Enumerates supported Network types. - */ -public enum NetworkType { - /** - * Used to describe a local network. - */ - LOCAL("local"), - /** - * Used to describe a flat network. - */ - FLAT("flat"), - /** - * Used to describe a VLAN network. NetworkSegment might have to be set. - */ - VLAN("vlan"), - /** - * Used to describe a Virtual Extensible LAN (VXLAN) network. - * It uses a VLAN-like encapsulation technique to encapsulate MAC-based - * OSI layer 2 Ethernet frames within layer 4 UDP packets. - */ - VXLAN("vxlan"), - /** - * Used to describe a GRE tunnel network. A virtual network realized as - * packets encapsulated using Generic Routing Encapsulation. GRE tunnel - * packets are routed by the compute node hosts, so GRE tunnels are not - * associated by the openvswitch plugin with specific physical networks. - */ - GRE("gre"), - /** - * Used by jclouds when the service returns an unknown value other than null. - */ - UNRECOGNIZED("unrecognized"); - - private String name; - - private NetworkType(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } - - /* - * This provides GSON enum support in jclouds. - * @param name The string representation of this enum value. - * @return The corresponding enum value. - */ - public static NetworkType fromValue(String name) { - if (name != null) { - for (NetworkType value : NetworkType.values()) { - if (name.equalsIgnoreCase(value.name)) { - return value; - } - } - return UNRECOGNIZED; - } - return null; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Networks.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Networks.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Networks.java deleted file mode 100644 index 9b3bf10..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Networks.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.domain; - -import java.beans.ConstructorProperties; - -import org.jclouds.openstack.v2_0.domain.Link; -import org.jclouds.openstack.v2_0.domain.PaginatedCollection; - -import com.google.common.collect.ImmutableSet; - -/** - * A collection of Networks - */ -public class Networks extends PaginatedCollection<Network> { - public static final Networks EMPTY = new Networks(ImmutableSet.<Network> of(), ImmutableSet.<Link> of()); - - @ConstructorProperties({"networks", "networks_links"}) - protected Networks(Iterable<Network> networks, Iterable<Link> networksLinks) { - super(networks, networksLinks); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Port.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Port.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Port.java deleted file mode 100644 index f22d2fa..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Port.java +++ /dev/null @@ -1,764 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.beans.ConstructorProperties; - -import javax.inject.Named; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; - -/** - * A Neutron port - * - * @see <a - * href="http://docs.openstack.org/api/openstack-network/1.0/content/Ports.html">api - * doc</a> - */ -public class Port { - - private String id; - private NetworkStatus status; - - // Extensions - - // portbindings.py - // The service will return the vif type for the specific port. - @Named("binding:vif_type") - private VIFType vifType; - // The service may return a dictionary containing additional - // information needed by the interface driver. The set of items - // returned may depend on the value of VIF_TYPE. - @Named("binding:vif_details") - private ImmutableMap<String, Object> vifDetails; - - // Plugins - - // qos.py - @Named("queue_id") - private String qosQueueId; - - private String name; - @Named("network_id") - private String networkId; - @Named("admin_state_up") - private Boolean adminStateUp; - @Named("mac_address") - private String macAddress; - @Named("fixed_ips") - private ImmutableSet<IP> fixedIps; - @Named("device_id") - private String deviceId; - @Named("device_owner") - private String deviceOwner; - @Named("tenant_id") - private String tenantId; - @Named("security_groups") - private ImmutableSet<String> securityGroups; - - // Extensions - - // allowedaddresspairs.py - @Named("allowed_address_pairs") - private ImmutableSet<AddressPair> allowedAddressPairs; - - // extra_dhcp_opt.py - @Named("extra_dhcp_opts") - private ImmutableSet<ExtraDhcpOption> extraDhcpOptions; - - // portbindings.py - // The type of vnic that this port should be attached to - @Named("binding:vnic_type") - private VNICType vnicType; - // In some cases different implementations may be run on different hosts. - // The host on which the port will be allocated. - @Named("binding:host_id") - private String hostId; - // The profile will be a dictionary that enables the application running - // on the specific host to pass and receive vif port specific information to - // the plugin. - @Named("binding:profile") - private ImmutableMap<String, Object> profile; - - // portsecurity.py - @Named("port_security_enabled") - private Boolean portSecurity; - - // Plugins - - // n1kv.py - @Named("n1kv:profile_id") - private String profileId; - - // maclearning.py - @Named("mac_learning_enabled") - private Boolean macLearning; - - // qos.py - @Named("rxtx_factor") - private Integer qosRxtxFactor; - - @ConstructorProperties({"id", "status", "binding:vif_type", "binding:vif_details", "queue_id", "name", "network_id", - "admin_state_up", "mac_address", "fixed_ips", "device_id", "device_owner", "tenant_id", "security_groups", - "allowed_address_pairs", "extra_dhcp_opts", "binding:vnic_type", "binding:host_id", "binding:profile", - "port_security_enabled", "n1kv:profile_id", "mac_learning_enabled", "rxtx_factor"}) - protected Port(String id, NetworkStatus status, VIFType vifType, ImmutableMap<String, Object> vifDetails, String qosQueueId, - String name, String networkId, Boolean adminStateUp, String macAddress, ImmutableSet<IP> fixedIps, String deviceId, - String deviceOwner, String tenantId, ImmutableSet<String> securityGroups, ImmutableSet<AddressPair> allowedAddressPairs, - ImmutableSet<ExtraDhcpOption> extraDhcpOptions, VNICType vnicType, String hostId, ImmutableMap<String, Object> profile, - Boolean portSecurity, String profileId, Boolean macLearning, Integer qosRxtxFactor) { - this.id = id; - this.status = status; - this.vifType = vifType; - this.vifDetails = vifDetails; - this.qosQueueId = qosQueueId; - this.name = name; - this.networkId = networkId; - this.adminStateUp = adminStateUp; - this.macAddress = macAddress; - this.fixedIps = fixedIps; - this.deviceId = deviceId; - this.deviceOwner = deviceOwner; - this.tenantId = tenantId; - this.securityGroups = securityGroups; - this.allowedAddressPairs = allowedAddressPairs; - this.extraDhcpOptions = extraDhcpOptions; - this.vnicType = vnicType; - this.hostId = hostId; - this.profile = profile; - this.portSecurity = portSecurity; - this.profileId = profileId; - this.macLearning = macLearning; - this.qosRxtxFactor = qosRxtxFactor; - } - - /** - * Default constructor. - */ - private Port() {} - - /** - * Copy constructor - * @param port - */ - private Port(Port port) { - this(port.id, - port.status, - port.vifType, - port.vifDetails, - port.qosQueueId, - port.name, - port.networkId, - port.adminStateUp, - port.macAddress, - port.fixedIps, - port.deviceId, - port.deviceOwner, - port.tenantId, - port.securityGroups, - port.allowedAddressPairs, - port.extraDhcpOptions, - port.vnicType, - port.hostId, - port.profile, - port.portSecurity, - port.profileId, - port.macLearning, - port.qosRxtxFactor); - } - - /** - * @return the id of the Port - */ - @Nullable - public String getId() { - return id; - } - - /** - * @return the status of the Port - */ - @Nullable - public NetworkStatus getStatus() { - return status; - } - - /** - * - * @return the vifType of the Port. Visible to only administrative users. - * - */ - @Nullable - public VIFType getVifType() { - return vifType; - } - - /** - * @return the vifDetails of the Port. A dictionary that enables the application to pass information about functions - * that Networking API v2.0 provides. Specify the following value: port_filter : Boolean to define whether - * Networking API v2.0 provides port filtering features such as security group and anti-MAC/IP spoofing. Visible to - * only administrative users. - */ - @Nullable - public ImmutableMap<String, Object> getVifDetails() { - return vifDetails; - } - - /** - * @return the qosQueueId of the Port - */ - @Nullable - public String getQosQueueId() { - return qosQueueId; - } - - /** - * @return the name of the Port - */ - @Nullable - public String getName() { - return name; - } - - /** - * @return the id of the network where this port is associated with. - */ - @Nullable - public String getNetworkId() { - return networkId; - } - - /** - * @return the administrative state of port. If false, port does not forward packets. - */ - @Nullable - public Boolean getAdminStateUp() { - return adminStateUp; - } - - /** - * @return the macAddress of the Port - */ - @Nullable - public String getMacAddress() { - return macAddress; - } - - /** - * @return the set of fixed ips this port has been assigned. - */ - @Nullable - public ImmutableSet<IP> getFixedIps() { - return fixedIps; - } - - /** - * @return the id of the device (e.g. server) using this port. - */ - @Nullable - public String getDeviceId() { - return deviceId; - } - - /** - * @return the entity (e.g.: dhcp agent) using this port. - */ - @Nullable - public String getDeviceOwner() { - return deviceOwner; - } - - /** - * @return the tenantId of the Port - */ - @Nullable - public String getTenantId() { - return tenantId; - } - - /** - * @return the set of security groups - */ - @Nullable - public ImmutableSet<String> getSecurityGroups() { - return securityGroups; - } - - /** - * @return the allowedAddressPairs of the Port - */ - @Nullable - public ImmutableSet<AddressPair> getAllowedAddressPairs() { - return allowedAddressPairs; - } - - /** - * @return the extraDhcpOptions of the Port - */ - @Nullable - public ImmutableSet<ExtraDhcpOption> getExtraDhcpOptions() { - return extraDhcpOptions; - } - - /** - * @return the vnicType of the Port. This extended attribute is visible to only port owners and administrative users. - * Specifies a value of normal (virtual nic), direct (pci passthrough), or macvtap (virtual interface with a - * tap-like software interface). These values support SR-IOV PCI passthrough networking. The ML2 plug-in supports - * the vnic_type. - */ - @Nullable - public VNICType getVnicType() { - return vnicType; - } - - /** - * @return the hostId of the Port. The ID of the host where the port is allocated. In some cases, different - * implementations can run on different hosts. Visible to only administrative users. - */ - @Nullable - public String getHostId() { - return hostId; - } - - /** - * @return the profile of the Port. A dictionary that enables the application to pass information about functions - * that the Networking API provides. To enable or disable port filtering features such as security group and - * anti-MAC/IP spoofing, specify port_filter: True or port_filter: False. Visible to only administrative users. - */ - @Nullable - public ImmutableMap<String, Object> getProfile() { - return profile; - } - - /** - * @return the portSecurity of the Port - */ - @Nullable - public Boolean getPortSecurity() { - return portSecurity; - } - - /** - * @return the profileId of the Port - */ - @Nullable - public String getProfileId() { - return profileId; - } - - /** - * @return the macLearning of the Port - */ - @Nullable - public Boolean getMacLearning() { - return macLearning; - } - - /** - * @return the qosRxtxFactor of the Port - */ - @Nullable - public Integer getQosRxtxFactor() { - return qosRxtxFactor; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - Port that = (Port) o; - - return Objects.equal(this.id, that.id) && - Objects.equal(this.status, that.status) && - Objects.equal(this.vifType, that.vifType) && - Objects.equal(this.vifDetails, that.vifDetails) && - Objects.equal(this.qosQueueId, that.qosQueueId) && - Objects.equal(this.name, that.name) && - Objects.equal(this.networkId, that.networkId) && - Objects.equal(this.adminStateUp, that.adminStateUp) && - Objects.equal(this.macAddress, that.macAddress) && - Objects.equal(this.fixedIps, that.fixedIps) && - Objects.equal(this.deviceId, that.deviceId) && - Objects.equal(this.deviceOwner, that.deviceOwner) && - Objects.equal(this.tenantId, that.tenantId) && - Objects.equal(this.securityGroups, that.securityGroups) && - Objects.equal(this.allowedAddressPairs, that.allowedAddressPairs) && - Objects.equal(this.extraDhcpOptions, that.extraDhcpOptions) && - Objects.equal(this.vnicType, that.vnicType) && - Objects.equal(this.hostId, that.hostId) && - Objects.equal(this.profile, that.profile) && - Objects.equal(this.portSecurity, that.portSecurity) && - Objects.equal(this.profileId, that.profileId) && - Objects.equal(this.macLearning, that.macLearning) && - Objects.equal(this.qosRxtxFactor, that.qosRxtxFactor); - } - - @Override - public int hashCode() { - return Objects.hashCode(id, status, vifType, vifDetails, qosQueueId, name, - networkId, adminStateUp, macAddress, fixedIps, deviceId, - deviceOwner, tenantId, securityGroups, allowedAddressPairs, extraDhcpOptions, - vnicType, hostId, profile, portSecurity, profileId, - macLearning, qosRxtxFactor); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("id", id) - .add("status", status) - .add("vifType", vifType) - .add("vifDetails", vifDetails) - .add("qosQueueId", qosQueueId) - .add("name", name) - .add("networkId", networkId) - .add("adminStateUp", adminStateUp) - .add("macAddress", macAddress) - .add("fixedIps", fixedIps) - .add("deviceId", deviceId) - .add("deviceOwner", deviceOwner) - .add("tenantId", tenantId) - .add("securityGroups", securityGroups) - .add("allowedAddressPairs", allowedAddressPairs) - .add("extraDhcpOptions", extraDhcpOptions) - .add("vnicType", vnicType) - .add("hostId", hostId) - .add("profile", profile) - .add("portSecurity", portSecurity) - .add("profileId", profileId) - .add("macLearning", macLearning) - .add("qosRxtxFactor", qosRxtxFactor) - .toString(); - } - - /* - * Methods to get the Create and Update builders follow - */ - - /** - * @return the Builder for creating a new Router - */ - public static CreateBuilder createBuilder(String networkId) { - return new CreateBuilder(networkId); - } - - /** - * @return the Builder for updating a Router - */ - public static UpdateBuilder updateBuilder() { - return new UpdateBuilder(); - } - - private abstract static class Builder<ParameterizedBuilderType> { - protected Port port; - - /** - * No-parameters constructor used when updating. - */ - private Builder() { - port = new Port(); - } - - protected abstract ParameterizedBuilderType self(); - - /** - * Provide the name to the Port's Builder. - * - * @return the Builder. - * @see Port#getName() - */ - public ParameterizedBuilderType name(String name) { - port.name = name; - return self(); - } - - /** - * Provide the networkId to the Port's Builder. - * - * @return the Builder. - * @see Port#getNetworkId() - */ - public ParameterizedBuilderType networkId(String networkId) { - port.networkId = networkId; - return self(); - } - - /** - * Provide the adminStateUp to the Port's Builder. - * - * @return the Builder. - * @see Port#getAdminStateUp() - */ - public ParameterizedBuilderType adminStateUp(Boolean adminStateUp) { - port.adminStateUp = adminStateUp; - return self(); - } - - /** - * Provide the macAddress to the Port's Builder. - * - * @return the Builder. - * @see Port#getMacAddress() - */ - public ParameterizedBuilderType macAddress(String macAddress) { - port.macAddress = macAddress; - return self(); - } - - /** - * Provide the fixedIps to the Port's Builder. - * - * @return the Builder. - * @see Port#getFixedIps() - */ - public ParameterizedBuilderType fixedIps(ImmutableSet<IP> fixedIps) { - port.fixedIps = fixedIps; - return self(); - } - - /** - * Provide the deviceId to the Port's Builder. - * - * @return the Builder. - * @see Port#getDeviceId() - */ - public ParameterizedBuilderType deviceId(String deviceId) { - port.deviceId = deviceId; - return self(); - } - - /** - * Provide the deviceOwner to the Port's Builder. - * - * @return the Builder. - * @see Port#getDeviceOwner() - */ - public ParameterizedBuilderType deviceOwner(String deviceOwner) { - port.deviceOwner = deviceOwner; - return self(); - } - - /** - * Provide the tenantId to the Port's Builder. - * - * @return the Builder. - * @see Port#getTenantId() - */ - public ParameterizedBuilderType tenantId(String tenantId) { - port.tenantId = tenantId; - return self(); - } - - /** - * Provide the tenantId to the Port's Builder. - * - * @return the Builder. - * @see Port#getSecurityGroups() - */ - public ParameterizedBuilderType securityGroups(ImmutableSet<String> securityGroups) { - port.securityGroups = securityGroups; - return self(); - } - - /** - * Provide the allowedAddressPairs to the Port's Builder. - * - * @return the Builder. - * @see Port#getAllowedAddressPairs() - */ - public ParameterizedBuilderType allowedAddressPairs(ImmutableSet<AddressPair> allowedAddressPairs) { - port.allowedAddressPairs = allowedAddressPairs; - return self(); - } - - /** - * Provide the extraDhcpOptions to the Port's Builder. - * - * @return the Builder. - * @see Port#getExtraDhcpOptions() - */ - public ParameterizedBuilderType extraDhcpOptions(ImmutableSet<ExtraDhcpOption> extraDhcpOptions) { - port.extraDhcpOptions = extraDhcpOptions; - return self(); - } - - /** - * Provide the vnicType to the Port's Builder. - * Specify a value of normal (virtual nic), direct (pci passthrough), or macvtap (virtual interface with a - * tap-like software interface). These values support SR-IOV PCI passthrough networking. The ML2 plug-in supports - * the vnic_type. - * - * @return the Builder. - * @see Port#getVnicType() - */ - public ParameterizedBuilderType vnicType(VNICType vnicType) { - port.vnicType = vnicType; - return self(); - } - - /** - * Provide the hostId to the Port's Builder. - * - * @return the Builder. - * @see Port#getHostId() - */ - public ParameterizedBuilderType hostId(String hostId) { - port.hostId = hostId; - return self(); - } - - /** - * Provide the profile to the Port's Builder. - * This attribute is a dictionary that can be used (with admin credentials) to supply information influencing the - * binding of the port. This functionality is needed for SR-IOV PCI passthrough. - * - * @return the Builder. - * @see Port#getProfile() - */ - public ParameterizedBuilderType profile(ImmutableMap<String, Object> profile) { - port.profile = profile; - return self(); - } - - /** - * Provide the portSecurity to the Port's Builder. - * - * @return the Builder. - * @see Port#getPortSecurity() - */ - public ParameterizedBuilderType portSecurity(Boolean portSecurity) { - port.portSecurity = portSecurity; - return self(); - } - - /** - * Provide the profileId to the Port's Builder. - * - * @return the Builder. - * @see Port#getProfileId() - */ - public ParameterizedBuilderType profileId(String profileId) { - port.profileId = profileId; - return self(); - } - - /** - * Provide the macLearning to the Port's Builder. - * - * @return the Builder. - * @see Port#getMacLearning() - */ - public ParameterizedBuilderType macLearning(Boolean macLearning) { - port.macLearning = macLearning; - return self(); - } - - /** - * Provide the qosRxtxFactor to the Port's Builder. - * - * @return the Builder. - * @see Port#getQosRxtxFactor() - */ - public ParameterizedBuilderType qosRxtxFactor(int qosRxtxFactor) { - port.qosRxtxFactor = qosRxtxFactor; - return self(); - } - } - - /** - * Create and Update builders (inheriting from Builder) - */ - public static class CreateBuilder extends Builder<CreateBuilder> { - /** - * - * Supply required properties for creating a Builder - */ - private CreateBuilder(String networkId) { - port.networkId = networkId; - } - - /** - * @return a CreatePort constructed with this Builder. - */ - public CreatePort build() { - return new CreatePort(port); - } - - protected CreateBuilder self() { - return this; - } - } - - /** - * Create and Update builders (inheriting from Builder) - */ - public static class UpdateBuilder extends Builder<UpdateBuilder> { - /** - * Supply required properties for updating a Builder - */ - private UpdateBuilder() { - } - - /** - * @return a UpdatePort constructed with this Builder. - */ - public UpdatePort build() { - return new UpdatePort(port); - } - - protected UpdateBuilder self() { - return this; - } - } - - /** - * Create and Update options - extend the domain class, passed to API update and create calls. - * Essentially the same as the domain class. Ensure validation and safe typing. - */ - public static class CreatePort extends Port { - /** - * Copy constructor - */ - private CreatePort(Port port) { - super(port); - checkNotNull(port.networkId, "networkId should not be null"); - } - } - - /** - * Create and Update options - extend the domain class, passed to API update and create calls. - * Essentially the same as the domain class. Ensure validation and safe typing. - */ - public static class UpdatePort extends Port { - /** - * Copy constructor - */ - private UpdatePort(Port port) { - super(port); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Ports.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Ports.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Ports.java deleted file mode 100644 index 8cf449b..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Ports.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.domain; - -import java.beans.ConstructorProperties; - -import org.jclouds.openstack.v2_0.domain.Link; -import org.jclouds.openstack.v2_0.domain.PaginatedCollection; - -import com.google.common.collect.ImmutableSet; - -/** - * A collection of Ports - */ -public class Ports extends PaginatedCollection<Port> { - public static final Ports EMPTY = new Ports(ImmutableSet.<Port> of(), ImmutableSet.<Link> of()); - - @ConstructorProperties({"ports", "ports_links"}) - protected Ports(Iterable<Port> ports, Iterable<Link> portsLinks) { - super(ports, portsLinks); - } -}
