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