http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rule.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rule.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rule.java deleted file mode 100644 index 89e9d19..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rule.java +++ /dev/null @@ -1,376 +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.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 Objects.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"); - 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/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleDirection.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleDirection.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleDirection.java deleted file mode 100644 index 52e4273..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleEthertype.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleEthertype.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleEthertype.java deleted file mode 100644 index dd3aa3f..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleProtocol.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleProtocol.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/RuleProtocol.java deleted file mode 100644 index f6a4574..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rules.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rules.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rules.java deleted file mode 100644 index 4794a18..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rules.java +++ /dev/null @@ -1,35 +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/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroup.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroup.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroup.java deleted file mode 100644 index d9b08aa..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroup.java +++ /dev/null @@ -1,218 +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.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 Objects.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/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroups.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroups.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/SecurityGroups.java deleted file mode 100644 index 044ce1c..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnet.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnet.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnet.java deleted file mode 100644 index 6e0cfc0..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnet.java +++ /dev/null @@ -1,466 +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.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 Objects.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/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnets.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnets.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Subnets.java deleted file mode 100644 index fb9896e..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/VIFType.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/VIFType.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/VIFType.java deleted file mode 100644 index 5417065..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/VNICType.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/VNICType.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/VNICType.java deleted file mode 100644 index 80fd4aa..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/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; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitor.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitor.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitor.java deleted file mode 100644 index 593690d..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitor.java +++ /dev/null @@ -1,450 +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.lbaas.v1; - -import java.beans.ConstructorProperties; - -import javax.inject.Named; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableList; - -/** - * A Neutron LBaaS v1 HealthMonitor. - */ -public class HealthMonitor { - - // Mandatory attributes when creating - @Named("tenant_id") - private String tenantId; - private ProbeType type; - // Mandatory attributes that can be updated - private Integer delay; - private Integer timeout; - @Named("max_retries") - private Integer maxRetries; - // Optional attributes that can be updated - @Named("http_method") - private HttpMethod httpMethod; - @Named("url_path") - private String urlPath; - @Named("expected_codes") - private String expectedCodes; - @Named("admin_state_up") - private Boolean adminStateUp; - // Read-only attributes - private String id; - private ImmutableList<PoolStatus> pools; - private LBaaSStatus status; - @Named("status_description") - private String statusDescription; - - /** - * Deserialization constructor - */ - @ConstructorProperties({ "id", "tenant_id", "type", "delay", "timeout", "max_retries", "http_method", "url_path", - "expected_codes", "pools", "admin_state_up", "status", "status_description" }) - private HealthMonitor(String id, String tenantId, ProbeType type, Integer delay, Integer timeout, - Integer maxRetries, HttpMethod httpMethod, String urlPath, String expectedCodes, - ImmutableList<PoolStatus> pools, Boolean adminStateUp, LBaaSStatus status, String statusDescription) { - this.id = id; - this.tenantId = tenantId; - this.type = type; - this.delay = delay; - this.timeout = timeout; - this.maxRetries = maxRetries; - this.httpMethod = httpMethod; - this.urlPath = urlPath; - this.expectedCodes = expectedCodes; - this.pools = pools; - this.adminStateUp = adminStateUp; - this.status = status; - this.statusDescription = statusDescription; - } - - /** - * Default constructor. - */ - private HealthMonitor() { - } - - /** - * Copy constructor. - * - * @param healthMonitor the HealthMonitor to copy from. - */ - private HealthMonitor(HealthMonitor healthMonitor) { - this(healthMonitor.id, healthMonitor.tenantId, healthMonitor.type, healthMonitor.delay, healthMonitor.timeout, - healthMonitor.maxRetries, healthMonitor.httpMethod, healthMonitor.urlPath, healthMonitor.expectedCodes, - healthMonitor.pools, healthMonitor.adminStateUp, healthMonitor.status, healthMonitor.statusDescription); - } - - /** - * @return the id of the HealthMonitor. - */ - @Nullable - public String getId() { - return id; - } - - /** - * @return the tenant id of the HealthMonitor. - */ - @Nullable - public String getTenantId() { - return tenantId; - } - - /** - * @return the probe type for this HealthMonitor. - */ - @Nullable - public ProbeType getType() { - return type; - } - - /** - * @return the delay for this HealthMonitor. - */ - @Nullable - public Integer getDelay() { - return delay; - } - - /** - * @return the timeout for this HealthMonitor. - */ - @Nullable - public Integer getTimeout() { - return timeout; - } - - /** - * @return the max retries for this HealthMonitor. - */ - @Nullable - public Integer getMaxRetries() { - return maxRetries; - } - - /** - * @return the HTTP method for this HealthMonitor. - */ - @Nullable - public HttpMethod getHttpMethod() { - return httpMethod; - } - - /** - * @return the URL path for this HealthMonitor. - */ - @Nullable - public String getUrlPath() { - return urlPath; - } - - /** - * @return the expected codes for this HealthMonitor. - */ - @Nullable - public String getExpectedCodes() { - return expectedCodes; - } - - /** - * @return the pools for this HealthMonitor. - */ - @Nullable - public ImmutableList<PoolStatus> getPools() { - return pools; - } - - /** - * @return the administrative state for this HealthMonitor. - */ - @Nullable - public Boolean getAdminStateUp() { - return adminStateUp; - } - - /** - * @return the status for this HealthMonitor. - */ - @Nullable - public LBaaSStatus getStatus() { - return status; - } - - /** - * @return the status description for this HealthMonitor. - */ - @Nullable - public String getStatusDescription() { - return statusDescription; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - HealthMonitor that = (HealthMonitor) o; - - return Objects.equal(this.id, that.id) && Objects.equal(this.tenantId, that.tenantId) - && Objects.equal(this.type, that.type) && Objects.equal(this.delay, that.delay) - && Objects.equal(this.timeout, that.timeout) && Objects.equal(this.maxRetries, that.maxRetries) - && Objects.equal(this.httpMethod, that.httpMethod) && Objects.equal(this.urlPath, that.urlPath) - && Objects.equal(this.expectedCodes, that.expectedCodes) && Objects.equal(this.pools, that.pools) - && Objects.equal(this.adminStateUp, that.adminStateUp) && Objects.equal(this.status, that.status) - && Objects.equal(this.statusDescription, that.statusDescription); - } - - @Override - public int hashCode() { - return Objects.hashCode(id, tenantId, type, delay, timeout, maxRetries, httpMethod, urlPath, expectedCodes, - pools, adminStateUp, status, statusDescription); - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("id", id).add("tenantId", tenantId).add("type", type) - .add("delay", delay).add("timeout", timeout).add("maxRetries", maxRetries).add("httpMethod", httpMethod) - .add("urlPath", urlPath).add("expectedCodes", expectedCodes).add("pools", pools) - .add("adminStateUp", adminStateUp).add("status", status).add("statusDescription", statusDescription) - .toString(); - } - - /* - * Methods to get the Create and Update builders follow. - */ - - /** - * @return the Builder for creating a new HealthMonitor. - */ - public static CreateBuilder createBuilder(ProbeType type, Integer delay, Integer timeout, Integer maxRetries) { - return new CreateBuilder(type, delay, timeout, maxRetries); - } - - /** - * @return the Builder for updating a HealthMonitor. - */ - public static UpdateBuilder updateBuilder() { - return new UpdateBuilder(); - } - - private abstract static class Builder<ParameterizedBuilderType> { - protected HealthMonitor healthMonitor; - - /** - * Default constructor. - */ - private Builder() { - healthMonitor = new HealthMonitor(); - } - - protected abstract ParameterizedBuilderType self(); - - /** - * Provides the delay for this HealthMonitor's Builder. - * - * @return the Builder. - * @see HealthMonitor#getDelay() - */ - public ParameterizedBuilderType delay(Integer delay) { - healthMonitor.delay = delay; - return self(); - } - - /** - * Provides the timeout for this HealthMonitor's Builder. - * - * @return the Builder. - * @see HealthMonitor#getTimeout() - */ - public ParameterizedBuilderType timeout(Integer timeout) { - healthMonitor.timeout = timeout; - return self(); - } - - /** - * Provides the max retries for this HealthMonitor's Builder. - * - * @return the Builder. - * @see HealthMonitor#getMaxRetries() - */ - public ParameterizedBuilderType maxRetries(Integer maxRetries) { - healthMonitor.maxRetries = maxRetries; - return self(); - } - - /** - * Provides the HTTP method for this HealthMonitor's Builder. - * - * @return the Builder. - * @see HealthMonitor#getHttpMethod() - */ - public ParameterizedBuilderType httpMethod(HttpMethod httpMethod) { - healthMonitor.httpMethod = httpMethod; - return self(); - } - - /** - * Provides the URL path for this HealthMonitor's Builder. - * - * @return the Builder. - * @see HealthMonitor#getUrlPath() - */ - public ParameterizedBuilderType urlPath(String urlPath) { - healthMonitor.urlPath = urlPath; - return self(); - } - - /** - * Provides the expected codes for this HealthMonitor's Builder. - * - * @return the Builder. - * @see HealthMonitor#getExpectedCodes() - */ - public ParameterizedBuilderType expectedCodes(String expectedCodes) { - healthMonitor.expectedCodes = expectedCodes; - return self(); - } - - /** - * Provides the administrative state for this HealthMonitor's Builder. - * - * @return the Builder. - * @see HealthMonitor#getAdminStateUp() - */ - public ParameterizedBuilderType adminStateUp(Boolean adminStateUp) { - healthMonitor.adminStateUp = adminStateUp; - return self(); - } - } - - /** - * Create builder (inheriting from Builder). - */ - public static class CreateBuilder extends Builder<CreateBuilder> { - /** - * Supply required properties for creating a HealthMonitor's CreateBuilder. - * - * @param type the probe type. - * @param delay the delay. - * @param timeout the timeout. - * @param maxRetries the max retries. - */ - private CreateBuilder(ProbeType type, Integer delay, Integer timeout, Integer maxRetries) { - type(type).delay(delay).timeout(timeout).maxRetries(maxRetries); - } - - /** - * Provides the tenantId for this HealthMonitor's CreateBuilder. 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 HealthMonitor#getTenantId() - */ - public CreateBuilder tenantId(String tenantId) { - healthMonitor.tenantId = tenantId; - return self(); - } - - /** - * Provides the probe type for this HealthMonitor's Builder. - * - * @return the Builder. - * @see HealthMonitor#getType() - */ - public CreateBuilder type(ProbeType type) { - healthMonitor.type = type; - return self(); - } - - /** - * @return a CreateHealthMonitor constructed with this Builder. - */ - public CreateHealthMonitor build() { - return new CreateHealthMonitor(healthMonitor); - } - - @Override - protected CreateBuilder self() { - return this; - } - } - - /** - * Update builder (inheriting from Builder). - */ - public static class UpdateBuilder extends Builder<UpdateBuilder> { - /** - * Supply required properties for creating a HealthMonitor's UpdateBuilder. - */ - private UpdateBuilder() { - } - - /** - * @return an UpdateHealthMonitor constructed with this Builder. - */ - public UpdateHealthMonitor build() { - return new UpdateHealthMonitor(healthMonitor); - } - - @Override - protected UpdateBuilder self() { - return this; - } - } - - /** - * Create options - extend the domain class, passed to API create calls. - * Essentially the same as the domain class. Ensure validation and safe typing. - */ - public static class CreateHealthMonitor extends HealthMonitor { - /** - * Copy constructor. - * - * @param healthMonitor the HealthMonitor to copy from. - */ - private CreateHealthMonitor(HealthMonitor healthMonitor) { - super(healthMonitor); - } - } - - /** - * Update options - extend the domain class, passed to API update calls. - * Essentially the same as the domain class. Ensure validation and safe typing. - */ - public static class UpdateHealthMonitor extends HealthMonitor { - /** - * Copy constructor. - * - * @param healthMonitor the HealthMonitor to copy from. - */ - private UpdateHealthMonitor(HealthMonitor healthMonitor) { - super(healthMonitor); - } - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitorStatus.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitorStatus.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitorStatus.java deleted file mode 100644 index 64e3aea..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitorStatus.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.lbaas.v1; - -import java.beans.ConstructorProperties; - -import javax.inject.Named; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.base.Objects; - -/** - * A Neutron LBaaS v1 HealthMonitorStatus. - * Contains an id and status describing the health monitor's status. - * - * @see Pool#getHealthMonitorsStatus() - */ -public class HealthMonitorStatus { - - // Mandatory attributes - @Named("monitor_id") - protected final String id; - protected final LBaaSStatus status; - // Optional attributes - @Named("status_description") - protected final String statusDescription; - - @ConstructorProperties({ "monitor_id", "status", "status_description" }) - protected HealthMonitorStatus(String id, LBaaSStatus status, String statusDescription) { - this.id = id; - this.status = status; - this.statusDescription = statusDescription; - } - - /** - * @return the id of the HealthMonitorStatus. - */ - @Nullable - public String getId() { - return id; - } - - /** - * @return the status of the HealthMonitorStatus - */ - @Nullable - public LBaaSStatus getStatus() { - return status; - } - - /** - * @return the status description of the HealthMonitorStatus - */ - @Nullable - public String getStatusDescription() { - return statusDescription; - } - - @Override - public int hashCode() { - return Objects.hashCode(id, status, statusDescription); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null || getClass() != obj.getClass()) - return false; - HealthMonitorStatus that = HealthMonitorStatus.class.cast(obj); - return Objects.equal(this.id, that.id) && Objects.equal(this.status, that.status) - && Objects.equal(this.statusDescription, that.statusDescription); - } - - protected Objects.ToStringHelper string() { - return Objects.toStringHelper(this).add("id", id).add("status", status) - .add("statusDescription", statusDescription); - } - - @Override - public String toString() { - return string().toString(); - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitors.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitors.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitors.java deleted file mode 100644 index a254938..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitors.java +++ /dev/null @@ -1,37 +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.lbaas.v1; - -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 Neutron LBaaS v1 HealthMonitors. - */ -public class HealthMonitors extends PaginatedCollection<HealthMonitor> { - public static final HealthMonitors EMPTY = new HealthMonitors(ImmutableSet.<HealthMonitor> of(), - ImmutableSet.<Link> of()); - - @ConstructorProperties({ "health_monitors", "health_monitors_links" }) - protected HealthMonitors(Iterable<HealthMonitor> healthMonitors, Iterable<Link> healthMonitorsLinks) { - super(healthMonitors, healthMonitorsLinks); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HttpMethod.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HttpMethod.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HttpMethod.java deleted file mode 100644 index f795c66..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HttpMethod.java +++ /dev/null @@ -1,75 +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.lbaas.v1; - - -/** - * Enumerates supported HTTP methods used by probes of type HTTP/HTTPS that are sent by health monitor to verify member state. - */ -public enum HttpMethod { - /** - * Health monitor sends a GET HTTP request to the member. - */ - GET("GET"), - /** - * Health monitor sends a POST HTTP request to the member. - */ - POST("POST"), - /** - * Health monitor sends a PUT HTTP request to the member. - */ - PUT("PUT"), - /** - * Health monitor sends a DELETE HTTP request to the member. - */ - DELETE("DELETE"), - /** - * Health monitor sends a HEAD HTTP request to the member. - */ - HEAD("HEAD"), - /** - * Used by jclouds when the service returns an unknown value other than null. - */ - UNRECOGNIZED("unrecognized"); - - private String name; - - private HttpMethod(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } - - /* - * This provides GSON enum support in jclouds. - * */ - public static HttpMethod fromValue(String name){ - if (name != null) { - for (HttpMethod value : HttpMethod.values()) { - if (name.equalsIgnoreCase(value.name)) { - return value; - } - } - return UNRECOGNIZED; - } - return null; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/LBaaSStatus.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/LBaaSStatus.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/LBaaSStatus.java deleted file mode 100644 index 85820fc..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/LBaaSStatus.java +++ /dev/null @@ -1,78 +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.lbaas.v1; - -/** - * Enumerates supported Neutron LBaaS v1 resources status. - */ -public enum LBaaSStatus { - /** - * The LBaaS v1 resource is ready and active. - */ - ACTIVE("active"), - /** - * The LBaaS v1 resource is being created. - */ - PENDING_CREATE("pending_create"), - /** - * The LBaaS v1 resource is being updated. - */ - PENDING_UPDATE("pending_update"), - /** - * The LBaaS v1 resource is going to be deleted. - */ - PENDING_DELETE("pending_delete"), - /** - * The LBaaS v1 resource is created but not active. - */ - INACTIVE("inactive"), - /** - * The LBaaS v1 resource is in an error state. - */ - ERROR("error"), - /** - * Used by jclouds when the service returns an unknown value other than null. - */ - UNRECOGNIZED("unrecognized"); - - private String name; - - private LBaaSStatus(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } - - /* - * This provides GSON enum support in jclouds. - * */ - public static LBaaSStatus fromValue(String name){ - if (name != null) { - for (LBaaSStatus value : LBaaSStatus.values()) { - if (name.equalsIgnoreCase(value.name)) { - return value; - } - } - return UNRECOGNIZED; - } - return null; - } -}
