http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Router.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Router.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Router.java deleted file mode 100644 index 7330c9b..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Router.java +++ /dev/null @@ -1,286 +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 Router - * - * @see <a - * href="http://docs.openstack.org/api/openstack-network/2.0/content/router_ext_concepts.html">api - * doc</a> - */ -public class Router { - - private String id; - private NetworkStatus status; - - private String name; - @Named("tenant_id") - private String tenantId; - @Named("admin_state_up") - private Boolean adminStateUp; - @Named("external_gateway_info") - private ExternalGatewayInfo externalGatewayInfo; - - /** - * @param id - * @param status - * @param name - * @param tenantId - * @param adminStateUp - * @param externalGatewayInfo - */ - @ConstructorProperties({"id", "status", "name", "tenant_id", "admin_state_up", "external_gateway_info"}) - private Router(String id, NetworkStatus status, String name, String tenantId, Boolean adminStateUp, ExternalGatewayInfo externalGatewayInfo) { - this.id = id; - this.status = status; - this.name = name; - this.tenantId = tenantId; - this.adminStateUp = adminStateUp; - this.externalGatewayInfo = externalGatewayInfo; - } - - /** - * Default constructor. - */ - private Router() {} - - /** - * Copy constructor - * @param router - */ - private Router(Router router) { - this(router.id, router.status, router.name, router.tenantId, router.adminStateUp, router.externalGatewayInfo); - } - - /** - * @return the id of the Router - */ - @Nullable - public String getId() { - return id; - } - - /** - * @return the status of the Router - */ - @Nullable - public NetworkStatus getStatus() { - return status; - } - - /** - * @return the name of the Router - */ - @Nullable - public String getName() { - return name; - } - - /** - * @return the tenantId of the Router - */ - @Nullable - public String getTenantId() { - return tenantId; - } - - /** - * @return the adminStateUp of the Router - */ - @Nullable - public Boolean getAdminStateUp() { - return adminStateUp; - } - - /** - * @return the externalGatewayInfo of the Router - */ - @Nullable - public ExternalGatewayInfo getExternalGatewayInfo() { - return externalGatewayInfo; - } - - /** - * @return the Builder for creating a new Router - */ - public static CreateBuilder createBuilder() { - return new CreateBuilder(); - } - - /** - * @return the Builder for updating a Router - */ - public static UpdateBuilder updateBuilder() { - return new UpdateBuilder(); - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - Router that = (Router) o; - - return Objects.equal(this.id, that.id) && - Objects.equal(this.status, that.status) && - Objects.equal(this.name, that.name) && - Objects.equal(this.tenantId, that.tenantId) && - Objects.equal(this.adminStateUp, that.adminStateUp) && - Objects.equal(this.externalGatewayInfo, that.externalGatewayInfo); - } - - @Override - public int hashCode() { - return Objects.hashCode(id, status, name, tenantId, adminStateUp, externalGatewayInfo); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("id", id) - .add("status", status) - .add("name", name) - .add("tenantId", tenantId) - .add("adminStateUp", adminStateUp) - .add("externalGatewayInfo", externalGatewayInfo) - .toString(); - } - - private abstract static class Builder<ParameterizedBuilderType> { - protected Router router; - - /** - * No-parameters constructor used when updating. - * */ - private Builder() { - router = new Router(); - } - - protected abstract ParameterizedBuilderType self(); - - /** - * Provide the name to the Router's Builder. - * - * @return the Builder. - * @see Router#getName() - */ - public ParameterizedBuilderType name(String name) { - router.name = name; - return self(); - } - - /** - * Provide the tenantId to the Router's Builder. - * - * @return the Builder. - * @see Router#getTenantId() - */ - public ParameterizedBuilderType tenantId(String tenantId) { - router.tenantId = tenantId; - return self(); - } - - /** - * Provide the adminStateUp to the Router's Builder. - * - * @return the Builder. - * @see Router#getAdminStateUp() - */ - public ParameterizedBuilderType adminStateUp(Boolean adminStateUp) { - router.adminStateUp = adminStateUp; - return self(); - } - - /** - * Provide the externalGatewayInfo to the Router's Builder. - * - * @return the Builder. - * @see Router#getExternalGatewayInfo() - */ - public ParameterizedBuilderType externalGatewayInfo(ExternalGatewayInfo externalGatewayInfo) { - router.externalGatewayInfo = externalGatewayInfo; - return self(); - } - } - - public static class CreateBuilder extends Builder<CreateBuilder> { - /** - * Supply required properties for creating a Builder - */ - private CreateBuilder() { - } - - /** - * @return a CreateRouter constructed with this Builder. - */ - public CreateRouter build() { - return new CreateRouter(router); - } - - protected CreateBuilder self() { - return this; - } - } - - public static class UpdateBuilder extends Builder<UpdateBuilder> { - /** - * Supply required properties for updating a Builder - */ - private UpdateBuilder() { - } - - /** - * @return a UpdateRouter constructed with this Builder. - */ - public UpdateRouter build() { - return new UpdateRouter(router); - } - - protected UpdateBuilder self() { - return this; - } - } - - public static class CreateRouter extends Router{ - /** - * Copy constructor - */ - private CreateRouter(Router router) { - super(router); - } - } - public static class UpdateRouter extends Router{ - /** - * Copy constructor - */ - private UpdateRouter(Router router) { - super(router); - } - } -}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/RouterInterface.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/RouterInterface.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/RouterInterface.java deleted file mode 100644 index 710c0bf..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/RouterInterface.java +++ /dev/null @@ -1,142 +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 Router Interface - * - * @see <a - * href="http://docs.openstack.org/api/openstack-network/2.0/content/router_add_interface.html">api - * doc</a> - */ -public class RouterInterface { - - @Named("subnet_id") - protected final String subnetId; - @Named("port_id") - protected final String portId; - - @ConstructorProperties({"subnet_id", "port_id"}) - protected RouterInterface(String subnetId, String portId) { - this.subnetId = subnetId; - this.portId = portId; - } - - /** - * @return the subnetId of the RouterInterface - */ - @Nullable - public String getSubnetId() { - return subnetId; - } - - /** - * @return the portId of the RouterInterface - */ - @Nullable - public String getPortId() { - return portId; - } - - @Override - public int hashCode() { - return Objects.hashCode(subnetId, portId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null || getClass() != obj.getClass()) - return false; - RouterInterface that = RouterInterface.class.cast(obj); - return Objects.equal(this.subnetId, that.subnetId) && Objects.equal(this.portId, that.portId); - } - - protected MoreObjects.ToStringHelper string() { - return MoreObjects.toStringHelper(this).add("subnetId", subnetId).add("portId", portId); - } - - @Override - public String toString() { - return string().toString(); - } - - /** - * @return the Builder for RouterInterface - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Gets a Builder configured as this object. - */ - public Builder toBuilder() { - return new Builder().fromRouterInterface(this); - } - - public static class Builder { - protected String subnetId; - protected String portId; - - /** - * Provide the subnetId to the RouterInterface's Builder. - * - * @return the Builder. - * @see RouterInterface#getSubnetId() - */ - public Builder subnetId(String subnetId) { - this.subnetId = subnetId; - return this; - } - - /** - * Provide the portId to the RouterInterface's Builder. - * - * @return the Builder. - * @see RouterInterface#getPortId() - */ - public Builder portId(String portId) { - this.portId = portId; - return this; - } - - /** - * @return a RouterInterface constructed with this Builder. - */ - public RouterInterface build() { - return new RouterInterface(subnetId, portId); - } - - /** - * @return a Builder from another RouterInterface. - */ - public Builder fromRouterInterface(RouterInterface in) { - return this.subnetId(in.getSubnetId()).portId(in.getPortId()); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Routers.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Routers.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Routers.java deleted file mode 100644 index c02c382..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Routers.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 Routers - */ -public class Routers extends PaginatedCollection<Router> { - public static final Routers EMPTY = new Routers(ImmutableSet.<Router> of(), ImmutableSet.<Link> of()); - - @ConstructorProperties({"routers", "routers_links"}) - protected Routers(Iterable<Router> routers, Iterable<Link> routersLinks) { - super(routers, routersLinks); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rule.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rule.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rule.java deleted file mode 100644 index ae4b913..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rule.java +++ /dev/null @@ -1,379 +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.checkArgument; -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; - -/** - * Contains a mapping between a MAC address and an IP address. - */ -public class Rule { - - private String id; - @Named("tenant_id") - private String tenantId; - private RuleDirection direction; - @Named("security_group_id") - private String securityGroupId; - private RuleEthertype ethertype; - @Named("port_range_min") - private Integer portRangeMin; - @Named("port_range_max") - private Integer portRangeMax; - private RuleProtocol protocol; - @Named("remote_group_id") - private String remoteGroupId; - @Named("remote_ip_prefix") - private String remoteIpPrefix; - - @ConstructorProperties({"id", "tenant_id", "direction", "security_group_id", "ethertype", "port_range_min", - "port_range_max", "protocol", "remote_group_id", "remote_ip_prefix"}) - protected Rule(String id, String tenantId, RuleDirection direction, String securityGroupId, - RuleEthertype ethertype, Integer portRangeMin, Integer portRangeMax, - RuleProtocol protocol, String remoteGroupId, String remoteIpPrefix) { - this.id = id; - this.tenantId = tenantId; - this.direction = direction; - this.securityGroupId = securityGroupId; - this.ethertype = ethertype; - this.portRangeMin = portRangeMin; - this.portRangeMax = portRangeMax; - this.protocol = protocol; - this.remoteGroupId = remoteGroupId; - this.remoteIpPrefix = remoteIpPrefix; - } - - private Rule(Rule rule) { - this(rule.id, - rule.tenantId, - rule.direction, - rule.securityGroupId, - rule.ethertype, - rule.portRangeMin, - rule.portRangeMax, - rule.protocol, - rule.remoteGroupId, - rule.remoteIpPrefix - ); - } - - private Rule() {} - - /** - * @return The identifier for this rule. - */ - @Nullable - public String getId() { - return id; - } - - /** - * @return The identifier of the tenant for this rule. - */ - @Nullable - public String getTenantId() { - return tenantId; - } - - /** - * @return The direction in which the security group rule is applied. - */ - @Nullable - public RuleDirection getDirection() { - return direction; - } - - /** - * @return The security group ID to associate with this security group rule. - */ - @Nullable - public String getSecurityGroupId() { - return securityGroupId; - } - - /** - * @return The internet protocol version type of this rule. - */ - @Nullable - public RuleEthertype getEthertype() { - return ethertype; - } - - /** - * @return The minimum port number in the range that is matched by the security group rule. If the protocol is TCP - * or UDP, this value must be less than or equal to the value of the port_range_max attribute. If the protocol is - * ICMP, this value must be an ICMP type. - */ - @Nullable - public Integer getPortRangeMin() { - return portRangeMin; - } - - /** - * @return The maximum port number in the range that is matched by the security group rule. The port_range_min - * attribute constrains the port_range_max attribute. If the protocol is ICMP, this value must be an ICMP type. - */ - @Nullable - public Integer getPortRangeMax() { - return portRangeMax; - } - - /** - * @return The protocol that is matched by the security group rule. Valid values are null, tcp, udp, and icmp. - */ - @Nullable - public RuleProtocol getProtocol() { - return protocol; - } - - /** - * @return The remote group ID to be associated with this security group rule. - */ - @Nullable - public String getRemoteGroupId() { - return remoteGroupId; - } - - /** - * @return The remote IP prefix to be associated with this security group rule. This attribute matches the specified - * IP prefix as the source IP address of the IP packet. - */ - @Nullable - public String getRemoteIpPrefix() { - return remoteIpPrefix; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - Rule that = (Rule) o; - - return Objects.equal(this.id, that.id) && - Objects.equal(this.tenantId, that.tenantId) && - Objects.equal(this.direction, that.direction) && - Objects.equal(this.securityGroupId, that.securityGroupId) && - Objects.equal(this.ethertype, that.ethertype) && - Objects.equal(this.portRangeMin, that.portRangeMin) && - Objects.equal(this.portRangeMax, that.portRangeMax) && - Objects.equal(this.protocol, that.protocol) && - Objects.equal(this.remoteGroupId, that.remoteGroupId) && - Objects.equal(this.remoteIpPrefix, that.remoteIpPrefix); - } - - @Override - public int hashCode() { - return Objects.hashCode(id, tenantId, direction, securityGroupId, ethertype, portRangeMin, - portRangeMax, protocol, remoteGroupId, remoteIpPrefix); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("id", id) - .add("tenantId", tenantId) - .add("direction", direction) - .add("securityGroupId", securityGroupId) - .add("ethertype", ethertype) - .add("portRangeMin", portRangeMin) - .add("portRangeMax", portRangeMax) - .add("protocol", protocol) - .add("remoteGroupId", remoteGroupId) - .add("remoteIpPrefix", remoteIpPrefix) - .toString(); - } - - - /* - * Methods to get the Create and Update builders follow - */ - - /** - * @return the Builder for creating a new SecurityGroupRule - */ - public static CreateBuilder createBuilder(RuleDirection direction, String securityGroupId) { - return new CreateBuilder(direction, securityGroupId); - } - - public abstract static class Builder<ParameterizedBuilderType> { - // Keep track of the builder's state. - protected Rule rule; - - private Builder() { - rule = new Rule(); - } - - protected abstract ParameterizedBuilderType self(); - - /** - * The tenant id for this rule. Usually can only be specified by administrators. - * - * @return the Builder. - * @see Rule#getTenantId() - */ - public ParameterizedBuilderType tenantId(String tenantId) { - rule.tenantId = tenantId; - return self(); - } - - /** - * The direction in which the security group rule is applied. - * - * @return the Builder. - * @see Rule#getDirection() - */ - public ParameterizedBuilderType direction(RuleDirection direction) { - rule.direction = direction; - return self(); - } - - /** - * The security group ID to associate with this security group rule. - * - * @return the Builder. - * @see Rule#getSecurityGroupId() - */ - public ParameterizedBuilderType securityGroupId(String securityGroupId) { - rule.securityGroupId = securityGroupId; - return self(); - } - - /** - * The internet protocol version for this rule. - * - * @return the Builder. - * @see Rule#getEthertype() - */ - public ParameterizedBuilderType ethertype(RuleEthertype ethertype) { - rule.ethertype = ethertype; - return self(); - } - - /** - * The minimum port number in the range that is matched by the security group rule. - * - * @return the Builder. - * @see Rule#getPortRangeMin() - */ - public ParameterizedBuilderType portRangeMin(Integer portRangeMin) { - rule.portRangeMin = portRangeMin; - return self(); - } - - /** - * The maximum port number in the range that is matched by the security group rule. - * - * @return the Builder. - * @see Rule#getPortRangeMax() - */ - public ParameterizedBuilderType portRangeMax(Integer portRangeMax) { - rule.portRangeMax = portRangeMax; - return self(); - } - - /** - * The protocol that is matched by the security group rule. Valid values are null, tcp, udp, and icmp. - * - * @return the Builder. - * @see Rule#getProtocol() - */ - public ParameterizedBuilderType protocol(RuleProtocol protocol) { - rule.protocol = protocol; - return self(); - } - - /** - * The remote group ID to be associated with this security group rule. You can specify either remote_group_id or - * remote_ip_prefix in the request body. - * - * @return the Builder. - * @see Rule#getRemoteGroupId() - */ - public ParameterizedBuilderType remoteGroupId(String remoteGroupId) { - rule.remoteGroupId = remoteGroupId; - return self(); - } - - /** - * The remote IP prefix to be associated with this security group rule. You can specify either remote_group_id - * or remote_ip_prefix in the request body. This attribute matches the specified IP prefix as the source IP - * address of the IP packet. - * - * @return the Builder. - * @see Rule#getRemoteIpPrefix() - */ - public ParameterizedBuilderType remoteIpPrefix(String remoteIpPrefix) { - rule.remoteIpPrefix = remoteIpPrefix; - return self(); - } - } - - /** - * This is used to build a CreateBuilder object. - */ - public static class CreateBuilder extends Builder<CreateBuilder> { - /** - * Supply required properties for creating a Builder - */ - private CreateBuilder(RuleDirection direction, String securityGroupId) { - rule.direction = direction; - rule.securityGroupId = securityGroupId; - } - - /** - * @return a CreateRule constructed with this Builder. - */ - public CreateRule build() { - return new CreateRule(rule); - } - - protected CreateBuilder 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 CreateRule extends Rule { - private CreateRule(Rule rule) { - super(rule); - checkNotNull(this.getDirection(), "direction should not be null"); - checkNotNull(this.getSecurityGroupId(), "security group id should not be null"); - if (this.getPortRangeMax() != null && this.getPortRangeMin() != null) { - checkArgument(this.getPortRangeMax() >= this.getPortRangeMin(), - "port range max should be greater than or equal to port range min"); - } - checkArgument(this.getRemoteGroupId() == null || this.getRemoteIpPrefix() == null, - "You can specify either remote_group_id or remote_ip_prefix in the request body."); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleDirection.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleDirection.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleDirection.java deleted file mode 100644 index 52e4273..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleDirection.java +++ /dev/null @@ -1,61 +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; - -/** - * The direction in which the security group rule is applied. - */ -public enum RuleDirection { - /** - * For a compute instance, an âingressâ security group rule matches traffic that is incoming (ingress) for that instance. - */ - INGRESS("ingress"), - /** - * An âegressâ rule is applied to traffic leaving the instance. - */ - EGRESS("egress"), - /** - * Used by jclouds when the service returns an unknown value other than null. - */ - UNRECOGNIZED("unrecognized"); - - private String name; - - private RuleDirection(String name) { - this.name = name; - } - - public String toString() { - return name; - } - - /* - * This provides GSON enum support in jclouds. - * */ - public static RuleDirection fromValue(String name){ - if (name != null) { - for (RuleDirection value : RuleDirection.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/RuleEthertype.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleEthertype.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleEthertype.java deleted file mode 100644 index dd3aa3f..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleEthertype.java +++ /dev/null @@ -1,61 +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; - -/** - * The direction in which the security group rule is applied. - */ -public enum RuleEthertype { - /** - * Internet Protocol version 4 - */ - IPV4("IPv4"), - /** - * Internet Protocol version 6 - */ - IPV6("IPv6"), - /** - * Used by jclouds when the service returns an unknown value other than null. - */ - UNRECOGNIZED("unrecognized"); - - private String name; - - private RuleEthertype(String name) { - this.name = name; - } - - public String toString() { - return name; - } - - /* - * This provides GSON enum support in jclouds. - * */ - public static RuleEthertype fromValue(String name){ - if (name != null) { - for (RuleEthertype value : RuleEthertype.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/RuleProtocol.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleProtocol.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleProtocol.java deleted file mode 100644 index f6a4574..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleProtocol.java +++ /dev/null @@ -1,65 +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; - -/** - * The protocol that is matched by the security group rule. Valid values are null, tcp, udp, and icmp. - */ -public enum RuleProtocol { - /** - * Transmission Control Protocol - */ - TCP("tcp"), - /** - * User Datagram Protocol - */ - UDP("udp"), - /** - * Internet Control Message Protocol - */ - ICMP("icmp"), - /** - * Used by jclouds when the service returns an unknown value other than null. - */ - UNRECOGNIZED("unrecognized"); - - private String name; - - private RuleProtocol(String name) { - this.name = name; - } - - public String toString() { - return name; - } - - /* - * This provides GSON enum support in jclouds. - * */ - public static RuleProtocol fromValue(String name){ - if (name != null) { - for (RuleProtocol value : RuleProtocol.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/Rules.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rules.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rules.java deleted file mode 100644 index 505ff36..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rules.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 Rules extends PaginatedCollection<Rule> { - public static final Rules EMPTY = new Rules(ImmutableSet.<Rule> of(), ImmutableSet.<Link> of()); - - @ConstructorProperties({"security_group_rules", "security_group_rules_links"}) - protected Rules(Iterable<Rule> securityGroups, Iterable<Link> securityGroupRulesLinks) { - super(securityGroups, securityGroupRulesLinks); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroup.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroup.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroup.java deleted file mode 100644 index 6a1b8b7..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroup.java +++ /dev/null @@ -1,220 +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.collect.ImmutableList; - -/** - * Contains a mapping between a MAC address and an IP address. - */ -public class SecurityGroup { - - private String id; - @Named("tenant_id") - private String tenantId; - private String name; - private String description; - @Named("security_group_rules") - private ImmutableList<Rule> rules; - - @ConstructorProperties({"id", "tenant_id", "name", "description", "security_group_rules"}) - protected SecurityGroup(String id, String tenantId, String name, String description, - ImmutableList<Rule> rules) { - this.id = id; - this.tenantId = tenantId; - this.name = name; - this.description = description; - this.rules = rules; - } - - private SecurityGroup(SecurityGroup securityGroup) { - this(securityGroup.id, - securityGroup.tenantId, - securityGroup.name, - securityGroup.description, - securityGroup.rules - ); - } - - private SecurityGroup() {} - - /** - * @return The identifier for this Security Group. - */ - @Nullable - public String getId() { - return id; - } - - /** - * @return The identifier of the tenant for this Security Group. - */ - @Nullable - public String getTenantId() { - return tenantId; - } - - /** - * @return The name of the Security Group. - */ - @Nullable - public String getName() { - return name; - } - - /** - * @return The description of the Security Group. - */ - @Nullable - public String getDescription() { - return description; - } - - /** - * @return The collection of rules for this Security Group. - */ - public ImmutableList<Rule> getRules() { - return rules != null ? rules : ImmutableList.<Rule>of(); - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - SecurityGroup that = (SecurityGroup) o; - - return Objects.equal(this.id, that.id) && - Objects.equal(this.tenantId, that.tenantId) && - Objects.equal(this.name, that.name) && - Objects.equal(this.description, that.description) && - Objects.equal(this.rules, that.rules); - } - - @Override - public int hashCode() { - return Objects.hashCode(id, tenantId, name, description, rules); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("id", id) - .add("tenantId", tenantId) - .add("name", name) - .add("description", description) - .add("securityGroupRules", rules) - .toString(); - } - - /* - * Methods to get the Create and Update builders follow - */ - - /** - * @return the Builder for creating a new SecurityGroup - */ - public static CreateBuilder createBuilder() { - return new CreateBuilder(); - } - - private abstract static class Builder<ParameterizedBuilderType> { - // Keep track of the builder's state. - protected SecurityGroup securityGroup; - - private Builder() { - securityGroup = new SecurityGroup(); - } - - protected abstract ParameterizedBuilderType self(); - - /** - * The tenant id for this Security Group. Usually can only be specified by administrators. - * - * @return the Builder. - * @see SecurityGroup#getTenantId() - */ - public ParameterizedBuilderType tenantId(String tenantId) { - securityGroup.tenantId = tenantId; - return self(); - } - - /** - * The name for this Security Group. - * - * @return the Builder. - * @see SecurityGroup#getName() - */ - public ParameterizedBuilderType name(String name) { - securityGroup.name = name; - return self(); - } - - /** - * The description for this Security Group. - * - * @return the Builder. - * @see SecurityGroup#getDescription() - */ - public ParameterizedBuilderType description(String description) { - securityGroup.description = description; - 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() { - } - - /** - * @return a CreateSecurityGroup constructed with this Builder. - */ - public CreateSecurityGroup build() { - return new CreateSecurityGroup(securityGroup); - } - - protected CreateBuilder 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 CreateSecurityGroup extends SecurityGroup { - private CreateSecurityGroup(SecurityGroup securityGroup) { - super(securityGroup); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroups.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroups.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroups.java deleted file mode 100644 index 044ce1c..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroups.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 SecurityGroups extends PaginatedCollection<SecurityGroup> { - public static final SecurityGroups EMPTY = new SecurityGroups(ImmutableSet.<SecurityGroup> of(), ImmutableSet.<Link> of()); - - @ConstructorProperties({"security_groups", "security_groups_links"}) - protected SecurityGroups(Iterable<SecurityGroup> securityGroups, Iterable<Link> securityGroupsLinks) { - super(securityGroups, securityGroupsLinks); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnet.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnet.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnet.java deleted file mode 100644 index 1f05709..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnet.java +++ /dev/null @@ -1,467 +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 java.util.Collection; - -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 subnet - * - * @see <a href="http://docs.openstack.org/api/openstack-network/2.0/content/Subnets.html">api doc</a> - */ -public class Subnet { - - private String id; - - private String name; - @Named("network_id") - private String networkId; - @Named("tenant_id") - private String tenantId; - // Cannot be used for updates. - @Named("allocation_pools") - private ImmutableSet<AllocationPool> allocationPools; - @Named("gateway_ip") - private String gatewayIp; - @Named("ip_version") - private Integer ipVersion; - private String cidr; - @Named("enable_dhcp") - private Boolean enableDhcp; - @Named("dns_nameservers") - private ImmutableSet<String> dnsNameServers; - @Named("host_routes") - private ImmutableSet<HostRoute> hostRoutes; - @Named("ipv6_address_mode") - private IPv6DHCPMode ipv6AddressMode; - @Named("ipv6_ra_mode") - private IPv6DHCPMode ipv6RaMode; - - @ConstructorProperties({"id", "name", "network_id", "tenant_id", "allocation_pools", "gateway_ip", "ip_version", - "cidr", "enable_dhcp", "dns_nameservers", "host_routes", "ipv6_address_mode", "ipv6_ra_mode"}) - private Subnet(String id, String name, String networkId, String tenantId, ImmutableSet<AllocationPool> allocationPools, - String gatewayIp, Integer ipVersion, String cidr, Boolean enableDhcp, ImmutableSet<String> dnsNameServers, ImmutableSet<HostRoute> hostRoutes, - IPv6DHCPMode ipv6AddressMode, IPv6DHCPMode ipv6RaMode) { - this.id = id; - this.name = name; - this.networkId = networkId; - this.tenantId = tenantId; - this.allocationPools = allocationPools; - this.gatewayIp = gatewayIp; - this.ipVersion = ipVersion; - this.cidr = cidr; - this.enableDhcp = enableDhcp; - this.dnsNameServers = dnsNameServers; - this.hostRoutes = hostRoutes; - this.ipv6AddressMode = ipv6AddressMode; - this.ipv6RaMode = ipv6RaMode; - } - - /** - * Default constructor. - */ - private Subnet() {} - - /** - * Copy constructor - * @param subnet - */ - private Subnet(Subnet subnet) { - this(subnet.id, - subnet.name, - subnet.networkId, - subnet.tenantId, - subnet.allocationPools, - subnet.gatewayIp, - subnet.ipVersion, - subnet.cidr, - subnet.enableDhcp, - subnet.dnsNameServers, - subnet.hostRoutes, - subnet.ipv6AddressMode, - subnet.ipv6RaMode); - } - - /** - * @return the id of the subnet - */ - @Nullable - public String getId() { - return this.id; - } - - /** - * @return the name of the subnet - */ - @Nullable - public String getName() { - return this.name; - } - - /** - * @return the id of the network this subnet is associated with. - */ - @Nullable - public String getNetworkId() { - return networkId; - } - - /** - * @return the id of the tenant where this entity is associated with. - */ - @Nullable - public String getTenantId() { - return tenantId; - } - - /** - * @return the sub-ranges of CIDR available for dynamic allocation to ports. - */ - @Nullable - public ImmutableSet<AllocationPool> getAllocationPools() { - return allocationPools; - } - - /** - * @return the default gateway used by devices in this subnet. - */ - @Nullable - public String getGatewayIp() { - return gatewayIp; - } - - /** - * @return the IP version used by this subnet. - */ - @Nullable - public Integer getIpVersion() { - return ipVersion; - } - - /** - * @return the CIDR representing the IP range for this subnet, based on IP version. - */ - @Nullable - public String getCidr() { - return cidr; - } - - /** - * @return true if DHCP is enabled for this subnet, false if not. - */ - @Nullable - public Boolean getEnableDhcp() { - return enableDhcp; - } - - /** - * @return Configurable maximum amount of name servers per subnet. The default is 5. - */ - @Nullable - public ImmutableSet<String> getDnsNameservers() { - return dnsNameServers; - } - - /** - * @return Configurable maximum amount of routes per subnet. The default is 20. - */ - @Nullable - public ImmutableSet<HostRoute> getHostRoutes() { - return hostRoutes; - } - - /** - * @return The IP v6 Address Mode. - */ - @Nullable - public IPv6DHCPMode getIPv6AddressMode() { - return ipv6AddressMode; - } - - /** - * @return The IP v6 Router Advertisement mode. - */ - @Nullable - public IPv6DHCPMode getIPv6RAMode() { - return ipv6RaMode; - } - - @Override - public int hashCode() { - return Objects.hashCode(id, name, networkId, tenantId, allocationPools, gatewayIp, - ipVersion, cidr, enableDhcp, dnsNameServers, hostRoutes, - ipv6AddressMode, ipv6RaMode); - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - Subnet that = (Subnet) o; - - return Objects.equal(this.id, that.id) && - Objects.equal(this.name, that.name) && - Objects.equal(this.networkId, that.networkId) && - Objects.equal(this.tenantId, that.tenantId) && - Objects.equal(this.allocationPools, that.allocationPools) && - Objects.equal(this.gatewayIp, that.gatewayIp) && - Objects.equal(this.ipVersion, that.ipVersion) && - Objects.equal(this.cidr, that.cidr) && - Objects.equal(this.enableDhcp, that.enableDhcp) && - Objects.equal(this.dnsNameServers, that.dnsNameServers) && - Objects.equal(this.hostRoutes, that.hostRoutes) && - Objects.equal(this.ipv6AddressMode, that.ipv6AddressMode) && - Objects.equal(this.ipv6RaMode, that.ipv6RaMode); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("id", id) - .add("name", name) - .add("networkId", networkId) - .add("tenantId", tenantId) - .add("allocationPools", allocationPools) - .add("gatewayIp", gatewayIp) - .add("ipVersion", ipVersion) - .add("cidr", cidr) - .add("enableDhcp", enableDhcp) - .add("dnsNameServers", dnsNameServers) - .add("hostRoutes", hostRoutes) - .add("ipv6AddressMode", ipv6AddressMode) - .add("ipv6RaMode", ipv6RaMode) - .toString(); - } - - /* - * Methods to get the Create and Update builders follow - */ - - /** - * @return the Builder for creating a new Router - */ - public static CreateBuilder createBuilder(String networkId, String cidr) { - return new CreateBuilder(networkId, cidr); - } - - /** - * @return the Builder for updating a Router - */ - public static UpdateBuilder updateBuilder() { - return new UpdateBuilder(); - } - - private abstract static class Builder<ParameterizedBuilderType> { - protected Subnet subnet; - - /** - * No-parameters constructor used when updating. - */ - private Builder() { - subnet = new Subnet(); - } - - protected abstract ParameterizedBuilderType self(); - - /** - * @see Subnet#getName() - */ - public ParameterizedBuilderType name(String name) { - subnet.name = name; - return self(); - } - - /** - * @see Subnet#getNetworkId() - */ - public ParameterizedBuilderType networkId(String networkId) { - subnet.networkId = networkId; - return self(); - } - - /** - * Only administrators can specify a tenant ID that is not their own. - * As it is optional, this is usually omitted in requests. - * @see Subnet#getTenantId() - */ - public ParameterizedBuilderType tenantId(String tenantId) { - subnet.tenantId = tenantId; - return self(); - } - - /** - * @see Subnet#getAllocationPools() - */ - public ParameterizedBuilderType allocationPools(Collection<AllocationPool> allocationPools) { - subnet.allocationPools = ImmutableSet.copyOf(allocationPools); - return self(); - } - - /** - * @see Subnet#getGatewayIp() - */ - public ParameterizedBuilderType gatewayIp(String gatewayIp) { - subnet.gatewayIp = gatewayIp; - return self(); - } - - /** - * @see Subnet#getIpVersion() - */ - public ParameterizedBuilderType ipVersion(int ipVersion) { - subnet.ipVersion = ipVersion; - return self(); - } - - /** - * @see Subnet#getCidr() - */ - public ParameterizedBuilderType cidr(String cidr) { - subnet.cidr = cidr; - return self(); - } - - /** - * @see Subnet#getEnableDhcp() - */ - public ParameterizedBuilderType enableDhcp(Boolean enableDhcp) { - subnet.enableDhcp = enableDhcp; - return self(); - } - - /** - * @see Subnet#getDnsNameservers() - */ - public ParameterizedBuilderType dnsNameServers(ImmutableSet<String> dnsNameServers) { - subnet.dnsNameServers = dnsNameServers; - return self(); - } - - /** - * @see Subnet#getHostRoutes() - */ - public ParameterizedBuilderType hostRoutes(ImmutableSet<HostRoute> hostRoutes) { - subnet.hostRoutes = hostRoutes; - return self(); - } - - /** - * @see Subnet#getIPv6RAMode() - */ - public ParameterizedBuilderType ipv6RaMode(IPv6DHCPMode ipv6RaMode) { - subnet.ipv6RaMode = ipv6RaMode; - return self(); - } - - /** - * @see Subnet#getIPv6AddressMode() - */ - public ParameterizedBuilderType ipv6AddressMode(IPv6DHCPMode ipv6AddressMode) { - subnet.ipv6AddressMode = ipv6AddressMode; - 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, String cidr) { - subnet.networkId = networkId; - subnet.cidr = cidr; - } - - /** - * @return a CreateSubnet constructed with this Builder. - */ - public CreateSubnet build() { - return new CreateSubnet(subnet); - } - - 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 UpdateSubnet constructed with this Builder. - */ - public UpdateSubnet build() { - return new UpdateSubnet(subnet); - } - - 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 CreateSubnet extends Subnet { - /** - * Copy constructor - */ - private CreateSubnet(Subnet subnet) { - super(subnet); - checkNotNull(subnet.networkId, "networkId should not be null"); - checkNotNull(subnet.cidr, "cidr 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 UpdateSubnet extends Subnet { - /** - * Copy constructor - */ - private UpdateSubnet(Subnet subnet) { - super(subnet); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnets.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnets.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnets.java deleted file mode 100644 index fb9896e..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnets.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 Subnets - */ -public class Subnets extends PaginatedCollection<Subnet> { - public static final Subnets EMPTY = new Subnets(ImmutableSet.<Subnet> of(), ImmutableSet.<Link> of()); - - @ConstructorProperties({"subnets", "subnets_links"}) - protected Subnets(Iterable<Subnet> subnets, Iterable<Link> subnetsLinks) { - super(subnets, subnetsLinks); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewall.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewall.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewall.java deleted file mode 100644 index 10f5cab..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewall.java +++ /dev/null @@ -1,68 +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 org.jclouds.javax.annotation.Nullable; -import org.jclouds.json.SerializedNames; - -import com.google.auto.value.AutoValue; - - -/** - * Representation of update options for an OpenStack Neutron Firewall. - * - * @see <a - * href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api - * doc</a> - */ -@AutoValue -public abstract class UpdateFirewall { - - @Nullable public abstract String getTenantId(); - @Nullable public abstract String getName(); - @Nullable public abstract String getDescription(); - @Nullable public abstract Boolean getAdminStateUp(); - @Nullable public abstract String getFirewallPolicyId(); - - @SerializedNames({"tenant_id", "name", "description", "admin_state_up", "firewall_policy_id"}) - public static UpdateFirewall create(String tenantId, String name, String description, Boolean adminStateUp, String firewallPolicyId) { - return builder().tenantId(tenantId).name(name).description(description).adminStateUp(adminStateUp).firewallPolicyId(firewallPolicyId).build(); - } - - public static Builder builder() { - return new AutoValue_UpdateFirewall.Builder(); - } - - public abstract Builder toBuilder(); - - @AutoValue.Builder - public abstract static class Builder { - public abstract Builder tenantId(String tenantId); - public abstract Builder name(String name); - public abstract Builder description(String description); - public abstract Builder adminStateUp(Boolean adminStateUp); - public abstract Builder firewallPolicyId(String firewallPolicyId); - - @Nullable public abstract String getTenantId(); - @Nullable public abstract String getName(); - @Nullable public abstract String getDescription(); - @Nullable public abstract Boolean getAdminStateUp(); - @Nullable public abstract String getFirewallPolicyId(); - - public abstract UpdateFirewall build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallPolicy.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallPolicy.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallPolicy.java deleted file mode 100644 index 3791b34..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallPolicy.java +++ /dev/null @@ -1,80 +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.util.List; - -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.json.SerializedNames; - -import com.google.auto.value.AutoValue; -import com.google.common.collect.ImmutableList; - -/** - * Representation of update options for an OpenStack Neutron Firewall Policy. - * - * @see <a - * href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api - * doc</a> - */ -@AutoValue -public abstract class UpdateFirewallPolicy { - - @Nullable public abstract String getTenantId(); - @Nullable public abstract String getName(); - @Nullable public abstract String getDescription(); - @Nullable public abstract Boolean getShared(); - @Nullable public abstract List<String> getFirewallRules(); - @Nullable public abstract Boolean getAudited(); - - @SerializedNames({"tenant_id", "name", "description", "shared", "firewall_rules", "audited"}) - private static UpdateFirewallPolicy create(String tenantId, String name, String description, Boolean shared, List<String> firewallRules, Boolean audited) { - return builder().tenantId(tenantId).name(name).description(description).shared(shared).firewallRules(firewallRules).audited(audited).build(); - } - - public static Builder builder() { - return new AutoValue_UpdateFirewallPolicy.Builder().shared(false).audited(false); - } - - public abstract Builder toBuilder(); - - @AutoValue.Builder - public abstract static class Builder { - public abstract Builder tenantId(String tenantId); - public abstract Builder name(String name); - public abstract Builder description(String description); - public abstract Builder shared(Boolean shared); - public abstract Builder firewallRules(List<String> firewallRules); - public abstract Builder audited(Boolean audited); - - abstract UpdateFirewallPolicy autoBuild(); - - @Nullable public abstract String getTenantId(); - @Nullable public abstract String getName(); - @Nullable public abstract String getDescription(); - @Nullable public abstract Boolean getShared(); - @Nullable public abstract List<String> getFirewallRules(); - @Nullable public abstract Boolean getAudited(); - - public UpdateFirewallPolicy build() { - firewallRules(getFirewallRules() != null ? ImmutableList.copyOf(getFirewallRules()) : ImmutableList.<String>of()); - return autoBuild(); - } - - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallRule.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallRule.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallRule.java deleted file mode 100644 index b66e902..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallRule.java +++ /dev/null @@ -1,100 +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 org.jclouds.javax.annotation.Nullable; -import org.jclouds.json.SerializedNames; - -import com.google.auto.value.AutoValue; - -/** - * Representation of update options for an OpenStack Neutron Firewall Rule. - * - * @see <a - * href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api - * doc</a> - */ -@AutoValue -public abstract class UpdateFirewallRule { - - @Nullable public abstract String getTenantId(); - @Nullable public abstract String getName(); - @Nullable public abstract String getDescription(); - @Nullable public abstract String getFirewallPolicyId(); - @Nullable public abstract Boolean getShared(); - @Nullable public abstract String getProtocol(); - @Nullable public abstract IpVersion getIpVersion(); - @Nullable public abstract String getSourceIpAddress(); - @Nullable public abstract String getDestinationIpAddress(); - @Nullable public abstract String getSourcePort(); - @Nullable public abstract String getDestinationPort(); - @Nullable public abstract Integer getPosition(); - @Nullable public abstract String getAction(); - @Nullable public abstract Boolean getEnabled(); - - @SerializedNames({ "tenant_id", "name", "description", "firewall_policy_id", "shared", "protocol", "ip_version", "source_ip_address", - "destination_ip_address", "source_port", "destination_port", "position", "action", "enabled"}) - public static UpdateFirewallRule create(String tenantId, String name, String description, String firewallPolicyId, Boolean shared, String protocol, - IpVersion ipVersion, String sourceIpAddress, String destinationIpAddress, String sourcePort, String destinationPort, int position, - String action, Boolean enabled) { - return builder().tenantId(tenantId).name(name).description(description).firewallPolicyId(firewallPolicyId).shared(shared) - .protocol(protocol).ipVersion(ipVersion).sourceIpAddress(sourceIpAddress).destinationIpAddress(destinationIpAddress).sourcePort(sourcePort) - .destinationPort(destinationPort).position(position).action(action).enabled(enabled).build(); - } - - public static Builder builder() { - return new AutoValue_UpdateFirewallRule.Builder().shared(false).enabled(false).position(null); - } - - public abstract Builder toBuilder(); - - @AutoValue.Builder - public abstract static class Builder { - public abstract Builder tenantId(String tenantId); - public abstract Builder name(String name); - public abstract Builder description(String description); - public abstract Builder firewallPolicyId(String firewallPolicyId); - public abstract Builder shared(Boolean shared); - public abstract Builder protocol(String protocol); - public abstract Builder ipVersion(IpVersion ipVersion); - public abstract Builder sourceIpAddress(String sourceIpAddress); - public abstract Builder destinationIpAddress(String destinationIpAddress); - public abstract Builder sourcePort(String sourcePort); - public abstract Builder destinationPort(String destinationPort); - public abstract Builder position(Integer position); - public abstract Builder action(String action); - public abstract Builder enabled(Boolean enabled); - - @Nullable public abstract String getTenantId(); - @Nullable public abstract String getName(); - @Nullable public abstract String getDescription(); - @Nullable public abstract String getFirewallPolicyId(); - @Nullable public abstract Boolean getShared(); - @Nullable public abstract String getProtocol(); - @Nullable public abstract IpVersion getIpVersion(); - @Nullable public abstract String getSourceIpAddress(); - @Nullable public abstract String getDestinationIpAddress(); - @Nullable public abstract String getSourcePort(); - @Nullable public abstract String getDestinationPort(); - @Nullable public abstract Integer getPosition(); - @Nullable public abstract String getAction(); - @Nullable public abstract Boolean getEnabled(); - - public abstract UpdateFirewallRule build(); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/VIFType.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/VIFType.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/VIFType.java deleted file mode 100644 index 5417065..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/VIFType.java +++ /dev/null @@ -1,62 +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 VIFType { - UNBOUND("unbound"), - BINDING_FAILED("binding_failed"), - IOVISOR("iovisor"), - OVS("ovs"), - BRIDGE("bridge"), - _802_QBG("802.1qbg"), - _802_QBH("802.1qbh"), - HYPERV("hyperv"), - MIDONET("midonet"), - MLNX_DIRECT("mlnx_direct"), - MLNX_HOSTDEV("hostdev"), - OTHER("other"), - /** - * Used by jclouds when the service returns an unknown value other than null. - */ - UNRECOGNIZED("unrecognized"); - - private String name; - - private VIFType(String name) { - this.name = name; - } - - public String toString() { - return name; - } - - /* - * This provides GSON enum support in jclouds. - * */ - public static VIFType fromValue(String name){ - if (name != null) { - for (VIFType value : VIFType.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/VNICType.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/VNICType.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/VNICType.java deleted file mode 100644 index 80fd4aa..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/VNICType.java +++ /dev/null @@ -1,56 +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 VNIC types. - */ -public enum VNICType { - NORMAL("normal"), - DIRECT("direct"), - MACVTAP("macvtap"), - /** - * Used by jclouds when the service returns an unknown value other than null. - */ - UNRECOGNIZED("unrecognized"); - - private String name; - - private VNICType(String name) { - this.name = name; - } - - public String toString() { - return name; - } - - /* - * This provides GSON enum support in jclouds. - * */ - public static VNICType fromValue(String name){ - if (name != null) { - for (VNICType value : VNICType.values()) { - if (name.equalsIgnoreCase(value.name)) { - return value; - } - } - return UNRECOGNIZED; - } - return null; - } -}
