mirror of https://github.com/apache/jclouds.git
Merge pull request #1481 from rackspace/1.6.x
Renamed Rackspace Cloud Load Balanacer domain objects with verb first.
This commit is contained in:
commit
bff3c73b98
|
@ -49,13 +49,13 @@ import com.google.common.base.Objects.ToStringHelper;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class NodeAdd extends BaseNode<NodeAdd> {
|
||||
public class AddNode extends BaseNode<AddNode> {
|
||||
|
||||
// for serialization only
|
||||
NodeAdd() {
|
||||
AddNode() {
|
||||
}
|
||||
|
||||
public NodeAdd(String address, int port, Condition condition, Type type, Integer weight) {
|
||||
public AddNode(String address, int port, Condition condition, Type type, Integer weight) {
|
||||
super(address, port, condition, type, weight);
|
||||
}
|
||||
|
||||
|
@ -79,18 +79,12 @@ public class NodeAdd extends BaseNode<NodeAdd> {
|
|||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
|
||||
NodeAdd that = NodeAdd.class.cast(obj);
|
||||
AddNode that = AddNode.class.cast(obj);
|
||||
return Objects.equal(this.address, that.address)
|
||||
&& Objects.equal(this.port, that.port);
|
||||
}
|
||||
|
||||
public static class Builder extends BaseNode.Builder<NodeAdd> {
|
||||
|
||||
@Override
|
||||
public NodeAdd build() {
|
||||
return new NodeAdd(address, port, condition, type, weight);
|
||||
}
|
||||
|
||||
public static class Builder extends BaseNode.Builder<AddNode> {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -130,8 +124,14 @@ public class NodeAdd extends BaseNode<NodeAdd> {
|
|||
public Builder weight(Integer weight) {
|
||||
return Builder.class.cast(super.weight(weight));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder from(NodeAdd in) {
|
||||
public AddNode build() {
|
||||
return new AddNode(address, port, condition, type, weight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder from(AddNode in) {
|
||||
return Builder.class.cast(super.from(in));
|
||||
}
|
||||
}
|
|
@ -37,30 +37,30 @@ import com.google.common.collect.ImmutableSet;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class LoadBalancerCreate extends BaseLoadBalancer<NodeAdd, LoadBalancerCreate> {
|
||||
public class CreateLoadBalancer extends BaseLoadBalancer<AddNode, CreateLoadBalancer> {
|
||||
|
||||
private final Set<Map<String, String>> virtualIps;
|
||||
private final Set<AccessRule> accessRules;
|
||||
private final Map<String, String> metadata;
|
||||
|
||||
public LoadBalancerCreate(String name, String protocol, @Nullable Integer port, Set<NodeAdd> nodeAdds,
|
||||
public CreateLoadBalancer(String name, String protocol, @Nullable Integer port, Set<AddNode> addNodes,
|
||||
@Nullable Algorithm algorithm, @Nullable Integer timeout, @Nullable Boolean halfClosed,
|
||||
@Nullable Map<String, SessionPersistence> sessionPersistenceType,
|
||||
@Nullable Map<String, Boolean> connectionLogging, @Nullable ConnectionThrottle connectionThrottle,
|
||||
@Nullable HealthMonitor healthMonitor, @Nullable Set<AccessRule> accessRules,
|
||||
@Nullable Map<String, String> metadata, VirtualIP.Type virtualIPType, Integer virtualIPId) {
|
||||
this(name, protocol, port, nodeAdds, algorithm, timeout, halfClosed, sessionPersistenceType, connectionLogging,
|
||||
this(name, protocol, port, addNodes, algorithm, timeout, halfClosed, sessionPersistenceType, connectionLogging,
|
||||
connectionThrottle, healthMonitor, accessRules, metadata,
|
||||
getVirtualIPsFromOptions(virtualIPType, virtualIPId));
|
||||
}
|
||||
|
||||
public LoadBalancerCreate(String name, String protocol, @Nullable Integer port, Set<NodeAdd> nodeAdds,
|
||||
public CreateLoadBalancer(String name, String protocol, @Nullable Integer port, Set<AddNode> addNodes,
|
||||
@Nullable Algorithm algorithm, @Nullable Integer timeout, @Nullable Boolean halfClosed,
|
||||
@Nullable Map<String, SessionPersistence> sessionPersistenceType,
|
||||
@Nullable Map<String, Boolean> connectionLogging, @Nullable ConnectionThrottle connectionThrottle,
|
||||
@Nullable HealthMonitor healthMonitor, @Nullable Set<AccessRule> accessRules,
|
||||
@Nullable Map<String, String> metadata, Set<Map<String, String>> virtualIPsFromOptions) {
|
||||
super(name, protocol, port, nodeAdds, algorithm, timeout, halfClosed, sessionPersistenceType, connectionLogging,
|
||||
super(name, protocol, port, addNodes, algorithm, timeout, halfClosed, sessionPersistenceType, connectionLogging,
|
||||
connectionThrottle, healthMonitor);
|
||||
this.virtualIps = checkNotNull(virtualIPsFromOptions, "virtualIPsFromOptions");
|
||||
this.accessRules = accessRules;
|
||||
|
@ -100,7 +100,7 @@ public class LoadBalancerCreate extends BaseLoadBalancer<NodeAdd, LoadBalancerCr
|
|||
return string().toString();
|
||||
}
|
||||
|
||||
public static class Builder extends BaseLoadBalancer.Builder<NodeAdd, LoadBalancerCreate> {
|
||||
public static class Builder extends BaseLoadBalancer.Builder<AddNode, CreateLoadBalancer> {
|
||||
private VirtualIP.Type virtualIPType;
|
||||
private Integer virtualIPId;
|
||||
private Set<Map<String, String>> virtualIps;
|
||||
|
@ -150,14 +150,14 @@ public class LoadBalancerCreate extends BaseLoadBalancer<NodeAdd, LoadBalancerCr
|
|||
return this;
|
||||
}
|
||||
|
||||
public LoadBalancerCreate build() {
|
||||
public CreateLoadBalancer build() {
|
||||
if (virtualIps == null) {
|
||||
return new LoadBalancerCreate(name, protocol, port, nodes, algorithm, timeout, halfClosed,
|
||||
return new CreateLoadBalancer(name, protocol, port, nodes, algorithm, timeout, halfClosed,
|
||||
sessionPersistence, connectionLogging, connectionThrottle, healthMonitor, accessRules, metadata,
|
||||
virtualIPType, virtualIPId);
|
||||
}
|
||||
else {
|
||||
return new LoadBalancerCreate(name, protocol, port, nodes, algorithm, timeout, halfClosed,
|
||||
return new CreateLoadBalancer(name, protocol, port, nodes, algorithm, timeout, halfClosed,
|
||||
sessionPersistence, connectionLogging, connectionThrottle, healthMonitor, accessRules, metadata,
|
||||
virtualIps);
|
||||
}
|
||||
|
@ -167,8 +167,8 @@ public class LoadBalancerCreate extends BaseLoadBalancer<NodeAdd, LoadBalancerCr
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Builder nodes(Iterable<NodeAdd> nodeAdds) {
|
||||
this.nodes = ImmutableSet.<NodeAdd> copyOf(checkNotNull(nodeAdds, "nodes"));
|
||||
public Builder nodes(Iterable<AddNode> addNodes) {
|
||||
this.nodes = ImmutableSet.<AddNode> copyOf(checkNotNull(addNodes, "nodes"));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ public class LoadBalancerCreate extends BaseLoadBalancer<NodeAdd, LoadBalancerCr
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Builder node(NodeAdd nodes) {
|
||||
public Builder node(AddNode nodes) {
|
||||
this.nodes.add(checkNotNull(nodes, "nodes"));
|
||||
return this;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public class LoadBalancerCreate extends BaseLoadBalancer<NodeAdd, LoadBalancerCr
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Builder from(LoadBalancerCreate in) {
|
||||
public Builder from(CreateLoadBalancer in) {
|
||||
return Builder.class.cast(super.from(in)).virtualIPs(in.virtualIps);
|
||||
}
|
||||
}
|
|
@ -27,45 +27,48 @@ import com.google.common.base.Objects.ToStringHelper;
|
|||
/**
|
||||
* Used to update Load Balancers.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @author Everett Toews
|
||||
*/
|
||||
public class LoadBalancerUpdate {
|
||||
public class UpdateLoadBalancer {
|
||||
private String name;
|
||||
private String protocol;
|
||||
private Integer port;
|
||||
private Algorithm algorithm;
|
||||
private Integer timeout;
|
||||
private Boolean halfClosed;
|
||||
|
||||
protected String name;
|
||||
protected String protocol;
|
||||
protected Integer port;
|
||||
protected Algorithm algorithm;
|
||||
protected Integer timeout;
|
||||
protected Boolean halfClosed;
|
||||
|
||||
public LoadBalancerUpdate name(String name) {
|
||||
protected UpdateLoadBalancer(String name, String protocol, Integer port, Algorithm algorithm, Integer timeout,
|
||||
Boolean halfClosed) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LoadBalancerUpdate protocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LoadBalancerUpdate port(Integer port) {
|
||||
this.port = port;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LoadBalancerUpdate algorithm(Algorithm algorithm) {
|
||||
this.algorithm = algorithm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LoadBalancerUpdate timeout(Integer timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
this.halfClosed = halfClosed;
|
||||
}
|
||||
|
||||
public LoadBalancerUpdate halfClosed(Boolean halfClosed) {
|
||||
this.halfClosed = halfClosed;
|
||||
return this;
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public Integer getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public Algorithm getAlgorithm() {
|
||||
return algorithm;
|
||||
}
|
||||
|
||||
public Integer getTimeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
public Boolean isHalfClosed() {
|
||||
return halfClosed;
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
|
@ -90,58 +93,83 @@ public class LoadBalancerUpdate {
|
|||
if (obj == null || getClass() != obj.getClass())
|
||||
return false;
|
||||
|
||||
LoadBalancerUpdate that = LoadBalancerUpdate.class.cast(obj);
|
||||
UpdateLoadBalancer that = UpdateLoadBalancer.class.cast(obj);
|
||||
return Objects.equal(this.name, that.name) && Objects.equal(this.algorithm, that.algorithm)
|
||||
&& Objects.equal(this.port, that.port) && Objects.equal(this.protocol, that.protocol)
|
||||
&& Objects.equal(this.timeout, that.timeout) && Objects.equal(this.halfClosed, that.halfClosed);
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String name;
|
||||
private String protocol;
|
||||
private Integer port;
|
||||
private Algorithm algorithm;
|
||||
private Integer timeout;
|
||||
private Boolean halfClosed;
|
||||
|
||||
/**
|
||||
* @see BaseLoadBalancer.Builder#name(String)
|
||||
*/
|
||||
public static LoadBalancerUpdate name(String name) {
|
||||
return new LoadBalancerUpdate().name(name);
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BaseLoadBalancer.Builder#protocol(String)
|
||||
*/
|
||||
public static LoadBalancerUpdate protocol(String protocol) {
|
||||
return new LoadBalancerUpdate().protocol(protocol);
|
||||
public Builder protocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BaseLoadBalancer.Builder#port(Integer)
|
||||
*/
|
||||
public static LoadBalancerUpdate port(Integer port) {
|
||||
return new LoadBalancerUpdate().port(port);
|
||||
public Builder port(Integer port) {
|
||||
this.port = port;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BaseLoadBalancer.Builder#algorithm(Algorithm)
|
||||
*/
|
||||
public static LoadBalancerUpdate algorithm(Algorithm algorithm) {
|
||||
return new LoadBalancerUpdate().algorithm(algorithm);
|
||||
public Builder algorithm(Algorithm algorithm) {
|
||||
this.algorithm = algorithm;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BaseLoadBalancer.Builder#timeout(Integer)
|
||||
*/
|
||||
public static LoadBalancerUpdate timeout(Integer timeout) {
|
||||
return new LoadBalancerUpdate().timeout(timeout);
|
||||
public Builder timeout(Integer timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BaseLoadBalancer.Builder#halfClosed(Boolean)
|
||||
*/
|
||||
public static LoadBalancerUpdate halfClosed(Boolean halfClosed) {
|
||||
return new LoadBalancerUpdate().halfClosed(halfClosed);
|
||||
}
|
||||
public Builder halfClosed(Boolean halfClosed) {
|
||||
this.halfClosed = halfClosed;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static <T extends BaseLoadBalancer<?, T>> LoadBalancerUpdate fromLoadBalancer(T lb) {
|
||||
return Builder.name(lb.getName()).port(lb.getPort()).protocol(lb.getProtocol()).algorithm(lb.getAlgorithm())
|
||||
public UpdateLoadBalancer build() {
|
||||
return new UpdateLoadBalancer(name, protocol, port, algorithm, timeout, halfClosed);
|
||||
}
|
||||
|
||||
public Builder from(UpdateLoadBalancer lb) {
|
||||
return this.name(lb.getName()).port(lb.getPort()).protocol(lb.getProtocol()).algorithm(lb.getAlgorithm())
|
||||
.timeout(lb.getTimeout()).halfClosed(lb.isHalfClosed());
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder().from(this);
|
||||
}
|
||||
}
|
|
@ -28,27 +28,29 @@ import com.google.common.base.Objects.ToStringHelper;
|
|||
/**
|
||||
* Used to update Nodes.
|
||||
*
|
||||
* @author Dan Lo Bianco
|
||||
* @author Everett Toews
|
||||
*/
|
||||
public class NodeUpdate {
|
||||
public class UpdateNode {
|
||||
private Condition condition;
|
||||
private Type type;
|
||||
private Integer weight;
|
||||
|
||||
protected Condition condition;
|
||||
protected Type type;
|
||||
protected Integer weight;
|
||||
|
||||
public NodeUpdate condition(Condition condition) {
|
||||
protected UpdateNode(Condition condition, Type type, Integer weight) {
|
||||
this.condition = condition;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NodeUpdate type(Type type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public NodeUpdate weight(Integer weight) {
|
||||
this.weight = weight;
|
||||
return this;
|
||||
public Condition getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Integer getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
|
@ -71,36 +73,55 @@ public class NodeUpdate {
|
|||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
|
||||
NodeUpdate that = NodeUpdate.class.cast(obj);
|
||||
UpdateNode that = UpdateNode.class.cast(obj);
|
||||
return Objects.equal(this.condition, that.condition)
|
||||
&& Objects.equal(this.type, that.type)
|
||||
&& Objects.equal(this.weight, that.weight);
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private Condition condition;
|
||||
private Type type;
|
||||
private Integer weight;
|
||||
|
||||
/**
|
||||
* @see BaseNode.Builder#condition(Condition)
|
||||
*/
|
||||
public static NodeUpdate condition(Condition condition) {
|
||||
return new NodeUpdate().condition(condition);
|
||||
public Builder condition(Condition condition) {
|
||||
this.condition = condition;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BaseNode.Builder#type(Type)
|
||||
*/
|
||||
public static NodeUpdate type(Type type) {
|
||||
return new NodeUpdate().type(type);
|
||||
public Builder type(Type type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BaseNode.Builder#weight(Integer)
|
||||
*/
|
||||
public static NodeUpdate weight(Integer weight) {
|
||||
return new NodeUpdate().weight(weight);
|
||||
public Builder weight(Integer weight) {
|
||||
this.weight = weight;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UpdateNode build() {
|
||||
return new UpdateNode(condition, type, weight);
|
||||
}
|
||||
|
||||
public Builder from(UpdateNode in) {
|
||||
return this.condition(in.getCondition()).type(in.getType()).weight(in.getWeight());
|
||||
}
|
||||
}
|
||||
|
||||
public static <T extends BaseNode<T>> NodeUpdate fromNode(T n) {
|
||||
return Builder.condition(n.getCondition()).type(n.getType()).weight(n.getWeight());
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder().from(this);
|
||||
}
|
||||
}
|
|
@ -24,8 +24,8 @@ import org.jclouds.collect.IterableWithMarker;
|
|||
import org.jclouds.collect.PagedIterable;
|
||||
import org.jclouds.openstack.v2_0.options.PaginationOptions;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerUpdate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Metadata;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +43,7 @@ public interface LoadBalancerApi {
|
|||
* identifier, the caller can check on the progress of the operation by performing a
|
||||
* {@link LoadBalancerApi#get}.
|
||||
*/
|
||||
LoadBalancer create(LoadBalancerCreate lbCreate);
|
||||
LoadBalancer create(CreateLoadBalancer createLB);
|
||||
|
||||
/**
|
||||
* Update the properties of a load balancer.
|
||||
|
@ -52,7 +52,7 @@ public interface LoadBalancerApi {
|
|||
* identifier, the caller can check on the progress of the operation by performing a
|
||||
* {@link LoadBalancerApi#get}.
|
||||
*/
|
||||
void update(int id, LoadBalancerUpdate lbUpdate);
|
||||
void update(int id, UpdateLoadBalancer updateLB);
|
||||
|
||||
/**
|
||||
* List the load balancers.
|
||||
|
|
|
@ -44,8 +44,8 @@ import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
|
|||
import org.jclouds.openstack.v2_0.options.PaginationOptions;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.binders.BindMetadataToJsonPayload;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerUpdate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Metadata;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseLoadBalancers;
|
||||
|
@ -72,7 +72,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
public interface LoadBalancerAsyncApi {
|
||||
|
||||
/**
|
||||
* @see LoadBalancerApi#create(LoadBalancerCreate)
|
||||
* @see LoadBalancerApi#create(CreateLoadBalancer)
|
||||
*/
|
||||
@Named("lb:create")
|
||||
@POST
|
||||
|
@ -80,17 +80,17 @@ public interface LoadBalancerAsyncApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Path("/loadbalancers")
|
||||
ListenableFuture<LoadBalancer> create(@WrapWith("loadBalancer") LoadBalancerCreate lbCreate);
|
||||
ListenableFuture<LoadBalancer> create(@WrapWith("loadBalancer") CreateLoadBalancer createLB);
|
||||
|
||||
/**
|
||||
* @see LoadBalancerApi#update(int, LoadBalancerUpdate)
|
||||
* @see LoadBalancerApi#update(int, UpdateLoadBalancer)
|
||||
*/
|
||||
@Named("lb:update")
|
||||
@PUT
|
||||
@ResponseParser(ParseLoadBalancer.class)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/loadbalancers/{id}")
|
||||
ListenableFuture<Void> update(@PathParam("id") int id, @WrapWith("loadBalancer") LoadBalancerUpdate lbUpdate);
|
||||
ListenableFuture<Void> update(@PathParam("id") int id, @WrapWith("loadBalancer") UpdateLoadBalancer updateLB);
|
||||
|
||||
/**
|
||||
* @see LoadBalancerApi#list()
|
||||
|
|
|
@ -26,8 +26,8 @@ import org.jclouds.collect.PagedIterable;
|
|||
import org.jclouds.openstack.v2_0.options.PaginationOptions;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Metadata;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Node;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeUpdate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to CloudLoadBalancers Node features.
|
||||
|
@ -38,14 +38,14 @@ import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
|||
*/
|
||||
public interface NodeApi {
|
||||
/**
|
||||
* Create a new node with the configuration defined by the request.
|
||||
* Add a new node with the configuration defined by the request.
|
||||
*/
|
||||
Set<Node> add(Iterable<NodeAdd> nodeAdds);
|
||||
Set<Node> add(Iterable<AddNode> addNodes);
|
||||
|
||||
/**
|
||||
* Update the attributes of a node.
|
||||
*/
|
||||
void update(int id, NodeUpdate nodeUpdate);
|
||||
void update(int id, UpdateNode updateNode);
|
||||
|
||||
/**
|
||||
* List the nodes.
|
||||
|
|
|
@ -47,8 +47,8 @@ import org.jclouds.rackspace.cloudloadbalancers.v1.binders.BindMetadataToJsonPay
|
|||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Metadata;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Node;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeUpdate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseMetadata;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseNodes;
|
||||
|
@ -83,16 +83,16 @@ public interface NodeAsyncApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Path("/nodes")
|
||||
ListenableFuture<Set<Node>> add(@WrapWith("nodes") Iterable<NodeAdd> nodeAdds);
|
||||
ListenableFuture<Set<Node>> add(@WrapWith("nodes") Iterable<AddNode> addNodes);
|
||||
|
||||
/**
|
||||
* @see NodeApi#update(int, NodeUpdate)
|
||||
* @see NodeApi#update(int, UpdateNode)
|
||||
*/
|
||||
@Named("node:update")
|
||||
@PUT
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/nodes/{id}")
|
||||
ListenableFuture<Void> update(@PathParam("id") int id, @WrapWith("node") NodeUpdate nodeUpdate);
|
||||
ListenableFuture<Void> update(@PathParam("id") int id, @WrapWith("node") UpdateNode updateNode);
|
||||
|
||||
/**
|
||||
* @see NodeApi#list()
|
||||
|
|
|
@ -34,8 +34,8 @@ import org.jclouds.loadbalancer.strategy.LoadBalanceNodesStrategy;
|
|||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersApi;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP.Type;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
@ -67,13 +67,13 @@ public class CloudLoadBalancersLoadBalanceNodesStrategy implements LoadBalanceNo
|
|||
|
||||
// TODO need to query and update the LB per current design.
|
||||
LoadBalancer lb = client.getLoadBalancerApiForZone(region).create(
|
||||
LoadBalancerCreate.builder().name(name).protocol(protocol.toUpperCase()).port(loadBalancerPort)
|
||||
CreateLoadBalancer.builder().name(name).protocol(protocol.toUpperCase()).port(loadBalancerPort)
|
||||
.virtualIPType(Type.PUBLIC).nodes(
|
||||
Iterables.transform(nodes, new Function<NodeMetadata, NodeAdd>() {
|
||||
Iterables.transform(nodes, new Function<NodeMetadata, AddNode>() {
|
||||
|
||||
@Override
|
||||
public NodeAdd apply(NodeMetadata arg0) {
|
||||
return NodeAdd.builder().address(
|
||||
public AddNode apply(NodeMetadata arg0) {
|
||||
return AddNode.builder().address(
|
||||
Iterables.get(arg0.getPrivateAddresses(), 0)).port(instancePort)
|
||||
.build();
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ import java.util.Map;
|
|||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AccessRule;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AccessRuleWithId;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP.Type;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.internal.BaseCloudLoadBalancersApiLiveTest;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
|
@ -72,12 +72,12 @@ public class AccessRuleApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
}
|
||||
|
||||
public void testCreateLoadBalancer() {
|
||||
NodeAdd nodeAdd = NodeAdd.builder().address("192.168.1.1").port(8080).build();
|
||||
LoadBalancerCreate lbCreate = LoadBalancerCreate.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(nodeAdd).build();
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = "ORD";//Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(lbCreate);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ import static org.testng.Assert.assertTrue;
|
|||
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.ConnectionThrottle;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP.Type;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.internal.BaseCloudLoadBalancersApiLiveTest;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
|
@ -45,12 +45,12 @@ public class ConnectionApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
private String zone;
|
||||
|
||||
public void testCreateLoadBalancer() {
|
||||
NodeAdd nodeAdd = NodeAdd.builder().address("192.168.1.1").port(8080).build();
|
||||
LoadBalancerCreate lbCreate = LoadBalancerCreate.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(nodeAdd).build();
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(lbCreate);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ import static org.testng.Assert.assertFalse;
|
|||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP.Type;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.internal.BaseCloudLoadBalancersApiLiveTest;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
|
@ -42,12 +42,12 @@ public class ContentCachingApiLiveTest extends BaseCloudLoadBalancersApiLiveTest
|
|||
private String zone;
|
||||
|
||||
public void testCreateLoadBalancer() {
|
||||
NodeAdd nodeAdd = NodeAdd.builder().address("192.168.1.1").port(8080).build();
|
||||
LoadBalancerCreate lbCreate = LoadBalancerCreate.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(nodeAdd).build();
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(lbCreate);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ import static org.testng.Assert.assertEquals;
|
|||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP.Type;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.internal.BaseCloudLoadBalancersApiLiveTest;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
|
@ -54,12 +54,12 @@ public class ErrorPageApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
}
|
||||
|
||||
public void testCreateLoadBalancer() {
|
||||
NodeAdd nodeAdd = NodeAdd.builder().address("192.168.1.1").port(8080).build();
|
||||
LoadBalancerCreate lbCreate = LoadBalancerCreate.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(nodeAdd).build();
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(lbCreate);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ import static org.testng.Assert.assertTrue;
|
|||
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.HealthMonitor;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP.Type;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.internal.BaseCloudLoadBalancersApiLiveTest;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
|
@ -44,12 +44,12 @@ public class HealthMonitorApiLiveTest extends BaseCloudLoadBalancersApiLiveTest
|
|||
private String zone;
|
||||
|
||||
public void testCreateLoadBalancer() {
|
||||
NodeAdd nodeAdd = NodeAdd.builder().address("192.168.1.1").port(8080).build();
|
||||
LoadBalancerCreate lbCreate = LoadBalancerCreate.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(nodeAdd).build();
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(lbCreate);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||
}
|
||||
|
|
|
@ -29,10 +29,10 @@ import javax.ws.rs.core.MediaType;
|
|||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersApi;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerUpdate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Metadata;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Node;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.features.LoadBalancerApi;
|
||||
|
@ -89,30 +89,30 @@ public class LoadBalancerApiExpectTest extends BaseCloudLoadBalancerApiExpectTes
|
|||
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/loadbalancer-get.json")).build()
|
||||
).getLoadBalancerApiForZone("DFW");
|
||||
|
||||
NodeAdd nodeAdd1 = NodeAdd.builder()
|
||||
AddNode addNode1 = AddNode.builder()
|
||||
.address("10.1.1.1")
|
||||
.condition(Node.Condition.ENABLED)
|
||||
.port(80)
|
||||
.build();
|
||||
|
||||
NodeAdd nodeAdd2 = NodeAdd.builder()
|
||||
AddNode addNode2 = AddNode.builder()
|
||||
.address("10.1.1.2")
|
||||
.condition(Node.Condition.ENABLED)
|
||||
.port(80)
|
||||
.build();
|
||||
|
||||
Set<NodeAdd> nodeAdds = Sets.newHashSet(nodeAdd1, nodeAdd2);
|
||||
Set<AddNode> addNodes = Sets.newHashSet(addNode1, addNode2);
|
||||
|
||||
LoadBalancerCreate lbCreate = LoadBalancerCreate.builder()
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name("sample-loadbalancer")
|
||||
.protocol("HTTP")
|
||||
.port(80)
|
||||
.algorithm(LoadBalancer.Algorithm.RANDOM)
|
||||
.virtualIPType(VirtualIP.Type.PUBLIC)
|
||||
.nodes(nodeAdds)
|
||||
.nodes(addNodes)
|
||||
.build();
|
||||
|
||||
LoadBalancer loadBalancer = api.create(lbCreate);
|
||||
LoadBalancer loadBalancer = api.create(createLB);
|
||||
|
||||
assertEquals(loadBalancer, getExpectedLoadBalancer());
|
||||
}
|
||||
|
@ -126,13 +126,14 @@ public class LoadBalancerApiExpectTest extends BaseCloudLoadBalancerApiExpectTes
|
|||
HttpResponse.builder().statusCode(202).payload("").build()
|
||||
).getLoadBalancerApiForZone("DFW");
|
||||
|
||||
LoadBalancerUpdate lbUpdate = LoadBalancerUpdate.Builder
|
||||
UpdateLoadBalancer updateLB = UpdateLoadBalancer.builder()
|
||||
.name("foo")
|
||||
.protocol("HTTPS")
|
||||
.port(443)
|
||||
.algorithm(LoadBalancer.Algorithm.RANDOM);
|
||||
.algorithm(LoadBalancer.Algorithm.RANDOM)
|
||||
.build();
|
||||
|
||||
api.update(2000, lbUpdate);
|
||||
api.update(2000, updateLB);
|
||||
}
|
||||
|
||||
public void testRemoveLoadBalancer() {
|
||||
|
|
|
@ -30,10 +30,10 @@ import java.util.Set;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerUpdate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Metadata;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP.Type;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.internal.BaseCloudLoadBalancersApiLiveTest;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
|
@ -67,12 +67,12 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
Logger.getAnonymousLogger().info("starting lb in region " + zone);
|
||||
|
||||
LoadBalancer lb = clbApi.getLoadBalancerApiForZone(zone).create(
|
||||
LoadBalancerCreate.builder()
|
||||
CreateLoadBalancer.builder()
|
||||
.name(prefix + "-" + zone)
|
||||
.protocol("HTTP")
|
||||
.port(80)
|
||||
.virtualIPType(Type.PUBLIC)
|
||||
.node(NodeAdd.builder()
|
||||
.node(AddNode.builder()
|
||||
.address("192.168.1.1")
|
||||
.port(8080)
|
||||
.build())
|
||||
|
@ -96,7 +96,7 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
public void testUpdateLoadBalancer() throws Exception {
|
||||
for (LoadBalancer lb: lbs) {
|
||||
clbApi.getLoadBalancerApiForZone(lb.getRegion()).update(lb.getId(),
|
||||
LoadBalancerUpdate.Builder.name("foo" + "-" + lb.getRegion()));
|
||||
UpdateLoadBalancer.builder().name("foo" + "-" + lb.getRegion()).build());
|
||||
|
||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ import org.jclouds.http.HttpResponse;
|
|||
import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersApi;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Metadata;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Node;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeUpdate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.features.NodeApi;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.internal.BaseCloudLoadBalancerApiExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -84,14 +84,14 @@ public class NodeApiExpectTest extends BaseCloudLoadBalancerApiExpectTest<CloudL
|
|||
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/nodes-list.json")).build()
|
||||
).getNodeApiForZoneAndLoadBalancer("DFW", 2000);
|
||||
|
||||
NodeAdd nodeAdd1 = NodeAdd.builder()
|
||||
AddNode addNode1 = AddNode.builder()
|
||||
.address("10.1.1.1")
|
||||
.condition(Node.Condition.ENABLED)
|
||||
.port(80)
|
||||
.weight(3)
|
||||
.build();
|
||||
|
||||
NodeAdd nodeAdd2 = NodeAdd.builder()
|
||||
AddNode addNode2 = AddNode.builder()
|
||||
.address("10.1.1.2")
|
||||
.condition(Node.Condition.ENABLED)
|
||||
.type(Node.Type.SECONDARY)
|
||||
|
@ -99,16 +99,16 @@ public class NodeApiExpectTest extends BaseCloudLoadBalancerApiExpectTest<CloudL
|
|||
.weight(8)
|
||||
.build();
|
||||
|
||||
NodeAdd nodeAdd3 = NodeAdd.builder()
|
||||
AddNode addNode3 = AddNode.builder()
|
||||
.address("10.1.1.3")
|
||||
.condition(Node.Condition.DISABLED)
|
||||
.port(80)
|
||||
.weight(12)
|
||||
.build();
|
||||
|
||||
Set<NodeAdd> nodeAdds = ImmutableSortedSet.<NodeAdd> of(nodeAdd1, nodeAdd2, nodeAdd3);
|
||||
Set<AddNode> addNodes = ImmutableSortedSet.<AddNode> of(addNode1, addNode2, addNode3);
|
||||
|
||||
Set<Node> nodes = api.add(nodeAdds);
|
||||
Set<Node> nodes = api.add(addNodes);
|
||||
assertEquals(nodes, getExpectedNodes());
|
||||
}
|
||||
|
||||
|
@ -121,12 +121,13 @@ public class NodeApiExpectTest extends BaseCloudLoadBalancerApiExpectTest<CloudL
|
|||
HttpResponse.builder().statusCode(200).build()
|
||||
).getNodeApiForZoneAndLoadBalancer("DFW", 2000);
|
||||
|
||||
NodeUpdate nodeUpdate = NodeUpdate.Builder
|
||||
UpdateNode updateNode = UpdateNode.builder()
|
||||
.condition(Node.Condition.DISABLED)
|
||||
.type(Node.Type.SECONDARY)
|
||||
.weight(20);
|
||||
.weight(20)
|
||||
.build();
|
||||
|
||||
api.update(410, nodeUpdate);
|
||||
api.update(410, updateNode);
|
||||
}
|
||||
|
||||
public void testRemoveNodeFromLoadBalancer() {
|
||||
|
|
|
@ -37,11 +37,11 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.Maps;
|
||||
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Metadata;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Node;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeUpdate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer.Status;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP.Type;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.features.LoadBalancerApi;
|
||||
|
@ -62,8 +62,8 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
for (String zone : clbApi.getConfiguredZones()) {
|
||||
Logger.getAnonymousLogger().info("starting lb in zone " + zone);
|
||||
LoadBalancer lb = clbApi.getLoadBalancerApiForZone(zone).create(
|
||||
LoadBalancerCreate.builder().name(prefix + "-" + zone).protocol("HTTP").port(80).virtualIPType(
|
||||
Type.PUBLIC).node(NodeAdd.builder().address("192.168.1.1").port(8080).build()).build());
|
||||
CreateLoadBalancer.builder().name(prefix + "-" + zone).protocol("HTTP").port(80).virtualIPType(
|
||||
Type.PUBLIC).node(AddNode.builder().address("192.168.1.1").port(8080).build()).build());
|
||||
nodes.put(lb, new HashSet<Node>());
|
||||
|
||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||
|
@ -78,7 +78,7 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
String region = lb.getRegion();
|
||||
Logger.getAnonymousLogger().info("starting node on loadbalancer " + lb.getId() + " in region " + region);
|
||||
Set<Node> newNodes = clbApi.getNodeApiForZoneAndLoadBalancer(region, lb.getId()).add(
|
||||
ImmutableSet.<NodeAdd> of(NodeAdd.builder().address("192.168.1.2").port(8080).build()));
|
||||
ImmutableSet.<AddNode> of(AddNode.builder().address("192.168.1.2").port(8080).build()));
|
||||
|
||||
for (Node n : newNodes) {
|
||||
assertEquals(n.getStatus(), Node.Status.ONLINE);
|
||||
|
@ -97,7 +97,7 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
for (Node n : entry.getValue()) {
|
||||
String region = entry.getKey().getRegion();
|
||||
clbApi.getNodeApiForZoneAndLoadBalancer(region, entry.getKey().getId()).update(n.getId(),
|
||||
NodeUpdate.Builder.weight(23));
|
||||
UpdateNode.builder().weight(23).build());
|
||||
assertEquals(clbApi.getNodeApiForZoneAndLoadBalancer(region, entry.getKey().getId()).get(n.getId())
|
||||
.getStatus(), Node.Status.ONLINE);
|
||||
|
||||
|
|
|
@ -30,10 +30,10 @@ import java.util.Date;
|
|||
import org.jclouds.http.HttpResponseException;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.HistoricalUsage;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerStats;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerUsage;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Protocol;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP.Type;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.internal.BaseCloudLoadBalancersApiLiveTest;
|
||||
|
@ -52,12 +52,12 @@ public class ReportApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
private String zone;
|
||||
|
||||
public void testCreateLoadBalancer() {
|
||||
NodeAdd nodeAdd = NodeAdd.builder().address("192.168.1.1").port(8080).build();
|
||||
LoadBalancerCreate lbCreate = LoadBalancerCreate.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(nodeAdd).build();
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(lbCreate);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ import static org.testng.Assert.assertNull;
|
|||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.SSLTermination;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP.Type;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.internal.BaseCloudLoadBalancersApiLiveTest;
|
||||
|
@ -44,12 +44,12 @@ public class SSLTerminationApiLiveTest extends BaseCloudLoadBalancersApiLiveTest
|
|||
private String zone;
|
||||
|
||||
public void testCreateLoadBalancer() {
|
||||
NodeAdd nodeAdd = NodeAdd.builder().address("192.168.1.1").port(8080).build();
|
||||
LoadBalancerCreate lbCreate = LoadBalancerCreate.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(nodeAdd).build();
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(lbCreate);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ import static org.testng.Assert.assertNull;
|
|||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.SessionPersistence;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP.Type;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.internal.BaseCloudLoadBalancersApiLiveTest;
|
||||
|
@ -44,12 +44,12 @@ public class SessionPersistenceApiLiveTest extends BaseCloudLoadBalancersApiLive
|
|||
private String zone;
|
||||
|
||||
public void testCreateLoadBalancer() {
|
||||
NodeAdd nodeAdd = NodeAdd.builder().address("192.168.1.1").port(8080).build();
|
||||
LoadBalancerCreate lbCreate = LoadBalancerCreate.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(nodeAdd).build();
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(lbCreate);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ import static org.testng.Assert.assertTrue;
|
|||
import java.util.List;
|
||||
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerCreate;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.NodeAdd;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIPWithId;
|
||||
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP.Type;
|
||||
|
@ -48,12 +48,12 @@ public class VirtualIPApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
private String zone;
|
||||
|
||||
public void testCreateLoadBalancer() {
|
||||
NodeAdd nodeAdd = NodeAdd.builder().address("192.168.1.1").port(8080).build();
|
||||
LoadBalancerCreate lbCreate = LoadBalancerCreate.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(nodeAdd).build();
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(lbCreate);
|
||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue