mirror of https://github.com/apache/jclouds.git
Issue 298: added gogrid 1.5 multiple datacenter support
This commit is contained in:
parent
20f1a75606
commit
0776becbc1
|
@ -34,7 +34,7 @@ import org.jclouds.rest.annotations.Delegate;
|
|||
* @author Oleksiy Yarmula
|
||||
*/
|
||||
public interface GoGridAsyncClient {
|
||||
public static final String VERSION = "1.4";
|
||||
public static final String VERSION = "1.5";
|
||||
|
||||
/**
|
||||
* @see GoGridClient#getServerServices()
|
||||
|
|
|
@ -44,7 +44,7 @@ public class GoGridPropertiesBuilder extends PropertiesBuilder {
|
|||
Properties properties = super.defaultProperties();
|
||||
properties.setProperty(PROPERTY_API_VERSION, GoGridAsyncClient.VERSION);
|
||||
properties.setProperty(PROPERTY_ENDPOINT, "https://api.gogrid.com/api");
|
||||
properties.setProperty(PROPERTY_GOGRID_DEFAULT_DC, "SANFRANCISCO");
|
||||
properties.setProperty(PROPERTY_GOGRID_DEFAULT_DC, "1");
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ import org.jclouds.gogrid.GoGridAsyncClient;
|
|||
import org.jclouds.gogrid.GoGridClient;
|
||||
import org.jclouds.gogrid.compute.functions.ServerToNodeMetadata;
|
||||
import org.jclouds.gogrid.compute.strategy.GoGridAddNodeWithTagStrategy;
|
||||
import org.jclouds.gogrid.domain.Option;
|
||||
import org.jclouds.gogrid.domain.PowerCommand;
|
||||
import org.jclouds.gogrid.domain.Server;
|
||||
import org.jclouds.gogrid.domain.ServerImage;
|
||||
|
@ -81,6 +82,7 @@ import com.google.common.base.Predicate;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Provides;
|
||||
|
@ -112,6 +114,19 @@ public class GoGridComputeServiceContextModule extends AbstractModule {
|
|||
bind(DestroyNodeStrategy.class).to(GoGridDestroyNodeStrategy.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
protected Map<String, ? extends Location> provideLocationMap(Set<? extends Location> locations) {
|
||||
return Maps.uniqueIndex(locations, new Function<Location, String>() {
|
||||
|
||||
@Override
|
||||
public String apply(Location from) {
|
||||
return from.getId();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Named("DEFAULT")
|
||||
protected TemplateBuilder provideTemplate(TemplateBuilder template) {
|
||||
|
@ -276,13 +291,13 @@ public class GoGridComputeServiceContextModule extends AbstractModule {
|
|||
|
||||
@Provides
|
||||
@Singleton
|
||||
Set<? extends Location> getDefaultLocations(@Provider String providerName, GoGridClient sync,
|
||||
Set<? extends Location> getAssignableLocations(@Provider String providerName, GoGridClient sync,
|
||||
LogHolder holder, Function<ComputeMetadata, String> indexer) {
|
||||
final Set<Location> locations = Sets.newHashSet();
|
||||
holder.logger.debug(">> providing locations");
|
||||
Location parent = new LocationImpl(LocationScope.PROVIDER, providerName, providerName, null);
|
||||
locations.add(new LocationImpl(LocationScope.ZONE, "SANFRANCISCO", "San Francisco, CA",
|
||||
parent));
|
||||
for (Option dc : sync.getServerServices().getDatacenters())
|
||||
locations.add(new LocationImpl(LocationScope.ZONE, dc.getId() + "", dc.getDescription(), parent));
|
||||
holder.logger.debug("<< locations(%d)", locations.size());
|
||||
return locations;
|
||||
}
|
||||
|
|
|
@ -58,33 +58,32 @@ public class ServerToNodeMetadata implements Function<Server, NodeMetadata> {
|
|||
protected Logger logger = Logger.NULL;
|
||||
private final Map<String, NodeState> serverStateToNodeState;
|
||||
private final GoGridClient client;
|
||||
private final Location location;
|
||||
private final Set<? extends Image> images;
|
||||
private final Map<String, ? extends Location> locations;
|
||||
|
||||
private static class FindImageForServer implements Predicate<Image> {
|
||||
private final Location location;
|
||||
private final Server instance;
|
||||
|
||||
private FindImageForServer(Location location, Server instance) {
|
||||
this.location = location;
|
||||
@Inject
|
||||
private FindImageForServer(Server instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Image input) {
|
||||
return input.getProviderId().equals(instance.getImage().getId() + "")
|
||||
&& (input.getLocation() == null || input.getLocation().equals(location) || input
|
||||
.getLocation().equals(location.getParent()));
|
||||
&& (input.getLocation() == null || input.getLocation().getId().equals(
|
||||
instance.getDatacenter().getId() + ""));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
ServerToNodeMetadata(Map<String, NodeState> serverStateToNodeState, GoGridClient client,
|
||||
Set<? extends Image> images, Location location) {
|
||||
Set<? extends Image> images, Map<String, ? extends Location> locations) {
|
||||
this.serverStateToNodeState = checkNotNull(serverStateToNodeState, "serverStateToNodeState");
|
||||
this.client = checkNotNull(client, "client");
|
||||
this.images = checkNotNull(images, "images");
|
||||
this.location = checkNotNull(location, "location");
|
||||
this.locations = checkNotNull(locations, "locations");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,14 +95,13 @@ public class ServerToNodeMetadata implements Function<Server, NodeMetadata> {
|
|||
Credentials creds = client.getServerServices().getServerCredentialsList().get(from.getName());
|
||||
Image image = null;
|
||||
try {
|
||||
image = Iterables.find(images, new FindImageForServer(location, from));
|
||||
image = Iterables.find(images, new FindImageForServer(from));
|
||||
} catch (NoSuchElementException e) {
|
||||
logger
|
||||
.warn("could not find a matching image for server %s in location %s", from,
|
||||
location);
|
||||
logger.warn("could not find a matching image for server %s", from);
|
||||
}
|
||||
return new NodeMetadataImpl(from.getId() + "", from.getName(), from.getId() + "", location,
|
||||
null, ImmutableMap.<String, String> of(), tag, image, state, ipSet, ImmutableList
|
||||
.<String> of(), ImmutableMap.<String, String> of(), creds);
|
||||
return new NodeMetadataImpl(from.getId() + "", from.getName(), from.getId() + "", locations
|
||||
.get(from.getDatacenter().getId() + ""), null, ImmutableMap.<String, String> of(),
|
||||
tag, image, state, ipSet, ImmutableList.<String> of(), ImmutableMap
|
||||
.<String, String> of(), creds);
|
||||
}
|
||||
}
|
|
@ -57,17 +57,16 @@ public class GoGridAddNodeWithTagStrategy implements AddNodeWithTagStrategy {
|
|||
|
||||
@Inject
|
||||
protected GoGridAddNodeWithTagStrategy(GoGridClient client,
|
||||
Function<Server, NodeMetadata> serverToNodeMetadata,
|
||||
Function<Size, String> sizeToRam, Timeouts timeouts) {
|
||||
Function<Server, NodeMetadata> serverToNodeMetadata, Function<Size, String> sizeToRam,
|
||||
Timeouts timeouts) {
|
||||
this.client = client;
|
||||
this.serverToNodeMetadata = serverToNodeMetadata;
|
||||
this.sizeToRam = sizeToRam;
|
||||
this.serverLatestJobCompleted = new RetryablePredicate<Server>(
|
||||
new ServerLatestJobCompleted(client.getJobServices()),
|
||||
timeouts.nodeRunning * 9l / 10l);
|
||||
this.serverLatestJobCompleted = new RetryablePredicate<Server>(new ServerLatestJobCompleted(
|
||||
client.getJobServices()), timeouts.nodeRunning * 9l / 10l);
|
||||
this.serverLatestJobCompletedShort = new RetryablePredicate<Server>(
|
||||
new ServerLatestJobCompleted(client.getJobServices()),
|
||||
timeouts.nodeRunning * 1l / 10l);
|
||||
new ServerLatestJobCompleted(client.getJobServices()),
|
||||
timeouts.nodeRunning * 1l / 10l);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,11 +79,10 @@ public class GoGridAddNodeWithTagStrategy implements AddNodeWithTagStrategy {
|
|||
// collision avoidance for
|
||||
// simplicity
|
||||
Set<Ip> availableIps = client.getIpServices().getIpList(
|
||||
new GetIpListOptions().onlyUnassigned().onlyWithType(
|
||||
IpType.PUBLIC));
|
||||
new GetIpListOptions().onlyUnassigned().onlyWithType(IpType.PUBLIC).inDatacenter(
|
||||
template.getLocation().getId()));
|
||||
if (availableIps.size() == 0)
|
||||
throw new RuntimeException(
|
||||
"No public IPs available on this identity.");
|
||||
throw new RuntimeException("No public IPs available on this identity.");
|
||||
int ipIndex = new SecureRandom().nextInt(availableIps.size());
|
||||
Ip availableIp = Iterables.get(availableIps, ipIndex);
|
||||
try {
|
||||
|
@ -98,11 +96,10 @@ public class GoGridAddNodeWithTagStrategy implements AddNodeWithTagStrategy {
|
|||
}
|
||||
if (template.getOptions().shouldBlockUntilRunning()) {
|
||||
serverLatestJobCompleted.apply(addedServer);
|
||||
client.getServerServices().power(addedServer.getName(),
|
||||
PowerCommand.START);
|
||||
client.getServerServices().power(addedServer.getName(), PowerCommand.START);
|
||||
serverLatestJobCompletedShort.apply(addedServer);
|
||||
addedServer = Iterables.getOnlyElement(client.getServerServices()
|
||||
.getServersByName(addedServer.getName()));
|
||||
addedServer = Iterables.getOnlyElement(client.getServerServices().getServersByName(
|
||||
addedServer.getName()));
|
||||
}
|
||||
return serverToNodeMetadata.apply(addedServer);
|
||||
}
|
||||
|
@ -110,8 +107,8 @@ public class GoGridAddNodeWithTagStrategy implements AddNodeWithTagStrategy {
|
|||
private Server addServer(String name, Template template, Ip availableIp) {
|
||||
Server addedServer;
|
||||
addedServer = client.getServerServices().addServer(name,
|
||||
checkNotNull(template.getImage().getProviderId()),
|
||||
sizeToRam.apply(template.getSize()), availableIp.getIp());
|
||||
checkNotNull(template.getImage().getProviderId()),
|
||||
sizeToRam.apply(template.getSize()), availableIp.getIp());
|
||||
return addedServer;
|
||||
}
|
||||
}
|
|
@ -38,6 +38,7 @@ public class Ip implements Comparable<Ip> {
|
|||
@SerializedName("public")
|
||||
private boolean isPublic;
|
||||
private IpState state;
|
||||
private Option datacenter;
|
||||
|
||||
/**
|
||||
* A no-args constructor is required for deserialization
|
||||
|
@ -55,18 +56,23 @@ public class Ip implements Comparable<Ip> {
|
|||
this.ip = ip;
|
||||
}
|
||||
|
||||
public Ip(long id, String ip, String subnet, boolean isPublic, IpState state) {
|
||||
public Ip(long id, String ip, String subnet, boolean isPublic, IpState state, Option datacenter) {
|
||||
this.id = id;
|
||||
this.ip = ip;
|
||||
this.subnet = subnet;
|
||||
this.isPublic = isPublic;
|
||||
this.state = state;
|
||||
this.datacenter = datacenter;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Option getDatacenter() {
|
||||
return datacenter;
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
@ -84,42 +90,58 @@ public class Ip implements Comparable<Ip> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
if (obj == null)
|
||||
return false;
|
||||
|
||||
Ip ip1 = (Ip) o;
|
||||
|
||||
if (id != ip1.id)
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
if (isPublic != ip1.isPublic)
|
||||
Ip other = (Ip) obj;
|
||||
if (datacenter == null) {
|
||||
if (other.datacenter != null)
|
||||
return false;
|
||||
} else if (!datacenter.equals(other.datacenter))
|
||||
return false;
|
||||
if (!ip.equals(ip1.ip))
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (state != null ? !state.equals(ip1.state) : ip1.state != null)
|
||||
if (ip == null) {
|
||||
if (other.ip != null)
|
||||
return false;
|
||||
} else if (!ip.equals(other.ip))
|
||||
return false;
|
||||
if (subnet != null ? !subnet.equals(ip1.subnet) : ip1.subnet != null)
|
||||
if (isPublic != other.isPublic)
|
||||
return false;
|
||||
if (state == null) {
|
||||
if (other.state != null)
|
||||
return false;
|
||||
} else if (!state.equals(other.state))
|
||||
return false;
|
||||
if (subnet == null) {
|
||||
if (other.subnet != null)
|
||||
return false;
|
||||
} else if (!subnet.equals(other.subnet))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = (int) (id ^ (id >>> 32));
|
||||
result = 31 * result + ip.hashCode();
|
||||
result = 31 * result + (subnet != null ? subnet.hashCode() : 0);
|
||||
result = 31 * result + (isPublic ? 1 : 0);
|
||||
result = 31 * result + (state != null ? state.hashCode() : 0);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((datacenter == null) ? 0 : datacenter.hashCode());
|
||||
result = prime * result + (int) (id ^ (id >>> 32));
|
||||
result = prime * result + ((ip == null) ? 0 : ip.hashCode());
|
||||
result = prime * result + (isPublic ? 1231 : 1237);
|
||||
result = prime * result + ((state == null) ? 0 : state.hashCode());
|
||||
result = prime * result + ((subnet == null) ? 0 : subnet.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Ip{" + "id=" + id + ", ip='" + ip + '\'' + ", subnet='" + subnet + '\''
|
||||
+ ", isPublic=" + isPublic + ", state=" + state + '}';
|
||||
return "Ip [datacenter=" + datacenter + ", id=" + id + ", ip=" + ip + ", isPublic="
|
||||
+ isPublic + ", state=" + state + ", subnet=" + subnet + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -73,4 +73,9 @@ public class IpPortPair implements Comparable<IpPortPair> {
|
|||
if(ip != null && o.getIp() != null) return Longs.compare(ip.getId(), o.getIp().getId());
|
||||
return Ints.compare(port, o.getPort());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IpPortPair [ip=" + ip + ", port=" + port + "]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,111 +28,167 @@ import com.google.gson.annotations.SerializedName;
|
|||
*/
|
||||
public class LoadBalancer implements Comparable<LoadBalancer> {
|
||||
|
||||
private long id;
|
||||
private String name;
|
||||
private String description;
|
||||
@SerializedName("virtualip")
|
||||
private IpPortPair virtualIp;
|
||||
@SerializedName("realiplist")
|
||||
private Set<IpPortPair> realIpList;
|
||||
private LoadBalancerType type;
|
||||
private LoadBalancerPersistenceType persistence;
|
||||
private LoadBalancerOs os;
|
||||
private LoadBalancerState state;
|
||||
private long id;
|
||||
private String name;
|
||||
private String description;
|
||||
@SerializedName("virtualip")
|
||||
private IpPortPair virtualIp;
|
||||
@SerializedName("realiplist")
|
||||
private Set<IpPortPair> realIpList;
|
||||
private LoadBalancerType type;
|
||||
private LoadBalancerPersistenceType persistence;
|
||||
private LoadBalancerOs os;
|
||||
private LoadBalancerState state;
|
||||
private Option datacenter;
|
||||
|
||||
/**
|
||||
* A no-args constructor is required for deserialization
|
||||
*/
|
||||
public LoadBalancer() {
|
||||
}
|
||||
/**
|
||||
* A no-args constructor is required for deserialization
|
||||
*/
|
||||
public LoadBalancer() {
|
||||
}
|
||||
|
||||
public LoadBalancer(long id, String name, String description,
|
||||
IpPortPair virtualIp, Set<IpPortPair> realIpList, LoadBalancerType type,
|
||||
LoadBalancerPersistenceType persistence, LoadBalancerOs os,
|
||||
LoadBalancerState state) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.virtualIp = virtualIp;
|
||||
this.realIpList = realIpList;
|
||||
this.type = type;
|
||||
this.persistence = persistence;
|
||||
this.os = os;
|
||||
this.state = state;
|
||||
}
|
||||
public LoadBalancer(long id, String name, String description, IpPortPair virtualIp,
|
||||
Set<IpPortPair> realIpList, LoadBalancerType type,
|
||||
LoadBalancerPersistenceType persistence, LoadBalancerOs os, LoadBalancerState state,
|
||||
Option datacenter) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.virtualIp = virtualIp;
|
||||
this.realIpList = realIpList;
|
||||
this.type = type;
|
||||
this.persistence = persistence;
|
||||
this.os = os;
|
||||
this.state = state;
|
||||
this.datacenter = datacenter;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public Option getDatacenter() {
|
||||
return datacenter;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public IpPortPair getVirtualIp() {
|
||||
return virtualIp;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public Set<IpPortPair> getRealIpList() {
|
||||
return realIpList;
|
||||
}
|
||||
public IpPortPair getVirtualIp() {
|
||||
return virtualIp;
|
||||
}
|
||||
|
||||
public LoadBalancerType getType() {
|
||||
return type;
|
||||
}
|
||||
public Set<IpPortPair> getRealIpList() {
|
||||
return realIpList;
|
||||
}
|
||||
|
||||
public LoadBalancerPersistenceType getPersistence() {
|
||||
return persistence;
|
||||
}
|
||||
public LoadBalancerType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public LoadBalancerOs getOs() {
|
||||
return os;
|
||||
}
|
||||
public LoadBalancerPersistenceType getPersistence() {
|
||||
return persistence;
|
||||
}
|
||||
|
||||
public LoadBalancerState getState() {
|
||||
return state;
|
||||
}
|
||||
public LoadBalancerOs getOs() {
|
||||
return os;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
public LoadBalancerState getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
LoadBalancer that = (LoadBalancer) o;
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
LoadBalancer other = (LoadBalancer) obj;
|
||||
if (datacenter == null) {
|
||||
if (other.datacenter != null)
|
||||
return false;
|
||||
} else if (!datacenter.equals(other.datacenter))
|
||||
return false;
|
||||
if (description == null) {
|
||||
if (other.description != null)
|
||||
return false;
|
||||
} else if (!description.equals(other.description))
|
||||
return false;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (os == null) {
|
||||
if (other.os != null)
|
||||
return false;
|
||||
} else if (!os.equals(other.os))
|
||||
return false;
|
||||
if (persistence == null) {
|
||||
if (other.persistence != null)
|
||||
return false;
|
||||
} else if (!persistence.equals(other.persistence))
|
||||
return false;
|
||||
if (realIpList == null) {
|
||||
if (other.realIpList != null)
|
||||
return false;
|
||||
} else if (!realIpList.equals(other.realIpList))
|
||||
return false;
|
||||
if (state == null) {
|
||||
if (other.state != null)
|
||||
return false;
|
||||
} else if (!state.equals(other.state))
|
||||
return false;
|
||||
if (type == null) {
|
||||
if (other.type != null)
|
||||
return false;
|
||||
} else if (!type.equals(other.type))
|
||||
return false;
|
||||
if (virtualIp == null) {
|
||||
if (other.virtualIp != null)
|
||||
return false;
|
||||
} else if (!virtualIp.equals(other.virtualIp))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (id != that.id) return false;
|
||||
if (description != null ? !description.equals(that.description) : that.description != null) return false;
|
||||
if (name != null ? !name.equals(that.name) : that.name != null) return false;
|
||||
if (os != null ? !os.equals(that.os) : that.os != null) return false;
|
||||
if (persistence != null ? !persistence.equals(that.persistence) : that.persistence != null) return false;
|
||||
if (realIpList != null ? !realIpList.equals(that.realIpList) : that.realIpList != null) return false;
|
||||
if (state != null ? !state.equals(that.state) : that.state != null) return false;
|
||||
if (type != null ? !type.equals(that.type) : that.type != null) return false;
|
||||
if (virtualIp != null ? !virtualIp.equals(that.virtualIp) : that.virtualIp != null) return false;
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((datacenter == null) ? 0 : datacenter.hashCode());
|
||||
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
||||
result = prime * result + (int) (id ^ (id >>> 32));
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((os == null) ? 0 : os.hashCode());
|
||||
result = prime * result + ((persistence == null) ? 0 : persistence.hashCode());
|
||||
result = prime * result + ((realIpList == null) ? 0 : realIpList.hashCode());
|
||||
result = prime * result + ((state == null) ? 0 : state.hashCode());
|
||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||
result = prime * result + ((virtualIp == null) ? 0 : virtualIp.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public int compareTo(LoadBalancer o) {
|
||||
return Longs.compare(id, o.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = (int) (id ^ (id >>> 32));
|
||||
result = 31 * result + (name != null ? name.hashCode() : 0);
|
||||
result = 31 * result + (description != null ? description.hashCode() : 0);
|
||||
result = 31 * result + (virtualIp != null ? virtualIp.hashCode() : 0);
|
||||
result = 31 * result + (realIpList != null ? realIpList.hashCode() : 0);
|
||||
result = 31 * result + (type != null ? type.hashCode() : 0);
|
||||
result = 31 * result + (persistence != null ? persistence.hashCode() : 0);
|
||||
result = 31 * result + (os != null ? os.hashCode() : 0);
|
||||
result = 31 * result + (state != null ? state.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(LoadBalancer o) {
|
||||
return Longs.compare(id, o.getId());
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LoadBalancer [datacenter=" + datacenter + ", description=" + description + ", id="
|
||||
+ id + ", name=" + name + ", os=" + os + ", persistence=" + persistence
|
||||
+ ", realIpList=" + realIpList + ", state=" + state + ", type=" + type
|
||||
+ ", virtualIp=" + virtualIp + "]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,134 +30,173 @@ import com.google.common.primitives.Longs;
|
|||
*/
|
||||
public class Server implements Comparable<Server> {
|
||||
|
||||
private long id;
|
||||
private boolean isSandbox;
|
||||
private String name;
|
||||
private String description;
|
||||
private Option state;
|
||||
private long id;
|
||||
private boolean isSandbox;
|
||||
private String name;
|
||||
private String description;
|
||||
private Option state;
|
||||
private Option datacenter;
|
||||
|
||||
private Option type;
|
||||
private Option ram;
|
||||
private Option os;
|
||||
private Ip ip;
|
||||
private Option type;
|
||||
private Option ram;
|
||||
private Option os;
|
||||
private Ip ip;
|
||||
|
||||
private ServerImage image;
|
||||
private ServerImage image;
|
||||
|
||||
/**
|
||||
* A no-args constructor is required for deserialization
|
||||
*/
|
||||
public Server() {
|
||||
}
|
||||
/**
|
||||
* A no-args constructor is required for deserialization
|
||||
*/
|
||||
public Server() {
|
||||
}
|
||||
|
||||
public Server(long id, boolean sandbox, String name,
|
||||
String description, Option state, Option type,
|
||||
Option ram, Option os, Ip ip, ServerImage image) {
|
||||
this.id = id;
|
||||
this.isSandbox = sandbox;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.state = state;
|
||||
this.type = type;
|
||||
this.ram = ram;
|
||||
this.os = os;
|
||||
this.ip = ip;
|
||||
this.image = image;
|
||||
}
|
||||
public Server(long id, Option datacenter, boolean sandbox, String name, String description,
|
||||
Option state, Option type, Option ram, Option os, Ip ip, ServerImage image) {
|
||||
this.id = id;
|
||||
this.isSandbox = sandbox;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.state = state;
|
||||
this.type = type;
|
||||
this.ram = ram;
|
||||
this.os = os;
|
||||
this.ip = ip;
|
||||
this.image = image;
|
||||
this.datacenter = datacenter;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean isSandbox() {
|
||||
return isSandbox;
|
||||
}
|
||||
public boolean isSandbox() {
|
||||
return isSandbox;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public Option getDatacenter() {
|
||||
return datacenter;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Option getState() {
|
||||
return state;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public Option getType() {
|
||||
return type;
|
||||
}
|
||||
public Option getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public Option getRam() {
|
||||
return ram;
|
||||
}
|
||||
public Option getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Option getOs() {
|
||||
return os;
|
||||
}
|
||||
public Option getRam() {
|
||||
return ram;
|
||||
}
|
||||
|
||||
public Ip getIp() {
|
||||
return ip;
|
||||
}
|
||||
public Option getOs() {
|
||||
return os;
|
||||
}
|
||||
|
||||
public ServerImage getImage() {
|
||||
return image;
|
||||
}
|
||||
public Ip getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
public ServerImage getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
Server server = (Server) o;
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Server other = (Server) obj;
|
||||
if (datacenter == null) {
|
||||
if (other.datacenter != null)
|
||||
return false;
|
||||
} else if (!datacenter.equals(other.datacenter))
|
||||
return false;
|
||||
if (description == null) {
|
||||
if (other.description != null)
|
||||
return false;
|
||||
} else if (!description.equals(other.description))
|
||||
return false;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (image == null) {
|
||||
if (other.image != null)
|
||||
return false;
|
||||
} else if (!image.equals(other.image))
|
||||
return false;
|
||||
if (ip == null) {
|
||||
if (other.ip != null)
|
||||
return false;
|
||||
} else if (!ip.equals(other.ip))
|
||||
return false;
|
||||
if (isSandbox != other.isSandbox)
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (os == null) {
|
||||
if (other.os != null)
|
||||
return false;
|
||||
} else if (!os.equals(other.os))
|
||||
return false;
|
||||
if (ram == null) {
|
||||
if (other.ram != null)
|
||||
return false;
|
||||
} else if (!ram.equals(other.ram))
|
||||
return false;
|
||||
if (state == null) {
|
||||
if (other.state != null)
|
||||
return false;
|
||||
} else if (!state.equals(other.state))
|
||||
return false;
|
||||
if (type == null) {
|
||||
if (other.type != null)
|
||||
return false;
|
||||
} else if (!type.equals(other.type))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (id != server.id) return false;
|
||||
if (isSandbox != server.isSandbox) return false;
|
||||
if (description != null ? !description.equals(server.description) : server.description != null) return false;
|
||||
if (image != null ? !image.equals(server.image) : server.image != null) return false;
|
||||
if (ip != null ? !ip.equals(server.ip) : server.ip != null) return false;
|
||||
if (!name.equals(server.name)) return false;
|
||||
if (os != null ? !os.equals(server.os) : server.os != null) return false;
|
||||
if (ram != null ? !ram.equals(server.ram) : server.ram != null) return false;
|
||||
if (!state.equals(server.state)) return false;
|
||||
if (!type.equals(server.type)) return false;
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((datacenter == null) ? 0 : datacenter.hashCode());
|
||||
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
||||
result = prime * result + (int) (id ^ (id >>> 32));
|
||||
result = prime * result + ((image == null) ? 0 : image.hashCode());
|
||||
result = prime * result + ((ip == null) ? 0 : ip.hashCode());
|
||||
result = prime * result + (isSandbox ? 1231 : 1237);
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((os == null) ? 0 : os.hashCode());
|
||||
result = prime * result + ((ram == null) ? 0 : ram.hashCode());
|
||||
result = prime * result + ((state == null) ? 0 : state.hashCode());
|
||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public int compareTo(Server o) {
|
||||
return Longs.compare(id, o.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = (int) (id ^ (id >>> 32));
|
||||
result = 31 * result + (isSandbox ? 1 : 0);
|
||||
result = 31 * result + name.hashCode();
|
||||
result = 31 * result + (description != null ? description.hashCode() : 0);
|
||||
result = 31 * result + state.hashCode();
|
||||
result = 31 * result + type.hashCode();
|
||||
result = 31 * result + (ram != null ? ram.hashCode() : 0);
|
||||
result = 31 * result + (os != null ? os.hashCode() : 0);
|
||||
result = 31 * result + (ip != null ? ip.hashCode() : 0);
|
||||
result = 31 * result + (image != null ? image.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Server o) {
|
||||
return Longs.compare(id, o.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Server{" +
|
||||
"id=" + id +
|
||||
", isSandbox=" + isSandbox +
|
||||
", name='" + name + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", state=" + state +
|
||||
", type=" + type +
|
||||
", ram=" + ram +
|
||||
", os=" + os +
|
||||
", ip=" + ip +
|
||||
", image=" + image +
|
||||
'}';
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Server [datacenter=" + datacenter + ", description=" + description + ", id=" + id
|
||||
+ ", image=" + image + ", ip=" + ip + ", isSandbox=" + isSandbox + ", name=" + name
|
||||
+ ", os=" + os + ", ram=" + ram + ", state=" + state + ", type=" + type + "]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,60 +18,79 @@
|
|||
*/
|
||||
package org.jclouds.gogrid.options;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.DATACENTER_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.IMAGE_STATE_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.IMAGE_TYPE_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.IS_PUBLIC_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.MAX_NUMBER_KEY;
|
||||
|
||||
import org.jclouds.gogrid.domain.ServerImageState;
|
||||
import org.jclouds.gogrid.domain.ServerImageType;
|
||||
import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.*;
|
||||
|
||||
/**
|
||||
* @author Oleksiy Yarmula
|
||||
*/
|
||||
public class GetImageListOptions extends BaseHttpRequestOptions {
|
||||
|
||||
public GetImageListOptions setType(ServerImageType imageType) {
|
||||
checkState(!queryParameters.containsKey(IMAGE_TYPE_KEY), "Can't have duplicate image type restrictions");
|
||||
queryParameters.put(IMAGE_TYPE_KEY, imageType.toString());
|
||||
return this;
|
||||
}
|
||||
public GetImageListOptions setType(ServerImageType imageType) {
|
||||
checkState(!queryParameters.containsKey(IMAGE_TYPE_KEY),
|
||||
"Can't have duplicate image type restrictions");
|
||||
queryParameters.put(IMAGE_TYPE_KEY, imageType.toString());
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetImageListOptions setState(ServerImageState imageState) {
|
||||
checkState(!queryParameters.containsKey(IMAGE_STATE_KEY), "Can't have duplicate image state restrictions");
|
||||
queryParameters.put(IMAGE_STATE_KEY, imageState.toString());
|
||||
return this;
|
||||
}
|
||||
public GetImageListOptions setState(ServerImageState imageState) {
|
||||
checkState(!queryParameters.containsKey(IMAGE_STATE_KEY),
|
||||
"Can't have duplicate image state restrictions");
|
||||
queryParameters.put(IMAGE_STATE_KEY, imageState.toString());
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetImageListOptions onlyPublic() {
|
||||
checkState(!queryParameters.containsKey(IS_PUBLIC_KEY), "Can't have duplicate image visibility restrictions");
|
||||
queryParameters.put(IS_PUBLIC_KEY, "true");
|
||||
return this;
|
||||
}
|
||||
public GetImageListOptions onlyPublic() {
|
||||
checkState(!queryParameters.containsKey(IS_PUBLIC_KEY),
|
||||
"Can't have duplicate image visibility restrictions");
|
||||
queryParameters.put(IS_PUBLIC_KEY, "true");
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetImageListOptions onlyPrivate() {
|
||||
checkState(!queryParameters.containsKey(IS_PUBLIC_KEY), "Can't have duplicate image visibility restrictions");
|
||||
queryParameters.put(IS_PUBLIC_KEY, "false");
|
||||
return this;
|
||||
}
|
||||
public GetImageListOptions onlyPrivate() {
|
||||
checkState(!queryParameters.containsKey(IS_PUBLIC_KEY),
|
||||
"Can't have duplicate image visibility restrictions");
|
||||
queryParameters.put(IS_PUBLIC_KEY, "false");
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetImageListOptions maxItemsNumber(Integer maxNumber) {
|
||||
checkState(!queryParameters.containsKey(MAX_NUMBER_KEY), "Can't have duplicate parameter of max returned items");
|
||||
queryParameters.put(MAX_NUMBER_KEY, maxNumber.toString());
|
||||
return this;
|
||||
}
|
||||
public GetImageListOptions inDatacenter(String datacenterId) {
|
||||
checkState(!queryParameters.containsKey(DATACENTER_KEY), "Can't have duplicate datacenter id");
|
||||
queryParameters.put(DATACENTER_KEY, datacenterId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
public GetImageListOptions publicWebServers() {
|
||||
return new GetImageListOptions().setState(ServerImageState.AVAILABLE).
|
||||
setType(ServerImageType.WEB_APPLICATION_SERVER).
|
||||
onlyPublic();
|
||||
}
|
||||
public GetImageListOptions maxItemsNumber(Integer maxNumber) {
|
||||
checkState(!queryParameters.containsKey(MAX_NUMBER_KEY),
|
||||
"Can't have duplicate parameter of max returned items");
|
||||
queryParameters.put(MAX_NUMBER_KEY, maxNumber.toString());
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetImageListOptions publicDatabaseServers() {
|
||||
return new GetImageListOptions().setState(ServerImageState.AVAILABLE).
|
||||
setType(ServerImageType.DATABASE_SERVER).
|
||||
onlyPublic();
|
||||
}
|
||||
}
|
||||
public static class Builder {
|
||||
public GetImageListOptions inDatacenter(String datacenterId) {
|
||||
GetImageListOptions getImageListOptions = new GetImageListOptions();
|
||||
return getImageListOptions.inDatacenter(checkNotNull(datacenterId));
|
||||
}
|
||||
|
||||
public GetImageListOptions publicWebServers() {
|
||||
return new GetImageListOptions().setState(ServerImageState.AVAILABLE).setType(
|
||||
ServerImageType.WEB_APPLICATION_SERVER).onlyPublic();
|
||||
}
|
||||
|
||||
public GetImageListOptions publicDatabaseServers() {
|
||||
return new GetImageListOptions().setState(ServerImageState.AVAILABLE).setType(
|
||||
ServerImageType.DATABASE_SERVER).onlyPublic();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,51 +18,67 @@
|
|||
*/
|
||||
package org.jclouds.gogrid.options;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.DATACENTER_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.IP_STATE_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.IP_TYPE_KEY;
|
||||
|
||||
import org.jclouds.gogrid.domain.IpState;
|
||||
import org.jclouds.gogrid.domain.IpType;
|
||||
import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.*;
|
||||
|
||||
/**
|
||||
* @author Oleksiy Yarmula
|
||||
*/
|
||||
public class GetIpListOptions extends BaseHttpRequestOptions {
|
||||
|
||||
public static final GetIpListOptions NONE = new GetIpListOptions();
|
||||
public static final GetIpListOptions NONE = new GetIpListOptions();
|
||||
|
||||
public GetIpListOptions onlyAssigned() {
|
||||
checkState(!queryParameters.containsKey(IP_STATE_KEY), "Can't have multiple values for whether IP is assigned");
|
||||
queryParameters.put(IP_STATE_KEY, IpState.ASSIGNED.toString());
|
||||
return this;
|
||||
}
|
||||
public GetIpListOptions onlyAssigned() {
|
||||
checkState(!queryParameters.containsKey(IP_STATE_KEY),
|
||||
"Can't have multiple values for whether IP is assigned");
|
||||
queryParameters.put(IP_STATE_KEY, IpState.ASSIGNED.toString());
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetIpListOptions onlyUnassigned() {
|
||||
checkState(!queryParameters.containsKey(IP_STATE_KEY), "Can't have multiple values for whether IP is assigned");
|
||||
queryParameters.put(IP_STATE_KEY, IpState.UNASSIGNED.toString());
|
||||
return this;
|
||||
}
|
||||
public GetIpListOptions onlyUnassigned() {
|
||||
checkState(!queryParameters.containsKey(IP_STATE_KEY),
|
||||
"Can't have multiple values for whether IP is assigned");
|
||||
queryParameters.put(IP_STATE_KEY, IpState.UNASSIGNED.toString());
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetIpListOptions onlyWithType(IpType type) {
|
||||
checkState(!queryParameters.containsKey(IP_TYPE_KEY), "Can't have multiple values for ip type limit");
|
||||
queryParameters.put(IP_TYPE_KEY, type.toString());
|
||||
return this;
|
||||
}
|
||||
public GetIpListOptions onlyWithType(IpType type) {
|
||||
checkState(!queryParameters.containsKey(IP_TYPE_KEY),
|
||||
"Can't have multiple values for ip type limit");
|
||||
queryParameters.put(IP_TYPE_KEY, type.toString());
|
||||
return this;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
public GetIpListOptions inDatacenter(String datacenterId) {
|
||||
checkState(!queryParameters.containsKey(DATACENTER_KEY), "Can't have duplicate datacenter id");
|
||||
queryParameters.put(DATACENTER_KEY, datacenterId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetIpListOptions create() {
|
||||
return new GetIpListOptions();
|
||||
}
|
||||
public static class Builder {
|
||||
|
||||
public GetIpListOptions limitToType(IpType type) {
|
||||
return new GetIpListOptions().onlyWithType(type);
|
||||
}
|
||||
public GetIpListOptions inDatacenter(String datacenterId) {
|
||||
return new GetIpListOptions().inDatacenter(checkNotNull(datacenterId));
|
||||
}
|
||||
|
||||
public GetIpListOptions unassignedPublicIps() {
|
||||
return new GetIpListOptions().onlyWithType(IpType.PUBLIC).onlyUnassigned();
|
||||
}
|
||||
}
|
||||
public GetIpListOptions create() {
|
||||
return new GetIpListOptions();
|
||||
}
|
||||
|
||||
public GetIpListOptions limitToType(IpType type) {
|
||||
return new GetIpListOptions().onlyWithType(type);
|
||||
}
|
||||
|
||||
public GetIpListOptions unassignedPublicIps() {
|
||||
return new GetIpListOptions().onlyWithType(IpType.PUBLIC).onlyUnassigned();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,58 +23,73 @@
|
|||
*/
|
||||
package org.jclouds.gogrid.options;
|
||||
|
||||
import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.SERVER_TYPE_KEY;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.DATACENTER_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.IS_SANDBOX_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.SERVER_TYPE_KEY;
|
||||
|
||||
import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||
|
||||
/**
|
||||
* @author Oleksiy Yarmula
|
||||
*/
|
||||
public class GetServerListOptions extends BaseHttpRequestOptions {
|
||||
|
||||
public final static GetServerListOptions NONE = new GetServerListOptions();
|
||||
public final static GetServerListOptions NONE = new GetServerListOptions();
|
||||
|
||||
public GetServerListOptions limitServerTypeTo(String serverType) {
|
||||
checkState(!queryParameters.containsKey(SERVER_TYPE_KEY), "Can't have duplicate server type limit");
|
||||
queryParameters.put(SERVER_TYPE_KEY, serverType);
|
||||
return this;
|
||||
}
|
||||
public GetServerListOptions limitServerTypeTo(String serverType) {
|
||||
checkState(!queryParameters.containsKey(SERVER_TYPE_KEY),
|
||||
"Can't have duplicate server type limit");
|
||||
queryParameters.put(SERVER_TYPE_KEY, serverType);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetServerListOptions onlySandboxServers() {
|
||||
checkState(!queryParameters.containsKey(IS_SANDBOX_KEY), "Can't have duplicate sandbox type limit");
|
||||
queryParameters.put(IS_SANDBOX_KEY, "true");
|
||||
return this;
|
||||
}
|
||||
public GetServerListOptions inDatacenter(String datacenterId) {
|
||||
checkState(!queryParameters.containsKey(DATACENTER_KEY), "Can't have duplicate datacenter id");
|
||||
queryParameters.put(DATACENTER_KEY, datacenterId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetServerListOptions excludeSandboxServers() {
|
||||
checkState(!queryParameters.containsKey(IS_SANDBOX_KEY), "Can't have duplicate sandbox type limit");
|
||||
queryParameters.put(IS_SANDBOX_KEY, "false");
|
||||
return this;
|
||||
}
|
||||
public GetServerListOptions onlySandboxServers() {
|
||||
checkState(!queryParameters.containsKey(IS_SANDBOX_KEY),
|
||||
"Can't have duplicate sandbox type limit");
|
||||
queryParameters.put(IS_SANDBOX_KEY, "true");
|
||||
return this;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
public GetServerListOptions excludeSandboxServers() {
|
||||
checkState(!queryParameters.containsKey(IS_SANDBOX_KEY),
|
||||
"Can't have duplicate sandbox type limit");
|
||||
queryParameters.put(IS_SANDBOX_KEY, "false");
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetServerListOptions limitServerTypeTo(String serverType) {
|
||||
GetServerListOptions getServerListOptions = new GetServerListOptions();
|
||||
getServerListOptions.limitServerTypeTo(checkNotNull(serverType));
|
||||
return getServerListOptions;
|
||||
}
|
||||
public static class Builder {
|
||||
public GetServerListOptions inDatacenter(String datacenterId) {
|
||||
GetServerListOptions getServerListOptions = new GetServerListOptions();
|
||||
getServerListOptions.inDatacenter(checkNotNull(datacenterId));
|
||||
return getServerListOptions;
|
||||
}
|
||||
|
||||
public GetServerListOptions onlySandboxServers() {
|
||||
GetServerListOptions getServerListOptions = new GetServerListOptions();
|
||||
getServerListOptions.onlySandboxServers();
|
||||
return getServerListOptions;
|
||||
}
|
||||
public GetServerListOptions limitServerTypeTo(String serverType) {
|
||||
GetServerListOptions getServerListOptions = new GetServerListOptions();
|
||||
getServerListOptions.limitServerTypeTo(checkNotNull(serverType));
|
||||
return getServerListOptions;
|
||||
}
|
||||
|
||||
public GetServerListOptions excludeSandboxServers() {
|
||||
GetServerListOptions getServerListOptions = new GetServerListOptions();
|
||||
getServerListOptions.excludeSandboxServers();
|
||||
return getServerListOptions;
|
||||
}
|
||||
public GetServerListOptions onlySandboxServers() {
|
||||
GetServerListOptions getServerListOptions = new GetServerListOptions();
|
||||
getServerListOptions.onlySandboxServers();
|
||||
return getServerListOptions;
|
||||
}
|
||||
|
||||
}
|
||||
public GetServerListOptions excludeSandboxServers() {
|
||||
GetServerListOptions getServerListOptions = new GetServerListOptions();
|
||||
getServerListOptions.excludeSandboxServers();
|
||||
return getServerListOptions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ public interface GoGridQueryParams {
|
|||
public static final String SERVER_ID_OR_NAME_KEY = "server";
|
||||
public static final String SERVER_TYPE_KEY = "server.type";
|
||||
|
||||
public static final String DATACENTER_KEY = "datacenter";
|
||||
|
||||
public static final String IS_SANDBOX_KEY = "isSandbox";
|
||||
public static final String IMAGE_KEY = "image";
|
||||
public static final String IP_KEY = "ip";
|
||||
|
|
|
@ -4,6 +4,7 @@ import static org.jclouds.gogrid.reference.GoGridHeaders.VERSION;
|
|||
import static org.jclouds.gogrid.reference.GoGridQueryParams.IMAGE_DESCRIPTION_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.IMAGE_FRIENDLY_NAME_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.IMAGE_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.LOOKUP_LIST_KEY;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -14,10 +15,12 @@ import javax.ws.rs.QueryParam;
|
|||
import org.jclouds.gogrid.GoGridAsyncClient;
|
||||
import org.jclouds.gogrid.binders.BindIdsToQueryParams;
|
||||
import org.jclouds.gogrid.binders.BindNamesToQueryParams;
|
||||
import org.jclouds.gogrid.domain.Option;
|
||||
import org.jclouds.gogrid.domain.ServerImage;
|
||||
import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication;
|
||||
import org.jclouds.gogrid.functions.ParseImageFromJsonResponse;
|
||||
import org.jclouds.gogrid.functions.ParseImageListFromJsonResponse;
|
||||
import org.jclouds.gogrid.functions.ParseOptionsFromJsonResponse;
|
||||
import org.jclouds.gogrid.options.GetImageListOptions;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
|
@ -77,4 +80,12 @@ public interface GridImageAsyncClient {
|
|||
ListenableFuture<ServerImage> editImageFriendlyName(@QueryParam(IMAGE_KEY) String idOrName,
|
||||
@QueryParam(IMAGE_FRIENDLY_NAME_KEY) String newFriendlyName);
|
||||
|
||||
/**
|
||||
* @see GridImageClient#getDatacenters
|
||||
*/
|
||||
@GET
|
||||
@ResponseParser(ParseOptionsFromJsonResponse.class)
|
||||
@Path("/common/lookup/list")
|
||||
@QueryParams(keys = LOOKUP_LIST_KEY, values = "datacenter")
|
||||
ListenableFuture<Set<Option>> getDatacenters();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Set;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.gogrid.domain.Option;
|
||||
import org.jclouds.gogrid.domain.ServerImage;
|
||||
import org.jclouds.gogrid.options.GetImageListOptions;
|
||||
|
||||
|
@ -65,4 +66,12 @@ public interface GridImageClient {
|
|||
*/
|
||||
ServerImage editImageFriendlyName(String idOrName, String newFriendlyName);
|
||||
|
||||
/**
|
||||
* Retrieves the list of supported Datacenters to save images in. The objects will have
|
||||
* datacenter ID, name and description. In most cases, id or name will be used for
|
||||
* {@link #getImageList}.
|
||||
*
|
||||
* @return supported datacenters
|
||||
*/
|
||||
Set<Option> getDatacenters();
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.jclouds.gogrid.services;
|
|||
import static org.jclouds.gogrid.reference.GoGridHeaders.VERSION;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.IP_STATE_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.IP_TYPE_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.LOOKUP_LIST_KEY;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -29,8 +30,10 @@ import javax.ws.rs.Path;
|
|||
|
||||
import org.jclouds.gogrid.GoGridAsyncClient;
|
||||
import org.jclouds.gogrid.domain.Ip;
|
||||
import org.jclouds.gogrid.domain.Option;
|
||||
import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication;
|
||||
import org.jclouds.gogrid.functions.ParseIpListFromJsonResponse;
|
||||
import org.jclouds.gogrid.functions.ParseOptionsFromJsonResponse;
|
||||
import org.jclouds.gogrid.options.GetIpListOptions;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
|
@ -82,4 +85,13 @@ public interface GridIpAsyncClient {
|
|||
@QueryParams(keys = IP_STATE_KEY, values = "Assigned")
|
||||
ListenableFuture<Set<Ip>> getAssignedIpList();
|
||||
|
||||
/**
|
||||
*
|
||||
* @see org.jclouds.gogrid.services.GridIpClient#getDatacenters
|
||||
*/
|
||||
@GET
|
||||
@ResponseParser(ParseOptionsFromJsonResponse.class)
|
||||
@Path("/common/lookup/list")
|
||||
@QueryParams(keys = LOOKUP_LIST_KEY, values = "ip.datacenter")
|
||||
ListenableFuture<Set<Option>> getDatacenters();
|
||||
}
|
||||
|
|
|
@ -18,48 +18,60 @@
|
|||
*/
|
||||
package org.jclouds.gogrid.services;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.gogrid.domain.Ip;
|
||||
import org.jclouds.gogrid.options.GetIpListOptions;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.gogrid.domain.Ip;
|
||||
import org.jclouds.gogrid.domain.Option;
|
||||
import org.jclouds.gogrid.options.GetIpListOptions;
|
||||
|
||||
/**
|
||||
* @author Oleksiy Yarmula
|
||||
*/
|
||||
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
||||
public interface GridIpClient {
|
||||
|
||||
/**
|
||||
* Returns all IPs in the system
|
||||
* that match the options
|
||||
* @param options options to narrow the search down
|
||||
* @return IPs found by the search
|
||||
*/
|
||||
Set<Ip> getIpList(GetIpListOptions... options);
|
||||
/**
|
||||
* Returns all IPs in the system that match the options
|
||||
*
|
||||
* @param options
|
||||
* options to narrow the search down
|
||||
* @return IPs found by the search
|
||||
*/
|
||||
Set<Ip> getIpList(GetIpListOptions... options);
|
||||
|
||||
/**
|
||||
* Returns the list of unassigned IPs.
|
||||
*
|
||||
* NOTE: this returns both public and private IPs!
|
||||
*
|
||||
* @return unassigned IPs
|
||||
*/
|
||||
Set<Ip> getUnassignedIpList();
|
||||
/**
|
||||
* Returns the list of unassigned IPs.
|
||||
*
|
||||
* NOTE: this returns both public and private IPs!
|
||||
*
|
||||
* @return unassigned IPs
|
||||
*/
|
||||
Set<Ip> getUnassignedIpList();
|
||||
|
||||
/**
|
||||
* Returns the list of unassigned public IPs.
|
||||
* @return unassigned public IPs
|
||||
*/
|
||||
Set<Ip> getUnassignedPublicIpList();
|
||||
/**
|
||||
* Returns the list of unassigned public IPs.
|
||||
*
|
||||
* @return unassigned public IPs
|
||||
*/
|
||||
Set<Ip> getUnassignedPublicIpList();
|
||||
|
||||
/**
|
||||
* Returns the list of assigned IPs
|
||||
*
|
||||
* NOTE: this returns both public and private IPs!
|
||||
*
|
||||
* @return assigned IPs
|
||||
*/
|
||||
Set<Ip> getAssignedIpList();
|
||||
/**
|
||||
* Returns the list of assigned IPs
|
||||
*
|
||||
* NOTE: this returns both public and private IPs!
|
||||
*
|
||||
* @return assigned IPs
|
||||
*/
|
||||
Set<Ip> getAssignedIpList();
|
||||
|
||||
/**
|
||||
* Retrieves the list of supported Datacenters to retrieve ips from. The objects will have
|
||||
* datacenter ID, name and description. In most cases, id or name will be used for
|
||||
* {@link #addServer}.
|
||||
*
|
||||
* @return supported datacenters
|
||||
*/
|
||||
Set<Option> getDatacenters();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.jclouds.gogrid.services;
|
|||
|
||||
import static org.jclouds.gogrid.reference.GoGridHeaders.VERSION;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.ID_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.LOOKUP_LIST_KEY;
|
||||
import static org.jclouds.gogrid.reference.GoGridQueryParams.NAME_KEY;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -36,9 +37,11 @@ import org.jclouds.gogrid.binders.BindRealIpPortPairsToQueryParams;
|
|||
import org.jclouds.gogrid.binders.BindVirtualIpPortPairToQueryParams;
|
||||
import org.jclouds.gogrid.domain.IpPortPair;
|
||||
import org.jclouds.gogrid.domain.LoadBalancer;
|
||||
import org.jclouds.gogrid.domain.Option;
|
||||
import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication;
|
||||
import org.jclouds.gogrid.functions.ParseLoadBalancerFromJsonResponse;
|
||||
import org.jclouds.gogrid.functions.ParseLoadBalancerListFromJsonResponse;
|
||||
import org.jclouds.gogrid.functions.ParseOptionsFromJsonResponse;
|
||||
import org.jclouds.gogrid.options.AddLoadBalancerOptions;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
|
@ -124,4 +127,13 @@ public interface GridLoadBalancerAsyncClient {
|
|||
@ResponseParser(ParseLoadBalancerFromJsonResponse.class)
|
||||
@Path("/grid/loadbalancer/delete")
|
||||
ListenableFuture<LoadBalancer> deleteByName(@QueryParam(NAME_KEY) String name);
|
||||
|
||||
/**
|
||||
* @see GridLoadBalancerClient#getDatacenters
|
||||
*/
|
||||
@GET
|
||||
@ResponseParser(ParseOptionsFromJsonResponse.class)
|
||||
@Path("/common/lookup/list")
|
||||
@QueryParams(keys = LOOKUP_LIST_KEY, values = "loadbalancer.datacenter")
|
||||
ListenableFuture<Set<Option>> getDatacenters();
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.gogrid.domain.IpPortPair;
|
||||
import org.jclouds.gogrid.domain.LoadBalancer;
|
||||
import org.jclouds.gogrid.domain.Option;
|
||||
import org.jclouds.gogrid.options.AddLoadBalancerOptions;
|
||||
|
||||
/**
|
||||
|
@ -126,4 +127,14 @@ public interface GridLoadBalancerClient {
|
|||
* @return load balancer before the command is executed
|
||||
*/
|
||||
LoadBalancer deleteByName(String name);
|
||||
|
||||
/**
|
||||
* Retrieves the list of supported Datacenters to launch servers into. The objects will have
|
||||
* datacenter ID, name and description. In most cases, id or name will be used for
|
||||
* {@link #addLoadBalancer}.
|
||||
*
|
||||
* @return supported datacenters
|
||||
*/
|
||||
Set<Option> getDatacenters();
|
||||
|
||||
}
|
||||
|
|
|
@ -152,4 +152,15 @@ public interface GridServerAsyncClient {
|
|||
@Path("/common/lookup/list")
|
||||
@QueryParams(keys = LOOKUP_LIST_KEY, values = "server.ram")
|
||||
ListenableFuture<Set<Option>> getRamSizes();
|
||||
|
||||
/**
|
||||
* @see GridServerClient#getDatacenters
|
||||
*/
|
||||
@GET
|
||||
@ResponseParser(ParseOptionsFromJsonResponse.class)
|
||||
@Path("/common/lookup/list")
|
||||
@QueryParams(keys = LOOKUP_LIST_KEY, values = "server.datacenter")
|
||||
ListenableFuture<Set<Option>> getDatacenters();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -149,4 +149,13 @@ public interface GridServerClient {
|
|||
* @return supported ram sizes
|
||||
*/
|
||||
Set<Option> getRamSizes();
|
||||
|
||||
/**
|
||||
* Retrieves the list of supported Datacenters to launch servers into. The objects will have
|
||||
* datacenter ID, name and description. In most cases, id or name will be used for
|
||||
* {@link #addServer}.
|
||||
*
|
||||
* @return supported datacenters
|
||||
*/
|
||||
Set<Option> getDatacenters();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class GoGridComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
Template defaultTemplate = client.templateBuilder().build();
|
||||
assertEquals(defaultTemplate.getImage().getArchitecture(), Architecture.X86_64);
|
||||
assertEquals(defaultTemplate.getImage().getOsFamily(), OsFamily.CENTOS);
|
||||
assertEquals(defaultTemplate.getLocation().getId(), "SANFRANCISCO");
|
||||
assertEquals(defaultTemplate.getLocation().getId(), "1");
|
||||
assertEquals(defaultTemplate.getSize().getCores(), 0.5d);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.jclouds.gogrid.domain.ServerImage;
|
|||
import org.jclouds.gogrid.services.GridServerClient;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
|
@ -40,6 +41,7 @@ public class ServerToNodeMetadataTest {
|
|||
expect(caller.getServerServices()).andReturn(client).atLeastOnce();
|
||||
Map<String, NodeState> serverStateToNodeState = createMock(Map.class);
|
||||
org.jclouds.compute.domain.Image jcImage = createMock(org.jclouds.compute.domain.Image.class);
|
||||
Option dc = new Option(1l, "US-West-1", "US West 1 Datacenter");
|
||||
|
||||
Set<org.jclouds.compute.domain.Image> images = ImmutableSet.of(jcImage);
|
||||
Server server = createMock(Server.class);
|
||||
|
@ -49,7 +51,8 @@ public class ServerToNodeMetadataTest {
|
|||
expect(server.getState()).andReturn(new Option("NODE_RUNNING")).atLeastOnce();
|
||||
|
||||
expect(serverStateToNodeState.get("NODE_RUNNING")).andReturn(NodeState.RUNNING);
|
||||
Location location = new LocationImpl(LocationScope.ZONE, "sanfran", "description", null);
|
||||
LocationImpl location = new LocationImpl(LocationScope.ZONE, "1", "US-West-1", null);
|
||||
Map<String, ? extends Location> locations = ImmutableMap.<String, Location> of("1", location);
|
||||
|
||||
Map<String, Credentials> credentialsMap = createMock(Map.class);
|
||||
expect(client.getServerCredentialsList()).andReturn(credentialsMap);
|
||||
|
@ -59,6 +62,7 @@ public class ServerToNodeMetadataTest {
|
|||
|
||||
ServerImage image = createMock(ServerImage.class);
|
||||
expect(server.getImage()).andReturn(image).atLeastOnce();
|
||||
expect(server.getDatacenter()).andReturn(dc).atLeastOnce();
|
||||
expect(image.getId()).andReturn(2000l).atLeastOnce();
|
||||
expect(jcImage.getProviderId()).andReturn("2000").atLeastOnce();
|
||||
expect(jcImage.getLocation()).andReturn(location).atLeastOnce();
|
||||
|
@ -72,7 +76,7 @@ public class ServerToNodeMetadataTest {
|
|||
replay(credentialsMap);
|
||||
|
||||
ServerToNodeMetadata parser = new ServerToNodeMetadata(serverStateToNodeState, caller,
|
||||
images, location);
|
||||
images, locations);
|
||||
|
||||
NodeMetadata metadata = parser.apply(server);
|
||||
assertEquals(metadata.getLocation(), location);
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.jclouds.gogrid.domain.LoadBalancerOs;
|
|||
import org.jclouds.gogrid.domain.LoadBalancerPersistenceType;
|
||||
import org.jclouds.gogrid.domain.LoadBalancerState;
|
||||
import org.jclouds.gogrid.domain.LoadBalancerType;
|
||||
import org.jclouds.gogrid.domain.Option;
|
||||
import org.jclouds.gogrid.functions.internal.CustomDeserializers;
|
||||
import org.jclouds.http.functions.config.ParserModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -62,15 +63,16 @@ public class ParseLoadBalancersFromJsonResponseTest {
|
|||
ParseLoadBalancerListFromJsonResponse parser = new ParseLoadBalancerListFromJsonResponse(i
|
||||
.getInstance(Gson.class));
|
||||
SortedSet<LoadBalancer> response = parser.apply(is);
|
||||
Option dc = new Option(1l, "US-West-1", "US West 1 Datacenter");
|
||||
|
||||
LoadBalancer loadBalancer = new LoadBalancer(6372L, "Balancer", null, new IpPortPair(
|
||||
new Ip(1313082L, "204.51.240.181", "204.51.240.176/255.255.255.240", true,
|
||||
IpState.ASSIGNED), 80), ImmutableSortedSet.of(new IpPortPair(
|
||||
IpState.ASSIGNED, dc), 80), ImmutableSortedSet.of(new IpPortPair(
|
||||
new Ip(1313086L, "204.51.240.185", "204.51.240.176/255.255.255.240", true,
|
||||
IpState.ASSIGNED), 80), new IpPortPair(new Ip(1313089L, "204.51.240.188",
|
||||
"204.51.240.176/255.255.255.240", true, IpState.ASSIGNED), 80)),
|
||||
IpState.ASSIGNED, dc), 80), new IpPortPair(new Ip(1313089L, "204.51.240.188",
|
||||
"204.51.240.176/255.255.255.240", true, IpState.ASSIGNED, dc), 80)),
|
||||
LoadBalancerType.ROUND_ROBIN, LoadBalancerPersistenceType.NONE, LoadBalancerOs.F5,
|
||||
LoadBalancerState.ON);
|
||||
LoadBalancerState.ON, dc);
|
||||
assertEquals(Iterables.getOnlyElement(response), loadBalancer);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,14 +71,14 @@ public class ParseServersFromJsonResponseTest {
|
|||
ParseServerListFromJsonResponse parser = new ParseServerListFromJsonResponse(i
|
||||
.getInstance(Gson.class));
|
||||
SortedSet<Server> response = parser.apply(is);
|
||||
|
||||
Option dc = new Option(1l, "US-West-1", "US West 1 Datacenter");
|
||||
Option centOs = new Option(13L, "CentOS 5.2 (32-bit)", "CentOS 5.2 (32-bit)");
|
||||
Option webServer = new Option(1L, "Web Server", "Web or Application Server");
|
||||
Server server = new Server(75245L, false, "PowerServer",
|
||||
Server server = new Server(75245L, dc, false, "PowerServer",
|
||||
"server to test the api. created by Alex", new Option(1L, "On",
|
||||
"Server is in active state."), webServer, new Option(1L, "512MB",
|
||||
"Server with 512MB RAM"), centOs, new Ip(1313079L, "204.51.240.178",
|
||||
"204.51.240.176/255.255.255.240", true, IpState.ASSIGNED), new ServerImage(
|
||||
"204.51.240.176/255.255.255.240", true, IpState.ASSIGNED, dc), new ServerImage(
|
||||
1946L, "GSI-f8979644-e646-4711-ad58-d98a5fa3612c",
|
||||
"BitNami Gallery 2.3.1-0", "http://bitnami.org/stack/gallery", centOs,
|
||||
null, ServerImageType.WEB_APPLICATION_SERVER, ServerImageState.AVAILABLE,
|
||||
|
|
|
@ -46,7 +46,7 @@ public class GridImageAsyncClientTest extends BaseGoGridAsyncClientTest<GridImag
|
|||
new GetImageListOptions().onlyPublic().setState(ServerImageState.AVAILABLE).setType(
|
||||
ServerImageType.WEB_APPLICATION_SERVER));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/list?v=1.4&"
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/list?v=1.5&"
|
||||
+ "isPublic=true&image.state=Available&" + "image.type=Web%20Server HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -59,7 +59,7 @@ public class GridImageAsyncClientTest extends BaseGoGridAsyncClientTest<GridImag
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/list?"
|
||||
+ "v=1.4&isPublic=true&image.state=Available&" + "image.type=Web%20Server&"
|
||||
+ "v=1.5&isPublic=true&image.state=Available&" + "image.type=Web%20Server&"
|
||||
+ "sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -71,7 +71,7 @@ public class GridImageAsyncClientTest extends BaseGoGridAsyncClientTest<GridImag
|
|||
GeneratedHttpRequest<GridImageAsyncClient> httpRequest = processor.createRequest(method,
|
||||
"name1", "name2");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/get?v=1.4&"
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/get?v=1.5&"
|
||||
+ "name=name1&name=name2 HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -83,7 +83,7 @@ public class GridImageAsyncClientTest extends BaseGoGridAsyncClientTest<GridImag
|
|||
checkFilters(httpRequest);
|
||||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/get?v=1.4&"
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/get?v=1.5&"
|
||||
+ "name=name1&name=name2&" + "sig=3f446f171455fbb5574aecff4997b273&api_key=foo "
|
||||
+ "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
|
@ -97,7 +97,7 @@ public class GridImageAsyncClientTest extends BaseGoGridAsyncClientTest<GridImag
|
|||
GeneratedHttpRequest<GridImageAsyncClient> httpRequest = processor.createRequest(method,
|
||||
"imageName", "newDesc");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/edit?v=1.4&"
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/edit?v=1.5&"
|
||||
+ "image=imageName&description=newDesc HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -109,7 +109,7 @@ public class GridImageAsyncClientTest extends BaseGoGridAsyncClientTest<GridImag
|
|||
checkFilters(httpRequest);
|
||||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/edit?v=1.4&"
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/edit?v=1.5&"
|
||||
+ "image=imageName&description=newDesc&"
|
||||
+ "sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
|
@ -123,7 +123,7 @@ public class GridImageAsyncClientTest extends BaseGoGridAsyncClientTest<GridImag
|
|||
GeneratedHttpRequest<GridImageAsyncClient> httpRequest = processor.createRequest(method,
|
||||
"imageName", "newFriendlyName");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/edit?v=1.4&"
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/edit?v=1.5&"
|
||||
+ "image=imageName&friendlyName=newFriendlyName HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -135,7 +135,7 @@ public class GridImageAsyncClientTest extends BaseGoGridAsyncClientTest<GridImag
|
|||
checkFilters(httpRequest);
|
||||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/edit?v=1.4&"
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/image/edit?v=1.5&"
|
||||
+ "image=imageName&friendlyName=newFriendlyName&"
|
||||
+ "sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
|
|
|
@ -43,7 +43,7 @@ public class GridIpAsyncClientTest extends BaseGoGridAsyncClientTest<GridIpAsync
|
|||
new GetIpListOptions().onlyUnassigned().onlyWithType(IpType.PUBLIC));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/ip/list?v=1.4&ip.state=Unassigned&"
|
||||
"GET https://api.gogrid.com/api/grid/ip/list?v=1.5&ip.state=Unassigned&"
|
||||
+ "ip.type=Public HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -56,7 +56,7 @@ public class GridIpAsyncClientTest extends BaseGoGridAsyncClientTest<GridIpAsync
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/ip/list?v=1.4&ip.state=Unassigned&"
|
||||
"GET https://api.gogrid.com/api/grid/ip/list?v=1.5&ip.state=Unassigned&"
|
||||
+ "ip.type=Public&sig=3f446f171455fbb5574aecff4997b273&api_key=foo "
|
||||
+ "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
|
@ -69,7 +69,7 @@ public class GridIpAsyncClientTest extends BaseGoGridAsyncClientTest<GridIpAsync
|
|||
GeneratedHttpRequest<GridIpAsyncClient> httpRequest = processor.createRequest(method);
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/ip/list?v=1.4&ip.state=Assigned HTTP/1.1");
|
||||
"GET https://api.gogrid.com/api/grid/ip/list?v=1.5&ip.state=Assigned HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class GridIpAsyncClientTest extends BaseGoGridAsyncClientTest<GridIpAsync
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/ip/list?v=1.4&ip.state=Assigned&"
|
||||
"GET https://api.gogrid.com/api/grid/ip/list?v=1.5&ip.state=Assigned&"
|
||||
+ "sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
|
|
@ -47,7 +47,7 @@ public class GridJobAsyncClientTest extends BaseGoGridAsyncClientTest<GridJobAsy
|
|||
ObjectType.VIRTUAL_SERVER).onlyForState(JobState.PROCESSING));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/job/list?v=1.4&startdate=1267385381770&"
|
||||
"GET https://api.gogrid.com/api/grid/job/list?v=1.5&startdate=1267385381770&"
|
||||
+ "enddate=1267385382770&job.objecttype=VirtualServer&"
|
||||
+ "job.state=Processing HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
|
@ -61,7 +61,7 @@ public class GridJobAsyncClientTest extends BaseGoGridAsyncClientTest<GridJobAsy
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/job/list?v=1.4&startdate=1267385381770&"
|
||||
"GET https://api.gogrid.com/api/grid/job/list?v=1.5&startdate=1267385381770&"
|
||||
+ "enddate=1267385382770&job.objecttype=VirtualServer&"
|
||||
+ "job.state=Processing&"
|
||||
+ "sig=3f446f171455fbb5574aecff4997b273&api_key=foo HTTP/1.1");
|
||||
|
@ -75,7 +75,7 @@ public class GridJobAsyncClientTest extends BaseGoGridAsyncClientTest<GridJobAsy
|
|||
GeneratedHttpRequest<GridJobAsyncClient> httpRequest = processor.createRequest(method);
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/job/list?v=1.4 HTTP/1.1");
|
||||
"GET https://api.gogrid.com/api/grid/job/list?v=1.5 HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class GridJobAsyncClientTest extends BaseGoGridAsyncClientTest<GridJobAsy
|
|||
GeneratedHttpRequest<GridJobAsyncClient> httpRequest = processor.createRequest(method,
|
||||
"MyServer");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/job/list?v=1.4&"
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/job/list?v=1.5&"
|
||||
+ "object=MyServer HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -98,7 +98,7 @@ public class GridJobAsyncClientTest extends BaseGoGridAsyncClientTest<GridJobAsy
|
|||
checkFilters(httpRequest);
|
||||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/job/list?v=1.4&"
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/job/list?v=1.5&"
|
||||
+ "object=MyServer&sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -110,7 +110,7 @@ public class GridJobAsyncClientTest extends BaseGoGridAsyncClientTest<GridJobAsy
|
|||
GeneratedHttpRequest<GridJobAsyncClient> httpRequest = processor.createRequest(method, 123L,
|
||||
456L);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/job/get?v=1.4&"
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/job/get?v=1.5&"
|
||||
+ "id=123&id=456 HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -122,7 +122,7 @@ public class GridJobAsyncClientTest extends BaseGoGridAsyncClientTest<GridJobAsy
|
|||
checkFilters(httpRequest);
|
||||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/job/get?v=1.4&"
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/job/get?v=1.5&"
|
||||
+ "id=123&id=456&sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
|
|
@ -50,7 +50,7 @@ public class GridLoadBalancerAsyncClientTest extends
|
|||
.createRequest(method);
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/loadbalancer/list?v=1.4 HTTP/1.1");
|
||||
"GET https://api.gogrid.com/api/grid/loadbalancer/list?v=1.5 HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class GridLoadBalancerAsyncClientTest extends
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/loadbalancer/list?v=1.4&"
|
||||
"GET https://api.gogrid.com/api/grid/loadbalancer/list?v=1.5&"
|
||||
+ "sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -80,7 +80,7 @@ public class GridLoadBalancerAsyncClientTest extends
|
|||
LoadBalancerType.LEAST_CONNECTED, LoadBalancerPersistenceType.SSL_STICKY));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/loadbalancer/"
|
||||
+ "add?v=1.4&name=BalanceIt&loadbalancer.type=Least%20Connect&"
|
||||
+ "add?v=1.5&name=BalanceIt&loadbalancer.type=Least%20Connect&"
|
||||
+ "loadbalancer.persistence=SSL%20Sticky&realiplist.0.ip=127.0.0.1&"
|
||||
+ "realiplist.0.port=8080&realiplist.1.ip=127.0.0.1&realiplist.1.port=9090&"
|
||||
+ "virtualip.ip=127.0.0.1&virtualip.port=80 HTTP/1.1");
|
||||
|
@ -95,7 +95,7 @@ public class GridLoadBalancerAsyncClientTest extends
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/loadbalancer/"
|
||||
+ "add?v=1.4&name=BalanceIt&loadbalancer.type=Least%20Connect&"
|
||||
+ "add?v=1.5&name=BalanceIt&loadbalancer.type=Least%20Connect&"
|
||||
+ "loadbalancer.persistence=SSL%20Sticky&realiplist.0.ip=127.0.0.1&"
|
||||
+ "realiplist.0.port=8080&realiplist.1.ip=127.0.0.1&realiplist.1.port=9090&"
|
||||
+ "virtualip.ip=127.0.0.1&virtualip.port=80&"
|
||||
|
@ -114,7 +114,7 @@ public class GridLoadBalancerAsyncClientTest extends
|
|||
|
||||
assertRequestLineEquals(
|
||||
httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/loadbalancer/edit?v=1.4&id=1&realiplist.0.ip=127.0.0.1&realiplist.0.port=8080&realiplist.1.ip=127.0.0.1&realiplist.1.port=9090 HTTP/1.1");
|
||||
"GET https://api.gogrid.com/api/grid/loadbalancer/edit?v=1.5&id=1&realiplist.0.ip=127.0.0.1&realiplist.0.port=8080&realiplist.1.ip=127.0.0.1&realiplist.1.port=9090 HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class GridLoadBalancerAsyncClientTest extends
|
|||
|
||||
assertRequestLineEquals(
|
||||
httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/loadbalancer/edit?v=1.4&id=1&realiplist.0.ip=127.0.0.1&realiplist.0.port=8080&realiplist.1.ip=127.0.0.1&realiplist.1.port=9090&sig=3f446f171455fbb5574aecff4997b273&api_key=foo HTTP/1.1");
|
||||
"GET https://api.gogrid.com/api/grid/loadbalancer/edit?v=1.5&id=1&realiplist.0.ip=127.0.0.1&realiplist.0.port=8080&realiplist.1.ip=127.0.0.1&realiplist.1.port=9090&sig=3f446f171455fbb5574aecff4997b273&api_key=foo HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ public class GridLoadBalancerAsyncClientTest extends
|
|||
new IpPortPair(new Ip("127.0.0.1"), 9090)));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/loadbalancer/"
|
||||
+ "edit?v=1.4&name=BalanceIt&realiplist.0.ip=127.0.0.1&"
|
||||
+ "edit?v=1.5&name=BalanceIt&realiplist.0.ip=127.0.0.1&"
|
||||
+ "realiplist.0.port=8080&realiplist.1.ip=127.0.0.1&realiplist.1.port=9090 HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -155,7 +155,7 @@ public class GridLoadBalancerAsyncClientTest extends
|
|||
|
||||
assertRequestLineEquals(
|
||||
httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/loadbalancer/edit?v=1.4&name=BalanceIt&realiplist.0.ip=127.0.0.1&realiplist.0.port=8080&realiplist.1.ip=127.0.0.1&realiplist.1.port=9090&sig=3f446f171455fbb5574aecff4997b273&api_key=foo HTTP/1.1");
|
||||
"GET https://api.gogrid.com/api/grid/loadbalancer/edit?v=1.5&name=BalanceIt&realiplist.0.ip=127.0.0.1&realiplist.0.port=8080&realiplist.1.ip=127.0.0.1&realiplist.1.port=9090&sig=3f446f171455fbb5574aecff4997b273&api_key=foo HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ public class GridLoadBalancerAsyncClientTest extends
|
|||
method, "My Load Balancer", "My Load Balancer 2");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/loadbalancer/"
|
||||
+ "get?v=1.4&name=My%20Load%20Balancer&name=My%20Load%20Balancer%202 HTTP/1.1");
|
||||
+ "get?v=1.5&name=My%20Load%20Balancer&name=My%20Load%20Balancer%202 HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
||||
|
@ -181,7 +181,7 @@ public class GridLoadBalancerAsyncClientTest extends
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/loadbalancer/"
|
||||
+ "get?v=1.4&name=My%20Load%20Balancer&name=My%20Load%20Balancer%202&"
|
||||
+ "get?v=1.5&name=My%20Load%20Balancer&name=My%20Load%20Balancer%202&"
|
||||
+ "sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -194,7 +194,7 @@ public class GridLoadBalancerAsyncClientTest extends
|
|||
method, 55L);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/loadbalancer/"
|
||||
+ "delete?v=1.4&id=55 HTTP/1.1");
|
||||
+ "delete?v=1.5&id=55 HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
||||
|
@ -206,7 +206,7 @@ public class GridLoadBalancerAsyncClientTest extends
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/loadbalancer/"
|
||||
+ "delete?v=1.4&id=55&" + "sig=3f446f171455fbb5574aecff4997b273&api_key=foo "
|
||||
+ "delete?v=1.5&id=55&" + "sig=3f446f171455fbb5574aecff4997b273&api_key=foo "
|
||||
+ "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
|
|
@ -73,7 +73,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
GeneratedHttpRequest<GridServerAsyncClient> httpRequest = processor.createRequest(method);
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/server/list?v=1.4 HTTP/1.1");
|
||||
"GET https://api.gogrid.com/api/grid/server/list?v=1.5 HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/server/list?"
|
||||
+ "v=1.4&sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
+ "v=1.5&sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
new GetServerListOptions.Builder().onlySandboxServers());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/server/list?v=1.4&isSandbox=true HTTP/1.1");
|
||||
"GET https://api.gogrid.com/api/grid/server/list?v=1.5&isSandbox=true HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/server/list?"
|
||||
+ "v=1.4&isSandbox=true&sig=3f446f171455fbb5574aecff4997b273&api_key=foo "
|
||||
+ "v=1.5&isSandbox=true&sig=3f446f171455fbb5574aecff4997b273&api_key=foo "
|
||||
+ "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -123,7 +123,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
"server1");
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/server/get?v=1.4&name=server1 HTTP/1.1");
|
||||
"GET https://api.gogrid.com/api/grid/server/get?v=1.5&name=server1 HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/server/get?"
|
||||
+ "v=1.4&name=server1&" + "sig=3f446f171455fbb5574aecff4997b273&api_key=foo "
|
||||
+ "v=1.5&name=server1&" + "sig=3f446f171455fbb5574aecff4997b273&api_key=foo "
|
||||
+ "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -148,7 +148,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
123L);
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/server/get?v=1.4&id=123 HTTP/1.1");
|
||||
"GET https://api.gogrid.com/api/grid/server/get?v=1.5&id=123 HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
||||
|
@ -160,7 +160,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/server/get?"
|
||||
+ "v=1.4&id=123&" + "sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
+ "v=1.5&id=123&" + "sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
GeneratedHttpRequest<GridServerAsyncClient> httpRequest = processor.createRequest(method,
|
||||
"serverName", "img55", "memory", "127.0.0.1");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/server/add?v=1.4&"
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/server/add?v=1.5&"
|
||||
+ "name=serverName&server.ram=memory&image=img55&ip=127.0.0.1 " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -185,7 +185,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/server/add?"
|
||||
+ "v=1.4&name=serverName&server.ram=memory&" + "image=img55&ip=127.0.0.1&"
|
||||
+ "v=1.5&name=serverName&server.ram=memory&" + "image=img55&ip=127.0.0.1&"
|
||||
+ "sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -201,7 +201,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
|
||||
assertRequestLineEquals(
|
||||
httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/server/add?v=1.4&name=serverName&server.ram=memory&image=img55&ip=127.0.0.1&isSandbox=true&description=fooy HTTP/1.1");
|
||||
"GET https://api.gogrid.com/api/grid/server/add?v=1.5&name=serverName&server.ram=memory&image=img55&ip=127.0.0.1&isSandbox=true&description=fooy HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
||||
|
@ -214,7 +214,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
|
||||
assertRequestLineEquals(
|
||||
httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/server/add?v=1.4&name=serverName&server.ram=memory&image=img55&ip=127.0.0.1&isSandbox=true&description=fooy&sig=3f446f171455fbb5574aecff4997b273&api_key=foo HTTP/1.1");
|
||||
"GET https://api.gogrid.com/api/grid/server/add?v=1.5&name=serverName&server.ram=memory&image=img55&ip=127.0.0.1&isSandbox=true&description=fooy&sig=3f446f171455fbb5574aecff4997b273&api_key=foo HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
"PowerServer", PowerCommand.RESTART);
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/server/power?v=1.4&"
|
||||
"GET https://api.gogrid.com/api/grid/server/power?v=1.5&"
|
||||
+ "server=PowerServer&power=restart " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -240,7 +240,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/server/power?v=1.4&"
|
||||
"GET https://api.gogrid.com/api/grid/server/power?v=1.5&"
|
||||
+ "server=PowerServer&power=restart&"
|
||||
+ "sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
|
@ -254,7 +254,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
"PowerServer");
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/server/delete?v=1.4&" + "name=PowerServer "
|
||||
"GET https://api.gogrid.com/api/grid/server/delete?v=1.5&" + "name=PowerServer "
|
||||
+ "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -267,7 +267,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/grid/server/delete?v=1.4&" + "name=PowerServer&"
|
||||
"GET https://api.gogrid.com/api/grid/server/delete?v=1.5&" + "name=PowerServer&"
|
||||
+ "sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -279,7 +279,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
GeneratedHttpRequest<GridServerAsyncClient> httpRequest = processor.createRequest(method);
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/common/lookup/list?v=1.4&lookup=server.ram "
|
||||
"GET https://api.gogrid.com/api/common/lookup/list?v=1.5&lookup=server.ram "
|
||||
+ "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
@ -292,7 +292,7 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest<GridSer
|
|||
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.gogrid.com/api/common/lookup/list?v=1.4&lookup=server.ram&"
|
||||
"GET https://api.gogrid.com/api/common/lookup/list?v=1.5&lookup=server.ram&"
|
||||
+ "sig=3f446f171455fbb5574aecff4997b273&api_key=foo " + "HTTP/1.1");
|
||||
assertHeadersEqual(httpRequest, "");
|
||||
assertPayloadEquals(httpRequest, null);
|
||||
|
|
|
@ -1,10 +1,21 @@
|
|||
{
|
||||
"list": [
|
||||
{
|
||||
"datacenter": {
|
||||
"description": "US West 1 Datacenter",
|
||||
"id": 1,
|
||||
"name": "US-West-1",
|
||||
"object": "option"
|
||||
},
|
||||
"object": "loadbalancer",
|
||||
"virtualip": {
|
||||
"object": "ipportpair",
|
||||
"ip": {
|
||||
"ip": {"datacenter": {
|
||||
"description": "US West 1 Datacenter",
|
||||
"id": 1,
|
||||
"name": "US-West-1",
|
||||
"object": "option"
|
||||
},
|
||||
"object": "ip",
|
||||
"public": true,
|
||||
"subnet": "204.51.240.176/255.255.255.240",
|
||||
|
@ -41,6 +52,12 @@
|
|||
"realiplist": [
|
||||
{
|
||||
"ip": {
|
||||
"datacenter": {
|
||||
"description": "US West 1 Datacenter",
|
||||
"id": 1,
|
||||
"name": "US-West-1",
|
||||
"object": "option"
|
||||
},
|
||||
"object": "ip",
|
||||
"public": true,
|
||||
"subnet": "204.51.240.176/255.255.255.240",
|
||||
|
@ -57,6 +74,12 @@
|
|||
},
|
||||
{
|
||||
"ip": {
|
||||
"datacenter": {
|
||||
"description": "US West 1 Datacenter",
|
||||
"id": 1,
|
||||
"name": "US-West-1",
|
||||
"object": "option"
|
||||
},
|
||||
"object": "ip",
|
||||
"public": true,
|
||||
"subnet": "204.51.240.176/255.255.255.240",
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
{
|
||||
"list": [
|
||||
{
|
||||
"datacenter": {
|
||||
"description": "US West 1 Datacenter",
|
||||
"id": 1,
|
||||
"name": "US-West-1",
|
||||
"object": "option"
|
||||
},
|
||||
"object": "server",
|
||||
"isSandbox": false,
|
||||
"type": {
|
||||
|
@ -78,6 +84,12 @@
|
|||
},
|
||||
"name": "PowerServer",
|
||||
"ip": {
|
||||
"datacenter": {
|
||||
"description": "US West 1 Datacenter",
|
||||
"id": 1,
|
||||
"name": "US-West-1",
|
||||
"object": "option"
|
||||
},
|
||||
"object": "ip",
|
||||
"public": true,
|
||||
"subnet": "204.51.240.176/255.255.255.240",
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ComputeTaskUtils {
|
|||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public ComputeServiceContext apply(URI from) {
|
||||
Properties props = getPropertiesFromResource("compute.properties");
|
||||
Properties props = getPropertiesFromResource("/rest.properties");
|
||||
props.putAll(projectProvider.get().getProperties());
|
||||
// adding the properties to the factory will allow us to pass alternate endpoints
|
||||
String provider = from.getHost();
|
||||
|
|
Loading…
Reference in New Issue