mirror of https://github.com/apache/jclouds.git
merged master
This commit is contained in:
commit
a898999355
|
@ -24,7 +24,7 @@ our compute api supports: aws-ec2, gogrid, cloudservers-us, stub (in-memory), de
|
|||
greenhousedata-element-vcloud, softlayer, cloudsigma (generic),
|
||||
cloudstack (generic), ninefold-compute, openstack-nov (keystone),
|
||||
hpcloud-compute, trystack-nova, openstack-nova-ec2,
|
||||
rackspace-cloudservers-us (next gen)
|
||||
rackspace-cloudservers-us (next gen), rackspace-cloudservers-uk (next gen)
|
||||
|
||||
* note * the pom dependency org.jclouds/jclouds-allcompute gives you access to
|
||||
to all of these providers
|
||||
|
|
|
@ -393,7 +393,7 @@ public class SSHJava extends Java {
|
|||
}
|
||||
|
||||
/**
|
||||
* All files transfered to the host will be relative to this. The java process itself will be at
|
||||
* All files transferred to the host will be relative to this. The java process itself will be at
|
||||
* this path/{@code id}.
|
||||
*/
|
||||
public void setRemotebase(File remotebase) {
|
||||
|
|
|
@ -227,7 +227,7 @@ public class SSHExecute {
|
|||
}
|
||||
|
||||
/**
|
||||
* Open an ssh seession.
|
||||
* Open an ssh session.
|
||||
*
|
||||
* @return the opened session
|
||||
* @throws JSchException
|
||||
|
|
|
@ -167,7 +167,7 @@ public class LoadBalancer extends BaseLoadBalancer<Node, LoadBalancer> {
|
|||
* configuration change or update, the status of the load balancer will change to PENDING_UPDATE
|
||||
* to signify configuration changes are in progress but have not yet been finalized. Load
|
||||
* balancers in a SUSPENDED status are configured to reject traffic and will not forward requests
|
||||
* to back-end nodess.
|
||||
* to back-end nodes.
|
||||
*/
|
||||
public static enum Status {
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -18,30 +18,109 @@
|
|||
*/
|
||||
package org.jclouds.cloudservers.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
/**
|
||||
* Class AbsoluteLimit
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
*/
|
||||
public class AbsoluteLimit {
|
||||
|
||||
protected String name;
|
||||
protected int value;
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromAbsoluteLimit(this);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
protected abstract T self();
|
||||
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
protected String name;
|
||||
protected int value;
|
||||
|
||||
/**
|
||||
* @see AbsoluteLimit#getName()
|
||||
*/
|
||||
public T name(String name) {
|
||||
this.name = name;
|
||||
return self();
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* @see AbsoluteLimit#getValue()
|
||||
*/
|
||||
public T value(int value) {
|
||||
this.value = value;
|
||||
return self();
|
||||
}
|
||||
|
||||
public void setValue(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
public AbsoluteLimit build() {
|
||||
return new AbsoluteLimit(name, value);
|
||||
}
|
||||
|
||||
public T fromAbsoluteLimit(AbsoluteLimit in) {
|
||||
return this
|
||||
.name(in.getName())
|
||||
.value(in.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private final String name;
|
||||
private final int value;
|
||||
|
||||
@ConstructorProperties({
|
||||
"name", "value"
|
||||
})
|
||||
protected AbsoluteLimit(String name, int value) {
|
||||
this.name = checkNotNull(name, "name");
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
AbsoluteLimit that = AbsoluteLimit.class.cast(obj);
|
||||
return Objects.equal(this.name, that.name)
|
||||
&& Objects.equal(this.value, that.value);
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper(this)
|
||||
.add("name", name).add("value", value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -18,81 +18,128 @@
|
|||
*/
|
||||
package org.jclouds.cloudservers.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Class Addresses
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
*/
|
||||
public class Addresses {
|
||||
|
||||
@SerializedName("public")
|
||||
private Set<String> publicAddresses = Sets.newLinkedHashSet();
|
||||
@SerializedName("private")
|
||||
private Set<String> privateAddresses = Sets.newLinkedHashSet();
|
||||
|
||||
public Addresses() {
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromAddresses(this);
|
||||
}
|
||||
|
||||
public Addresses(Set<String> publicAddresses, Set<String> privateAddresses) {
|
||||
this.publicAddresses = publicAddresses;
|
||||
this.privateAddresses = privateAddresses;
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
protected abstract T self();
|
||||
|
||||
protected Set<String> publicAddresses;
|
||||
protected Set<String> privateAddresses;
|
||||
|
||||
/**
|
||||
* @see Addresses#getPublicAddresses()
|
||||
*/
|
||||
public T publicAddresses(Collection<String> publicAddresses) {
|
||||
this.publicAddresses = ImmutableSet.copyOf(checkNotNull(publicAddresses, "publicAddresses"));
|
||||
return self();
|
||||
}
|
||||
|
||||
public T publicAddresses(String... in) {
|
||||
return publicAddresses(ImmutableSet.copyOf(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Addresses#getPrivateAddresses()
|
||||
*/
|
||||
public T privateAddresses(Collection<String> privateAddresses) {
|
||||
this.privateAddresses = ImmutableSet.copyOf(checkNotNull(privateAddresses, "privateAddresses"));
|
||||
return self();
|
||||
}
|
||||
|
||||
public T privateAddresses(String... in) {
|
||||
return privateAddresses(ImmutableSet.copyOf(in));
|
||||
}
|
||||
|
||||
public Addresses build() {
|
||||
return new Addresses(publicAddresses, privateAddresses);
|
||||
}
|
||||
|
||||
public T fromAddresses(Addresses in) {
|
||||
return this
|
||||
.publicAddresses(in.getPublicAddresses())
|
||||
.privateAddresses(in.getPrivateAddresses());
|
||||
}
|
||||
}
|
||||
|
||||
public void setPublicAddresses(Set<String> publicAddresses) {
|
||||
this.publicAddresses = publicAddresses;
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@Named("public")
|
||||
private final Set<String> publicAddresses;
|
||||
@Named("private")
|
||||
private final Set<String> privateAddresses;
|
||||
|
||||
@ConstructorProperties({
|
||||
"public", "private"
|
||||
})
|
||||
protected Addresses(@Nullable Set<String> publicAddresses, @Nullable Set<String> privateAddresses) {
|
||||
this.publicAddresses = publicAddresses == null ? null : ImmutableSet.copyOf(publicAddresses);
|
||||
this.privateAddresses = privateAddresses == null ? null : ImmutableSet.copyOf(privateAddresses);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Set<String> getPublicAddresses() {
|
||||
return publicAddresses;
|
||||
}
|
||||
|
||||
public void setPrivateAddresses(Set<String> privateAddresses) {
|
||||
this.privateAddresses = privateAddresses;
|
||||
return this.publicAddresses;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Set<String> getPrivateAddresses() {
|
||||
return privateAddresses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Addresses [privateAddresses=" + privateAddresses + ", publicAddresses="
|
||||
+ publicAddresses + "]";
|
||||
return this.privateAddresses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((privateAddresses == null) ? 0 : privateAddresses.hashCode());
|
||||
result = prime * result + ((publicAddresses == null) ? 0 : publicAddresses.hashCode());
|
||||
return result;
|
||||
return Objects.hashCode(publicAddresses, privateAddresses);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Addresses other = (Addresses) obj;
|
||||
if (privateAddresses == null) {
|
||||
if (other.privateAddresses != null)
|
||||
return false;
|
||||
} else if (!privateAddresses.equals(other.privateAddresses))
|
||||
return false;
|
||||
if (publicAddresses == null) {
|
||||
if (other.publicAddresses != null)
|
||||
return false;
|
||||
} else if (!publicAddresses.equals(other.publicAddresses))
|
||||
return false;
|
||||
return true;
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
Addresses that = Addresses.class.cast(obj);
|
||||
return Objects.equal(this.publicAddresses, that.publicAddresses)
|
||||
&& Objects.equal(this.privateAddresses, that.privateAddresses);
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper(this)
|
||||
.add("publicAddresses", publicAddresses).add("privateAddresses", privateAddresses);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -18,87 +18,131 @@
|
|||
*/
|
||||
package org.jclouds.cloudservers.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
/**
|
||||
* A backup schedule can be defined to create server images at regular intervals (daily and weekly).
|
||||
* Backup schedules are configurable per server.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
*/
|
||||
public class BackupSchedule {
|
||||
protected DailyBackup daily = DailyBackup.DISABLED;
|
||||
protected boolean enabled;
|
||||
protected WeeklyBackup weekly = WeeklyBackup.DISABLED;
|
||||
|
||||
public BackupSchedule() {
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromBackupSchedule(this);
|
||||
}
|
||||
|
||||
public BackupSchedule(WeeklyBackup weekly, DailyBackup daily, boolean enabled) {
|
||||
this.weekly = weekly;
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
protected abstract T self();
|
||||
|
||||
protected DailyBackup daily;
|
||||
protected boolean enabled;
|
||||
protected WeeklyBackup weekly;
|
||||
|
||||
/**
|
||||
* @see BackupSchedule#getDaily()
|
||||
*/
|
||||
public T daily(DailyBackup daily) {
|
||||
this.daily = daily;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BackupSchedule#isEnabled()
|
||||
*/
|
||||
public T enabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BackupSchedule#getWeekly()
|
||||
*/
|
||||
public T weekly(WeeklyBackup weekly) {
|
||||
this.weekly = weekly;
|
||||
return self();
|
||||
}
|
||||
|
||||
public BackupSchedule build() {
|
||||
return new BackupSchedule(daily, enabled, weekly);
|
||||
}
|
||||
|
||||
public T fromBackupSchedule(BackupSchedule in) {
|
||||
return this
|
||||
.daily(in.getDaily())
|
||||
.enabled(in.isEnabled())
|
||||
.weekly(in.getWeekly());
|
||||
}
|
||||
}
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private final DailyBackup daily;
|
||||
private final boolean enabled;
|
||||
private final WeeklyBackup weekly;
|
||||
|
||||
@ConstructorProperties({
|
||||
"daily", "enabled", "weekly"
|
||||
})
|
||||
protected BackupSchedule(@Nullable DailyBackup daily, boolean enabled, @Nullable WeeklyBackup weekly) {
|
||||
this.daily = daily;
|
||||
this.enabled = enabled;
|
||||
this.weekly = weekly;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public DailyBackup getDaily() {
|
||||
return daily;
|
||||
}
|
||||
|
||||
public void setDaily(DailyBackup value) {
|
||||
this.daily = value;
|
||||
return this.daily;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean value) {
|
||||
this.enabled = value;
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public WeeklyBackup getWeekly() {
|
||||
return weekly;
|
||||
}
|
||||
|
||||
public void setWeekly(WeeklyBackup value) {
|
||||
this.weekly = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[daily=" + daily + ", enabled=" + enabled + ", weekly=" + weekly + "]";
|
||||
return this.weekly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((daily == null) ? 0 : daily.hashCode());
|
||||
result = prime * result + (enabled ? 1231 : 1237);
|
||||
result = prime * result + ((weekly == null) ? 0 : weekly.hashCode());
|
||||
return result;
|
||||
return Objects.hashCode(daily, enabled, weekly);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
BackupSchedule other = (BackupSchedule) obj;
|
||||
if (daily == null) {
|
||||
if (other.daily != null)
|
||||
return false;
|
||||
} else if (!daily.equals(other.daily))
|
||||
return false;
|
||||
if (enabled != other.enabled)
|
||||
return false;
|
||||
if (weekly == null) {
|
||||
if (other.weekly != null)
|
||||
return false;
|
||||
} else if (!weekly.equals(other.weekly))
|
||||
return false;
|
||||
return true;
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
BackupSchedule that = BackupSchedule.class.cast(obj);
|
||||
return Objects.equal(this.daily, that.daily)
|
||||
&& Objects.equal(this.enabled, that.enabled)
|
||||
&& Objects.equal(this.weekly, that.weekly);
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper(this)
|
||||
.add("daily", daily).add("enabled", enabled).add("weekly", weekly);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -18,103 +18,148 @@
|
|||
*/
|
||||
package org.jclouds.cloudservers.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* A flavor is an available hardware configuration for a server. Each flavor has a unique
|
||||
* combination of disk space and memory capacity.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
*/
|
||||
public class Flavor {
|
||||
|
||||
public Flavor() {
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromFlavor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Flavor [disk=" + disk + ", id=" + id + ", name=" + name + ", ram=" + ram + "]";
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
protected abstract T self();
|
||||
|
||||
protected int id;
|
||||
protected String name;
|
||||
protected Integer disk;
|
||||
protected Integer ram;
|
||||
|
||||
/**
|
||||
* @see Flavor#getId()
|
||||
*/
|
||||
public T id(int id) {
|
||||
this.id = id;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Flavor#getName()
|
||||
*/
|
||||
public T name(String name) {
|
||||
this.name = name;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Flavor#getDisk()
|
||||
*/
|
||||
public T disk(Integer disk) {
|
||||
this.disk = disk;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Flavor#getRam()
|
||||
*/
|
||||
public T ram(Integer ram) {
|
||||
this.ram = ram;
|
||||
return self();
|
||||
}
|
||||
|
||||
public Flavor build() {
|
||||
return new Flavor(id, name, disk, ram);
|
||||
}
|
||||
|
||||
public T fromFlavor(Flavor in) {
|
||||
return this
|
||||
.id(in.getId())
|
||||
.name(in.getName())
|
||||
.disk(in.getDisk())
|
||||
.ram(in.getRam());
|
||||
}
|
||||
}
|
||||
|
||||
public Flavor(int id, String name) {
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private final int id;
|
||||
private final String name;
|
||||
private final Integer disk;
|
||||
private final Integer ram;
|
||||
|
||||
@ConstructorProperties({
|
||||
"id", "name", "disk", "ram"
|
||||
})
|
||||
protected Flavor(int id, String name, @Nullable Integer disk, @Nullable Integer ram) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private Integer disk;
|
||||
private Integer ram;
|
||||
|
||||
public Integer getDisk() {
|
||||
return disk;
|
||||
}
|
||||
|
||||
public void setDisk(Integer value) {
|
||||
this.disk = value;
|
||||
this.name = checkNotNull(name, "name");
|
||||
this.disk = disk;
|
||||
this.ram = ram;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int value) {
|
||||
this.id = value;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
@Nullable
|
||||
public Integer getDisk() {
|
||||
return this.disk;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getRam() {
|
||||
return ram;
|
||||
}
|
||||
|
||||
public void setRam(Integer value) {
|
||||
this.ram = value;
|
||||
return this.ram;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((disk == null) ? 0 : disk.hashCode());
|
||||
result = prime * result + id;
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((ram == null) ? 0 : ram.hashCode());
|
||||
return result;
|
||||
return Objects.hashCode(id, name, disk, ram);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Flavor other = (Flavor) obj;
|
||||
if (disk == null) {
|
||||
if (other.disk != null)
|
||||
return false;
|
||||
} else if (!disk.equals(other.disk))
|
||||
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 (ram == null) {
|
||||
if (other.ram != null)
|
||||
return false;
|
||||
} else if (!ram.equals(other.ram))
|
||||
return false;
|
||||
return true;
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
Flavor that = Flavor.class.cast(obj);
|
||||
return Objects.equal(this.id, that.id)
|
||||
&& Objects.equal(this.name, that.name)
|
||||
&& Objects.equal(this.disk, that.disk)
|
||||
&& Objects.equal(this.ram, that.ram);
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper(this)
|
||||
.add("id", id).add("name", name).add("disk", disk).add("ram", ram);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -18,8 +18,16 @@
|
|||
*/
|
||||
package org.jclouds.cloudservers.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Date;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
/**
|
||||
* An image is a collection of files used to create or rebuild a server. Rackspace provides a number
|
||||
* of pre-built OS images by default. You may also create custom images from cloud servers you have
|
||||
|
@ -27,119 +35,188 @@ import java.util.Date;
|
|||
* if you plan to deploy a particular server configuration frequently.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
*/
|
||||
public class Image {
|
||||
|
||||
private Date created;
|
||||
private int id;
|
||||
private String name;
|
||||
private Integer progress;
|
||||
private Integer serverId;
|
||||
private ImageStatus status;
|
||||
private Date updated;
|
||||
|
||||
public Image() {
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromImage(this);
|
||||
}
|
||||
|
||||
public Image(int id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
protected abstract T self();
|
||||
|
||||
protected Date created;
|
||||
protected int id;
|
||||
protected String name;
|
||||
protected Integer progress;
|
||||
protected Integer serverId;
|
||||
protected ImageStatus status;
|
||||
protected Date updated;
|
||||
|
||||
/**
|
||||
* @see Image#getCreated()
|
||||
*/
|
||||
public T created(Date created) {
|
||||
this.created = created;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Image#getId()
|
||||
*/
|
||||
public T id(int id) {
|
||||
this.id = id;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Image#getName()
|
||||
*/
|
||||
public T name(String name) {
|
||||
this.name = name;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Image#getProgress()
|
||||
*/
|
||||
public T progress(Integer progress) {
|
||||
this.progress = progress;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Image#getServerId()
|
||||
*/
|
||||
public T serverId(Integer serverId) {
|
||||
this.serverId = serverId;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Image#getStatus()
|
||||
*/
|
||||
public T status(ImageStatus status) {
|
||||
this.status = status;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Image#getUpdated()
|
||||
*/
|
||||
public T updated(Date updated) {
|
||||
this.updated = updated;
|
||||
return self();
|
||||
}
|
||||
|
||||
public Image build() {
|
||||
return new Image(created, id, name, progress, serverId, status, updated);
|
||||
}
|
||||
|
||||
public T fromImage(Image in) {
|
||||
return this
|
||||
.created(in.getCreated())
|
||||
.id(in.getId())
|
||||
.name(in.getName())
|
||||
.progress(in.getProgress())
|
||||
.serverId(in.getServerId())
|
||||
.status(in.getStatus())
|
||||
.updated(in.getUpdated());
|
||||
}
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private final Date created;
|
||||
private final int id;
|
||||
private final String name;
|
||||
private final Integer progress;
|
||||
private final Integer serverId;
|
||||
private final ImageStatus status;
|
||||
private final Date updated;
|
||||
|
||||
@ConstructorProperties({
|
||||
"created", "id", "name", "progress", "serverId", "status", "updated"
|
||||
})
|
||||
protected Image(@Nullable Date created, int id, String name, @Nullable Integer progress, @Nullable Integer serverId, @Nullable ImageStatus status, @Nullable Date updated) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setProgress(Integer progress) {
|
||||
this.name = checkNotNull(name, "name");
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
public Integer getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setServerId(Integer serverId) {
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
public Integer getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
|
||||
public void setStatus(ImageStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public ImageStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setUpdated(Date updated) {
|
||||
this.updated = updated;
|
||||
}
|
||||
|
||||
public Date getUpdated() {
|
||||
return updated;
|
||||
@Nullable
|
||||
public Date getCreated() {
|
||||
return this.created;
|
||||
}
|
||||
/**
|
||||
* note that this ignores the create time
|
||||
*/
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getProgress() {
|
||||
return this.progress;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getServerId() {
|
||||
return this.serverId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ImageStatus getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Date getUpdated() {
|
||||
return this.updated;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + id;
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((serverId == null) ? 0 : serverId.hashCode());
|
||||
return result;
|
||||
return Objects.hashCode(created, id, name, progress, serverId, status, updated);
|
||||
}
|
||||
|
||||
/**
|
||||
* note that this ignores the serverid and create time.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Image other = (Image) obj;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
return true;
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
Image that = Image.class.cast(obj);
|
||||
return Objects.equal(this.created, that.created)
|
||||
&& Objects.equal(this.id, that.id)
|
||||
&& Objects.equal(this.name, that.name)
|
||||
&& Objects.equal(this.progress, that.progress)
|
||||
&& Objects.equal(this.serverId, that.serverId)
|
||||
&& Objects.equal(this.status, that.status)
|
||||
&& Objects.equal(this.updated, that.updated);
|
||||
}
|
||||
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper(this)
|
||||
.add("created", created).add("id", id).add("name", name).add("progress", progress).add("serverId", serverId).add("status", status).add("updated", updated);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Image [created=" + created + ", id=" + id + ", name=" + name + ", serverId=" + serverId + ", status="
|
||||
+ status + "]";
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -18,59 +18,115 @@
|
|||
*/
|
||||
package org.jclouds.cloudservers.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Class Limits
|
||||
*/
|
||||
public class Limits {
|
||||
|
||||
private Set<RateLimit> rate = Sets.newLinkedHashSet();
|
||||
private Map<String, Integer> absolute = Maps.newLinkedHashMap();
|
||||
|
||||
public Set<RateLimit> getRate() {
|
||||
return rate;
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromLimits(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Limits [rate=" + rate + ", absolute=" + absolute + "]";
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
protected abstract T self();
|
||||
|
||||
protected Set<RateLimit> rate = ImmutableSet.of();
|
||||
protected Map<String, Integer> absolute = ImmutableMap.of();
|
||||
|
||||
/**
|
||||
* @see Limits#getRate()
|
||||
*/
|
||||
public T rate(Set<RateLimit> rate) {
|
||||
this.rate = ImmutableSet.copyOf(checkNotNull(rate, "rate"));
|
||||
return self();
|
||||
}
|
||||
|
||||
public T rate(RateLimit... in) {
|
||||
return rate(ImmutableSet.copyOf(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Limits#getAbsolute()
|
||||
*/
|
||||
public T absolute(Map<String, Integer> absolute) {
|
||||
this.absolute = ImmutableMap.copyOf(checkNotNull(absolute, "absolute"));
|
||||
return self();
|
||||
}
|
||||
|
||||
public Limits build() {
|
||||
return new Limits(rate, absolute);
|
||||
}
|
||||
|
||||
public T fromLimits(Limits in) {
|
||||
return this
|
||||
.rate(in.getRate())
|
||||
.absolute(in.getAbsolute());
|
||||
}
|
||||
}
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private final Set<RateLimit> rate;
|
||||
private final Map<String, Integer> absolute;
|
||||
|
||||
@ConstructorProperties({
|
||||
"rate", "absolute"
|
||||
})
|
||||
protected Limits(Set<RateLimit> rate, Map<String, Integer> absolute) {
|
||||
this.rate = ImmutableSet.copyOf(checkNotNull(rate, "rate"));
|
||||
this.absolute = ImmutableMap.copyOf(checkNotNull(absolute, "absolute"));
|
||||
}
|
||||
|
||||
public Set<RateLimit> getRate() {
|
||||
return this.rate;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getAbsolute() {
|
||||
return this.absolute;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((absolute == null) ? 0 : absolute.hashCode());
|
||||
result = prime * result + ((rate == null) ? 0 : rate.hashCode());
|
||||
return result;
|
||||
return Objects.hashCode(rate, absolute);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Limits other = (Limits) obj;
|
||||
if (absolute == null) {
|
||||
if (other.absolute != null)
|
||||
return false;
|
||||
} else if (!absolute.equals(other.absolute))
|
||||
return false;
|
||||
if (rate == null) {
|
||||
if (other.rate != null)
|
||||
return false;
|
||||
} else if (!rate.equals(other.rate))
|
||||
return false;
|
||||
return true;
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
Limits that = Limits.class.cast(obj);
|
||||
return Objects.equal(this.rate, that.rate)
|
||||
&& Objects.equal(this.absolute, that.absolute);
|
||||
}
|
||||
|
||||
public Map<String, Integer> getAbsolute() {
|
||||
return absolute;
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper(this)
|
||||
.add("rate", rate).add("absolute", absolute);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -18,8 +18,16 @@
|
|||
*/
|
||||
package org.jclouds.cloudservers.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* RateLimit.
|
||||
* <p/>
|
||||
* we specify rate limits in terms of both a human readable wild-card URI and a machine processable
|
||||
|
@ -34,73 +42,121 @@ package org.jclouds.cloudservers.domain;
|
|||
* will be returned with a Reply-After header to notify the client when theyagain.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
*/
|
||||
public class RateLimit {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((regex == null) ? 0 : regex.hashCode());
|
||||
result = prime * result + remaining;
|
||||
result = prime * result + (int) (resetTime ^ (resetTime >>> 32));
|
||||
result = prime * result + ((unit == null) ? 0 : unit.hashCode());
|
||||
result = prime * result + ((uri == null) ? 0 : uri.hashCode());
|
||||
result = prime * result + value;
|
||||
result = prime * result + ((verb == null) ? 0 : verb.hashCode());
|
||||
return result;
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromRateLimit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
RateLimit other = (RateLimit) obj;
|
||||
if (regex == null) {
|
||||
if (other.regex != null)
|
||||
return false;
|
||||
} else if (!regex.equals(other.regex))
|
||||
return false;
|
||||
if (remaining != other.remaining)
|
||||
return false;
|
||||
if (resetTime != other.resetTime)
|
||||
return false;
|
||||
if (unit != other.unit)
|
||||
return false;
|
||||
if (uri == null) {
|
||||
if (other.uri != null)
|
||||
return false;
|
||||
} else if (!uri.equals(other.uri))
|
||||
return false;
|
||||
if (value != other.value)
|
||||
return false;
|
||||
if (verb == null) {
|
||||
if (other.verb != null)
|
||||
return false;
|
||||
} else if (!verb.equals(other.verb))
|
||||
return false;
|
||||
return true;
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
protected abstract T self();
|
||||
|
||||
protected String uri;
|
||||
protected String regex;
|
||||
protected int remaining;
|
||||
protected long resetTime;
|
||||
protected RateLimitUnit unit;
|
||||
protected int value;
|
||||
protected String verb;
|
||||
|
||||
/**
|
||||
* @see RateLimit#getUri()
|
||||
*/
|
||||
public T uri(String uri) {
|
||||
this.uri = uri;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RateLimit#getRegex()
|
||||
*/
|
||||
public T regex(String regex) {
|
||||
this.regex = regex;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RateLimit#getRemaining()
|
||||
*/
|
||||
public T remaining(int remaining) {
|
||||
this.remaining = remaining;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RateLimit#getResetTime()
|
||||
*/
|
||||
public T resetTime(long resetTime) {
|
||||
this.resetTime = resetTime;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RateLimit#getUnit()
|
||||
*/
|
||||
public T unit(RateLimitUnit unit) {
|
||||
this.unit = unit;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RateLimit#getValue()
|
||||
*/
|
||||
public T value(int value) {
|
||||
this.value = value;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RateLimit#getVerb()
|
||||
*/
|
||||
public T verb(String verb) {
|
||||
this.verb = verb;
|
||||
return self();
|
||||
}
|
||||
|
||||
public RateLimit build() {
|
||||
return new RateLimit(uri, regex, remaining, resetTime, unit, value, verb);
|
||||
}
|
||||
|
||||
public T fromRateLimit(RateLimit in) {
|
||||
return this
|
||||
.uri(in.getUri())
|
||||
.regex(in.getRegex())
|
||||
.remaining(in.getRemaining())
|
||||
.resetTime(in.getResetTime())
|
||||
.unit(in.getUnit())
|
||||
.value(in.getValue())
|
||||
.verb(in.getVerb());
|
||||
}
|
||||
}
|
||||
|
||||
private String uri;
|
||||
private String regex;
|
||||
private int remaining;
|
||||
private long resetTime;
|
||||
private RateLimitUnit unit;
|
||||
private int value;
|
||||
private String verb;
|
||||
|
||||
// for deserializer
|
||||
public RateLimit() {
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public RateLimit(String uri, String regex, int remaining, long resetTime, RateLimitUnit unit, int value, String verb) {
|
||||
this.uri = uri;
|
||||
private final String uri;
|
||||
private final String regex;
|
||||
private final int remaining;
|
||||
private final long resetTime;
|
||||
private final RateLimitUnit unit;
|
||||
private final int value;
|
||||
private final String verb;
|
||||
|
||||
@ConstructorProperties({
|
||||
"uri", "regex", "remaining", "resetTime", "unit", "value", "verb"
|
||||
})
|
||||
protected RateLimit(String uri, @Nullable String regex, int remaining, long resetTime, @Nullable RateLimitUnit unit,
|
||||
int value, @Nullable String verb) {
|
||||
this.uri = checkNotNull(uri, "uri");
|
||||
this.regex = regex;
|
||||
this.remaining = remaining;
|
||||
this.resetTime = resetTime;
|
||||
|
@ -110,37 +166,63 @@ public class RateLimit {
|
|||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
return this.uri;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getRegex() {
|
||||
return regex;
|
||||
return this.regex;
|
||||
}
|
||||
|
||||
public int getRemaining() {
|
||||
return remaining;
|
||||
return this.remaining;
|
||||
}
|
||||
|
||||
public long getResetTime() {
|
||||
return resetTime;
|
||||
return this.resetTime;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RateLimitUnit getUnit() {
|
||||
return unit;
|
||||
return this.unit;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getVerb() {
|
||||
return verb;
|
||||
return this.verb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(uri, regex, remaining, resetTime, unit, value, verb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
RateLimit that = RateLimit.class.cast(obj);
|
||||
return Objects.equal(this.uri, that.uri)
|
||||
&& Objects.equal(this.regex, that.regex)
|
||||
&& Objects.equal(this.remaining, that.remaining)
|
||||
&& Objects.equal(this.resetTime, that.resetTime)
|
||||
&& Objects.equal(this.unit, that.unit)
|
||||
&& Objects.equal(this.value, that.value)
|
||||
&& Objects.equal(this.verb, that.verb);
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper(this)
|
||||
.add("uri", uri).add("regex", regex).add("remaining", remaining).add("resetTime", resetTime).add("unit", unit).add("value", value).add("verb", verb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[uri=" + uri + ", regex=" + regex + ", remaining=" + remaining + ", resetTime=" + resetTime + ", unit="
|
||||
+ unit + ", value=" + value + ", verb=" + verb + "]";
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -18,72 +18,220 @@
|
|||
*/
|
||||
package org.jclouds.cloudservers.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/**
|
||||
* A server is a virtual machine instance in the Cloud Servers system. Flavor and image are
|
||||
* requisite elements when creating a server.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
*/
|
||||
public class Server {
|
||||
private int id;
|
||||
private String name;
|
||||
private Map<String, String> metadata = Maps.newHashMap();
|
||||
private Addresses addresses;
|
||||
private String adminPass;
|
||||
private Integer flavorId;
|
||||
private String hostId;
|
||||
private Integer imageId;
|
||||
private Integer sharedIpGroupId;
|
||||
private Integer progress;
|
||||
private ServerStatus status;
|
||||
|
||||
public Server() {
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromServer(this);
|
||||
}
|
||||
|
||||
public Server(int id, String name) {
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
protected abstract T self();
|
||||
|
||||
protected int id;
|
||||
protected String name;
|
||||
protected Map<String, String> metadata;
|
||||
protected Addresses addresses;
|
||||
protected String adminPass;
|
||||
protected Integer flavorId;
|
||||
protected String hostId;
|
||||
protected Integer imageId;
|
||||
protected Integer sharedIpGroupId;
|
||||
protected Integer progress;
|
||||
protected ServerStatus status;
|
||||
|
||||
/**
|
||||
* @see Server#getId()
|
||||
*/
|
||||
public T id(int id) {
|
||||
this.id = id;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Server#getName()
|
||||
*/
|
||||
public T name(String name) {
|
||||
this.name = name;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Server#getMetadata()
|
||||
*/
|
||||
public T metadata(Map<String, String> metadata) {
|
||||
this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Server#getAddresses()
|
||||
*/
|
||||
public T addresses(Addresses addresses) {
|
||||
this.addresses = addresses;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Server#getAdminPass()
|
||||
*/
|
||||
public T adminPass(String adminPass) {
|
||||
this.adminPass = adminPass;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Server#getFlavorId()
|
||||
*/
|
||||
public T flavorId(Integer flavorId) {
|
||||
this.flavorId = flavorId;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Server#getHostId()
|
||||
*/
|
||||
public T hostId(String hostId) {
|
||||
this.hostId = hostId;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Server#getImageId()
|
||||
*/
|
||||
public T imageId(Integer imageId) {
|
||||
this.imageId = imageId;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Server#getSharedIpGroupId()
|
||||
*/
|
||||
public T sharedIpGroupId(Integer sharedIpGroupId) {
|
||||
this.sharedIpGroupId = sharedIpGroupId;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Server#getProgress()
|
||||
*/
|
||||
public T progress(Integer progress) {
|
||||
this.progress = progress;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Server#getStatus()
|
||||
*/
|
||||
public T status(ServerStatus status) {
|
||||
this.status = status;
|
||||
return self();
|
||||
}
|
||||
|
||||
public Server build() {
|
||||
return new Server(id, name, metadata, addresses, adminPass, flavorId, hostId, imageId, sharedIpGroupId, progress, status);
|
||||
}
|
||||
|
||||
public T fromServer(Server in) {
|
||||
return this
|
||||
.id(in.getId())
|
||||
.name(in.getName())
|
||||
.metadata(in.getMetadata())
|
||||
.addresses(in.getAddresses())
|
||||
.adminPass(in.getAdminPass())
|
||||
.flavorId(in.getFlavorId())
|
||||
.hostId(in.getHostId())
|
||||
.imageId(in.getImageId())
|
||||
.sharedIpGroupId(in.getSharedIpGroupId())
|
||||
.progress(in.getProgress())
|
||||
.status(in.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private final int id;
|
||||
private final String name;
|
||||
private final Map<String, String> metadata;
|
||||
private final Addresses addresses;
|
||||
private final String adminPass;
|
||||
private final Integer flavorId;
|
||||
private final String hostId;
|
||||
private final Integer imageId;
|
||||
private final Integer sharedIpGroupId;
|
||||
private final Integer progress;
|
||||
private final ServerStatus status;
|
||||
|
||||
@ConstructorProperties({
|
||||
"id", "name", "metadata", "addresses", "adminPass", "flavorId", "hostId", "imageId", "sharedIpGroupId", "progress", "status"
|
||||
})
|
||||
protected Server(int id, String name, @Nullable Map<String, String> metadata, @Nullable Addresses addresses,
|
||||
@Nullable String adminPass, @Nullable Integer flavorId, @Nullable String hostId, @Nullable Integer imageId,
|
||||
@Nullable Integer sharedIpGroupId, @Nullable Integer progress, @Nullable ServerStatus status) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setMetadata(Map<String, String> metadata) {
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
public Map<String, String> getMetadata() {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
public void setAddresses(Addresses addresses) {
|
||||
this.name = checkNotNull(name, "name");
|
||||
this.metadata = metadata == null ? null : ImmutableMap.copyOf(metadata);
|
||||
this.addresses = addresses;
|
||||
}
|
||||
|
||||
public Addresses getAddresses() {
|
||||
return addresses;
|
||||
}
|
||||
|
||||
public void setAdminPass(String adminPass) {
|
||||
this.adminPass = adminPass;
|
||||
}
|
||||
|
||||
public String getAdminPass() {
|
||||
return adminPass;
|
||||
}
|
||||
|
||||
public void setFlavorId(Integer flavorId) {
|
||||
this.flavorId = flavorId;
|
||||
}
|
||||
|
||||
public Integer getFlavorId() {
|
||||
return flavorId;
|
||||
}
|
||||
|
||||
public void setHostId(String hostId) {
|
||||
this.hostId = hostId;
|
||||
this.imageId = imageId;
|
||||
this.sharedIpGroupId = sharedIpGroupId;
|
||||
this.progress = progress;
|
||||
this.status = status == null ? ServerStatus.UNKNOWN : status;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Map<String, String> getMetadata() {
|
||||
return this.metadata;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Addresses getAddresses() {
|
||||
return this.addresses;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getAdminPass() {
|
||||
return this.adminPass;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getFlavorId() {
|
||||
return this.flavorId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,48 +242,24 @@ public class Server {
|
|||
* <p/>
|
||||
* Note: hostId is unique PER ACCOUNT and is not globally unique.
|
||||
*/
|
||||
@Nullable
|
||||
public String getHostId() {
|
||||
return hostId;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setImageId(Integer imageId) {
|
||||
this.imageId = imageId;
|
||||
return this.hostId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getImageId() {
|
||||
return imageId;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setProgress(Integer progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
public Integer getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setSharedIpGroupId(Integer sharedIpGroupId) {
|
||||
this.sharedIpGroupId = sharedIpGroupId;
|
||||
return this.imageId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getSharedIpGroupId() {
|
||||
return sharedIpGroupId;
|
||||
return this.sharedIpGroupId;
|
||||
}
|
||||
|
||||
public void setStatus(ServerStatus status) {
|
||||
this.status = status;
|
||||
@Nullable
|
||||
public Integer getProgress() {
|
||||
return this.progress;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -143,13 +267,12 @@ public class Server {
|
|||
* state. Servers with an ACTIVE status are available for use.
|
||||
*/
|
||||
public ServerStatus getStatus() {
|
||||
return status;
|
||||
return this.status;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id, name);
|
||||
return Objects.hashCode(id, name, metadata, addresses, adminPass, flavorId, hostId, imageId, sharedIpGroupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -157,21 +280,25 @@ public class Server {
|
|||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
Server that = Server.class.cast(obj);
|
||||
return Objects.equal(this.getId(), that.getId())
|
||||
&& Objects.equal(this.name, that.name);
|
||||
return Objects.equal(this.id, that.id)
|
||||
&& Objects.equal(this.name, that.name)
|
||||
&& Objects.equal(this.metadata, that.metadata)
|
||||
&& Objects.equal(this.addresses, that.addresses)
|
||||
&& Objects.equal(this.adminPass, that.adminPass)
|
||||
&& Objects.equal(this.flavorId, that.flavorId)
|
||||
&& Objects.equal(this.hostId, that.hostId)
|
||||
&& Objects.equal(this.imageId, that.imageId)
|
||||
&& Objects.equal(this.sharedIpGroupId, that.sharedIpGroupId);
|
||||
}
|
||||
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper(this)
|
||||
.add("id", id).add("name", name).add("metadata", metadata).add("addresses", addresses).add("adminPass", adminPass).add("flavorId", flavorId).add("hostId", hostId).add("imageId", imageId).add("sharedIpGroupId", sharedIpGroupId).add("progress", progress).add("status", status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("id", getId())
|
||||
.add("name", name)
|
||||
.add("addresses", addresses)
|
||||
.add("flavorId", flavorId)
|
||||
.add("imageId", imageId)
|
||||
.add("hostId", hostId)
|
||||
.add("metadata", metadata)
|
||||
.add("sharedIpGroupId", sharedIpGroupId).toString();
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -18,25 +18,105 @@
|
|||
*/
|
||||
package org.jclouds.cloudservers.domain;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
/**
|
||||
* Class ShareIp
|
||||
*/
|
||||
public class ShareIp {
|
||||
|
||||
private boolean configureServer;
|
||||
private int sharedIpGroupId;
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromShareIp(this);
|
||||
}
|
||||
|
||||
public void setConfigureServer(boolean configureServer) {
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
protected abstract T self();
|
||||
|
||||
protected boolean configureServer;
|
||||
protected int sharedIpGroupId;
|
||||
|
||||
/**
|
||||
* @see ShareIp#isConfigureServer()
|
||||
*/
|
||||
public T configureServer(boolean configureServer) {
|
||||
this.configureServer = configureServer;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ShareIp#getSharedIpGroupId()
|
||||
*/
|
||||
public T sharedIpGroupId(int sharedIpGroupId) {
|
||||
this.sharedIpGroupId = sharedIpGroupId;
|
||||
return self();
|
||||
}
|
||||
|
||||
public ShareIp build() {
|
||||
return new ShareIp(configureServer, sharedIpGroupId);
|
||||
}
|
||||
|
||||
public T fromShareIp(ShareIp in) {
|
||||
return this
|
||||
.configureServer(in.isConfigureServer())
|
||||
.sharedIpGroupId(in.getSharedIpGroupId());
|
||||
}
|
||||
}
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private final boolean configureServer;
|
||||
private final int sharedIpGroupId;
|
||||
|
||||
@ConstructorProperties({
|
||||
"configureServer", "sharedIpGroupId"
|
||||
})
|
||||
protected ShareIp(boolean configureServer, int sharedIpGroupId) {
|
||||
this.configureServer = configureServer;
|
||||
}
|
||||
|
||||
public boolean isConfigureServer() {
|
||||
return configureServer;
|
||||
}
|
||||
|
||||
public void setSharedIpGroupId(int sharedIpGroupId) {
|
||||
this.sharedIpGroupId = sharedIpGroupId;
|
||||
}
|
||||
|
||||
public boolean isConfigureServer() {
|
||||
return this.configureServer;
|
||||
}
|
||||
|
||||
public int getSharedIpGroupId() {
|
||||
return sharedIpGroupId;
|
||||
return this.sharedIpGroupId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(configureServer, sharedIpGroupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
ShareIp that = ShareIp.class.cast(obj);
|
||||
return Objects.equal(this.configureServer, that.configureServer)
|
||||
&& Objects.equal(this.sharedIpGroupId, that.sharedIpGroupId);
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper(this)
|
||||
.add("configureServer", configureServer).add("sharedIpGroupId", sharedIpGroupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -18,9 +18,16 @@
|
|||
*/
|
||||
package org.jclouds.cloudservers.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
/**
|
||||
* A shared IP group is a collection of servers that can share IPs with other members of the group.
|
||||
|
@ -29,83 +36,120 @@ import com.google.common.collect.Lists;
|
|||
* groups. A server may only be a member of one shared IP group.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
*/
|
||||
public class SharedIpGroup {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
|
||||
private List<Integer> servers = Lists.newArrayList();
|
||||
|
||||
public SharedIpGroup() {
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromSharedIpGroup(this);
|
||||
}
|
||||
|
||||
public SharedIpGroup(int id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
protected abstract T self();
|
||||
|
||||
protected int id;
|
||||
protected String name;
|
||||
protected List<Integer> servers = null;
|
||||
|
||||
/**
|
||||
* @see SharedIpGroup#getId()
|
||||
*/
|
||||
public T id(int id) {
|
||||
this.id = id;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SharedIpGroup#getName()
|
||||
*/
|
||||
public T name(String name) {
|
||||
this.name = name;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SharedIpGroup#getServers()
|
||||
*/
|
||||
public T servers(List<Integer> servers) {
|
||||
this.servers = ImmutableList.copyOf(checkNotNull(servers, "servers"));
|
||||
return self();
|
||||
}
|
||||
|
||||
public T servers(Integer... in) {
|
||||
return servers(ImmutableList.copyOf(in));
|
||||
}
|
||||
|
||||
public SharedIpGroup build() {
|
||||
return new SharedIpGroup(id, name, servers);
|
||||
}
|
||||
|
||||
public T fromSharedIpGroup(SharedIpGroup in) {
|
||||
return this
|
||||
.id(in.getId())
|
||||
.name(in.getName())
|
||||
.servers(in.getServers());
|
||||
}
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private final int id;
|
||||
private final String name;
|
||||
private final List<Integer> servers;
|
||||
|
||||
@ConstructorProperties({
|
||||
"id", "name", "servers"
|
||||
})
|
||||
protected SharedIpGroup(int id, String name, @Nullable List<Integer> servers) {
|
||||
this.id = id;
|
||||
this.name = checkNotNull(name, "name");
|
||||
this.servers = servers == null ? null : ImmutableList.copyOf(servers);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setServers(List<Integer> servers) {
|
||||
this.servers = servers;
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public List<Integer> getServers() {
|
||||
return servers;
|
||||
return this.servers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + id;
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((servers == null) ? 0 : servers.hashCode());
|
||||
return result;
|
||||
return Objects.hashCode(id, name, servers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
SharedIpGroup other = (SharedIpGroup) obj;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (servers == null) {
|
||||
if (other.servers != null)
|
||||
return false;
|
||||
} else if (!servers.equals(other.servers))
|
||||
return false;
|
||||
return true;
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
SharedIpGroup that = SharedIpGroup.class.cast(obj);
|
||||
return Objects.equal(this.id, that.id)
|
||||
&& Objects.equal(this.name, that.name)
|
||||
&& Objects.equal(this.servers, that.servers);
|
||||
}
|
||||
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper(this)
|
||||
.add("id", id).add("name", name).add("servers", servers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SharedIpGroup [id=" + id + ", name=" + name + ", servers=" + servers + "]";
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -18,42 +18,144 @@
|
|||
*/
|
||||
package org.jclouds.cloudservers.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
/**
|
||||
* Class Version
|
||||
*/
|
||||
public class Version {
|
||||
|
||||
private String docURL;
|
||||
private String id = "v1.0";
|
||||
private VersionStatus status;
|
||||
private String wadl;
|
||||
|
||||
public void setDocURL(String docURL) {
|
||||
this.docURL = docURL;
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromVersion(this);
|
||||
}
|
||||
|
||||
public String getDocURL() {
|
||||
return docURL;
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
protected abstract T self();
|
||||
|
||||
protected String docURL;
|
||||
protected String id;
|
||||
protected VersionStatus status;
|
||||
protected String wadl;
|
||||
|
||||
/**
|
||||
* @see Version#getDocURL()
|
||||
*/
|
||||
public T docURL(String docURL) {
|
||||
this.docURL = docURL;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Version#getId()
|
||||
*/
|
||||
public T id(String id) {
|
||||
this.id = id;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Version#getStatus()
|
||||
*/
|
||||
public T status(VersionStatus status) {
|
||||
this.status = status;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Version#getWadl()
|
||||
*/
|
||||
public T wadl(String wadl) {
|
||||
this.wadl = wadl;
|
||||
return self();
|
||||
}
|
||||
|
||||
public Version build() {
|
||||
return new Version(docURL, id, status, wadl);
|
||||
}
|
||||
|
||||
public T fromVersion(Version in) {
|
||||
return this
|
||||
.docURL(in.getDocURL())
|
||||
.id(in.getId())
|
||||
.status(in.getStatus())
|
||||
.wadl(in.getWadl());
|
||||
}
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
private final String docURL;
|
||||
private final String id;
|
||||
private final VersionStatus status;
|
||||
private final String wadl;
|
||||
|
||||
public void setStatus(VersionStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public VersionStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setWadl(String wadl) {
|
||||
@ConstructorProperties({
|
||||
"docURL", "id", "status", "wadl"
|
||||
})
|
||||
protected Version(String docURL, String id, @Nullable VersionStatus status, @Nullable String wadl) {
|
||||
this.docURL = checkNotNull(docURL, "docURL");
|
||||
this.id = checkNotNull(id, "id");
|
||||
this.status = status == null ? VersionStatus.UNRECOGNIZED : status;
|
||||
this.wadl = wadl;
|
||||
}
|
||||
|
||||
public String getWadl() {
|
||||
return wadl;
|
||||
public String getDocURL() {
|
||||
return this.docURL;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public VersionStatus getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getWadl() {
|
||||
return this.wadl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(docURL, id, status, wadl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
Version that = Version.class.cast(obj);
|
||||
return Objects.equal(this.docURL, that.docURL)
|
||||
&& Objects.equal(this.id, that.id)
|
||||
&& Objects.equal(this.status, that.status)
|
||||
&& Objects.equal(this.wadl, that.wadl);
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper(this)
|
||||
.add("docURL", docURL).add("id", id).add("status", status).add("wadl", wadl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.jclouds.rest.MapBinder;
|
|||
import org.jclouds.rest.binders.BindToJsonPayload;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
|
@ -105,9 +106,7 @@ public class CreateServerOptions implements MapBinder {
|
|||
if (sharedIpGroupId != null)
|
||||
server.sharedIpGroupId = this.sharedIpGroupId;
|
||||
if (publicIp != null) {
|
||||
server.addresses = new Addresses();
|
||||
server.addresses.getPublicAddresses().add(publicIp);
|
||||
server.addresses.setPrivateAddresses(null);
|
||||
server.addresses = Addresses.builder().publicAddresses(ImmutableSet.of(publicIp)).build();
|
||||
}
|
||||
return bindToRequest(request, ImmutableMap.of("server", server));
|
||||
}
|
||||
|
|
|
@ -502,8 +502,8 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testReplaceBackupSchedule() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Method method = CloudServersAsyncClient.class.getMethod("replaceBackupSchedule", int.class, BackupSchedule.class);
|
||||
HttpRequest request = processor.createRequest(method, 2, new BackupSchedule(WeeklyBackup.MONDAY,
|
||||
DailyBackup.H_0800_1000, true));
|
||||
HttpRequest request = processor.createRequest(method, 2, BackupSchedule.builder().weekly(WeeklyBackup.MONDAY)
|
||||
.daily(DailyBackup.H_0800_1000).enabled(true).build());
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/backup_schedule HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
|
|
@ -503,11 +503,8 @@ public class CloudServersClientLiveTest extends BaseComputeServiceContextLiveTes
|
|||
|
||||
@Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "testShareNoConfig")
|
||||
public void testBackup() throws Exception {
|
||||
assertEquals(new BackupSchedule(), client.getBackupSchedule(serverId));
|
||||
BackupSchedule dailyWeekly = new BackupSchedule();
|
||||
dailyWeekly.setEnabled(true);
|
||||
dailyWeekly.setWeekly(WeeklyBackup.FRIDAY);
|
||||
dailyWeekly.setDaily(DailyBackup.H_0400_0600);
|
||||
assertEquals(BackupSchedule.builder().build(), client.getBackupSchedule(serverId));
|
||||
BackupSchedule dailyWeekly = BackupSchedule.builder().enabled(true).weekly(WeeklyBackup.FRIDAY).daily(DailyBackup.H_0400_0600).build();
|
||||
client.replaceBackupSchedule(serverId, dailyWeekly);
|
||||
client.deleteBackupSchedule(serverId);
|
||||
// disables, doesn't delete: Web Hosting #119571
|
||||
|
|
|
@ -30,18 +30,14 @@ import org.testng.annotations.Test;
|
|||
@Test(groups = "unit")
|
||||
public class ServerTest {
|
||||
public void testStatusDoesntAffectEquals() {
|
||||
Server server1 = new Server(1, "hello");
|
||||
server1.setStatus(ServerStatus.ACTIVE);
|
||||
Server server2 = new Server(1, "hello");
|
||||
server2.setStatus(ServerStatus.BUILD);
|
||||
Server server1 = Server.builder().id(1).name("hello").status(ServerStatus.ACTIVE).build();
|
||||
Server server2 = Server.builder().id(1).name("hello").status(ServerStatus.BUILD).build();
|
||||
assertEquals(server1, server2);
|
||||
}
|
||||
|
||||
public void testProgressDoesntAffectEquals() {
|
||||
Server server1 = new Server(1, "hello");
|
||||
server1.setProgress(1);
|
||||
Server server2 = new Server(1, "hello");
|
||||
server2.setProgress(2);
|
||||
Server server1 = Server.builder().id(1).name("hello").progress(1).build();
|
||||
Server server2 = Server.builder().id(1).name("hello").progress(2).build();
|
||||
assertEquals(server1, server2);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ParseBackupScheduleFromJsonResponseTest {
|
|||
.get(new TypeLiteral<UnwrapOnlyJsonValue<BackupSchedule>>() {
|
||||
}));
|
||||
BackupSchedule response = parser.apply(HttpResponse.builder().statusCode(200).message("ok").payload(is).build());
|
||||
assertEquals(new BackupSchedule(WeeklyBackup.THURSDAY, DailyBackup.H_0400_0600, true), response);
|
||||
assertEquals(BackupSchedule.builder().weekly(WeeklyBackup.THURSDAY).daily(DailyBackup.H_0400_0600).enabled(true).build(), response);
|
||||
}
|
||||
|
||||
public void testNoSchedule() throws UnknownHostException {
|
||||
|
@ -63,6 +63,6 @@ public class ParseBackupScheduleFromJsonResponseTest {
|
|||
BackupSchedule response = parser.apply(HttpResponse.builder()
|
||||
.statusCode(200).message("ok")
|
||||
.payload("{\"backupSchedule\":{\"enabled\" : false}}").build());
|
||||
assertEquals(new BackupSchedule(), response);
|
||||
assertEquals(BackupSchedule.builder().build(), response);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,8 @@ public class ParseFlavorListFromJsonResponseTest {
|
|||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/test_list_flavors.json");
|
||||
|
||||
List<Flavor> expects = ImmutableList.of(new Flavor(1, "256 MB Server"), new Flavor(2, "512 MB Server"));
|
||||
List<Flavor> expects = ImmutableList.of(Flavor.builder().id(1).name("256 MB Server").build(),
|
||||
Flavor.builder().id(2).name("512 MB Server").build());
|
||||
|
||||
UnwrapOnlyJsonValue<List<Flavor>> parser = i.getInstance(Key
|
||||
.get(new TypeLiteral<UnwrapOnlyJsonValue<List<Flavor>>>() {
|
||||
|
|
|
@ -61,7 +61,8 @@ public class ParseImageListFromJsonResponseTest {
|
|||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/test_list_images.json");
|
||||
|
||||
List<Image> expects = ImmutableList.of(new Image(2, "CentOS 5.2"), new Image(743, "My Server Backup"));
|
||||
List<Image> expects = ImmutableList.of(Image.builder().id(2).name("CentOS 5.2").build(),
|
||||
Image.builder().id(743).name("My Server Backup").build());
|
||||
|
||||
UnwrapOnlyJsonValue<List<Image>> parser = i.getInstance(Key
|
||||
.get(new TypeLiteral<UnwrapOnlyJsonValue<List<Image>>>() {
|
||||
|
|
|
@ -59,9 +59,7 @@ public class ParseServerFromJsonResponseTest {
|
|||
assertEquals(response.getProgress(), Integer.valueOf(60));
|
||||
List<String> publicAddresses = Lists.newArrayList("67.23.10.132", "67.23.10.131");
|
||||
List<String> privateAddresses = Lists.newArrayList("10.176.42.16");
|
||||
Addresses addresses1 = new Addresses();
|
||||
addresses1.getPrivateAddresses().addAll(privateAddresses);
|
||||
addresses1.getPublicAddresses().addAll(publicAddresses);
|
||||
Addresses addresses1 = Addresses.builder().publicAddresses(publicAddresses).privateAddresses(privateAddresses).build();
|
||||
assertEquals(response.getAddresses(), addresses1);
|
||||
assertEquals(response.getMetadata(), ImmutableMap.of("Server Label", "Web Head 1", "Image Version", "2.1"));
|
||||
|
||||
|
|
|
@ -53,7 +53,8 @@ public class ParseServerListFromJsonResponseTest {
|
|||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/test_list_servers.json");
|
||||
|
||||
List<Server> expects = ImmutableList.of(new Server(1234, "sample-server"), new Server(5678, "sample-server2"));
|
||||
List<Server> expects = ImmutableList.of(Server.builder().id(1234).name("sample-server").build(),
|
||||
Server.builder().id(5678).name("sample-server2").build());
|
||||
|
||||
UnwrapOnlyJsonValue<List<Server>> parser = i.getInstance(Key
|
||||
.get(new TypeLiteral<UnwrapOnlyJsonValue<List<Server>>>() {
|
||||
|
@ -80,9 +81,7 @@ public class ParseServerListFromJsonResponseTest {
|
|||
assertEquals(response.get(0).getProgress(), Integer.valueOf(60));
|
||||
List<String> publicAddresses = Lists.newArrayList("67.23.10.132", "67.23.10.131");
|
||||
List<String> privateAddresses = Lists.newArrayList("10.176.42.16");
|
||||
Addresses addresses1 = new Addresses();
|
||||
addresses1.getPrivateAddresses().addAll(privateAddresses);
|
||||
addresses1.getPublicAddresses().addAll(publicAddresses);
|
||||
Addresses addresses1 = Addresses.builder().privateAddresses(privateAddresses).publicAddresses(publicAddresses).build();
|
||||
assertEquals(response.get(0).getAddresses(), addresses1);
|
||||
assertEquals(response.get(0).getMetadata(), ImmutableMap.of("Server Label", "Web Head 1", "Image Version", "2.1"));
|
||||
assertEquals(response.get(1).getId(), 5678);
|
||||
|
@ -94,9 +93,7 @@ public class ParseServerListFromJsonResponseTest {
|
|||
assertEquals(response.get(1).getProgress(), null);
|
||||
List<String> publicAddresses2 = Lists.newArrayList("67.23.10.133");
|
||||
List<String> privateAddresses2 = Lists.newArrayList("10.176.42.17");
|
||||
Addresses addresses2 = new Addresses();
|
||||
addresses2.getPrivateAddresses().addAll(privateAddresses2);
|
||||
addresses2.getPublicAddresses().addAll(publicAddresses2);
|
||||
Addresses addresses2 = Addresses.builder().privateAddresses(privateAddresses2).publicAddresses(publicAddresses2).build();
|
||||
assertEquals(response.get(1).getAddresses(), addresses2);
|
||||
assertEquals(response.get(1).getMetadata(), ImmutableMap.of("Server Label", "DB 1"));
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ public class ParseSharedIpGroupListFromJsonResponseTest {
|
|||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/test_list_sharedipgroups.json");
|
||||
|
||||
List<SharedIpGroup> expects = ImmutableList.of(new SharedIpGroup(1234, "Shared IP Group 1"), new SharedIpGroup(
|
||||
5678, "Shared IP Group 2"));
|
||||
List<SharedIpGroup> expects = ImmutableList.of(SharedIpGroup.builder().id(1234).name("Shared IP Group 1").build(),
|
||||
SharedIpGroup.builder().id(5678).name("Shared IP Group 2").build());
|
||||
|
||||
UnwrapOnlyJsonValue<List<SharedIpGroup>> parser = i.getInstance(Key
|
||||
.get(new TypeLiteral<UnwrapOnlyJsonValue<List<SharedIpGroup>>>() {
|
||||
|
|
|
@ -32,7 +32,7 @@ import com.google.gson.stream.JsonReader;
|
|||
* Data adapter for the date formats used by CloudStack.
|
||||
*
|
||||
* Essentially this is a workaround for the CloudStack getUsage() API call returning a
|
||||
* corrupted formn of ISO-8601 dates, which have an unexpected pair of apostrophes, like
|
||||
* corrupted form of ISO-8601 dates, which have an unexpected pair of apostrophes, like
|
||||
* 2011-12-12'T'00:00:00+00:00
|
||||
*
|
||||
* @author Richard Downer
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.google.common.base.Joiner;
|
|||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
|
@ -259,7 +260,7 @@ public class ServiceOffering implements Comparable<ServiceOffering> {
|
|||
private final int memory;
|
||||
private final boolean haSupport;
|
||||
private final StorageType storageType;
|
||||
private final String tags;
|
||||
private final Set<String> tags;
|
||||
private final boolean defaultUse;
|
||||
private final String hostTags;
|
||||
private final boolean systemOffering;
|
||||
|
@ -285,7 +286,8 @@ public class ServiceOffering implements Comparable<ServiceOffering> {
|
|||
this.memory = memory;
|
||||
this.haSupport = haSupport;
|
||||
this.storageType = storageType;
|
||||
this.tags = tags;
|
||||
this.tags = !(Strings.emptyToNull(tags) == null) ? ImmutableSet.copyOf(Splitter.on(',').split(tags))
|
||||
: ImmutableSet.<String> of();
|
||||
this.defaultUse = defaultUse;
|
||||
this.hostTags = hostTags;
|
||||
this.systemOffering = systemOffering;
|
||||
|
@ -377,7 +379,7 @@ public class ServiceOffering implements Comparable<ServiceOffering> {
|
|||
* @return the tags for the service offering
|
||||
*/
|
||||
public Set<String> getTags() {
|
||||
return tags == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(Splitter.on(',').split(tags));
|
||||
return tags;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -333,7 +333,7 @@ public class Snapshot {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return valid types are hourly, daily, weekly, monthy, template, and none.
|
||||
* @return valid types are hourly, daily, weekly, monthly, template, and none.
|
||||
*/
|
||||
@Nullable
|
||||
public Snapshot.Interval getInterval() {
|
||||
|
|
|
@ -150,7 +150,7 @@ public class SnapshotPolicy {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return valid types are hourly, daily, weekly, monthy, template, and none.
|
||||
* @return valid types are hourly, daily, weekly, monthly, template, and none.
|
||||
*/
|
||||
@Nullable
|
||||
public Snapshot.Interval getInterval() {
|
||||
|
|
|
@ -940,7 +940,7 @@ public class VirtualMachine {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the ID of the availablility zone for the virtual machine
|
||||
* @return the ID of the availability zone for the virtual machine
|
||||
*/
|
||||
@Nullable
|
||||
public String getZoneId() {
|
||||
|
|
|
@ -95,7 +95,7 @@ public interface FirewallClient {
|
|||
* @param options
|
||||
* if present, how to constrain the list.
|
||||
* @return PortForwardingRules matching query, or empty set, if no
|
||||
* PortForwardingRulees are found
|
||||
* PortForwardingRules are found
|
||||
*/
|
||||
Set<PortForwardingRule> listPortForwardingRules(ListPortForwardingRulesOptions... options);
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ public interface TemplateClient {
|
|||
/**
|
||||
* Updates a template visibility permissions. A public template is visible to
|
||||
* all accounts within the same domain. A private template is visible only to
|
||||
* the owner of the template. A priviledged template is a private template
|
||||
* the owner of the template. A privileged template is a private template
|
||||
* with account permissions added. Only accounts specified under the template
|
||||
* permissions are visible to them.
|
||||
*
|
||||
|
|
|
@ -67,7 +67,7 @@ public class CreateTemplateOptions extends BaseHttpRequestOptions {
|
|||
}
|
||||
|
||||
/**
|
||||
* true if the template requres HVM, false otherwise
|
||||
* true if the template requires HVM, false otherwise
|
||||
*/
|
||||
public CreateTemplateOptions requiresHVM(boolean requiresHVM) {
|
||||
this.queryParameters.replaceValues("requireshvm", ImmutableSet.of(requiresHVM + ""));
|
||||
|
|
|
@ -43,7 +43,7 @@ public class ListFirewallRulesOptions extends AccountInDomainOptions {
|
|||
|
||||
/**
|
||||
* @param ipAddressId
|
||||
* the id of IP address of the firwall services
|
||||
* the id of IP address of the firewall services
|
||||
*/
|
||||
public ListFirewallRulesOptions ipAddressId(String ipAddressId) {
|
||||
this.queryParameters.replaceValues("ipaddressid", ImmutableSet.of(ipAddressId + ""));
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
<test.ec2.credential>${test.aws.credential}</test.ec2.credential>
|
||||
<test.ec2.template />
|
||||
<test.ec2.ebs-template>hardwareId=m1.small,imageId=us-west-2/ami-38c64a08</test.ec2.ebs-template>
|
||||
<test.ec2.windows-template>hardwareId=m1.small,imageNameMatches=Windows_Server-2008-R2_SP1-English-64Bit-Base-WinRM-</test.ec2.windows-template>
|
||||
<test.ec2.windows-owner>449550055360</test.ec2.windows-owner>
|
||||
<jclouds.osgi.export>org.jclouds.ec2*;version="${project.version}"</jclouds.osgi.export>
|
||||
<jclouds.osgi.import>
|
||||
org.jclouds.compute.internal;version="${project.version}",
|
||||
|
@ -128,6 +130,8 @@
|
|||
<test.ec2.credential>${test.ec2.credential}</test.ec2.credential>
|
||||
<test.ec2.template>${test.ec2.template}</test.ec2.template>
|
||||
<test.ec2.ebs-template>${test.ec2.ebs-template}</test.ec2.ebs-template>
|
||||
<test.ec2.windows-template>${test.ec2.windows-template}</test.ec2.windows-template>
|
||||
<test.ec2.windows-owner>${test.ec2.windows-owner}</test.ec2.windows-owner>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
*/
|
||||
package org.jclouds.ec2;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.jclouds.ec2.features.WindowsAsyncApi;
|
||||
import org.jclouds.ec2.services.AMIAsyncClient;
|
||||
import org.jclouds.ec2.services.AvailabilityZoneAndRegionAsyncClient;
|
||||
import org.jclouds.ec2.services.ElasticBlockStoreAsyncClient;
|
||||
|
@ -26,7 +31,13 @@ import org.jclouds.ec2.services.InstanceAsyncClient;
|
|||
import org.jclouds.ec2.services.KeyPairAsyncClient;
|
||||
import org.jclouds.ec2.services.SecurityGroupAsyncClient;
|
||||
import org.jclouds.ec2.services.WindowsAsyncClient;
|
||||
import org.jclouds.location.Region;
|
||||
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to EC2 services.
|
||||
|
@ -35,6 +46,13 @@ import org.jclouds.rest.annotations.Delegate;
|
|||
*/
|
||||
public interface EC2AsyncClient {
|
||||
public final static String VERSION = "2010-06-15";
|
||||
/**
|
||||
*
|
||||
* @return the Region codes configured
|
||||
*/
|
||||
@Provides
|
||||
@Region
|
||||
Set<String> getConfiguredRegions();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to AMI services.
|
||||
|
@ -84,4 +102,15 @@ public interface EC2AsyncClient {
|
|||
@Delegate
|
||||
ElasticBlockStoreAsyncClient getElasticBlockStoreServices();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Windows features.
|
||||
*/
|
||||
@Delegate
|
||||
@Beta
|
||||
WindowsAsyncApi getWindowsApi();
|
||||
|
||||
@Delegate
|
||||
@Beta
|
||||
WindowsAsyncApi getWindowsApiForRegion(
|
||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
||||
}
|
||||
|
|
|
@ -18,9 +18,13 @@
|
|||
*/
|
||||
package org.jclouds.ec2;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.ec2.features.WindowsApi;
|
||||
import org.jclouds.ec2.services.AMIClient;
|
||||
import org.jclouds.ec2.services.AvailabilityZoneAndRegionClient;
|
||||
import org.jclouds.ec2.services.ElasticBlockStoreClient;
|
||||
|
@ -29,7 +33,13 @@ import org.jclouds.ec2.services.InstanceClient;
|
|||
import org.jclouds.ec2.services.KeyPairClient;
|
||||
import org.jclouds.ec2.services.SecurityGroupClient;
|
||||
import org.jclouds.ec2.services.WindowsClient;
|
||||
import org.jclouds.location.Region;
|
||||
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to EC2 services.
|
||||
|
@ -38,6 +48,14 @@ import org.jclouds.rest.annotations.Delegate;
|
|||
*/
|
||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||
public interface EC2Client {
|
||||
/**
|
||||
*
|
||||
* @return the Region codes configured
|
||||
*/
|
||||
@Provides
|
||||
@Region
|
||||
Set<String> getConfiguredRegions();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to AMI services.
|
||||
*/
|
||||
|
@ -85,5 +103,17 @@ public interface EC2Client {
|
|||
*/
|
||||
@Delegate
|
||||
ElasticBlockStoreClient getElasticBlockStoreServices();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Windows features.
|
||||
*/
|
||||
@Delegate
|
||||
@Beta
|
||||
WindowsApi getWindowsApi();
|
||||
|
||||
@Delegate
|
||||
@Beta
|
||||
WindowsApi getWindowsApiForRegion(
|
||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
||||
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public class EC2ComputeService extends BaseComputeService {
|
|||
CreateNodesInGroupThenAddToSet runNodesAndAddToSetStrategy, RebootNodeStrategy rebootNodeStrategy,
|
||||
DestroyNodeStrategy destroyNodeStrategy, ResumeNodeStrategy startNodeStrategy,
|
||||
SuspendNodeStrategy stopNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider,
|
||||
Provider<TemplateOptions> templateOptionsProvider,
|
||||
@Named("DEFAULT") Provider<TemplateOptions> templateOptionsProvider,
|
||||
@Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
|
||||
@Named(TIMEOUT_NODE_TERMINATED) Predicate<AtomicReference<NodeMetadata>> nodeTerminated,
|
||||
@Named(TIMEOUT_NODE_SUSPENDED) Predicate<AtomicReference<NodeMetadata>> nodeSuspended,
|
||||
|
@ -223,7 +223,7 @@ public class EC2ComputeService extends BaseComputeService {
|
|||
// resources existing.
|
||||
|
||||
// Also in #445, in aws-ec2 the deleteSecurityGroup sometimes fails after terminating the final VM using a
|
||||
// given security group, if called very soon after the VM's state reports terminated. Emprically, it seems that
|
||||
// given security group, if called very soon after the VM's state reports terminated. Empirically, it seems that
|
||||
// waiting a small time (e.g. enabling logging or debugging!) then the tests pass. We therefore retry.
|
||||
final int maxAttempts = 3;
|
||||
Retryables.retryNumTimes(new Predicate<Void>() {
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.jclouds.ec2.compute.config;
|
|||
|
||||
import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_TIMEOUT_SECURITYGROUP_PRESENT;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -31,18 +30,20 @@ import javax.inject.Singleton;
|
|||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.compute.domain.NodeMetadata.Status;
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.compute.extensions.ImageExtension;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.ec2.compute.EC2ComputeService;
|
||||
import org.jclouds.ec2.compute.domain.PasswordDataAndPrivateKey;
|
||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||
import org.jclouds.ec2.compute.extensions.EC2ImageExtension;
|
||||
import org.jclouds.ec2.compute.functions.AddElasticIpsToNodemetadata;
|
||||
import org.jclouds.ec2.compute.functions.CreateUniqueKeyPair;
|
||||
import org.jclouds.ec2.compute.functions.CredentialsForInstance;
|
||||
import org.jclouds.ec2.compute.functions.EC2ImageParser;
|
||||
import org.jclouds.ec2.compute.functions.PasswordCredentialsFromWindowsInstance;
|
||||
import org.jclouds.ec2.compute.functions.RunningInstanceToNodeMetadata;
|
||||
import org.jclouds.ec2.compute.functions.WindowsLoginCredentialsFromEncryptedData;
|
||||
import org.jclouds.ec2.compute.internal.EC2TemplateBuilderImpl;
|
||||
|
@ -52,10 +53,10 @@ import org.jclouds.ec2.compute.loaders.RegionAndIdToImage;
|
|||
import org.jclouds.ec2.compute.options.EC2TemplateOptions;
|
||||
import org.jclouds.ec2.compute.predicates.GetImageWhenStatusAvailablePredicateWithResult;
|
||||
import org.jclouds.ec2.compute.predicates.SecurityGroupPresent;
|
||||
import org.jclouds.ec2.domain.Image.ImageState;
|
||||
import org.jclouds.ec2.domain.InstanceState;
|
||||
import org.jclouds.ec2.domain.KeyPair;
|
||||
import org.jclouds.ec2.domain.RunningInstance;
|
||||
import org.jclouds.ec2.domain.Image.ImageState;
|
||||
import org.jclouds.ec2.reference.EC2Constants;
|
||||
import org.jclouds.predicates.PredicateWithResult;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
|
@ -64,7 +65,6 @@ import com.google.common.annotations.VisibleForTesting;
|
|||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
|
@ -117,7 +117,7 @@ public class EC2ComputeServiceDependenciesModule extends AbstractModule {
|
|||
bind(TemplateBuilder.class).to(EC2TemplateBuilderImpl.class);
|
||||
bind(TemplateOptions.class).to(EC2TemplateOptions.class);
|
||||
bind(ComputeService.class).to(EC2ComputeService.class);
|
||||
bind(new TypeLiteral<CacheLoader<RunningInstance, Credentials>>() {
|
||||
bind(new TypeLiteral<CacheLoader<RunningInstance, LoginCredentials>>() {
|
||||
}).to(CredentialsForInstance.class);
|
||||
bind(new TypeLiteral<Function<RegionAndName, KeyPair>>() {
|
||||
}).to(CreateUniqueKeyPair.class);
|
||||
|
@ -126,8 +126,11 @@ public class EC2ComputeServiceDependenciesModule extends AbstractModule {
|
|||
bind(new TypeLiteral<CacheLoader<RegionAndName, String>>() {
|
||||
}).annotatedWith(Names.named("SECURITY")).to(CreateSecurityGroupIfNeeded.class);
|
||||
bind(new TypeLiteral<CacheLoader<RegionAndName, String>>() {
|
||||
}).annotatedWith(Names.named("ELASTICIP")).to(LoadPublicIpForInstanceOrNull.class);
|
||||
bind(WindowsLoginCredentialsFromEncryptedData.class);
|
||||
}).annotatedWith(Names.named("ELASTICIP")).to(LoadPublicIpForInstanceOrNull.class);
|
||||
bind(new TypeLiteral<Function<PasswordDataAndPrivateKey, LoginCredentials>>() {
|
||||
}).to(WindowsLoginCredentialsFromEncryptedData.class);
|
||||
bind(new TypeLiteral<Function<RunningInstance, LoginCredentials>>() {
|
||||
}).to(PasswordCredentialsFromWindowsInstance.class);
|
||||
bind(new TypeLiteral<Function<org.jclouds.ec2.domain.Image, Image>>() {
|
||||
}).to(EC2ImageParser.class);
|
||||
bind(new TypeLiteral<ImageExtension>() {
|
||||
|
@ -151,21 +154,7 @@ public class EC2ComputeServiceDependenciesModule extends AbstractModule {
|
|||
|
||||
@Provides
|
||||
@Singleton
|
||||
Supplier<String> provideSuffix() {
|
||||
return new Supplier<String>() {
|
||||
final SecureRandom random = new SecureRandom();
|
||||
|
||||
@Override
|
||||
public String get() {
|
||||
return random.nextInt(100) + "";
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
protected LoadingCache<RunningInstance, Credentials> credentialsMap(CacheLoader<RunningInstance, Credentials> in) {
|
||||
protected LoadingCache<RunningInstance, LoginCredentials> credentialsMap(CacheLoader<RunningInstance, LoginCredentials> in) {
|
||||
return CacheBuilder.newBuilder().build(in);
|
||||
}
|
||||
|
||||
|
|
|
@ -352,6 +352,14 @@ public class EC2HardwareBuilder extends HardwareBuilder {
|
|||
.virtualizationType(VirtualizationType.HVM);
|
||||
}
|
||||
|
||||
public static EC2HardwareBuilder hi1_4xlarge() {
|
||||
return new EC2HardwareBuilder(InstanceType.HI1_4XLARGE)
|
||||
.ram(60 * 1024 + 512)
|
||||
.processors(ImmutableList.of(new Processor(8.0, 5.5), new Processor(8.0, 5.5)))
|
||||
.volumes(ImmutableList.<Volume> of(new VolumeImpl(1024.0f, "/dev/sda1", true, false),
|
||||
new VolumeImpl(1024.0f, "/dev/sdb", false, false)));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Hardware build() {
|
||||
|
|
|
@ -20,9 +20,11 @@ package org.jclouds.ec2.compute.domain;
|
|||
|
||||
import org.jclouds.ec2.domain.PasswordData;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* An encrypted Windows Administrator password, and the private key that can decrypt it.
|
||||
*
|
||||
*
|
||||
* @author Richard Downer
|
||||
*/
|
||||
public class PasswordDataAndPrivateKey {
|
||||
|
@ -42,4 +44,35 @@ public class PasswordDataAndPrivateKey {
|
|||
public String getPrivateKey() {
|
||||
return privateKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(passwordData, privateKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
PasswordDataAndPrivateKey other = PasswordDataAndPrivateKey.class.cast(obj);
|
||||
return Objects.equal(this.passwordData, other.passwordData) && Objects.equal(this.privateKey, other.privateKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("passwordData", passwordData).toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,12 +27,13 @@ import javax.inject.Inject;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||
import org.jclouds.ec2.domain.KeyPair;
|
||||
import org.jclouds.ec2.domain.RunningInstance;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
|
@ -42,28 +43,32 @@ import com.google.common.cache.LoadingCache;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Singleton
|
||||
public class CredentialsForInstance extends CacheLoader<RunningInstance, Credentials> {
|
||||
public class CredentialsForInstance extends CacheLoader<RunningInstance, LoginCredentials> {
|
||||
|
||||
private final ConcurrentMap<RegionAndName, KeyPair> credentialsMap;
|
||||
private final Supplier<LoadingCache<RegionAndName, ? extends Image>> imageMap;
|
||||
private final Function<RunningInstance, LoginCredentials> passwordCredentialsFromWindowsInstance;
|
||||
|
||||
@Inject
|
||||
CredentialsForInstance(ConcurrentMap<RegionAndName, KeyPair> credentialsMap,
|
||||
Supplier<LoadingCache<RegionAndName, ? extends Image>> imageMap) {
|
||||
Supplier<LoadingCache<RegionAndName, ? extends Image>> imageMap, Function<RunningInstance, LoginCredentials> passwordCredentialsFromWindowsInstance) {
|
||||
this.credentialsMap = checkNotNull(credentialsMap, "credentialsMap");
|
||||
this.imageMap = imageMap;
|
||||
this.imageMap = checkNotNull(imageMap, "imageMap");
|
||||
this.passwordCredentialsFromWindowsInstance = checkNotNull(passwordCredentialsFromWindowsInstance, "passwordCredentialsFromWindowsInstance");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Credentials load(RunningInstance instance) throws ExecutionException {
|
||||
Credentials credentials = null;// default if no keypair exists
|
||||
if (instance.getKeyName() != null) {
|
||||
credentials = new Credentials(getLoginAccountFor(instance), getPrivateKeyOrNull(instance));
|
||||
public LoginCredentials load(final RunningInstance instance) throws ExecutionException {
|
||||
if ("windows".equals(instance.getPlatform())) {
|
||||
return passwordCredentialsFromWindowsInstance.apply(instance);
|
||||
} else if (instance.getKeyName() != null) {
|
||||
return LoginCredentials.builder().user(getLoginAccountFor(instance)).privateKey(getPrivateKeyOrNull(instance)).build();
|
||||
}
|
||||
return credentials;
|
||||
return null;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
String getPrivateKeyOrNull(RunningInstance instance) throws ExecutionException {
|
||||
String getPrivateKeyOrNull(RunningInstance instance) {
|
||||
KeyPair keyPair = credentialsMap.get(new RegionAndName(instance.getRegion(), instance.getKeyName()));
|
||||
return keyPair != null ? keyPair.getKeyMaterial() : null;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ec2.compute.functions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.ec2.EC2Client;
|
||||
import org.jclouds.ec2.compute.domain.PasswordDataAndPrivateKey;
|
||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||
import org.jclouds.ec2.domain.KeyPair;
|
||||
import org.jclouds.ec2.domain.PasswordData;
|
||||
import org.jclouds.ec2.domain.RunningInstance;
|
||||
import org.jclouds.ec2.features.WindowsApi;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Singleton
|
||||
public class PasswordCredentialsFromWindowsInstance implements Function<RunningInstance, LoginCredentials> {
|
||||
|
||||
@Resource
|
||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
private final ConcurrentMap<RegionAndName, KeyPair> credentialsMap;
|
||||
private final EC2Client ec2Client;
|
||||
private final Function<PasswordDataAndPrivateKey, LoginCredentials> pwDataToLoginCredentials;
|
||||
|
||||
@Inject
|
||||
protected PasswordCredentialsFromWindowsInstance(ConcurrentMap<RegionAndName, KeyPair> credentialsMap,
|
||||
EC2Client ec2Client, Function<PasswordDataAndPrivateKey, LoginCredentials> pwDataToLoginCredentials) {
|
||||
this.credentialsMap = checkNotNull(credentialsMap, "credentialsMap");
|
||||
this.ec2Client = checkNotNull(ec2Client, "ec2Client");
|
||||
this.pwDataToLoginCredentials = checkNotNull(pwDataToLoginCredentials, "pwDataToLoginCredentials");
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginCredentials apply(final RunningInstance instance) {
|
||||
LoginCredentials credentials = LoginCredentials.builder().user("Administrator").noPrivateKey().build();
|
||||
String privateKey = getPrivateKeyOrNull(instance);
|
||||
if (privateKey == null) {
|
||||
return credentials;
|
||||
}
|
||||
final WindowsApi windowsApi = ec2Client.getWindowsApiForRegion(instance.getRegion());
|
||||
// The Administrator password will take some time before it is ready - Amazon says
|
||||
// sometimes
|
||||
// 15 minutes.
|
||||
// So we create a predicate that tests if the password is ready, and wrap it in a retryable
|
||||
// predicate.
|
||||
final AtomicReference<PasswordData> data = new AtomicReference<PasswordData>();
|
||||
Predicate<String> passwordReady = new Predicate<String>() {
|
||||
@Override
|
||||
public boolean apply(@Nullable String s) {
|
||||
if (Strings.isNullOrEmpty(s))
|
||||
return false;
|
||||
data.set(windowsApi.getPasswordDataForInstance(instance.getId()));
|
||||
if (data.get() == null)
|
||||
return false;
|
||||
return !Strings.isNullOrEmpty(data.get().getPasswordData());
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: parameterize
|
||||
RetryablePredicate<String> passwordReadyRetryable = new RetryablePredicate<String>(passwordReady, 600, 10,
|
||||
TimeUnit.SECONDS);
|
||||
logger.debug(">> awaiting password data for instance(%s/%s)", instance.getRegion(), instance.getId());
|
||||
if (passwordReadyRetryable.apply(instance.getId())) {
|
||||
credentials = pwDataToLoginCredentials.apply(new PasswordDataAndPrivateKey(data.get(), privateKey));
|
||||
logger.debug("<< obtained password data for instance(%s/%s)", instance.getRegion(), instance.getId());
|
||||
} else {
|
||||
logger.debug("<< unable to get password data for instance(%s/%s)", instance.getRegion(), instance.getId());
|
||||
}
|
||||
return credentials;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
String getPrivateKeyOrNull(RunningInstance instance) {
|
||||
KeyPair keyPair = credentialsMap.get(new RegionAndName(instance.getRegion(), instance.getKeyName()));
|
||||
return keyPair != null ? keyPair.getKeyMaterial() : null;
|
||||
}
|
||||
|
||||
}
|
|
@ -24,9 +24,9 @@ import static com.google.common.collect.Iterables.filter;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Singleton;
|
||||
|
@ -36,9 +36,9 @@ import org.jclouds.compute.domain.Hardware;
|
|||
import org.jclouds.compute.domain.HardwareBuilder;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.NodeMetadata.Status;
|
||||
import org.jclouds.compute.domain.NodeMetadataBuilder;
|
||||
import org.jclouds.compute.domain.Volume;
|
||||
import org.jclouds.compute.domain.NodeMetadata.Status;
|
||||
import org.jclouds.compute.domain.internal.VolumeImpl;
|
||||
import org.jclouds.compute.functions.GroupNamingConvention;
|
||||
import org.jclouds.domain.Credentials;
|
||||
|
@ -50,7 +50,6 @@ import org.jclouds.ec2.domain.InstanceState;
|
|||
import org.jclouds.ec2.domain.RootDeviceType;
|
||||
import org.jclouds.ec2.domain.RunningInstance;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.util.InetAddresses2;
|
||||
import org.jclouds.util.InetAddresses2.IsPrivateIPAddress;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
@ -61,10 +60,10 @@ import com.google.common.base.Supplier;
|
|||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSet.Builder;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.collect.ImmutableSet.Builder;
|
||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class WindowsLoginCredentialsFromEncryptedData implements Function<Passwo
|
|||
|
||||
@Override
|
||||
public LoginCredentials apply(@Nullable PasswordDataAndPrivateKey dataAndKey) {
|
||||
if(dataAndKey == null)
|
||||
if (dataAndKey == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
|
@ -69,10 +69,10 @@ public class WindowsLoginCredentialsFromEncryptedData implements Function<Passwo
|
|||
String password = new String(plainText, Charset.forName("ASCII"));
|
||||
|
||||
return LoginCredentials.builder()
|
||||
.user("Administrator")
|
||||
.password(password)
|
||||
.noPrivateKey()
|
||||
.build();
|
||||
.user("Administrator")
|
||||
.password(password)
|
||||
.noPrivateKey()
|
||||
.build();
|
||||
} catch(Exception e) {
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
|
|
|
@ -18,11 +18,12 @@
|
|||
*/
|
||||
package org.jclouds.ec2.compute.options;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -37,8 +38,11 @@ import org.jclouds.javax.annotation.Nullable;
|
|||
import org.jclouds.scriptbuilder.domain.Statement;
|
||||
import org.jclouds.util.Preconditions2;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.primitives.Bytes;
|
||||
|
||||
/**
|
||||
* Contains options supported in the {@code ComputeService#runNode} operation on
|
||||
|
@ -86,9 +90,42 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
|
|||
private Set<String> groupNames = ImmutableSet.of();
|
||||
private String keyPair = null;
|
||||
private boolean noKeyPair;
|
||||
private byte[] userData;
|
||||
private List<Byte> userData;
|
||||
private ImmutableSet.Builder<BlockDeviceMapping> blockDeviceMappings = ImmutableSet.builder();
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
EC2TemplateOptions that = EC2TemplateOptions.class.cast(o);
|
||||
return super.equals(that) && equal(this.groupNames, that.groupNames) && equal(this.keyPair, that.keyPair)
|
||||
&& equal(this.noKeyPair, that.noKeyPair) && equal(this.userData, that.userData)
|
||||
&& equal(this.blockDeviceMappings, that.blockDeviceMappings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects
|
||||
.hashCode(super.hashCode(), groupNames, keyPair, noKeyPair, userData, userData, blockDeviceMappings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
ToStringHelper toString = super.string();
|
||||
if (groupNames.size() != 0)
|
||||
toString.add("groupNames", groupNames);
|
||||
if (noKeyPair)
|
||||
toString.add("noKeyPair", noKeyPair);
|
||||
toString.add("keyPair", keyPair);
|
||||
toString.add("userData", userData);
|
||||
ImmutableSet<BlockDeviceMapping> mappings = blockDeviceMappings.build();
|
||||
if (mappings.size() != 0)
|
||||
toString.add("blockDeviceMappings", mappings);
|
||||
return toString;
|
||||
}
|
||||
|
||||
public static final EC2TemplateOptions NONE = new EC2TemplateOptions();
|
||||
|
||||
/**
|
||||
|
@ -116,7 +153,7 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
|
|||
public EC2TemplateOptions userData(byte[] unencodedData) {
|
||||
checkArgument(checkNotNull(unencodedData, "unencodedData").length <= 16 * 1024,
|
||||
"userData cannot be larger than 16kb");
|
||||
this.userData = unencodedData;
|
||||
this.userData = Bytes.asList(unencodedData);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -166,7 +203,7 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
|
|||
return this;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
public static class Builder extends TemplateOptions.Builder {
|
||||
/**
|
||||
* @see EC2TemplateOptions#blockDeviceMappings
|
||||
*/
|
||||
|
@ -315,6 +352,45 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
|
|||
return options.overrideLoginCredentials(credentials);
|
||||
}
|
||||
|
||||
public static EC2TemplateOptions nameTask(String name) {
|
||||
EC2TemplateOptions options = new EC2TemplateOptions();
|
||||
return options.nameTask(name);
|
||||
}
|
||||
|
||||
public static EC2TemplateOptions runAsRoot(boolean value) {
|
||||
EC2TemplateOptions options = new EC2TemplateOptions();
|
||||
return options.runAsRoot(value);
|
||||
}
|
||||
|
||||
public static EC2TemplateOptions tags(Iterable<String> tags) {
|
||||
EC2TemplateOptions options = new EC2TemplateOptions();
|
||||
return options.tags(tags);
|
||||
}
|
||||
|
||||
public static EC2TemplateOptions blockUntilRunning(boolean blockUntilRunning) {
|
||||
EC2TemplateOptions options = new EC2TemplateOptions();
|
||||
return options.blockUntilRunning(blockUntilRunning);
|
||||
}
|
||||
|
||||
public static EC2TemplateOptions runScript(Statement script) {
|
||||
EC2TemplateOptions options = new EC2TemplateOptions();
|
||||
return options.runScript(script);
|
||||
}
|
||||
|
||||
public static EC2TemplateOptions runScript(String script) {
|
||||
EC2TemplateOptions options = new EC2TemplateOptions();
|
||||
return options.runScript(script);
|
||||
}
|
||||
|
||||
public static EC2TemplateOptions userMetadata(String key, String value) {
|
||||
EC2TemplateOptions options = new EC2TemplateOptions();
|
||||
return options.userMetadata(key, value);
|
||||
}
|
||||
|
||||
public static EC2TemplateOptions blockOnComplete(boolean value) {
|
||||
EC2TemplateOptions options = new EC2TemplateOptions();
|
||||
return options.blockOnComplete(value);
|
||||
}
|
||||
}
|
||||
|
||||
// methods that only facilitate returning the correct object type
|
||||
|
@ -447,6 +523,38 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
|
|||
return EC2TemplateOptions.class.cast(super.userMetadata(key, value));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public EC2TemplateOptions runScript(String script) {
|
||||
return EC2TemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public EC2TemplateOptions tags(Iterable<String> tags) {
|
||||
return EC2TemplateOptions.class.cast(super.tags(tags));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public EC2TemplateOptions wrapInInitScript(boolean wrapInInitScript) {
|
||||
return EC2TemplateOptions.class.cast(super.wrapInInitScript(wrapInInitScript));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public EC2TemplateOptions blockOnComplete(boolean blockOnComplete) {
|
||||
return EC2TemplateOptions.class.cast(super.blockOnComplete(blockOnComplete));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return groupNames the user specified to run instances with, or zero
|
||||
* length set to create an implicit group
|
||||
|
@ -474,7 +582,7 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
|
|||
* @return unencoded user data.
|
||||
*/
|
||||
public byte[] getUserData() {
|
||||
return userData;
|
||||
return userData == null ? null : Bytes.toArray(userData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -484,53 +592,4 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
|
|||
return blockDeviceMappings.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((blockDeviceMappings == null) ? 0 : blockDeviceMappings.hashCode());
|
||||
result = prime * result + ((groupNames == null) ? 0 : groupNames.hashCode());
|
||||
result = prime * result + ((keyPair == null) ? 0 : keyPair.hashCode());
|
||||
result = prime * result + (noKeyPair ? 1231 : 1237);
|
||||
result = prime * result + Arrays.hashCode(userData);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (!super.equals(obj))
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
EC2TemplateOptions other = (EC2TemplateOptions) obj;
|
||||
if (blockDeviceMappings == null) {
|
||||
if (other.blockDeviceMappings != null)
|
||||
return false;
|
||||
} else if (!blockDeviceMappings.equals(other.blockDeviceMappings))
|
||||
return false;
|
||||
if (groupNames == null) {
|
||||
if (other.groupNames != null)
|
||||
return false;
|
||||
} else if (!groupNames.equals(other.groupNames))
|
||||
return false;
|
||||
if (keyPair == null) {
|
||||
if (other.keyPair != null)
|
||||
return false;
|
||||
} else if (!keyPair.equals(other.keyPair))
|
||||
return false;
|
||||
|
||||
if (!Arrays.equals(userData, other.userData))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[groupNames=" + groupNames + ", keyPair=" + keyPair + ", noKeyPair=" + noKeyPair + ", userData="
|
||||
+ Arrays.toString(userData) + ", blockDeviceMappings=" + blockDeviceMappings.build() + "]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,10 +39,13 @@ import org.jclouds.compute.config.CustomizationResponse;
|
|||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import static org.jclouds.compute.functions.DefaultCredentialsFromImageOrOverridingCredentials.*;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.compute.strategy.CreateNodesInGroupThenAddToSet;
|
||||
import org.jclouds.compute.util.ComputeUtils;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.ec2.EC2Client;
|
||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||
import org.jclouds.ec2.compute.predicates.InstancePresent;
|
||||
|
@ -57,9 +60,9 @@ import com.google.common.base.Joiner;
|
|||
import com.google.common.base.Predicate;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSet.Builder;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.ImmutableSet.Builder;
|
||||
|
||||
/**
|
||||
* creates futures that correlate to
|
||||
|
@ -91,12 +94,10 @@ public class EC2CreateNodesInGroupThenAddToSet implements CreateNodesInGroupThen
|
|||
@VisibleForTesting
|
||||
final ComputeUtils utils;
|
||||
final InstancePresent instancePresent;
|
||||
final LoadingCache<RunningInstance, Credentials> instanceToCredentials;
|
||||
final LoadingCache<RunningInstance, LoginCredentials> instanceToCredentials;
|
||||
final Map<String, Credentials> credentialStore;
|
||||
final Provider<TemplateBuilder> templateBuilderProvider;
|
||||
|
||||
|
||||
|
||||
@Inject
|
||||
protected EC2CreateNodesInGroupThenAddToSet(
|
||||
EC2Client client,
|
||||
|
@ -106,7 +107,7 @@ public class EC2CreateNodesInGroupThenAddToSet implements CreateNodesInGroupThen
|
|||
Provider<TemplateBuilder> templateBuilderProvider,
|
||||
CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize,
|
||||
InstancePresent instancePresent, Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata,
|
||||
LoadingCache<RunningInstance, Credentials> instanceToCredentials, Map<String, Credentials> credentialStore,
|
||||
LoadingCache<RunningInstance, LoginCredentials> instanceToCredentials, Map<String, Credentials> credentialStore,
|
||||
ComputeUtils utils) {
|
||||
this.client = checkNotNull(client, "client");
|
||||
this.elasticIpCache = checkNotNull(elasticIpCache, "elasticIpCache");
|
||||
|
@ -147,7 +148,7 @@ public class EC2CreateNodesInGroupThenAddToSet implements CreateNodesInGroupThen
|
|||
logger.debug("<< started instances(%s)", idsString);
|
||||
all(ids, instancePresent);
|
||||
logger.debug("<< present instances(%s)", idsString);
|
||||
populateCredentials(started);
|
||||
populateCredentials(started, template.getOptions());
|
||||
}
|
||||
|
||||
assignElasticIpsToInstances(ips, started);
|
||||
|
@ -156,13 +157,14 @@ public class EC2CreateNodesInGroupThenAddToSet implements CreateNodesInGroupThen
|
|||
runningInstanceToNodeMetadata), goodNodes, badNodes, customizationResponses);
|
||||
}
|
||||
|
||||
protected void populateCredentials(Iterable<? extends RunningInstance> started) {
|
||||
Credentials credentials = null;
|
||||
protected void populateCredentials(Iterable<? extends RunningInstance> started, TemplateOptions options) {
|
||||
LoginCredentials credentials = null;
|
||||
for (RunningInstance instance : started) {
|
||||
credentials = instanceToCredentials.apply(instance);
|
||||
if (credentials != null)
|
||||
break;
|
||||
}
|
||||
credentials = overrideDefaultCredentialsWithOptionsIfPresent(credentials, options);
|
||||
if (credentials != null)
|
||||
for (RunningInstance instance : started)
|
||||
credentialStore.put("node#" + instance.getRegion() + "/" + instance.getId(), credentials);
|
||||
|
|
|
@ -23,6 +23,8 @@ import java.util.Map;
|
|||
import org.jclouds.aws.config.WithZonesFormSigningRestClientModule;
|
||||
import org.jclouds.ec2.EC2AsyncClient;
|
||||
import org.jclouds.ec2.EC2Client;
|
||||
import org.jclouds.ec2.features.WindowsApi;
|
||||
import org.jclouds.ec2.features.WindowsAsyncApi;
|
||||
import org.jclouds.ec2.services.AMIAsyncClient;
|
||||
import org.jclouds.ec2.services.AMIClient;
|
||||
import org.jclouds.ec2.services.AvailabilityZoneAndRegionAsyncClient;
|
||||
|
@ -73,6 +75,7 @@ public class EC2RestClientModule<S extends EC2Client, A extends EC2AsyncClient>
|
|||
.put(WindowsClient.class, WindowsAsyncClient.class)//
|
||||
.put(AvailabilityZoneAndRegionClient.class, AvailabilityZoneAndRegionAsyncClient.class)//
|
||||
.put(ElasticBlockStoreClient.class, ElasticBlockStoreAsyncClient.class)//
|
||||
.put(WindowsApi.class, WindowsAsyncApi.class)//
|
||||
.build();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -103,7 +103,7 @@ public class BundleInstanceS3Storage {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[ccessKeyId=" + ccessKeyId + ", bucket=" + bucket + ", prefix=" + prefix + ", secreAccessKey="
|
||||
return "[ccessKeyId=" + ccessKeyId + ", bucket=" + bucket + ", prefix=" + prefix + ", secretAccessKey="
|
||||
+ secretAccessKey + ", uploadPolicy=" + uploadPolicy + ", uploadPolicySignature=" + uploadPolicySignature
|
||||
+ "]";
|
||||
}
|
||||
|
|
|
@ -186,4 +186,17 @@ public class InstanceType {
|
|||
*/
|
||||
public static final String CC2_8XLARGE = "cc2.8xlarge";
|
||||
|
||||
/**
|
||||
* High I/O Quadruple Extra Large specifications
|
||||
* <ul>
|
||||
* <li>60.5 GB of memory</li>
|
||||
* <li>35 EC2 Compute Units (16 virtual cores)</li>
|
||||
* <li>2 SSD-based volumes each with 1024 GB of instance storage</li>
|
||||
* <li>64-bit platform</li>
|
||||
* <li>I/O Performance: Very High (10 Gigabit Ethernet)</li>
|
||||
* <li>Storage I/O Performance: Very High**</li>
|
||||
* </ul>
|
||||
*/
|
||||
public static final String HI1_4XLARGE = "hi1.4xlarge";
|
||||
|
||||
}
|
||||
|
|
|
@ -18,11 +18,26 @@
|
|||
*/
|
||||
package org.jclouds.ec2.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Holds the encrypted Windows Administrator password for an instance.
|
||||
*
|
||||
* The encrypted administrator password for an instance running Windows.
|
||||
*
|
||||
* <h4>Note</h4>
|
||||
*
|
||||
* The Windows password is only generated the first time an AMI is launched. It is not generated for
|
||||
* rebundled AMIs or after the password is changed on an instance.
|
||||
*
|
||||
* The password is encrypted using the key pair that you provided.
|
||||
*
|
||||
* @see <a
|
||||
* href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-GetPasswordData.html"
|
||||
* >doc</a>
|
||||
*
|
||||
* @author Richard Downer
|
||||
*/
|
||||
public class PasswordData {
|
||||
|
@ -31,99 +46,110 @@ public class PasswordData {
|
|||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromPasswordData(this);
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private String requestId;
|
||||
private String instanceId;
|
||||
private Date timestamp;
|
||||
private String passwordData;
|
||||
|
||||
private Builder() {}
|
||||
|
||||
public Builder requestId(String requestId) {
|
||||
this.requestId = requestId;
|
||||
return this;
|
||||
}
|
||||
protected String instanceId;
|
||||
protected Date timestamp;
|
||||
protected String passwordData;
|
||||
|
||||
/**
|
||||
* @see PasswordData#getInstanceId()
|
||||
*/
|
||||
public Builder instanceId(String instanceId) {
|
||||
this.instanceId = instanceId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see PasswordData#getTimestamp()
|
||||
*/
|
||||
public Builder timestamp(Date timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see PasswordData#getPasswordData()
|
||||
*/
|
||||
public Builder passwordData(String passwordData) {
|
||||
this.passwordData = passwordData;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PasswordData build() {
|
||||
return new PasswordData(requestId, instanceId, timestamp, passwordData);
|
||||
return new PasswordData(instanceId, timestamp, passwordData);
|
||||
}
|
||||
|
||||
public Builder fromPasswordData(PasswordData in) {
|
||||
return this.instanceId(in.getInstanceId()).timestamp(in.getTimestamp()).passwordData(in.getPasswordData());
|
||||
}
|
||||
}
|
||||
|
||||
private String requestId;
|
||||
private String instanceId;
|
||||
private Date timestamp;
|
||||
private String passwordData;
|
||||
protected final String instanceId;
|
||||
protected final Date timestamp;
|
||||
protected final String passwordData;
|
||||
|
||||
public PasswordData(String requestId, String instanceId, Date timestamp, String passwordData) {
|
||||
this.requestId = requestId;
|
||||
this.instanceId = instanceId;
|
||||
this.timestamp = timestamp;
|
||||
this.passwordData = passwordData;
|
||||
}
|
||||
|
||||
public String getRequestId() {
|
||||
return requestId;
|
||||
protected PasswordData(String instanceId, Date timestamp, String passwordData) {
|
||||
this.instanceId = checkNotNull(instanceId, "instanceId");
|
||||
this.timestamp = checkNotNull(timestamp, "timestamp");
|
||||
this.passwordData = checkNotNull(passwordData, "passwordData");
|
||||
}
|
||||
|
||||
/**
|
||||
* The ID of the instance.
|
||||
*/
|
||||
public String getInstanceId() {
|
||||
return instanceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* The time the data was last updated.
|
||||
*/
|
||||
public Date getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* The password of the instance.
|
||||
*/
|
||||
public String getPasswordData() {
|
||||
return passwordData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
PasswordData that = (PasswordData) o;
|
||||
|
||||
if (instanceId != null ? !instanceId.equals(that.instanceId) : that.instanceId != null) return false;
|
||||
if (passwordData != null ? !passwordData.equals(that.passwordData) : that.passwordData != null) return false;
|
||||
if (requestId != null ? !requestId.equals(that.requestId) : that.requestId != null) return false;
|
||||
if (timestamp != null ? !timestamp.equals(that.timestamp) : that.timestamp != null) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = requestId != null ? requestId.hashCode() : 0;
|
||||
result = 31 * result + (instanceId != null ? instanceId.hashCode() : 0);
|
||||
result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0);
|
||||
result = 31 * result + (passwordData != null ? passwordData.hashCode() : 0);
|
||||
return result;
|
||||
return Objects.hashCode(instanceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
PasswordData other = PasswordData.class.cast(obj);
|
||||
return Objects.equal(this.instanceId, other.instanceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PasswordData{" +
|
||||
"requestId='" + requestId + '\'' +
|
||||
", instanceId='" + instanceId + '\'' +
|
||||
", timestamp=" + timestamp +
|
||||
", passwordData='" + passwordData + '\'' +
|
||||
'}';
|
||||
return Objects.toStringHelper(this).omitNullValues().add("instanceId", instanceId).add("timestamp", timestamp)
|
||||
.add("passwordData", passwordData).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ec2.features;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.ec2.domain.PasswordData;
|
||||
|
||||
import com.google.common.annotations.Beta;
|
||||
|
||||
/**
|
||||
* Provides access to EC2 Windows Features via the Query API
|
||||
* <p/>
|
||||
*
|
||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference" >doc</a>
|
||||
* @see WindowsAsyncApi
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Timeout(duration = 45, timeUnit = TimeUnit.SECONDS)
|
||||
@Beta
|
||||
public interface WindowsApi {
|
||||
|
||||
/**
|
||||
*
|
||||
* Retrieves the encrypted administrator password for the instances running Windows. <h4>Note</h4>
|
||||
*
|
||||
* The Windows password is only generated the first time an AMI is launched. It is not generated
|
||||
* for rebundled AMIs or after the password is changed on an instance.
|
||||
*
|
||||
* The password is encrypted using the key pair that you provided.
|
||||
*
|
||||
* @param instanceId
|
||||
* The ID of the instance to query
|
||||
* @return password data or null if not available
|
||||
* @see <a href=
|
||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-GetPasswordData.html"
|
||||
* />
|
||||
*/
|
||||
PasswordData getPasswordDataForInstance(String instanceId);
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ec2.features;
|
||||
|
||||
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
||||
|
||||
import javax.ws.rs.FormParam;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
import org.jclouds.aws.filters.FormSigner;
|
||||
import org.jclouds.ec2.domain.PasswordData;
|
||||
import org.jclouds.ec2.xml.GetPasswordDataResponseHandler;
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.FormParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.VirtualHost;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to EC2 Windows Features via the Query API
|
||||
* <p/>
|
||||
*
|
||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference" >doc</a>
|
||||
* @see WindowsAsyncApi
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@RequestFilters(FormSigner.class)
|
||||
@VirtualHost
|
||||
@Beta
|
||||
public interface WindowsAsyncApi {
|
||||
|
||||
/**
|
||||
* @see WindowsApi#getPasswordDataForInstance
|
||||
*/
|
||||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "GetPasswordData")
|
||||
@XMLResponseParser(GetPasswordDataResponseHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<PasswordData> getPasswordDataForInstance(@FormParam("InstanceId") String instanceId);
|
||||
|
||||
}
|
|
@ -24,6 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.crypto.CryptoStreams;
|
||||
import org.jclouds.util.Predicates2;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Function;
|
||||
|
@ -38,35 +39,16 @@ import com.google.common.base.Predicates;
|
|||
*/
|
||||
@Singleton
|
||||
public class EncodedRSAPublicKeyToBase64 implements Function<Object, String> {
|
||||
private static Predicate<Object> startsWith(String value) {
|
||||
return new ToStringStartsWith(value);
|
||||
}
|
||||
|
||||
private static final class ToStringStartsWith implements Predicate<Object> {
|
||||
private final String value;
|
||||
|
||||
private ToStringStartsWith(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Object input) {
|
||||
return input.toString().startsWith(value);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "toStringStartsWith(" + value + ")";
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static final Predicate<Object> ALLOWED_MARKERS = Predicates.or(startsWith("ssh-rsa"),
|
||||
startsWith("-----BEGIN CERTIFICATE-----"), startsWith("---- BEGIN SSH2 PUBLIC KEY ----"));
|
||||
private static final Predicate<String> ALLOWED_MARKERS = Predicates.or(
|
||||
Predicates2.startsWith("ssh-rsa"),
|
||||
Predicates2.startsWith("-----BEGIN CERTIFICATE-----"),
|
||||
Predicates2.startsWith("---- BEGIN SSH2 PUBLIC KEY ----"));
|
||||
|
||||
@Override
|
||||
public String apply(Object from) {
|
||||
checkNotNull(from, "input");
|
||||
checkArgument(ALLOWED_MARKERS.apply(from), "must be a ssh public key, conforming to %s ", ALLOWED_MARKERS);
|
||||
return CryptoStreams.base64(from.toString().getBytes(Charsets.UTF_8));
|
||||
String fromString = from.toString();
|
||||
checkArgument(ALLOWED_MARKERS.apply(fromString), "must be a ssh public key, conforming to %s ", ALLOWED_MARKERS);
|
||||
return CryptoStreams.base64(fromString.getBytes(Charsets.UTF_8));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,8 +112,8 @@ public class RunInstancesOptions extends BaseEC2RequestOptions {
|
|||
|
||||
/**
|
||||
* The ID of the RAM disk with which to launch the instance. Some kernels require additional
|
||||
* drivers at l aunch. Check the kernel requirements for information on whether you need to
|
||||
* specify a RAM disk. To find kernel requirements, go to th e Resource Center and search for the
|
||||
* drivers at launch. Check the kernel requirements for information on whether you need to
|
||||
* specify a RAM disk. To find kernel requirements, go to the Resource Center and search for the
|
||||
* kernel ID.
|
||||
*/
|
||||
public RunInstancesOptions withRamdisk(String ramDiskId) {
|
||||
|
|
|
@ -23,6 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
import java.util.Set;
|
||||
|
||||
import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||
import org.jclouds.util.Predicates2;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
@ -52,13 +53,7 @@ public class BaseEC2RequestOptions extends BaseHttpRequestOptions {
|
|||
|
||||
protected Set<String> getFormValuesWithKeysPrefixedBy(final String prefix) {
|
||||
Builder<String> values = ImmutableSet.builder();
|
||||
for (String key : Iterables.filter(formParameters.keySet(), new Predicate<String>() {
|
||||
|
||||
public boolean apply(String input) {
|
||||
return input.startsWith(prefix);
|
||||
}
|
||||
|
||||
})) {
|
||||
for (String key : Iterables.filter(formParameters.keySet(), Predicates2.startsWith(prefix))) {
|
||||
values.add(Iterables.get(formParameters.get(key), 0));
|
||||
}
|
||||
return values.build();
|
||||
|
|
|
@ -43,7 +43,7 @@ public interface AMIClient {
|
|||
|
||||
/**
|
||||
* Returns information about AMIs, AKIs, and ARIs. This includes image type, product codes,
|
||||
* architecture, and kernel and RAM disk IDs. Images available to you include p ublic images,
|
||||
* architecture, and kernel and RAM disk IDs. Images available to you include public images,
|
||||
* private images that you own, and private images owned by other users for which you have
|
||||
* explicit launch permissions.
|
||||
*
|
||||
|
|
|
@ -53,7 +53,7 @@ public interface WindowsClient {
|
|||
* @param bucket
|
||||
* The bucket in which to store the AMI. You can specify a bucket
|
||||
* that you already own or a new bucket that Amazon EC2 creates on
|
||||
* your behalf. If you specify a bucket that belongs to som eone
|
||||
* your behalf. If you specify a bucket that belongs to someone
|
||||
* else, Amazon EC2 returns an error.
|
||||
* @param uploadPolicy
|
||||
* An Amazon S3 upload policy that gives Amazon EC2 permission to
|
||||
|
|
|
@ -40,7 +40,7 @@ public class DescribeAvailabilityZonesResponseHandler extends ParseSax.HandlerWi
|
|||
private StringBuilder currentText = new StringBuilder();
|
||||
private final Supplier<String> defaultRegion;
|
||||
|
||||
private Set<AvailabilityZoneInfo> availablilityZones = Sets.newLinkedHashSet();
|
||||
private Set<AvailabilityZoneInfo> availabilityZones = Sets.newLinkedHashSet();
|
||||
private String zone;
|
||||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
@ -63,7 +63,7 @@ public class DescribeAvailabilityZonesResponseHandler extends ParseSax.HandlerWi
|
|||
}
|
||||
|
||||
public Set<AvailabilityZoneInfo> getResult() {
|
||||
return availablilityZones;
|
||||
return availabilityZones;
|
||||
}
|
||||
|
||||
public void startElement(String uri, String name, String qName, Attributes attrs) {
|
||||
|
@ -89,7 +89,7 @@ public class DescribeAvailabilityZonesResponseHandler extends ParseSax.HandlerWi
|
|||
} else if (qName.equals("messageSet")) {
|
||||
inMessageSet = false;
|
||||
} else if (qName.equals("item") && !inMessageSet) {
|
||||
availablilityZones.add(new AvailabilityZoneInfo(zone, zoneState, region, messages));
|
||||
availabilityZones.add(new AvailabilityZoneInfo(zone, zoneState, region, messages));
|
||||
this.zone = null;
|
||||
this.region = defaultRegion.get();
|
||||
this.zoneState = null;
|
||||
|
|
|
@ -37,6 +37,7 @@ public class DescribeSnapshotsResponseHandler extends ParseSax.HandlerWithResult
|
|||
|
||||
private Set<Snapshot> snapshots = Sets.newLinkedHashSet();
|
||||
private final SnapshotHandler snapshotHandler;
|
||||
private int itemDepth = 0;
|
||||
|
||||
@Inject
|
||||
public DescribeSnapshotsResponseHandler(SnapshotHandler snapshotHandler) {
|
||||
|
@ -50,13 +51,16 @@ public class DescribeSnapshotsResponseHandler extends ParseSax.HandlerWithResult
|
|||
@Override
|
||||
public void startElement(String uri, String localName, String qName, Attributes attributes)
|
||||
throws SAXException {
|
||||
itemDepth++;
|
||||
snapshotHandler.startElement(uri, localName, qName, attributes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endElement(String uri, String localName, String qName) throws SAXException {
|
||||
snapshotHandler.endElement(uri, localName, qName);
|
||||
if (qName.equals("item")) {
|
||||
itemDepth--;
|
||||
|
||||
if (qName.equals("item") && itemDepth == 2) {
|
||||
this.snapshots.add(snapshotHandler.getResult());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,9 +46,7 @@ public class GetPasswordDataResponseHandler extends ParseSax.HandlerWithResult<P
|
|||
}
|
||||
|
||||
public void endElement(String uri, String name, String qName) {
|
||||
if (qName.equals("requestId")) {
|
||||
builder.requestId(currentText.toString().trim());
|
||||
} else if (qName.equals("instanceId")) {
|
||||
if (qName.equals("instanceId")) {
|
||||
builder.instanceId(currentText.toString().trim());
|
||||
} else if (qName.equals("timestamp")) {
|
||||
builder.timestamp(dateCodec.toDate(currentText.toString().trim()));
|
||||
|
|
|
@ -0,0 +1,259 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ec2.compute;
|
||||
import static org.jclouds.ec2.compute.options.EC2TemplateOptions.Builder.blockUntilRunning;
|
||||
import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.ec2.compute.internal.BaseEC2ComputeServiceExpectTest;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableMap.Builder;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Tests the compute service abstraction of the EC2 api.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "EC2ComputeServiceExpectTest")
|
||||
public class EC2ComputeServiceExpectTest extends BaseEC2ComputeServiceExpectTest {
|
||||
|
||||
static String region = "us-east-1";
|
||||
|
||||
@Override
|
||||
protected Properties setupProperties() {
|
||||
Properties properties = super.setupProperties();
|
||||
properties.setProperty(PROPERTY_REGIONS, region);
|
||||
properties.setProperty(provider + ".template", "osDescriptionMatches=.*fedora.*");
|
||||
return properties;
|
||||
}
|
||||
|
||||
private HttpRequest describeAvailabilityZonesRequest;
|
||||
private HttpResponse describeAvailabilityZonesResponse;
|
||||
private HttpRequest describeImagesRequest;
|
||||
private HttpResponse describeImagesResponse;
|
||||
private HttpRequest createKeyPairRequest;
|
||||
private HttpResponse createKeyPairResponse;
|
||||
private HttpRequest createSecurityGroupRequest;
|
||||
private HttpResponse createSecurityGroupResponse;
|
||||
private HttpRequest describeSecurityGroupRequest;
|
||||
private HttpResponse describeSecurityGroupResponse;
|
||||
private HttpRequest authorizeSecurityGroupIngressRequest22;
|
||||
private HttpResponse authorizeSecurityGroupIngressResponse;
|
||||
private HttpRequest authorizeSecurityGroupIngressRequestGroup;
|
||||
private HttpRequest runInstancesRequest;
|
||||
private HttpResponse runInstancesResponse;
|
||||
private HttpRequest describeInstanceRequest;
|
||||
private HttpResponse describeInstanceResponse;
|
||||
private HttpRequest describeImageRequest;
|
||||
|
||||
public EC2ComputeServiceExpectTest() {
|
||||
describeAvailabilityZonesRequest =
|
||||
formSigner.filter(HttpRequest.builder()
|
||||
.method("POST")
|
||||
.endpoint("https://ec2." + region + ".amazonaws.com/")
|
||||
.addHeader("Host", "ec2." + region + ".amazonaws.com")
|
||||
.addFormParam("Action", "DescribeAvailabilityZones").build());
|
||||
|
||||
describeAvailabilityZonesResponse =
|
||||
HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType(
|
||||
"/availabilityZones-" + region + ".xml", MediaType.APPLICATION_XML)).build();
|
||||
describeImagesRequest =
|
||||
formSigner.filter(HttpRequest.builder()
|
||||
.method("POST")
|
||||
.endpoint("https://ec2." + region + ".amazonaws.com/")
|
||||
.addHeader("Host", "ec2." + region + ".amazonaws.com")
|
||||
.addFormParam("Action", "DescribeImages").build());
|
||||
|
||||
describeImagesResponse =
|
||||
HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType(
|
||||
"/describe_images.xml", MediaType.APPLICATION_XML)).build();
|
||||
|
||||
createKeyPairRequest =
|
||||
formSigner.filter(HttpRequest.builder()
|
||||
.method("POST")
|
||||
.endpoint("https://ec2." + region + ".amazonaws.com/")
|
||||
.addHeader("Host", "ec2." + region + ".amazonaws.com")
|
||||
.addFormParam("Action", "CreateKeyPair")
|
||||
.addFormParam("KeyName", "jclouds#test#0").build());
|
||||
|
||||
createKeyPairResponse =
|
||||
HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType(
|
||||
"/create_keypair.xml", MediaType.APPLICATION_XML)).build();
|
||||
|
||||
createSecurityGroupRequest =
|
||||
formSigner.filter(HttpRequest.builder()
|
||||
.method("POST")
|
||||
.endpoint("https://ec2." + region + ".amazonaws.com/")
|
||||
.addHeader("Host", "ec2." + region + ".amazonaws.com")
|
||||
.addFormParam("Action", "CreateSecurityGroup")
|
||||
.addFormParam("GroupDescription", "jclouds#test")
|
||||
.addFormParam("GroupName", "jclouds#test").build());
|
||||
|
||||
createSecurityGroupResponse =
|
||||
HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType(
|
||||
"/created_securitygroup.xml", MediaType.APPLICATION_XML)).build();
|
||||
|
||||
describeSecurityGroupRequest =
|
||||
formSigner.filter(HttpRequest.builder()
|
||||
.method("POST")
|
||||
.endpoint("https://ec2." + region + ".amazonaws.com/")
|
||||
.addHeader("Host", "ec2." + region + ".amazonaws.com")
|
||||
.addFormParam("Action", "DescribeSecurityGroups")
|
||||
.addFormParam("GroupName.1", "jclouds#test").build());
|
||||
|
||||
describeSecurityGroupResponse =
|
||||
HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType(
|
||||
"/new_securitygroup.xml", MediaType.APPLICATION_XML)).build();
|
||||
|
||||
authorizeSecurityGroupIngressRequest22 =
|
||||
formSigner.filter(HttpRequest.builder()
|
||||
.method("POST")
|
||||
.endpoint("https://ec2." + region + ".amazonaws.com/")
|
||||
.addHeader("Host", "ec2." + region + ".amazonaws.com")
|
||||
.addFormParam("Action", "AuthorizeSecurityGroupIngress")
|
||||
.addFormParam("CidrIp", "0.0.0.0/0")
|
||||
.addFormParam("FromPort", "22")
|
||||
.addFormParam("ToPort", "22")
|
||||
.addFormParam("GroupName", "jclouds#test")
|
||||
.addFormParam("IpProtocol", "tcp").build());
|
||||
|
||||
authorizeSecurityGroupIngressRequestGroup =
|
||||
formSigner.filter(HttpRequest.builder()
|
||||
.method("POST")
|
||||
.endpoint("https://ec2." + region + ".amazonaws.com/")
|
||||
.addHeader("Host", "ec2." + region + ".amazonaws.com")
|
||||
.addFormParam("Action", "AuthorizeSecurityGroupIngress")
|
||||
.addFormParam("SourceSecurityGroupName", "jclouds#test")
|
||||
.addFormParam("SourceSecurityGroupOwnerId", "993194456877")
|
||||
.addFormParam("GroupName", "jclouds#test").build());
|
||||
|
||||
authorizeSecurityGroupIngressResponse =
|
||||
HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType(
|
||||
"/authorize_securitygroup_ingress_response.xml", MediaType.APPLICATION_XML)).build();
|
||||
|
||||
|
||||
runInstancesRequest =
|
||||
formSigner.filter(HttpRequest.builder()
|
||||
.method("POST")
|
||||
.endpoint("https://ec2." + region + ".amazonaws.com/")
|
||||
.addHeader("Host", "ec2." + region + ".amazonaws.com")
|
||||
.addFormParam("Action", "RunInstances")
|
||||
.addFormParam("ImageId", "ami-be3adfd7")
|
||||
.addFormParam("InstanceType", "m1.small")
|
||||
.addFormParam("KeyName", "jclouds#test#0")
|
||||
.addFormParam("MaxCount", "1")
|
||||
.addFormParam("MinCount", "1")
|
||||
.addFormParam("SecurityGroup.1", "jclouds#test").build());
|
||||
|
||||
runInstancesResponse =
|
||||
HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType(
|
||||
"/new_instance.xml", MediaType.APPLICATION_XML)).build();
|
||||
|
||||
describeInstanceRequest =
|
||||
formSigner.filter(HttpRequest.builder()
|
||||
.method("POST")
|
||||
.endpoint("https://ec2." + region + ".amazonaws.com/")
|
||||
.addHeader("Host", "ec2." + region + ".amazonaws.com")
|
||||
.addFormParam("Action", "DescribeInstances")
|
||||
.addFormParam("InstanceId.1", "i-2baa5550").build());
|
||||
|
||||
describeInstanceResponse =
|
||||
HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType(
|
||||
"/describe_instances_running-1.xml", MediaType.APPLICATION_XML)).build();
|
||||
|
||||
//TODO: duplicate.. shouldn't need this
|
||||
describeImageRequest =
|
||||
formSigner.filter(HttpRequest.builder()
|
||||
.method("POST")
|
||||
.endpoint("https://ec2." + region + ".amazonaws.com/")
|
||||
.addHeader("Host", "ec2." + region + ".amazonaws.com")
|
||||
.addFormParam("ImageId.1", "ami-aecd60c7")
|
||||
.addFormParam("Action", "DescribeImages").build());
|
||||
}
|
||||
|
||||
public void testCreateNodeWithGeneratedKeyPairAndOverriddenLoginUser() throws Exception {
|
||||
Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
|
||||
requestResponseMap.put(describeRegionsRequest, describeRegionsResponse);
|
||||
requestResponseMap.put(describeAvailabilityZonesRequest, describeAvailabilityZonesResponse);
|
||||
requestResponseMap.put(describeImagesRequest, describeImagesResponse);
|
||||
requestResponseMap.put(createKeyPairRequest, createKeyPairResponse);
|
||||
requestResponseMap.put(createSecurityGroupRequest, createSecurityGroupResponse);
|
||||
requestResponseMap.put(describeSecurityGroupRequest, describeSecurityGroupResponse);
|
||||
requestResponseMap.put(authorizeSecurityGroupIngressRequest22, authorizeSecurityGroupIngressResponse);
|
||||
requestResponseMap.put(authorizeSecurityGroupIngressRequestGroup, authorizeSecurityGroupIngressResponse);
|
||||
requestResponseMap.put(runInstancesRequest, runInstancesResponse);
|
||||
requestResponseMap.put(describeInstanceRequest, describeInstanceResponse);
|
||||
requestResponseMap.put(describeImageRequest, describeImagesResponse);
|
||||
|
||||
ComputeService apiThatCreatesNode = requestsSendResponses(requestResponseMap.build());
|
||||
|
||||
NodeMetadata node = Iterables.getOnlyElement(apiThatCreatesNode.createNodesInGroup("test", 1,
|
||||
blockUntilRunning(false).overrideLoginUser("ec2-user")));
|
||||
assertEquals(node.getCredentials().getUser(), "ec2-user");
|
||||
System.out.println(node.getImageId());
|
||||
assertNotNull(node.getCredentials().getPrivateKey());
|
||||
}
|
||||
|
||||
//FIXME - issue-1051
|
||||
@Test(enabled = false)
|
||||
public void testCreateNodeWithGeneratedKeyPairAndOverriddenLoginUserWithTemplateBuilder() throws Exception {
|
||||
Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
|
||||
requestResponseMap.put(describeRegionsRequest, describeRegionsResponse);
|
||||
requestResponseMap.put(describeAvailabilityZonesRequest, describeAvailabilityZonesResponse);
|
||||
requestResponseMap.put(describeImagesRequest, describeImagesResponse);
|
||||
requestResponseMap.put(createKeyPairRequest, createKeyPairResponse);
|
||||
requestResponseMap.put(createSecurityGroupRequest, createSecurityGroupResponse);
|
||||
requestResponseMap.put(describeSecurityGroupRequest, describeSecurityGroupResponse);
|
||||
requestResponseMap.put(authorizeSecurityGroupIngressRequest22, authorizeSecurityGroupIngressResponse);
|
||||
requestResponseMap.put(authorizeSecurityGroupIngressRequestGroup, authorizeSecurityGroupIngressResponse);
|
||||
requestResponseMap.put(runInstancesRequest, runInstancesResponse);
|
||||
requestResponseMap.put(describeInstanceRequest, describeInstanceResponse);
|
||||
requestResponseMap.put(describeImageRequest, describeImagesResponse);
|
||||
|
||||
ComputeService apiThatCreatesNode = requestsSendResponses(requestResponseMap.build());
|
||||
|
||||
NodeMetadata node = Iterables.getOnlyElement(
|
||||
apiThatCreatesNode.createNodesInGroup("test", 1,
|
||||
apiThatCreatesNode.templateBuilder().from("osDescriptionMatches=.*fedora.*,loginUser=ec2-user").build()));
|
||||
assertEquals(node.getCredentials().getUser(), "ec2-user");
|
||||
assertNotNull(node.getCredentials().getPrivateKey());
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ec2.compute.functions;
|
||||
|
||||
import static org.jclouds.compute.options.TemplateOptions.Builder.inboundPorts;
|
||||
import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.domain.TemplateBuilderSpec;
|
||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.compute.predicates.NodePredicates;
|
||||
import org.jclouds.encryption.bouncycastle.config.BouncyCastleCryptoModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code WindowsApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", singleThreaded = true, testName = "PasswordCredentialsFromWindowsInstanceLiveTest")
|
||||
public class PasswordCredentialsFromWindowsInstanceLiveTest extends BaseComputeServiceContextLiveTest {
|
||||
protected TemplateBuilderSpec windowsTemplate;
|
||||
|
||||
public PasswordCredentialsFromWindowsInstanceLiveTest() {
|
||||
provider = "ec2";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Properties setupProperties() {
|
||||
Properties overrides = super.setupProperties();
|
||||
String windowsSpec = setIfTestSystemPropertyPresent(overrides, provider + ".windows-template");
|
||||
if (Strings.emptyToNull(windowsSpec) != null) {
|
||||
windowsTemplate = TemplateBuilderSpec.parse(windowsSpec);
|
||||
}
|
||||
String windowsOwner = setIfTestSystemPropertyPresent(overrides, provider + ".windows-owner");
|
||||
if (Strings.emptyToNull(windowsOwner) != null) {
|
||||
overrides.setProperty(PROPERTY_EC2_AMI_OWNERS, windowsOwner);
|
||||
}
|
||||
return overrides;
|
||||
}
|
||||
|
||||
// TODO: refactor so that we don't need to use bouncycastle
|
||||
@Override
|
||||
protected Iterable<Module> setupModules() {
|
||||
return ImmutableSet.<Module> builder().addAll(super.setupModules()).add(new BouncyCastleCryptoModule()).build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWindowsAdminWorks() throws Exception {
|
||||
String group = "winadm";
|
||||
// Spin up a new node. Make sure to open the RDP port 3389
|
||||
Template template = view.getComputeService().templateBuilder().from(windowsTemplate).options(inboundPorts(3389))
|
||||
.build();
|
||||
try {
|
||||
NodeMetadata node = Iterables.getOnlyElement(view.getComputeService().createNodesInGroup(group, 1, template));
|
||||
assertEquals(node.getCredentials().getUser(), "Administrator");
|
||||
assertFalse(Strings.isNullOrEmpty(node.getCredentials().getPassword()));
|
||||
} finally {
|
||||
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -22,6 +22,8 @@ import static org.testng.Assert.assertEquals;
|
|||
import static org.testng.Assert.assertFalse;
|
||||
|
||||
import org.jclouds.crypto.Crypto;
|
||||
import org.jclouds.date.DateService;
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.ec2.compute.domain.PasswordDataAndPrivateKey;
|
||||
import org.jclouds.ec2.domain.PasswordData;
|
||||
|
@ -58,12 +60,17 @@ public class WindowsLoginCredentialsFromEncryptedDataTest {
|
|||
"-----END RSA PRIVATE KEY-----";
|
||||
private static final String ENCRYPTED_PASSWORD = "gO1oMoIjjIifv2iqcfIKiQD7ziOTVXsuaBJFEQrZdb8uJH/LsAiJXZeGKEeXlHl/oMoR3HEIoYuHxl+p5iHdrpP889RmxWBDGOWC5iTUzK6CRa5mFmF1I5Lpt7v2YeVoQWihSM8B19BEdBdY1svQp9nyhPB4AqLDrY28x/OrmRh/qYq953i6Y4Z8c76OHqqGcUYM4ePysRlcizSgQjdkEDmKC10Ak3OFRRx3/LqYsFIMiOHeg47APg+UANNTyRiTIia5FDhSeHJzaeYCBRQ7UYH0z2rg4cX3YjOz/MoznjHiaaN4MO+5N3v84VawnqwKOvlwPyI2bmz0+9Tr6DKzqA==";
|
||||
|
||||
protected final DateService dateService = new SimpleDateFormatDateService();
|
||||
|
||||
@Test
|
||||
public void testApply() throws Exception {
|
||||
Crypto crypto = new BouncyCastleCrypto();
|
||||
WindowsLoginCredentialsFromEncryptedData f = new WindowsLoginCredentialsFromEncryptedData(crypto);
|
||||
|
||||
PasswordData passwordData = PasswordData.builder().passwordData(ENCRYPTED_PASSWORD).build();
|
||||
PasswordData passwordData = PasswordData.builder()
|
||||
.instanceId("i-2574e22a")
|
||||
.timestamp(dateService.iso8601DateParse("2012-07-30T07:27:23.000+0000"))
|
||||
.passwordData(ENCRYPTED_PASSWORD).build();
|
||||
|
||||
LoginCredentials credentials = f.apply(new PasswordDataAndPrivateKey(passwordData, PRIVATE_KEY));
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.jclouds.ec2.compute.internal;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.ec2.internal.BaseEC2ExpectTest;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.inject.Module;
|
||||
|
||||
public abstract class BaseEC2ComputeServiceContextExpectTest<T> extends BaseEC2ExpectTest<T> implements
|
||||
Function<ComputeServiceContext, T> {
|
||||
|
||||
@Override
|
||||
public T createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
|
||||
return apply(createComputeServiceContext(fn, module, props));
|
||||
}
|
||||
|
||||
private ComputeServiceContext createComputeServiceContext(Function<HttpRequest, HttpResponse> fn, Module module,
|
||||
Properties props) {
|
||||
return createInjector(fn, module, props).getInstance(ComputeServiceContext.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.jclouds.ec2.compute.internal;
|
||||
|
||||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
|
||||
public class BaseEC2ComputeServiceExpectTest extends BaseEC2ComputeServiceContextExpectTest<ComputeService> {
|
||||
|
||||
@Override
|
||||
public ComputeService apply(ComputeServiceContext input) {
|
||||
return input.getComputeService();
|
||||
}
|
||||
|
||||
}
|
|
@ -28,7 +28,7 @@ import javax.ws.rs.core.MediaType;
|
|||
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.ec2.compute.BaseEC2ComputeServiceExpectTest;
|
||||
import org.jclouds.ec2.compute.internal.BaseEC2ComputeServiceContextExpectTest;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.predicates.PredicateWithResult;
|
||||
|
@ -42,7 +42,7 @@ import com.google.inject.Injector;
|
|||
* @author David Alves
|
||||
*/
|
||||
@Test(groups = "unit", testName = "GetImageWhenStatusAvailablePredicateWithResultExpectTest")
|
||||
public class GetImageWhenStatusAvailablePredicateWithResultExpectTest extends BaseEC2ComputeServiceExpectTest<Injector> {
|
||||
public class GetImageWhenStatusAvailablePredicateWithResultExpectTest extends BaseEC2ComputeServiceContextExpectTest<Injector> {
|
||||
|
||||
protected HttpRequest describeRegionsRequest = HttpRequest.builder()
|
||||
.method("POST")
|
||||
|
|
|
@ -33,10 +33,10 @@ import org.jclouds.compute.config.CustomizationResponse;
|
|||
import org.jclouds.compute.domain.Hardware;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.NodeMetadata.Status;
|
||||
import org.jclouds.compute.domain.NodeMetadataBuilder;
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.compute.domain.NodeMetadata.Status;
|
||||
import org.jclouds.compute.predicates.AtomicNodeRunning;
|
||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||
import org.jclouds.compute.util.ComputeUtils;
|
||||
|
@ -44,6 +44,7 @@ import org.jclouds.domain.Credentials;
|
|||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LocationBuilder;
|
||||
import org.jclouds.domain.LocationScope;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.ec2.EC2Client;
|
||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||
import org.jclouds.ec2.compute.functions.RunningInstanceToNodeMetadata;
|
||||
|
@ -116,13 +117,17 @@ public class EC2CreateNodesInGroupThenAddToSetTest {
|
|||
Reservation.class.cast(reservation));
|
||||
expect(instance.getId()).andReturn(instanceCreatedId).atLeastOnce();
|
||||
// simulate a lazy credentials fetch
|
||||
Credentials creds = new Credentials("foo", "bar");
|
||||
LoginCredentials creds = LoginCredentials.builder().user("foo").privateKey("bar").build();
|
||||
expect(strategy.instanceToCredentials.apply(instance)).andReturn(creds);
|
||||
expect(instance.getRegion()).andReturn(region).atLeastOnce();
|
||||
expect(strategy.credentialStore.put("node#" + region + "/" + instanceCreatedId, creds)).andReturn(null);
|
||||
|
||||
expect(strategy.instancePresent.apply(new RegionAndName(region, instanceCreatedId))).andReturn(true);
|
||||
expect(input.template.getOptions()).andReturn(input.options).atLeastOnce();
|
||||
expect(input.options.getLoginUser()).andReturn(null);
|
||||
expect(input.options.getLoginPassword()).andReturn(null);
|
||||
expect(input.options.getLoginPrivateKey()).andReturn(null);
|
||||
expect(input.options.shouldAuthenticateSudo()).andReturn(null);
|
||||
|
||||
expect(
|
||||
strategy.utils.customizeNodesAndAddToGoodMapOrPutExceptionIntoBadMap(eq(input.options),
|
||||
|
@ -213,13 +218,18 @@ public class EC2CreateNodesInGroupThenAddToSetTest {
|
|||
Reservation.class.cast(reservation));
|
||||
expect(instance.getId()).andReturn(instanceCreatedId).atLeastOnce();
|
||||
// simulate a lazy credentials fetch
|
||||
Credentials creds = new Credentials("foo", "bar");
|
||||
LoginCredentials creds = LoginCredentials.builder().user("foo").privateKey("bar").build();
|
||||
expect(strategy.instanceToCredentials.apply(instance)).andReturn(creds);
|
||||
expect(instance.getRegion()).andReturn(region).atLeastOnce();
|
||||
expect(strategy.credentialStore.put("node#" + region + "/" + instanceCreatedId, creds)).andReturn(null);
|
||||
|
||||
expect(strategy.instancePresent.apply(new RegionAndName(region, instanceCreatedId))).andReturn(true);
|
||||
expect(input.template.getOptions()).andReturn(input.options).atLeastOnce();
|
||||
expect(input.options.getLoginUser()).andReturn(null);
|
||||
expect(input.options.getLoginPassword()).andReturn(null);
|
||||
expect(input.options.getLoginPrivateKey()).andReturn(null);
|
||||
expect(input.options.shouldAuthenticateSudo()).andReturn(null);
|
||||
|
||||
|
||||
expect(strategy.runningInstanceToNodeMetadata.apply(instance)).andReturn(nodeMetadata);
|
||||
expect(
|
||||
|
@ -310,7 +320,7 @@ public class EC2CreateNodesInGroupThenAddToSetTest {
|
|||
CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize = createMock(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class);
|
||||
InstancePresent instancePresent = createMock(InstancePresent.class);
|
||||
RunningInstanceToNodeMetadata runningInstanceToNodeMetadata = createMock(RunningInstanceToNodeMetadata.class);
|
||||
LoadingCache<RunningInstance, Credentials> instanceToCredentials = createMock(LoadingCache.class);
|
||||
LoadingCache<RunningInstance, LoginCredentials> instanceToCredentials = createMock(LoadingCache.class);
|
||||
LoadingCache<RegionAndName, String> elasticIpCache = createMock(LoadingCache.class);
|
||||
GetNodeMetadataStrategy nodeRunning = new GetNodeMetadataStrategy(){
|
||||
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unles required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either expres or implied. See the License for the
|
||||
* specific language governing permisions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ec2.features;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNull;
|
||||
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.jclouds.ec2.EC2Client;
|
||||
import org.jclouds.ec2.internal.BaseEC2ExpectTest;
|
||||
import org.jclouds.ec2.parse.GetPasswordDataResponseTest;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "WindowsApiExpectTest")
|
||||
public class WindowsApiExpectTest extends BaseEC2ExpectTest<EC2Client> {
|
||||
|
||||
public WindowsApiExpectTest() {
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
|
||||
}
|
||||
|
||||
HttpRequest get = HttpRequest.builder()
|
||||
.method("POST")
|
||||
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||
.payload(
|
||||
payloadFromStringWithContentType(
|
||||
"Action=GetPasswordData" +
|
||||
"&InstanceId=i-2574e22a" +
|
||||
"&Signature=vX1Tskc4VuBUWPqsJ%2BzcjEj6%2F2iMCKzqjWnKFXRkDdA%3D" +
|
||||
"&SignatureMethod=HmacSHA256" +
|
||||
"&SignatureVersion=2" +
|
||||
"&Timestamp=2012-04-16T15%3A54%3A08.897Z" +
|
||||
"&Version=2010-06-15" +
|
||||
"&AWSAccessKeyId=identity",
|
||||
"application/x-www-form-urlencoded"))
|
||||
.build();
|
||||
|
||||
|
||||
public void testGetPasswordDataWhenResponseIs2xx() throws Exception {
|
||||
|
||||
HttpResponse getResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/get_passworddata.xml", "text/xml")).build();
|
||||
|
||||
EC2Client apiWhenExist = requestSendsResponse(
|
||||
get, getResponse);
|
||||
|
||||
assertEquals(apiWhenExist.getWindowsApi().getPasswordDataForInstance("i-2574e22a").toString(), new GetPasswordDataResponseTest().expected().toString());
|
||||
}
|
||||
|
||||
public void testGetPasswordDataWhenResponseIs404() throws Exception {
|
||||
|
||||
HttpResponse getResponse = HttpResponse.builder().statusCode(404).build();
|
||||
|
||||
EC2Client apiWhenDontExist = requestSendsResponse(
|
||||
get, getResponse);
|
||||
|
||||
assertNull(apiWhenDontExist.getWindowsApi().getPasswordDataForInstance("i-2574e22a"));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ec2.features;
|
||||
|
||||
import org.jclouds.ec2.internal.BaseEC2ClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", testName = "WindowsApiLiveTest")
|
||||
public class WindowsApiLiveTest extends BaseEC2ClientLiveTest {
|
||||
|
||||
|
||||
|
||||
protected WindowsApi api() {
|
||||
return context.getApi().getWindowsApi();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.jclouds.ec2.internal;
|
||||
|
||||
import org.jclouds.apis.BaseContextLiveTest;
|
||||
import org.jclouds.ec2.EC2ApiMetadata;
|
||||
import org.jclouds.ec2.EC2AsyncClient;
|
||||
import org.jclouds.ec2.EC2Client;
|
||||
import org.jclouds.rest.RestContext;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class BaseEC2ClientLiveTest extends BaseContextLiveTest<RestContext<? extends EC2Client, ? extends EC2AsyncClient>> {
|
||||
|
||||
public BaseEC2ClientLiveTest() {
|
||||
provider = "ec2";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TypeToken<RestContext<? extends EC2Client, ? extends EC2AsyncClient>> contextType() {
|
||||
return EC2ApiMetadata.CONTEXT_TOKEN;
|
||||
}
|
||||
|
||||
}
|
|
@ -19,6 +19,7 @@
|
|||
package org.jclouds.ec2.internal;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
|
@ -34,17 +35,21 @@ import org.jclouds.rest.ConfiguresRestClient;
|
|||
import org.jclouds.rest.internal.BaseRestClientExpectTest;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableMap.Builder;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.Provides;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
||||
public abstract class BaseEC2ExpectTest<T> extends BaseRestClientExpectTest<T> {
|
||||
protected static final String CONSTANT_DATE = "2012-04-16T15:54:08.897Z";
|
||||
|
||||
protected DateService dateService = new SimpleDateFormatDateService();
|
||||
|
||||
protected FormSigner formSigner;
|
||||
|
||||
protected HttpRequest describeRegionsRequest = HttpRequest.builder()
|
||||
.method("POST")
|
||||
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||
|
@ -52,15 +57,17 @@ public abstract class BaseEC2ExpectTest<T> extends BaseRestClientExpectTest<T> {
|
|||
.payload(payloadFromStringWithContentType(
|
||||
"Action=DescribeRegions&Signature=s5OXKqaaeKhJW5FVrRntuMsUL4Ed5fjzgUWeukU96ko%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-04-16T15%3A54%3A08.897Z&Version=2010-06-15&AWSAccessKeyId=identity",
|
||||
MediaType.APPLICATION_FORM_URLENCODED)).build();
|
||||
|
||||
protected HttpResponse describeRegionsResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/regionEndpoints-all.xml", MediaType.APPLICATION_XML))
|
||||
.build();
|
||||
|
||||
protected final Map<HttpRequest, HttpResponse> describeAvailabilityZonesRequestResponse;
|
||||
|
||||
|
||||
public BaseEC2ExpectTest() {
|
||||
provider = "ec2";
|
||||
FormSigner formSigner = createInjector(Functions.forMap(ImmutableMap.<HttpRequest, HttpResponse> of()),
|
||||
formSigner = createInjector(Functions.forMap(ImmutableMap.<HttpRequest, HttpResponse> of()),
|
||||
createModule(), setupProperties()).getInstance(FormSigner.class);
|
||||
Builder<HttpRequest, HttpResponse> builder = ImmutableMap.<HttpRequest, HttpResponse> builder();
|
||||
for (String region : ImmutableSet.of("ap-northeast-1", "ap-southeast-1", "eu-west-1", "sa-east-1", "us-east-1", "us-west-1", "us-west-2")){
|
||||
|
@ -81,7 +88,24 @@ public abstract class BaseEC2ExpectTest<T> extends BaseRestClientExpectTest<T> {
|
|||
}
|
||||
|
||||
@ConfiguresRestClient
|
||||
private static final class TestEC2RestClientModule extends EC2RestClientModule<EC2Client, EC2AsyncClient> {
|
||||
protected static class TestEC2RestClientModule extends EC2RestClientModule<EC2Client, EC2AsyncClient> {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
super.configure();
|
||||
// predicatable node names
|
||||
final AtomicInteger suffix = new AtomicInteger();
|
||||
bind(new TypeLiteral<Supplier<String>>() {
|
||||
}).toInstance(new Supplier<String>() {
|
||||
|
||||
@Override
|
||||
public String get() {
|
||||
return suffix.getAndIncrement() + "";
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Provides
|
||||
protected String provideTimeStamp(DateService dateService) {
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ec2.parse;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.jclouds.date.DateService;
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.ec2.domain.PasswordData;
|
||||
import org.jclouds.ec2.xml.GetPasswordDataResponseHandler;
|
||||
import org.jclouds.http.functions.BaseHandlerTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||
@Test(groups = "unit", testName = "GetPasswordDataResponseTest")
|
||||
public class GetPasswordDataResponseTest extends BaseHandlerTest {
|
||||
protected final DateService dateService = new SimpleDateFormatDateService();
|
||||
|
||||
public void test() {
|
||||
InputStream is = getClass().getResourceAsStream("/get_passworddata.xml");
|
||||
|
||||
PasswordData expected = expected();
|
||||
|
||||
GetPasswordDataResponseHandler handler = injector.getInstance(GetPasswordDataResponseHandler.class);
|
||||
PasswordData result = factory.create(handler).parse(is);
|
||||
|
||||
assertEquals(result.toString(), expected.toString());
|
||||
}
|
||||
|
||||
public PasswordData expected() {
|
||||
return PasswordData.builder()
|
||||
.instanceId("i-2574e22a")
|
||||
.timestamp(dateService.iso8601DateParse("2012-07-30T07:27:23.000+0000"))
|
||||
.passwordData("TGludXggdmVyc2lvbiAyLjYuMTYteGVuVSAoYnVpbGRlckBwYXRjaGJhdC5hbWF6b25zYSkgKGdj").build();
|
||||
}
|
||||
}
|
|
@ -1,38 +1,57 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ec2.services;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.collect.Iterables.concat;
|
||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static com.google.common.collect.Sets.newHashSet;
|
||||
import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.imageIds;
|
||||
import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.addNewBlockDevice;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.RunNodesException;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.domain.TemplateBuilderSpec;
|
||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.compute.predicates.ImagePredicates;
|
||||
import org.jclouds.ec2.EC2ApiMetadata;
|
||||
import org.jclouds.ec2.EC2Client;
|
||||
import org.jclouds.ec2.domain.BlockDevice;
|
||||
import org.jclouds.ec2.domain.Image;
|
||||
import org.jclouds.ec2.domain.Image.ImageType;
|
||||
import org.jclouds.ec2.domain.Reservation;
|
||||
import org.jclouds.ec2.domain.RootDeviceType;
|
||||
import org.jclouds.ec2.domain.RunningInstance;
|
||||
import org.jclouds.ec2.domain.Snapshot;
|
||||
import org.jclouds.ec2.services.AMIClient;
|
||||
import org.jclouds.ec2.predicates.InstanceStateRunning;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code AMIClient}
|
||||
|
@ -50,28 +69,37 @@ public class AMIClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
@Override
|
||||
protected Properties setupProperties() {
|
||||
Properties overrides = super.setupProperties();
|
||||
String ebsSpec = setIfTestSystemPropertyPresent(overrides, provider + ".ebs-template");
|
||||
if (ebsSpec != null)
|
||||
ebsTemplate = TemplateBuilderSpec.parse(ebsSpec);
|
||||
String ebsSpec = checkNotNull(setIfTestSystemPropertyPresent(overrides, provider + ".ebs-template"), provider
|
||||
+ ".ebs-template");
|
||||
ebsTemplate = TemplateBuilderSpec.parse(ebsSpec);
|
||||
return overrides;
|
||||
}
|
||||
|
||||
protected EC2Client ec2Client;
|
||||
protected AMIClient client;
|
||||
|
||||
protected Set<String> imagesToDeregister = Sets.newHashSet();
|
||||
protected Set<String> snapshotsToDelete = Sets.newHashSet();
|
||||
protected RetryablePredicate<RunningInstance> runningTester;
|
||||
|
||||
protected Set<String> imagesToDeregister = newHashSet();
|
||||
protected Set<String> snapshotsToDelete = newHashSet();
|
||||
protected String regionId;
|
||||
protected String ebsBackedImageId;
|
||||
protected String ebsBackedImageName = "jcloudstest1";
|
||||
protected String imageId;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getAMIServices();
|
||||
ec2Client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
runningTester = new RetryablePredicate<RunningInstance>(new InstanceStateRunning(ec2Client), 600, 5,
|
||||
TimeUnit.SECONDS);
|
||||
|
||||
client = ec2Client.getAMIServices();
|
||||
if (ebsTemplate != null) {
|
||||
Template template = view.getComputeService().templateBuilder().from(ebsTemplate).build();
|
||||
regionId = template.getLocation().getId();
|
||||
imageId = template.getImage().getProviderId();
|
||||
for (Image image : client.describeImagesInRegion(regionId)) {
|
||||
if (ebsBackedImageName.equals(image.getName()))
|
||||
client.deregisterImageInRegion(regionId, image.getId());
|
||||
|
@ -89,8 +117,7 @@ public class AMIClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
}
|
||||
|
||||
public void testDescribeImages() {
|
||||
for (String region : view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getAvailabilityZoneAndRegionServices()
|
||||
.describeRegions().keySet()) {
|
||||
for (String region : ec2Client.getConfiguredRegions()) {
|
||||
Set<? extends Image> allResults = client.describeImagesInRegion(region);
|
||||
assertNotNull(allResults);
|
||||
assert allResults.size() >= 2 : allResults.size();
|
||||
|
@ -108,18 +135,16 @@ public class AMIClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
|
||||
@Test
|
||||
public void testCreateAndListEBSBackedImage() throws Exception {
|
||||
ComputeService computeService = view.getComputeService();
|
||||
Snapshot snapshot = createSnapshot(computeService);
|
||||
Snapshot snapshot = createSnapshot();
|
||||
|
||||
// List of images before...
|
||||
int sizeBefore = computeService.listImages().size();
|
||||
int sizeBefore = client.describeImagesInRegion(regionId).size();
|
||||
|
||||
// Register a new image...
|
||||
ebsBackedImageId = client.registerUnixImageBackedByEbsInRegion(regionId, ebsBackedImageName, snapshot.getId(),
|
||||
addNewBlockDevice("/dev/sda2", "myvirtual", 1).withDescription("adrian"));
|
||||
imagesToDeregister.add(ebsBackedImageId);
|
||||
final Image ebsBackedImage = Iterables.getOnlyElement(client.describeImagesInRegion(regionId,
|
||||
imageIds(ebsBackedImageId)));
|
||||
final Image ebsBackedImage = getOnlyElement(client.describeImagesInRegion(regionId, imageIds(ebsBackedImageId)));
|
||||
assertEquals(ebsBackedImage.getName(), ebsBackedImageName);
|
||||
assertEquals(ebsBackedImage.getImageType(), ImageType.MACHINE);
|
||||
assertEquals(ebsBackedImage.getRootDeviceType(), RootDeviceType.EBS);
|
||||
|
@ -130,46 +155,40 @@ public class AMIClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
ImmutableMap.of("/dev/sda1", new Image.EbsBlockDevice(snapshot.getId(), snapshot.getVolumeSize(), true),
|
||||
"/dev/sda2", new Image.EbsBlockDevice(null, 1, false)).entrySet());
|
||||
|
||||
// This is the suggested method to ensure the new image ID is inserted
|
||||
// into the cache
|
||||
// (suggested by adriancole_ on #jclouds)
|
||||
computeService.templateBuilder().imageId(ebsBackedImage.getRegion() + "/" + ebsBackedImageId).build();
|
||||
|
||||
// List of images after - should be one larger than before
|
||||
Set<? extends org.jclouds.compute.domain.Image> after = computeService.listImages();
|
||||
assertEquals(after.size(), sizeBefore + 1);
|
||||
|
||||
// Detailed check: filter for the AMI ID
|
||||
Iterable<? extends org.jclouds.compute.domain.Image> filtered = Iterables.filter(after,
|
||||
ImagePredicates.idEquals(ebsBackedImage.getRegion() + "/" + ebsBackedImageId));
|
||||
assertEquals(Iterables.size(filtered), 1);
|
||||
int after = client.describeImagesInRegion(regionId).size();
|
||||
assertEquals(after, sizeBefore + 1);
|
||||
}
|
||||
|
||||
// Fires up an instance, finds its root volume ID, takes a snapshot, then
|
||||
// terminates the instance.
|
||||
private Snapshot createSnapshot(ComputeService computeService) throws RunNodesException {
|
||||
Template template = computeService.templateBuilder().from(ebsTemplate).build();
|
||||
regionId = template.getLocation().getId();
|
||||
Set<? extends NodeMetadata> nodes = computeService.createNodesInGroup("jcloudstest", 1, template);
|
||||
private Snapshot createSnapshot() throws RunNodesException {
|
||||
|
||||
String instanceId = null;
|
||||
try {
|
||||
String instanceId = Iterables.getOnlyElement(nodes).getProviderId();
|
||||
Reservation<? extends RunningInstance> reservation = Iterables.getOnlyElement(view
|
||||
.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getInstanceServices()
|
||||
.describeInstancesInRegion(regionId, instanceId));
|
||||
RunningInstance instance = Iterables.getOnlyElement(reservation);
|
||||
RunningInstance instance = getOnlyElement(concat(ec2Client.getInstanceServices().runInstancesInRegion(
|
||||
regionId, null, imageId, 1, 1)));
|
||||
instanceId = instance.getId();
|
||||
|
||||
assertTrue(runningTester.apply(instance), instanceId + "didn't achieve the state running!");
|
||||
|
||||
instance = getOnlyElement(concat(ec2Client.getInstanceServices().describeInstancesInRegion(regionId,
|
||||
instanceId)));
|
||||
BlockDevice device = instance.getEbsBlockDevices().get("/dev/sda1");
|
||||
Snapshot snapshot = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getElasticBlockStoreServices()
|
||||
.createSnapshotInRegion(regionId, device.getVolumeId());
|
||||
assertNotNull(device, "device: /dev/sda1 not present on: " + instance);
|
||||
Snapshot snapshot = ec2Client.getElasticBlockStoreServices().createSnapshotInRegion(regionId,
|
||||
device.getVolumeId());
|
||||
snapshotsToDelete.add(snapshot.getId());
|
||||
return snapshot;
|
||||
} finally {
|
||||
computeService.destroyNodesMatching(Predicates.in(nodes));
|
||||
if (instanceId != null)
|
||||
ec2Client.getInstanceServices().terminateInstancesInRegion(regionId, instanceId);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testCreateAndListEBSBackedImage")
|
||||
public void testGetLaunchPermissionForImage() {
|
||||
System.out.println(client.getLaunchPermissionForImageInRegion(regionId, ebsBackedImageId));
|
||||
client.getLaunchPermissionForImageInRegion(regionId, ebsBackedImageId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -178,8 +197,7 @@ public class AMIClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
for (String imageId : imagesToDeregister)
|
||||
client.deregisterImageInRegion(regionId, imageId);
|
||||
for (String snapshotId : snapshotsToDelete)
|
||||
view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getElasticBlockStoreServices()
|
||||
.deleteSnapshotInRegion(regionId, snapshotId);
|
||||
ec2Client.getElasticBlockStoreServices().deleteSnapshotInRegion(regionId, snapshotId);
|
||||
super.tearDownContext();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,18 +25,17 @@ import static org.testng.Assert.assertNotNull;
|
|||
|
||||
import java.net.URI;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.jclouds.aws.domain.Region;
|
||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.ec2.EC2ApiMetadata;
|
||||
import org.jclouds.ec2.EC2Client;
|
||||
import org.jclouds.ec2.domain.AvailabilityZoneInfo;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
/**
|
||||
|
@ -50,31 +49,30 @@ public class AvailabilityZoneAndRegionClientLiveTest extends BaseComputeServiceC
|
|||
provider = "ec2";
|
||||
}
|
||||
|
||||
private EC2Client ec2Client;
|
||||
private AvailabilityZoneAndRegionClient client;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getAvailabilityZoneAndRegionServices();
|
||||
ec2Client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
client = ec2Client.getAvailabilityZoneAndRegionServices();
|
||||
}
|
||||
|
||||
public void testDescribeAvailabilityZones() {
|
||||
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1,
|
||||
Region.AP_SOUTHEAST_1)) {
|
||||
for (String region : ec2Client.getConfiguredRegions()) {
|
||||
Set<AvailabilityZoneInfo> allResults = client.describeAvailabilityZonesInRegion(region);
|
||||
assertNotNull(allResults);
|
||||
assert allResults.size() >= 2 : allResults.size();
|
||||
assert allResults.size() >= 1 : allResults.size();
|
||||
Iterator<AvailabilityZoneInfo> iterator = allResults.iterator();
|
||||
String id1 = iterator.next().getZone();
|
||||
String id2 = iterator.next().getZone();
|
||||
Set<AvailabilityZoneInfo> twoResults = client.describeAvailabilityZonesInRegion(region,
|
||||
availabilityZones(id1, id2));
|
||||
assertNotNull(twoResults);
|
||||
assertEquals(twoResults.size(), 2);
|
||||
Set<AvailabilityZoneInfo> oneResult = client.describeAvailabilityZonesInRegion(region,
|
||||
availabilityZones(id1));
|
||||
assertNotNull(oneResult);
|
||||
assertEquals(oneResult.size(), 1);
|
||||
iterator = allResults.iterator();
|
||||
assertEquals(iterator.next().getZone(), id1);
|
||||
assertEquals(iterator.next().getZone(), id2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,17 +80,15 @@ public class AvailabilityZoneAndRegionClientLiveTest extends BaseComputeServiceC
|
|||
SortedMap<String, URI> allResults = Maps.newTreeMap();
|
||||
allResults.putAll(client.describeRegions());
|
||||
assertNotNull(allResults);
|
||||
assert allResults.size() >= 2 : allResults.size();
|
||||
assert allResults.size() >= 1 : allResults.size();
|
||||
Iterator<Entry<String, URI>> iterator = allResults.entrySet().iterator();
|
||||
String r1 = iterator.next().getKey();
|
||||
String r2 = iterator.next().getKey();
|
||||
SortedMap<String, URI> twoResults = Maps.newTreeMap();
|
||||
twoResults.putAll(client.describeRegions(regions(r1, r2)));
|
||||
assertNotNull(twoResults);
|
||||
assertEquals(twoResults.size(), 2);
|
||||
iterator = twoResults.entrySet().iterator();
|
||||
SortedMap<String, URI> oneResult = Maps.newTreeMap();
|
||||
oneResult.putAll(client.describeRegions(regions(r1)));
|
||||
assertNotNull(oneResult);
|
||||
assertEquals(oneResult.size(), 1);
|
||||
iterator = oneResult.entrySet().iterator();
|
||||
assertEquals(iterator.next().getKey(), r1);
|
||||
assertEquals(iterator.next().getKey(), r2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.ec2.services;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.snapshotIds;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
@ -26,9 +27,10 @@ import java.util.Set;
|
|||
import java.util.SortedSet;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.aws.domain.Region;
|
||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.ec2.EC2ApiMetadata;
|
||||
import org.jclouds.ec2.EC2Client;
|
||||
import org.jclouds.ec2.domain.AvailabilityZoneInfo;
|
||||
import org.jclouds.ec2.domain.Snapshot;
|
||||
import org.jclouds.ec2.domain.Volume;
|
||||
import org.jclouds.ec2.predicates.SnapshotCompleted;
|
||||
|
@ -38,8 +40,8 @@ import org.testng.annotations.BeforeClass;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
|
@ -52,8 +54,13 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
|
|||
public ElasticBlockStoreClientLiveTest() {
|
||||
provider = "ec2";
|
||||
}
|
||||
|
||||
|
||||
private EC2Client ec2Client;
|
||||
private ElasticBlockStoreClient client;
|
||||
|
||||
private String defaultRegion;
|
||||
private String defaultZone;
|
||||
|
||||
private String volumeId;
|
||||
private Snapshot snapshot;
|
||||
|
||||
|
@ -61,12 +68,17 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
|
|||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getElasticBlockStoreServices();
|
||||
ec2Client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
client = ec2Client.getElasticBlockStoreServices();
|
||||
AvailabilityZoneInfo info = Iterables.get(ec2Client.getAvailabilityZoneAndRegionServices()
|
||||
.describeAvailabilityZonesInRegion(defaultRegion), 0);
|
||||
defaultRegion = checkNotNull(Strings.emptyToNull(info.getRegion()), "region of " + info);
|
||||
defaultZone = checkNotNull(Strings.emptyToNull(info.getZone()), "zone of " + info);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeVolumes() {
|
||||
for (String region : view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getAvailabilityZoneAndRegionServices().describeRegions().keySet()) {
|
||||
for (String region : ec2Client.getConfiguredRegions()) {
|
||||
SortedSet<Volume> allResults = Sets.newTreeSet(client.describeVolumesInRegion(region));
|
||||
assertNotNull(allResults);
|
||||
if (allResults.size() >= 1) {
|
||||
|
@ -81,14 +93,13 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
|
|||
|
||||
@Test
|
||||
void testCreateVolumeInAvailabilityZone() {
|
||||
Volume expected = client.createVolumeInAvailabilityZone(getDefaultAvailabilityZone(), 1);
|
||||
Volume expected = client.createVolumeInAvailabilityZone(defaultZone, 1);
|
||||
assertNotNull(expected);
|
||||
System.out.println(expected);
|
||||
assertEquals(expected.getAvailabilityZone(), getDefaultAvailabilityZone());
|
||||
assertEquals(expected.getAvailabilityZone(), defaultZone);
|
||||
|
||||
this.volumeId = expected.getId();
|
||||
|
||||
Set<Volume> result = Sets.newLinkedHashSet(client.describeVolumesInRegion(null, expected.getId()));
|
||||
Set<Volume> result = Sets.newLinkedHashSet(client.describeVolumesInRegion(defaultRegion, expected.getId()));
|
||||
assertNotNull(result);
|
||||
assertEquals(result.size(), 1);
|
||||
Volume volume = result.iterator().next();
|
||||
|
@ -97,7 +108,7 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
|
|||
|
||||
@Test(dependsOnMethods = "testCreateVolumeInAvailabilityZone")
|
||||
void testCreateSnapshotInRegion() {
|
||||
Snapshot snapshot = client.createSnapshotInRegion(null, volumeId);
|
||||
Snapshot snapshot = client.createSnapshotInRegion(defaultRegion, volumeId);
|
||||
Predicate<Snapshot> snapshotted = new RetryablePredicate<Snapshot>(new SnapshotCompleted(client), 600, 10,
|
||||
TimeUnit.SECONDS);
|
||||
assert snapshotted.apply(snapshot);
|
||||
|
@ -109,13 +120,9 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
|
|||
this.snapshot = result;
|
||||
}
|
||||
|
||||
protected String getDefaultAvailabilityZone(){
|
||||
return "us-east-1a";
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testCreateSnapshotInRegion")
|
||||
void testCreateVolumeFromSnapshotInAvailabilityZone() {
|
||||
Volume volume = client.createVolumeFromSnapshotInAvailabilityZone(getDefaultAvailabilityZone(), snapshot.getId());
|
||||
Volume volume = client.createVolumeFromSnapshotInAvailabilityZone(defaultZone, snapshot.getId());
|
||||
assertNotNull(volume);
|
||||
|
||||
Predicate<Volume> availabile = new RetryablePredicate<Volume>(new VolumeAvailable(client), 600, 10,
|
||||
|
@ -125,7 +132,7 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
|
|||
Volume result = Iterables.getOnlyElement(client.describeVolumesInRegion(snapshot.getRegion(), volume.getId()));
|
||||
assertEquals(volume.getId(), result.getId());
|
||||
assertEquals(volume.getSnapshotId(), snapshot.getId());
|
||||
assertEquals(volume.getAvailabilityZone(), getDefaultAvailabilityZone());
|
||||
assertEquals(volume.getAvailabilityZone(), defaultZone);
|
||||
assertEquals(result.getStatus(), Volume.Status.AVAILABLE);
|
||||
|
||||
client.deleteVolumeInRegion(snapshot.getRegion(), volume.getId());
|
||||
|
@ -133,8 +140,7 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
|
|||
|
||||
@Test(dependsOnMethods = "testCreateSnapshotInRegion")
|
||||
void testCreateVolumeFromSnapshotInAvailabilityZoneWithSize() {
|
||||
Volume volume = client.createVolumeFromSnapshotInAvailabilityZone(getDefaultAvailabilityZone(), 2,
|
||||
snapshot.getId());
|
||||
Volume volume = client.createVolumeFromSnapshotInAvailabilityZone(defaultZone, 2, snapshot.getId());
|
||||
assertNotNull(volume);
|
||||
|
||||
Predicate<Volume> availabile = new RetryablePredicate<Volume>(new VolumeAvailable(client), 600, 10,
|
||||
|
@ -144,7 +150,7 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
|
|||
Volume result = Iterables.getOnlyElement(client.describeVolumesInRegion(snapshot.getRegion(), volume.getId()));
|
||||
assertEquals(volume.getId(), result.getId());
|
||||
assertEquals(volume.getSnapshotId(), snapshot.getId());
|
||||
assertEquals(volume.getAvailabilityZone(), getDefaultAvailabilityZone());
|
||||
assertEquals(volume.getAvailabilityZone(), defaultZone);
|
||||
assertEquals(volume.getSize(), 2);
|
||||
assertEquals(result.getStatus(), Volume.Status.AVAILABLE);
|
||||
|
||||
|
@ -163,8 +169,7 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
|
|||
|
||||
@Test
|
||||
void testDescribeSnapshots() {
|
||||
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1,
|
||||
Region.AP_SOUTHEAST_1)) {
|
||||
for (String region : ec2Client.getConfiguredRegions()) {
|
||||
SortedSet<Snapshot> allResults = Sets.newTreeSet(client.describeSnapshotsInRegion(region));
|
||||
assertNotNull(allResults);
|
||||
if (allResults.size() >= 1) {
|
||||
|
@ -179,32 +184,37 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
|
|||
|
||||
@Test(enabled = false)
|
||||
public void testAddCreateVolumePermissionsToSnapshot() {
|
||||
// TODO client.addCreateVolumePermissionsToSnapshotInRegion(null, userIds,
|
||||
// TODO client.addCreateVolumePermissionsToSnapshotInRegion(defaultRegion,
|
||||
// userIds,
|
||||
// userGroups,
|
||||
// snapshotId);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testRemoveCreateVolumePermissionsFromSnapshot() {
|
||||
// TODO client.removeCreateVolumePermissionsFromSnapshotInRegion(null, userIds,
|
||||
// TODO
|
||||
// client.removeCreateVolumePermissionsFromSnapshotInRegion(defaultRegion,
|
||||
// userIds,
|
||||
// userGroups,
|
||||
// snapshotId);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testResetCreateVolumePermissionsOnSnapshot() {
|
||||
// TODO client.resetCreateVolumePermissionsOnSnapshotInRegion(null, snapshotId);
|
||||
// TODO
|
||||
// client.resetCreateVolumePermissionsOnSnapshotInRegion(defaultRegion,
|
||||
// snapshotId);
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testCreateSnapshotInRegion")
|
||||
public void testGetCreateVolumePermissionForSnapshot() {
|
||||
System.out.println(client.getCreateVolumePermissionForSnapshotInRegion(snapshot.getRegion(), snapshot.getId()));
|
||||
client.getCreateVolumePermissionForSnapshotInRegion(snapshot.getRegion(), snapshot.getId());
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testCreateSnapshotInRegion")
|
||||
void testDeleteVolumeInRegion() {
|
||||
client.deleteVolumeInRegion(null, volumeId);
|
||||
Set<Volume> result = Sets.newLinkedHashSet(client.describeVolumesInRegion(null, volumeId));
|
||||
client.deleteVolumeInRegion(defaultRegion, volumeId);
|
||||
Set<Volume> result = Sets.newLinkedHashSet(client.describeVolumesInRegion(defaultRegion, volumeId));
|
||||
assertEquals(result.size(), 1);
|
||||
Volume volume = result.iterator().next();
|
||||
assertEquals(volume.getStatus(), Volume.Status.DELETING);
|
||||
|
|
|
@ -23,14 +23,13 @@ import static org.testng.Assert.assertNotNull;
|
|||
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.jclouds.aws.domain.Region;
|
||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.ec2.EC2ApiMetadata;
|
||||
import org.jclouds.ec2.EC2Client;
|
||||
import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
|
@ -44,19 +43,20 @@ public class ElasticIPAddressClientLiveTest extends BaseComputeServiceContextLiv
|
|||
provider = "ec2";
|
||||
}
|
||||
|
||||
private EC2Client ec2Client;
|
||||
private ElasticIPAddressClient client;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getElasticIPAddressServices();
|
||||
ec2Client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
client = ec2Client.getElasticIPAddressServices();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeAddresses() {
|
||||
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1,
|
||||
Region.AP_SOUTHEAST_1)) {
|
||||
for (String region : ec2Client.getConfiguredRegions()) {
|
||||
SortedSet<PublicIpInstanceIdPair> allResults = Sets.newTreeSet(client.describeAddressesInRegion(region));
|
||||
assertNotNull(allResults);
|
||||
if (allResults.size() >= 1) {
|
||||
|
|
|
@ -22,16 +22,14 @@ import static org.testng.Assert.assertNotNull;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.aws.domain.Region;
|
||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.ec2.EC2ApiMetadata;
|
||||
import org.jclouds.ec2.EC2Client;
|
||||
import org.jclouds.ec2.domain.Reservation;
|
||||
import org.jclouds.ec2.domain.RunningInstance;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code EC2Client}
|
||||
*
|
||||
|
@ -43,19 +41,20 @@ public class InstanceClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
provider = "ec2";
|
||||
}
|
||||
|
||||
private EC2Client ec2Client;
|
||||
private InstanceClient client;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getInstanceServices();
|
||||
ec2Client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
client = ec2Client.getInstanceServices();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeInstances() {
|
||||
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1,
|
||||
Region.AP_SOUTHEAST_1)) {
|
||||
for (String region : ec2Client.getConfiguredRegions()) {
|
||||
Set<? extends Reservation<? extends RunningInstance>> allResults = client.describeInstancesInRegion(region);
|
||||
assertNotNull(allResults);
|
||||
assert allResults.size() >= 0 : allResults.size();
|
||||
|
|
|
@ -24,14 +24,13 @@ import static org.testng.Assert.assertNotNull;
|
|||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.jclouds.aws.domain.Region;
|
||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.ec2.EC2ApiMetadata;
|
||||
import org.jclouds.ec2.EC2Client;
|
||||
import org.jclouds.ec2.domain.KeyPair;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
|
@ -45,20 +44,20 @@ public class KeyPairClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
provider = "ec2";
|
||||
}
|
||||
|
||||
private EC2Client ec2Client;
|
||||
private KeyPairClient client;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getKeyPairServices();
|
||||
ec2Client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
client = ec2Client.getKeyPairServices();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeKeyPairs() {
|
||||
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1,
|
||||
Region.AP_SOUTHEAST_1)) {
|
||||
|
||||
for (String region : ec2Client.getConfiguredRegions()) {
|
||||
SortedSet<KeyPair> allResults = Sets.newTreeSet(client.describeKeyPairsInRegion(region));
|
||||
assertNotNull(allResults);
|
||||
if (allResults.size() >= 1) {
|
||||
|
|
|
@ -25,9 +25,9 @@ import java.util.Iterator;
|
|||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.jclouds.aws.domain.Region;
|
||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.ec2.EC2ApiMetadata;
|
||||
import org.jclouds.ec2.EC2Client;
|
||||
import org.jclouds.ec2.domain.IpPermission;
|
||||
import org.jclouds.ec2.domain.IpProtocol;
|
||||
import org.jclouds.ec2.domain.SecurityGroup;
|
||||
|
@ -41,7 +41,6 @@ import com.google.common.collect.ImmutableMultimap;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code SecurityGroupClient}
|
||||
|
@ -54,19 +53,20 @@ public class SecurityGroupClientLiveTest extends BaseComputeServiceContextLiveTe
|
|||
provider = "ec2";
|
||||
}
|
||||
|
||||
private EC2Client ec2Client;
|
||||
protected SecurityGroupClient client;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getSecurityGroupServices();
|
||||
ec2Client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
client = ec2Client.getSecurityGroupServices();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribe() {
|
||||
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1,
|
||||
Region.AP_SOUTHEAST_1, Region.AP_NORTHEAST_1)) {
|
||||
for (String region : ec2Client.getConfiguredRegions()) {
|
||||
SortedSet<SecurityGroup> allResults = ImmutableSortedSet.<SecurityGroup> copyOf(client
|
||||
.describeSecurityGroupsInRegion(region));
|
||||
assertNotNull(allResults);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class KeyPairResponseHandlerTest extends BaseEC2HandlerTest {
|
|||
|
||||
InputStream is = getClass().getResourceAsStream("/create_keypair.xml");
|
||||
|
||||
KeyPair expected = KeyPair.builder().region(defaultRegion).keyName("adriancole-ec21").sha1OfPrivateKey(
|
||||
KeyPair expected = KeyPair.builder().region(defaultRegion).keyName("jclouds#test#0").sha1OfPrivateKey(
|
||||
"13:36:74:b9:56:bb:07:96:c0:19:ab:00:7f:9f:06:d2:16:a0:45:32").keyMaterial(
|
||||
"-----BEGIN RSA PRIVATE KEY-----\n"
|
||||
+ "MIIEowIBAAKCAQEA0CbFlhSdbMdad2ux2BVqk6Ut5fLKb0CdbqubGcEBfwsSz9Rp4Ile76P90MpV\n"
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<AuthorizeSecurityGroupIngressResponse xmlns="http://ec2.amazonaws.com/doc/2011-05-15/">
|
||||
<requestId>9b6a9df1-bc19-4e56-9d11-7f8382538667</requestId>
|
||||
<return>true</return>
|
||||
</AuthorizeSecurityGroupIngressResponse>
|
|
@ -1,6 +1,6 @@
|
|||
<CreateKeyPairResponse xmlns="http://ec2.amazonaws.com/doc/2011-05-15/">
|
||||
<requestId>bb5e3a3c-e254-454d-ba29-d607cdf6357a</requestId>
|
||||
<keyName>adriancole-ec21</keyName>
|
||||
<keyName>jclouds#test#0</keyName>
|
||||
<keyFingerprint>13:36:74:b9:56:bb:07:96:c0:19:ab:00:7f:9f:06:d2:16:a0:45:32</keyFingerprint>
|
||||
<keyMaterial>-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEowIBAAKCAQEA0CbFlhSdbMdad2ux2BVqk6Ut5fLKb0CdbqubGcEBfwsSz9Rp4Ile76P90MpV
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CreateSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2011-05-15/">
|
||||
<requestId>8bf8a888-33af-459a-8424-13d4da0c2341</requestId>
|
||||
<return>true</return>
|
||||
<groupId>sg-3c6ef654</groupId>
|
||||
</CreateSecurityGroupResponse>
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2011-05-15/">
|
||||
<requestId>f6d3252e-35e5-4ef5-b2c5-62da95dd829b</requestId>
|
||||
<reservationSet>
|
||||
<item>
|
||||
<reservationId>r-205ad944</reservationId>
|
||||
<ownerId>993194456877</ownerId>
|
||||
<groupSet>
|
||||
<item>
|
||||
<groupId>sg-3c6ef654</groupId>
|
||||
<groupName>jclouds#mygroup2</groupName>
|
||||
</item>
|
||||
</groupSet>
|
||||
<instancesSet>
|
||||
<item>
|
||||
<instanceId>i-2baa5550</instanceId>
|
||||
<imageId>ami-aecd60c7</imageId>
|
||||
<instanceState>
|
||||
<code>16</code>
|
||||
<name>running</name>
|
||||
</instanceState>
|
||||
<privateDnsName>ip-10-28-89-195.ec2.internal</privateDnsName>
|
||||
<dnsName>ec2-50-16-1-166.compute-1.amazonaws.com</dnsName>
|
||||
<reason/>
|
||||
<keyName>jclouds#mygroup2#81</keyName>
|
||||
<amiLaunchIndex>0</amiLaunchIndex>
|
||||
<productCodes/>
|
||||
<instanceType>t1.micro</instanceType>
|
||||
<launchTime>2012-08-02T04:28:30.000Z</launchTime>
|
||||
<placement>
|
||||
<availabilityZone>us-east-1e</availabilityZone>
|
||||
<groupName/>
|
||||
<tenancy>default</tenancy>
|
||||
</placement>
|
||||
<kernelId>aki-88aa75e1</kernelId>
|
||||
<monitoring>
|
||||
<state>disabled</state>
|
||||
</monitoring>
|
||||
<privateIpAddress>10.28.89.195</privateIpAddress>
|
||||
<ipAddress>50.16.1.166</ipAddress>
|
||||
<groupSet>
|
||||
<item>
|
||||
<groupId>sg-3c6ef654</groupId>
|
||||
<groupName>jclouds#mygroup2</groupName>
|
||||
</item>
|
||||
</groupSet>
|
||||
<architecture>x86_64</architecture>
|
||||
<rootDeviceType>ebs</rootDeviceType>
|
||||
<rootDeviceName>/dev/sda1</rootDeviceName>
|
||||
<blockDeviceMapping>
|
||||
<item>
|
||||
<deviceName>/dev/sda1</deviceName>
|
||||
<ebs>
|
||||
<volumeId>vol-f2d7c993</volumeId>
|
||||
<status>attached</status>
|
||||
<attachTime>2012-08-02T04:28:56.000Z</attachTime>
|
||||
<deleteOnTermination>true</deleteOnTermination>
|
||||
</ebs>
|
||||
</item>
|
||||
</blockDeviceMapping>
|
||||
<virtualizationType>paravirtual</virtualizationType>
|
||||
<clientToken/>
|
||||
<tagSet>
|
||||
<item>
|
||||
<key>Name</key>
|
||||
<value>mygroup2-2baa5550</value>
|
||||
</item>
|
||||
</tagSet>
|
||||
<hypervisor>xen</hypervisor>
|
||||
</item>
|
||||
</instancesSet>
|
||||
</item>
|
||||
</reservationSet>
|
||||
</DescribeInstancesResponse>
|
|
@ -9,6 +9,12 @@
|
|||
<ownerId>218213537122</ownerId>
|
||||
<volumeSize>10</volumeSize>
|
||||
<description>Daily Backup</description>
|
||||
<tagSet>
|
||||
<item>
|
||||
<key>Name</key>
|
||||
<value>example_name_tag</value>
|
||||
</item>
|
||||
</tagSet>
|
||||
</item>
|
||||
</snapshotSet>
|
||||
</DescribeSnapshotsResponse>
|
|
@ -0,0 +1,6 @@
|
|||
<GetPasswordDataResponse xmlns="http://ec2.amazonaws.com/doc/2012-06-15/">
|
||||
<requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
|
||||
<instanceId>i-2574e22a</instanceId>
|
||||
<timestamp>2012-07-30T07:27:23.000+0000</timestamp>
|
||||
<passwordData>TGludXggdmVyc2lvbiAyLjYuMTYteGVuVSAoYnVpbGRlckBwYXRjaGJhdC5hbWF6b25zYSkgKGdj</passwordData>
|
||||
</GetPasswordDataResponse>
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2011-05-15/">
|
||||
<requestId>99260d2b-1bdc-4473-b386-48d22e96900a</requestId>
|
||||
<reservationId>r-205ad944</reservationId>
|
||||
<ownerId>993194456877</ownerId>
|
||||
<groupSet>
|
||||
<item>
|
||||
<groupId>sg-3c6ef654</groupId>
|
||||
<groupName>jclouds#test</groupName>
|
||||
</item>
|
||||
</groupSet>
|
||||
<instancesSet>
|
||||
<item>
|
||||
<instanceId>i-2baa5550</instanceId>
|
||||
<imageId>ami-aecd60c7</imageId>
|
||||
<instanceState>
|
||||
<code>0</code>
|
||||
<name>pending</name>
|
||||
</instanceState>
|
||||
<privateDnsName/>
|
||||
<dnsName/>
|
||||
<reason/>
|
||||
<keyName>jclouds#test#0</keyName>
|
||||
<amiLaunchIndex>0</amiLaunchIndex>
|
||||
<productCodes/>
|
||||
<instanceType>t1.micro</instanceType>
|
||||
<launchTime>2012-08-02T04:28:30.000Z</launchTime>
|
||||
<placement>
|
||||
<availabilityZone>us-east-1e</availabilityZone>
|
||||
<groupName/>
|
||||
<tenancy>default</tenancy>
|
||||
</placement>
|
||||
<kernelId>aki-88aa75e1</kernelId>
|
||||
<monitoring>
|
||||
<state>disabled</state>
|
||||
</monitoring>
|
||||
<groupSet>
|
||||
<item>
|
||||
<groupId>sg-3c6ef654</groupId>
|
||||
<groupName>jclouds#test</groupName>
|
||||
</item>
|
||||
</groupSet>
|
||||
<stateReason>
|
||||
<code>pending</code>
|
||||
<message>pending</message>
|
||||
</stateReason>
|
||||
<architecture>x86_64</architecture>
|
||||
<rootDeviceType>ebs</rootDeviceType>
|
||||
<rootDeviceName>/dev/sda1</rootDeviceName>
|
||||
<blockDeviceMapping/>
|
||||
<virtualizationType>paravirtual</virtualizationType>
|
||||
<clientToken/>
|
||||
<hypervisor>xen</hypervisor>
|
||||
</item>
|
||||
</instancesSet>
|
||||
</RunInstancesResponse>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<DescribeSecurityGroupsResponse xmlns="http://ec2.amazonaws.com/doc/2011-05-15/">
|
||||
<requestId>6df3e2a6-76c0-414b-89ff-9318144e0bbe</requestId>
|
||||
<securityGroupInfo>
|
||||
<item>
|
||||
<ownerId>993194456877</ownerId>
|
||||
<groupId>sg-3c6ef654</groupId>
|
||||
<groupName>jclouds#test</groupName>
|
||||
<groupDescription>jclouds#test</groupDescription>
|
||||
<ipPermissions/>
|
||||
<ipPermissionsEgress/>
|
||||
</item>
|
||||
</securityGroupInfo>
|
||||
</DescribeSecurityGroupsResponse>
|
|
@ -48,7 +48,7 @@
|
|||
</repositories>
|
||||
|
||||
<properties>
|
||||
<test.elasticstack.endpoint>https://api.lon-p.elastichosts.com</test.elasticstack.endpoint>
|
||||
<test.elasticstack.endpoint>https://api-lon-p.elastichosts.com</test.elasticstack.endpoint>
|
||||
<test.elasticstack.api-version>1.0</test.elasticstack.api-version>
|
||||
<test.elasticstack.build-version />
|
||||
<test.elasticstack.identity>FIXME</test.elasticstack.identity>
|
||||
|
|
|
@ -83,7 +83,7 @@ public class ElasticStackApiMetadata extends BaseRestApiMetadata {
|
|||
.credentialName("Secret API key")
|
||||
.documentation(URI.create("http://www.elasticstack.com/cloud-platform/api"))
|
||||
.version("1.0")
|
||||
.defaultEndpoint("https://api.lon-p.elastichosts.com")
|
||||
.defaultEndpoint("https://api-lon-p.elastichosts.com")
|
||||
.defaultProperties(ElasticStackApiMetadata.defaultProperties())
|
||||
.view(TypeToken.of(ComputeServiceContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(ElasticStackRestClientModule.class, ElasticStackComputeServiceContextModule.class));
|
||||
|
|
|
@ -66,7 +66,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
Method method = ElasticStackAsyncClient.class.getMethod("listServers");
|
||||
HttpRequest httpRequest = processor.createRequest(method);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.lon-p.elastichosts.com/servers/list HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/list HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.lon-p.elastichosts.com/servers/list HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/list HTTP/1.1");
|
||||
// for example, using basic authentication, we should get "only one"
|
||||
// header
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\nAuthorization: Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==\n");
|
||||
|
@ -93,7 +93,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
Method method = ElasticStackAsyncClient.class.getMethod("listServerInfo");
|
||||
HttpRequest httpRequest = processor.createRequest(method);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.lon-p.elastichosts.com/servers/info HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
Method method = ElasticStackAsyncClient.class.getMethod("getServerInfo", String.class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, "uuid");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.lon-p.elastichosts.com/servers/uuid/info HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/uuid/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -125,7 +125,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
HttpRequest httpRequest = processor.createRequest(method,
|
||||
BindServerToPlainTextStringTest.SERVER);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/servers/create HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/create HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, BindServerToPlainTextStringTest.CREATED_SERVER, "text/plain", false);
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
HttpRequest httpRequest = processor.createRequest(method,
|
||||
BindServerToPlainTextStringTest.SERVER);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/servers/create/stopped HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/create/stopped HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, BindServerToPlainTextStringTest.CREATED_SERVER, "text/plain", false);
|
||||
|
||||
|
@ -159,7 +159,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
HttpRequest httpRequest = processor.createRequest(method, "100",
|
||||
BindServerToPlainTextStringTest.SERVER);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/servers/100/set HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/100/set HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, BindServerToPlainTextStringTest.CREATED_SERVER, "text/plain", false);
|
||||
|
||||
|
@ -175,7 +175,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
Method method = ElasticStackAsyncClient.class.getMethod("destroyServer", String.class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, "uuid");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/servers/uuid/destroy HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/destroy HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -191,7 +191,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
Method method = ElasticStackAsyncClient.class.getMethod("startServer", String.class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, "uuid");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/servers/uuid/start HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/start HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -207,7 +207,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
Method method = ElasticStackAsyncClient.class.getMethod("stopServer", String.class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, "uuid");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/servers/uuid/stop HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/stop HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -223,7 +223,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
Method method = ElasticStackAsyncClient.class.getMethod("shutdownServer", String.class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, "uuid");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/servers/uuid/shutdown HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/shutdown HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -239,7 +239,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
Method method = ElasticStackAsyncClient.class.getMethod("resetServer", String.class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, "uuid");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/servers/uuid/reset HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/reset HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -255,7 +255,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
Method method = ElasticStackAsyncClient.class.getMethod("listDrives");
|
||||
HttpRequest httpRequest = processor.createRequest(method);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.lon-p.elastichosts.com/drives/list HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/list HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -263,7 +263,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.lon-p.elastichosts.com/drives/list HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/list HTTP/1.1");
|
||||
// for example, using basic authentication, we should get "only one"
|
||||
// header
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\nAuthorization: Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==\n");
|
||||
|
@ -282,7 +282,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
Method method = ElasticStackAsyncClient.class.getMethod("listDriveInfo");
|
||||
HttpRequest httpRequest = processor.createRequest(method);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.lon-p.elastichosts.com/drives/info HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -297,7 +297,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
Method method = ElasticStackAsyncClient.class.getMethod("getDriveInfo", String.class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, "uuid");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.lon-p.elastichosts.com/drives/uuid/info HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/uuid/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -314,7 +314,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
HttpRequest httpRequest = processor.createRequest(method,
|
||||
new CreateDriveRequest.Builder().name("foo").size(10000l).build());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/drives/create HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/create HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, "name foo\nsize 10000", "text/plain", false);
|
||||
|
||||
|
@ -331,7 +331,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
HttpRequest httpRequest = processor.createRequest(method, "100",
|
||||
new DriveData.Builder().name("foo").size(10000l).tags(ImmutableList.of("production", "candy")).build());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/drives/100/set HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/100/set HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, "name foo\nsize 10000\ntags production candy", "text/plain", false);
|
||||
|
||||
|
@ -347,7 +347,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
Method method = ElasticStackAsyncClient.class.getMethod("destroyDrive", String.class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, "uuid");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/drives/uuid/destroy HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/uuid/destroy HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -363,7 +363,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
Method method = ElasticStackAsyncClient.class.getMethod("imageDrive", String.class, String.class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, "100", "200");
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/drives/200/image/100 HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/200/image/100 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -381,7 +381,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
HttpRequest httpRequest = processor.createRequest(method, "100", "200",
|
||||
ImageConversionType.GUNZIP);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/drives/200/image/100/gunzip HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/200/image/100/gunzip HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -397,7 +397,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
Method method = ElasticStackAsyncClient.class.getMethod("readDrive", String.class, long.class, long.class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, "100", 1024, 2048);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/drives/100/read/1024/2048 HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/100/read/1024/2048 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/octet-stream\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -413,7 +413,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
HttpRequest httpRequest = processor.createRequest(method, "100",
|
||||
Payloads.newStringPayload("foo"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/drives/100/write HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/100/write HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, "foo", MediaType.APPLICATION_OCTET_STREAM, false);
|
||||
|
||||
|
@ -429,7 +429,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
HttpRequest httpRequest = processor.createRequest(method, "100",
|
||||
Payloads.newStringPayload("foo"), 2048);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.lon-p.elastichosts.com/drives/100/write/2048 HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/100/write/2048 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, "foo", MediaType.APPLICATION_OCTET_STREAM, false);
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.eucalyptus.services;
|
||||
|
||||
import org.jclouds.ec2.services.AMIClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", singleThreaded = true, testName = "EucalyptusAMIClientLiveTest")
|
||||
public class EucalyptusAMIClientLiveTest extends AMIClientLiveTest {
|
||||
public EucalyptusAMIClientLiveTest() {
|
||||
provider = "eucalyptus";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.eucalyptus.services;
|
||||
|
||||
import org.jclouds.ec2.services.AvailabilityZoneAndRegionClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", singleThreaded = true, testName = "EucalyptusAvailabilityZoneAndRegionClientLiveTest")
|
||||
public class EucalyptusAvailabilityZoneAndRegionClientLiveTest extends AvailabilityZoneAndRegionClientLiveTest {
|
||||
public EucalyptusAvailabilityZoneAndRegionClientLiveTest() {
|
||||
provider = "eucalyptus";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.eucalyptus.services;
|
||||
|
||||
import org.jclouds.ec2.services.ElasticBlockStoreClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", singleThreaded = true, testName = "EucalyptusElasticBlockStoreClientLiveTest")
|
||||
public class EucalyptusElasticBlockStoreClientLiveTest extends ElasticBlockStoreClientLiveTest {
|
||||
public EucalyptusElasticBlockStoreClientLiveTest() {
|
||||
provider = "eucalyptus";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.eucalyptus.services;
|
||||
|
||||
import org.jclouds.ec2.services.ElasticIPAddressClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", singleThreaded = true, testName = "EucalyptusElasticIPAddressClientLiveTest")
|
||||
public class EucalyptusElasticIPAddressClientLiveTest extends ElasticIPAddressClientLiveTest {
|
||||
public EucalyptusElasticIPAddressClientLiveTest() {
|
||||
provider = "eucalyptus";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.eucalyptus.services;
|
||||
|
||||
import org.jclouds.ec2.services.InstanceClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", singleThreaded = true, testName = "EucalyptusInstanceClientLiveTest")
|
||||
public class EucalyptusInstanceClientLiveTest extends InstanceClientLiveTest {
|
||||
public EucalyptusInstanceClientLiveTest() {
|
||||
provider = "eucalyptus";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.eucalyptus.services;
|
||||
|
||||
import org.jclouds.ec2.services.KeyPairClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", singleThreaded = true, testName = "EucalyptusKeyPairClientLiveTest")
|
||||
public class EucalyptusKeyPairClientLiveTest extends KeyPairClientLiveTest {
|
||||
public EucalyptusKeyPairClientLiveTest() {
|
||||
provider = "eucalyptus";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.eucalyptus.services;
|
||||
|
||||
import org.jclouds.ec2.services.SecurityGroupClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", singleThreaded = true, testName = "EucalyptusSecurityGroupClientLiveTest")
|
||||
public class EucalyptusSecurityGroupClientLiveTest extends SecurityGroupClientLiveTest {
|
||||
public EucalyptusSecurityGroupClientLiveTest() {
|
||||
provider = "eucalyptus";
|
||||
}
|
||||
|
||||
}
|
|
@ -55,7 +55,7 @@
|
|||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>1.4</version>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue