mirror of https://github.com/apache/jclouds.git
updated to reflect naming conventions
This commit is contained in:
parent
4e76ad0b46
commit
ac2c2e75e8
|
@ -23,7 +23,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.glesys.domain.ServerState;
|
import org.jclouds.glesys.domain.Server;
|
||||||
import org.jclouds.glesys.functions.internal.GleSYSTypeAdapters;
|
import org.jclouds.glesys.functions.internal.GleSYSTypeAdapters;
|
||||||
import org.jclouds.glesys.functions.internal.GlesysDateAdapter;
|
import org.jclouds.glesys.functions.internal.GlesysDateAdapter;
|
||||||
import org.jclouds.json.config.GsonModule.DateAdapter;
|
import org.jclouds.json.config.GsonModule.DateAdapter;
|
||||||
|
@ -40,7 +40,7 @@ public class GleSYSParserModule extends AbstractModule {
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
public Map<Type, Object> provideCustomAdapterBindings() {
|
public Map<Type, Object> provideCustomAdapterBindings() {
|
||||||
return ImmutableMap.<Type, Object> of(ServerState.class, new GleSYSTypeAdapters.ServerStateAdapter());
|
return ImmutableMap.<Type, Object> of(Server.State.class, new GleSYSTypeAdapters.ServerStateAdapter());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -33,7 +33,7 @@ import com.google.gson.annotations.SerializedName;
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href="https://customer.glesys.com/api.php?a=doc#server_allowedarguments" />
|
* @see <a href="https://customer.glesys.com/api.php?a=doc#server_allowedarguments" />
|
||||||
*/
|
*/
|
||||||
public class ServerAllowedArguments {
|
public class AllowedArgumentsForCreateServer {
|
||||||
public static Builder builder() {
|
public static Builder builder() {
|
||||||
return new Builder();
|
return new Builder();
|
||||||
}
|
}
|
||||||
|
@ -101,11 +101,11 @@ public class ServerAllowedArguments {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServerAllowedArguments build() {
|
public AllowedArgumentsForCreateServer build() {
|
||||||
return new ServerAllowedArguments(diskSizes, memorySizes, cpuCores, templates, transfers, dataCenters);
|
return new AllowedArgumentsForCreateServer(diskSizes, memorySizes, cpuCores, templates, transfers, dataCenters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder fromAllowedArguments(ServerAllowedArguments in) {
|
public Builder fromAllowedArguments(AllowedArgumentsForCreateServer in) {
|
||||||
return diskSizes(in.getDiskSizes())
|
return diskSizes(in.getDiskSizes())
|
||||||
.memorySizes(in.getMemorySizes())
|
.memorySizes(in.getMemorySizes())
|
||||||
.cpuCores(in.getCpuCores())
|
.cpuCores(in.getCpuCores())
|
||||||
|
@ -128,7 +128,7 @@ public class ServerAllowedArguments {
|
||||||
@SerializedName("datacenter")
|
@SerializedName("datacenter")
|
||||||
private final List<String> dataCenters;
|
private final List<String> dataCenters;
|
||||||
|
|
||||||
public ServerAllowedArguments(List<Integer> diskSizes, List<Integer> memorySizes, List<Integer> cpuCores,
|
public AllowedArgumentsForCreateServer(List<Integer> diskSizes, List<Integer> memorySizes, List<Integer> cpuCores,
|
||||||
List<String> templates, List<Integer> transfers, List<String> dataCenters) {
|
List<String> templates, List<Integer> transfers, List<String> dataCenters) {
|
||||||
checkNotNull(diskSizes, "diskSizes");
|
checkNotNull(diskSizes, "diskSizes");
|
||||||
checkNotNull(memorySizes, "memorySizes");
|
checkNotNull(memorySizes, "memorySizes");
|
||||||
|
@ -147,7 +147,7 @@ public class ServerAllowedArguments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list of disk sizes, in GB, that can be used for creating servers on this platform
|
* @return a list of disk sizes, in GB, that can be used for creating servers on this platform
|
||||||
* @see org.jclouds.glesys.domain.ServerTemplate#getMinDiskSize()
|
* @see org.jclouds.glesys.domain.Template#getMinDiskSize()
|
||||||
*/
|
*/
|
||||||
public List<Integer> getDiskSizes() {
|
public List<Integer> getDiskSizes() {
|
||||||
return diskSizes;
|
return diskSizes;
|
||||||
|
@ -155,7 +155,7 @@ public class ServerAllowedArguments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list of memory sizes, in MB, that can be used for creating servers on this platform
|
* @return a list of memory sizes, in MB, that can be used for creating servers on this platform
|
||||||
* @see org.jclouds.glesys.domain.ServerTemplate#getMinMemSize()
|
* @see org.jclouds.glesys.domain.Template#getMinMemSize()
|
||||||
*/
|
*/
|
||||||
public List<Integer> getMemorySizes() {
|
public List<Integer> getMemorySizes() {
|
||||||
return memorySizes;
|
return memorySizes;
|
||||||
|
@ -170,7 +170,7 @@ public class ServerAllowedArguments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list of template names available for creating servers on this platform
|
* @return a list of template names available for creating servers on this platform
|
||||||
* @see org.jclouds.glesys.domain.ServerTemplate#getName()
|
* @see org.jclouds.glesys.domain.Template#getName()
|
||||||
*/
|
*/
|
||||||
public List<String> getTemplates() {
|
public List<String> getTemplates() {
|
||||||
return templates;
|
return templates;
|
||||||
|
@ -195,8 +195,8 @@ public class ServerAllowedArguments {
|
||||||
if (this == object) {
|
if (this == object) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (object instanceof ServerAllowedArguments) {
|
if (object instanceof AllowedArgumentsForCreateServer) {
|
||||||
final ServerAllowedArguments other = (ServerAllowedArguments) object;
|
final AllowedArgumentsForCreateServer other = (AllowedArgumentsForCreateServer) object;
|
||||||
return Objects.equal(diskSizes, other.diskSizes)
|
return Objects.equal(diskSizes, other.diskSizes)
|
||||||
&& Objects.equal(memorySizes, other.memorySizes)
|
&& Objects.equal(memorySizes, other.memorySizes)
|
||||||
&& Objects.equal(cpuCores, other.cpuCores)
|
&& Objects.equal(cpuCores, other.cpuCores)
|
|
@ -26,7 +26,7 @@ import com.google.common.base.Objects;
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href="https://customer.glesys.com/api.php?a=doc#server_console" />
|
* @see <a href="https://customer.glesys.com/api.php?a=doc#server_console" />
|
||||||
*/
|
*/
|
||||||
public class ServerConsole {
|
public class Console {
|
||||||
public static Builder builder() {
|
public static Builder builder() {
|
||||||
return new Builder();
|
return new Builder();
|
||||||
}
|
}
|
||||||
|
@ -57,11 +57,11 @@ public class ServerConsole {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServerConsole build() {
|
public Console build() {
|
||||||
return new ServerConsole(host, port, protocol, password);
|
return new Console(host, port, protocol, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder fromServerConsole(ServerConsole in) {
|
public Builder fromConsole(Console in) {
|
||||||
return host(in.getHost()).port(in.getPort()).password(in.getPassword()).protocol(in.getProtocol());
|
return host(in.getHost()).port(in.getPort()).password(in.getPassword()).protocol(in.getProtocol());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public class ServerConsole {
|
||||||
private final String protocol;
|
private final String protocol;
|
||||||
private final String password;
|
private final String password;
|
||||||
|
|
||||||
public ServerConsole(String host, int port, String protocol, String password) {
|
public Console(String host, int port, String protocol, String password) {
|
||||||
this.host = host;
|
this.host = host;
|
||||||
this.port = port;
|
this.port = port;
|
||||||
this.protocol = protocol;
|
this.protocol = protocol;
|
||||||
|
@ -112,8 +112,8 @@ public class ServerConsole {
|
||||||
if (this == object) {
|
if (this == object) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (object instanceof ServerConsole) {
|
if (object instanceof Console) {
|
||||||
final ServerConsole other = (ServerConsole) object;
|
final Console other = (Console) object;
|
||||||
return Objects.equal(host, other.host)
|
return Objects.equal(host, other.host)
|
||||||
&& Objects.equal(port, other.port)
|
&& Objects.equal(port, other.port)
|
||||||
&& Objects.equal(protocol, other.protocol);
|
&& Objects.equal(protocol, other.protocol);
|
|
@ -29,7 +29,7 @@ import java.util.Date;
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_list" />
|
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_list" />
|
||||||
*/
|
*/
|
||||||
public class Email implements Comparable<Email> {
|
public class EmailAccount implements Comparable<EmailAccount> {
|
||||||
public static Builder builder() {
|
public static Builder builder() {
|
||||||
return new Builder();
|
return new Builder();
|
||||||
}
|
}
|
||||||
|
@ -96,12 +96,12 @@ public class Email implements Comparable<Email> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Email build() {
|
public EmailAccount build() {
|
||||||
return new Email(account, quota, usedQuota, antispamLevel, antiVirus, autoRespond, autoRespondMessage,
|
return new EmailAccount(account, quota, usedQuota, antispamLevel, antiVirus, autoRespond, autoRespondMessage,
|
||||||
autoRespondSaveEmail, created, modified);
|
autoRespondSaveEmail, created, modified);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder fromEmail(Email in) {
|
public Builder fromEmail(EmailAccount in) {
|
||||||
return account(in.getAccount()).quota(in.getQuota()).usedQuota(in.getUsedQuota()).antispamLevel(in.getAntispamLevel()).
|
return account(in.getAccount()).quota(in.getQuota()).usedQuota(in.getUsedQuota()).antispamLevel(in.getAntispamLevel()).
|
||||||
antiVirus(in.getAntiVirus()).autoRespond(in.getAutoRespond()).autoRespondMessage(in.getAutoRespondMessage()).
|
antiVirus(in.getAntiVirus()).autoRespond(in.getAutoRespond()).autoRespondMessage(in.getAutoRespondMessage()).
|
||||||
autoRespondSaveEmail(in.getAutoRespondSaveEmail()).created(in.getCreated()).modified(in.getModified());
|
autoRespondSaveEmail(in.getAutoRespondSaveEmail()).created(in.getCreated()).modified(in.getModified());
|
||||||
|
@ -126,7 +126,7 @@ public class Email implements Comparable<Email> {
|
||||||
private final Date created;
|
private final Date created;
|
||||||
private final Date modified;
|
private final Date modified;
|
||||||
|
|
||||||
public Email(String account, String quota, String usedQuota, int antispamLevel, boolean antiVirus, boolean autoRespond, String autoRespondMessage, boolean autoRespondSaveEmail, Date created, Date modified) {
|
public EmailAccount(String account, String quota, String usedQuota, int antispamLevel, boolean antiVirus, boolean autoRespond, String autoRespondMessage, boolean autoRespondSaveEmail, Date created, Date modified) {
|
||||||
this.account = account;
|
this.account = account;
|
||||||
this.quota = quota;
|
this.quota = quota;
|
||||||
this.usedQuota = usedQuota;
|
this.usedQuota = usedQuota;
|
||||||
|
@ -189,7 +189,7 @@ public class Email implements Comparable<Email> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Email other) {
|
public int compareTo(EmailAccount other) {
|
||||||
return account.compareTo(other.getAccount());
|
return account.compareTo(other.getAccount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,8 +198,8 @@ public class Email implements Comparable<Email> {
|
||||||
if (this == object) {
|
if (this == object) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (object instanceof Email) {
|
if (object instanceof EmailAccount) {
|
||||||
Email other = (Email) object;
|
EmailAccount other = (EmailAccount) object;
|
||||||
return Objects.equal(account, other.account);
|
return Objects.equal(account, other.account);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.glesys.domain;
|
package org.jclouds.glesys.domain;
|
||||||
|
|
||||||
|
import com.google.common.annotations.Beta;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -30,6 +31,8 @@ import java.util.Set;
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_overview" />
|
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_overview" />
|
||||||
*/
|
*/
|
||||||
|
//TODO: find a better name for this class
|
||||||
|
@Beta
|
||||||
public class EmailOverview {
|
public class EmailOverview {
|
||||||
public static Builder builder() {
|
public static Builder builder() {
|
||||||
return new Builder();
|
return new Builder();
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.glesys.domain;
|
package org.jclouds.glesys.domain;
|
||||||
|
|
||||||
|
import com.google.common.annotations.Beta;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,6 +27,8 @@ import com.google.common.base.Objects;
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_overview" />
|
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_overview" />
|
||||||
*/
|
*/
|
||||||
|
//TODO: find a better name for this class
|
||||||
|
@Beta
|
||||||
public class EmailOverviewDomain {
|
public class EmailOverviewDomain {
|
||||||
public static Builder builder() {
|
public static Builder builder() {
|
||||||
return new Builder();
|
return new Builder();
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.glesys.domain;
|
package org.jclouds.glesys.domain;
|
||||||
|
|
||||||
|
import com.google.common.annotations.Beta;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
@ -27,6 +28,8 @@ import com.google.gson.annotations.SerializedName;
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_overview" />
|
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_overview" />
|
||||||
*/
|
*/
|
||||||
|
//TODO: find a better name for this class
|
||||||
|
@Beta
|
||||||
public class EmailOverviewSummary {
|
public class EmailOverviewSummary {
|
||||||
public static Builder builder() {
|
public static Builder builder() {
|
||||||
return new Builder();
|
return new Builder();
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.glesys.domain;
|
package org.jclouds.glesys.domain;
|
||||||
|
|
||||||
|
import com.google.common.base.CaseFormat;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
@ -30,6 +31,29 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
* @see <a href= "https://customer.glesys.com/api.php?a=doc#server_list" />
|
* @see <a href= "https://customer.glesys.com/api.php?a=doc#server_list" />
|
||||||
*/
|
*/
|
||||||
public class Server implements Comparable<Server> {
|
public class Server implements Comparable<Server> {
|
||||||
|
|
||||||
|
public static enum State {
|
||||||
|
|
||||||
|
RUNNING, STOPPED, UNRECOGNIZED;
|
||||||
|
|
||||||
|
public String value() {
|
||||||
|
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return value();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static State fromValue(String state) {
|
||||||
|
try {
|
||||||
|
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return UNRECOGNIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Builder builder() {
|
public static Builder builder() {
|
||||||
return new Builder();
|
return new Builder();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
/**
|
|
||||||
* 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.glesys.domain;
|
|
||||||
|
|
||||||
import com.google.common.base.CaseFormat;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Valid states for a server hosted in a Glesys cloud
|
|
||||||
*
|
|
||||||
* @author Adam Lowe
|
|
||||||
* @see ServerStatus
|
|
||||||
*/
|
|
||||||
public enum ServerState {
|
|
||||||
|
|
||||||
RUNNING, STOPPED, UNRECOGNIZED;
|
|
||||||
|
|
||||||
public String value() {
|
|
||||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return value();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ServerState fromValue(String state) {
|
|
||||||
try {
|
|
||||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
return UNRECOGNIZED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -34,13 +34,13 @@ public class ServerStatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private ServerState state;
|
private Server.State state;
|
||||||
private ResourceUsage cpu;
|
private ResourceUsage cpu;
|
||||||
private ResourceUsage memory;
|
private ResourceUsage memory;
|
||||||
private ResourceUsage disk;
|
private ResourceUsage disk;
|
||||||
private ServerUptime uptime;
|
private ServerUptime uptime;
|
||||||
|
|
||||||
public Builder state(ServerState state) {
|
public Builder state(Server.State state) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -74,13 +74,13 @@ public class ServerStatus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ServerState state;
|
private final Server.State state;
|
||||||
private final ResourceUsage cpu;
|
private final ResourceUsage cpu;
|
||||||
private final ResourceUsage memory;
|
private final ResourceUsage memory;
|
||||||
private final ResourceUsage disk;
|
private final ResourceUsage disk;
|
||||||
private final ServerUptime uptime;
|
private final ServerUptime uptime;
|
||||||
|
|
||||||
public ServerStatus(ServerState state, ResourceUsage cpu, ResourceUsage memory, ResourceUsage disk, ServerUptime uptime) {
|
public ServerStatus(Server.State state, ResourceUsage cpu, ResourceUsage memory, ResourceUsage disk, ServerUptime uptime) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.cpu = cpu;
|
this.cpu = cpu;
|
||||||
this.memory = memory;
|
this.memory = memory;
|
||||||
|
@ -91,7 +91,7 @@ public class ServerStatus {
|
||||||
/**
|
/**
|
||||||
* @return the state of the server (e.g. "running")
|
* @return the state of the server (e.g. "running")
|
||||||
*/
|
*/
|
||||||
public ServerState getState() {
|
public Server.State getState() {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import com.google.gson.annotations.SerializedName;
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href= "https://customer.glesys.com/api.php?a=doc#server_templates" />
|
* @see <a href= "https://customer.glesys.com/api.php?a=doc#server_templates" />
|
||||||
*/
|
*/
|
||||||
public class ServerTemplate implements Comparable<ServerTemplate>{
|
public class Template implements Comparable<Template>{
|
||||||
|
|
||||||
public static Builder builder() {
|
public static Builder builder() {
|
||||||
return new Builder();
|
return new Builder();
|
||||||
|
@ -66,11 +66,11 @@ public class ServerTemplate implements Comparable<ServerTemplate>{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServerTemplate build() {
|
public Template build() {
|
||||||
return new ServerTemplate(name, minDiskSize, minMemSize, os, platform);
|
return new Template(name, minDiskSize, minMemSize, os, platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder fromTemplate(ServerTemplate in) {
|
public Builder fromTemplate(Template in) {
|
||||||
return name(in.getName()).minDiskSize(in.getMinDiskSize()).minMemSize(in.getMinMemSize()).os(in.getOs()).platform(in.getPlatform());
|
return name(in.getName()).minDiskSize(in.getMinDiskSize()).minMemSize(in.getMinMemSize()).os(in.getOs()).platform(in.getPlatform());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class ServerTemplate implements Comparable<ServerTemplate>{
|
||||||
private final String os;
|
private final String os;
|
||||||
private final String platform;
|
private final String platform;
|
||||||
|
|
||||||
public ServerTemplate(String name, int minDiskSize, int minMemSize, String os, String platform) {
|
public Template(String name, int minDiskSize, int minMemSize, String os, String platform) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.minDiskSize = minDiskSize;
|
this.minDiskSize = minDiskSize;
|
||||||
this.minMemSize = minMemSize;
|
this.minMemSize = minMemSize;
|
||||||
|
@ -99,7 +99,7 @@ public class ServerTemplate implements Comparable<ServerTemplate>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the minimum allowed disk size in GB
|
* @return the minimum allowed disk size in GB
|
||||||
* @see org.jclouds.glesys.domain.ServerAllowedArguments#getDiskSizes()
|
* @see org.jclouds.glesys.domain.AllowedArgumentsForCreateServer#getDiskSizes()
|
||||||
*/
|
*/
|
||||||
public int getMinDiskSize() {
|
public int getMinDiskSize() {
|
||||||
return minDiskSize;
|
return minDiskSize;
|
||||||
|
@ -107,7 +107,7 @@ public class ServerTemplate implements Comparable<ServerTemplate>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the minimum allowed memory size in MB
|
* @return the minimum allowed memory size in MB
|
||||||
* @see org.jclouds.glesys.domain.ServerAllowedArguments#getMemorySizes()
|
* @see org.jclouds.glesys.domain.AllowedArgumentsForCreateServer#getMemorySizes()
|
||||||
*/
|
*/
|
||||||
public int getMinMemSize() {
|
public int getMinMemSize() {
|
||||||
return minMemSize;
|
return minMemSize;
|
||||||
|
@ -132,8 +132,8 @@ public class ServerTemplate implements Comparable<ServerTemplate>{
|
||||||
if (this == object) {
|
if (this == object) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (object instanceof ServerTemplate) {
|
if (object instanceof Template) {
|
||||||
final ServerTemplate other = (ServerTemplate) object;
|
final Template other = (Template) object;
|
||||||
return Objects.equal(name, other.name)
|
return Objects.equal(name, other.name)
|
||||||
&& Objects.equal(platform, other.platform);
|
&& Objects.equal(platform, other.platform);
|
||||||
} else {
|
} else {
|
||||||
|
@ -153,7 +153,7 @@ public class ServerTemplate implements Comparable<ServerTemplate>{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(ServerTemplate arg0) {
|
public int compareTo(Template arg0) {
|
||||||
return Ordering.usingToString().compare(this, arg0);
|
return Ordering.usingToString().compare(this, arg0);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,10 +21,10 @@ package org.jclouds.glesys.features;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import org.jclouds.glesys.domain.Domain;
|
import org.jclouds.glesys.domain.Domain;
|
||||||
import org.jclouds.glesys.domain.DomainRecord;
|
import org.jclouds.glesys.domain.DomainRecord;
|
||||||
import org.jclouds.glesys.options.DomainAddOptions;
|
import org.jclouds.glesys.options.AddDomainOptions;
|
||||||
import org.jclouds.glesys.options.DomainOptions;
|
import org.jclouds.glesys.options.DomainOptions;
|
||||||
import org.jclouds.glesys.options.DomainRecordAddOptions;
|
import org.jclouds.glesys.options.AddRecordOptions;
|
||||||
import org.jclouds.glesys.options.DomainRecordEditOptions;
|
import org.jclouds.glesys.options.EditRecordOptions;
|
||||||
import org.jclouds.http.filters.BasicAuthentication;
|
import org.jclouds.http.filters.BasicAuthentication;
|
||||||
import org.jclouds.rest.annotations.ExceptionParser;
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
@ -64,7 +64,7 @@ public interface DomainAsyncClient {
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/domain/add/format/json")
|
@Path("/domain/add/format/json")
|
||||||
ListenableFuture<Void> addDomain(@FormParam("name") String name, DomainAddOptions... options);
|
ListenableFuture<Void> addDomain(@FormParam("name") String name, AddDomainOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainClient#editDomain
|
* @see DomainClient#editDomain
|
||||||
|
@ -97,14 +97,14 @@ public interface DomainAsyncClient {
|
||||||
@Path("/domain/add_record/format/json")
|
@Path("/domain/add_record/format/json")
|
||||||
ListenableFuture<Void> addRecord(@FormParam("domain") String domain, @FormParam("host") String host,
|
ListenableFuture<Void> addRecord(@FormParam("domain") String domain, @FormParam("host") String host,
|
||||||
@FormParam("type") String type, @FormParam("data") String data,
|
@FormParam("type") String type, @FormParam("data") String data,
|
||||||
DomainRecordAddOptions... options);
|
AddRecordOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainClient#editRecord
|
* @see DomainClient#editRecord
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/domain/update_record/format/json")
|
@Path("/domain/update_record/format/json")
|
||||||
ListenableFuture<Void> editRecord(@FormParam("record_id") String record_id, DomainRecordEditOptions... options);
|
ListenableFuture<Void> editRecord(@FormParam("record_id") String record_id, EditRecordOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainClient#deleteRecord
|
* @see DomainClient#deleteRecord
|
||||||
|
|
|
@ -21,10 +21,10 @@ package org.jclouds.glesys.features;
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.glesys.domain.Domain;
|
import org.jclouds.glesys.domain.Domain;
|
||||||
import org.jclouds.glesys.domain.DomainRecord;
|
import org.jclouds.glesys.domain.DomainRecord;
|
||||||
import org.jclouds.glesys.options.DomainAddOptions;
|
import org.jclouds.glesys.options.AddDomainOptions;
|
||||||
import org.jclouds.glesys.options.DomainOptions;
|
import org.jclouds.glesys.options.DomainOptions;
|
||||||
import org.jclouds.glesys.options.DomainRecordAddOptions;
|
import org.jclouds.glesys.options.AddRecordOptions;
|
||||||
import org.jclouds.glesys.options.DomainRecordEditOptions;
|
import org.jclouds.glesys.options.EditRecordOptions;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -53,7 +53,7 @@ public interface DomainClient {
|
||||||
* @param domain the name of the domain to add.
|
* @param domain the name of the domain to add.
|
||||||
* @param options optional parameters
|
* @param options optional parameters
|
||||||
*/
|
*/
|
||||||
void addDomain(String domain, DomainAddOptions... options);
|
void addDomain(String domain, AddDomainOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a domain to the Glesys dns-system
|
* Add a domain to the Glesys dns-system
|
||||||
|
@ -86,7 +86,7 @@ public interface DomainClient {
|
||||||
* @param data
|
* @param data
|
||||||
* @param options optional settings for the record
|
* @param options optional settings for the record
|
||||||
*/
|
*/
|
||||||
void addRecord(String domain, String host, String type, String data, DomainRecordAddOptions... options);
|
void addRecord(String domain, String host, String type, String data, AddRecordOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify a specific DNS Record
|
* Modify a specific DNS Record
|
||||||
|
@ -95,7 +95,7 @@ public interface DomainClient {
|
||||||
* @param options the settings to change
|
* @param options the settings to change
|
||||||
* @see #listRecords to retrieve the necessary ids
|
* @see #listRecords to retrieve the necessary ids
|
||||||
*/
|
*/
|
||||||
void editRecord(String recordId, DomainRecordEditOptions... options);
|
void editRecord(String recordId, EditRecordOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a DNS record
|
* Delete a DNS record
|
||||||
|
|
|
@ -26,10 +26,10 @@ import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.glesys.domain.Email;
|
import org.jclouds.glesys.domain.EmailAccount;
|
||||||
import org.jclouds.glesys.domain.EmailOverview;
|
import org.jclouds.glesys.domain.EmailOverview;
|
||||||
import org.jclouds.glesys.options.EmailCreateOptions;
|
import org.jclouds.glesys.options.CreateAccountOptions;
|
||||||
import org.jclouds.glesys.options.EmailEditOptions;
|
import org.jclouds.glesys.options.EditAccountOptions;
|
||||||
import org.jclouds.http.filters.BasicAuthentication;
|
import org.jclouds.http.filters.BasicAuthentication;
|
||||||
import org.jclouds.rest.annotations.ExceptionParser;
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
@ -68,14 +68,14 @@ public interface EmailAsyncClient {
|
||||||
@SelectJson("emailaccounts")
|
@SelectJson("emailaccounts")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||||
ListenableFuture<Set<Email>> listAccounts(@FormParam("domain") String domain);
|
ListenableFuture<Set<EmailAccount>> listAccounts(@FormParam("domain") String domain);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.features.EmailClient#createAccount
|
* @see org.jclouds.glesys.features.EmailClient#createAccount
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/email/createaccount/format/json")
|
@Path("/email/createaccount/format/json")
|
||||||
ListenableFuture<Void> createAccount(@FormParam("emailaccount") String accountAddress, @FormParam("password") String password, EmailCreateOptions... options);
|
ListenableFuture<Void> createAccount(@FormParam("emailaccount") String accountAddress, @FormParam("password") String password, CreateAccountOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.features.EmailClient#createAlias
|
* @see org.jclouds.glesys.features.EmailClient#createAlias
|
||||||
|
@ -89,7 +89,7 @@ public interface EmailAsyncClient {
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/email/editaccount/format/json")
|
@Path("/email/editaccount/format/json")
|
||||||
ListenableFuture<Void> editAccount(@FormParam("emailaccount") String accountAddress, EmailEditOptions... options);
|
ListenableFuture<Void> editAccount(@FormParam("emailaccount") String accountAddress, EditAccountOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.features.EmailClient#editAlias
|
* @see org.jclouds.glesys.features.EmailClient#editAlias
|
||||||
|
|
|
@ -22,10 +22,10 @@ import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.glesys.domain.Email;
|
import org.jclouds.glesys.domain.EmailAccount;
|
||||||
import org.jclouds.glesys.domain.EmailOverview;
|
import org.jclouds.glesys.domain.EmailOverview;
|
||||||
import org.jclouds.glesys.options.EmailCreateOptions;
|
import org.jclouds.glesys.options.CreateAccountOptions;
|
||||||
import org.jclouds.glesys.options.EmailEditOptions;
|
import org.jclouds.glesys.options.EditAccountOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to E-Mail requests.
|
* Provides synchronous access to E-Mail requests.
|
||||||
|
@ -50,7 +50,7 @@ public interface EmailClient {
|
||||||
*
|
*
|
||||||
* @return the relevant set of details
|
* @return the relevant set of details
|
||||||
*/
|
*/
|
||||||
Set<Email> listAccounts(String domain);
|
Set<EmailAccount> listAccounts(String domain);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new e-mail account
|
* Create a new e-mail account
|
||||||
|
@ -60,7 +60,7 @@ public interface EmailClient {
|
||||||
* @param options optional parameters
|
* @param options optional parameters
|
||||||
* @see DomainClient#addDomain
|
* @see DomainClient#addDomain
|
||||||
*/
|
*/
|
||||||
void createAccount(String accountAddress, String password, EmailCreateOptions... options);
|
void createAccount(String accountAddress, String password, CreateAccountOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an e-mail alias for an e-mail account
|
* Create an e-mail alias for an e-mail account
|
||||||
|
@ -77,7 +77,7 @@ public interface EmailClient {
|
||||||
* @param accountAddress the existing e-mail account address
|
* @param accountAddress the existing e-mail account address
|
||||||
* @param options optional parameters
|
* @param options optional parameters
|
||||||
*/
|
*/
|
||||||
void editAccount(String accountAddress, EmailEditOptions... options);
|
void editAccount(String accountAddress, EditAccountOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust (re-target) an e-mail alias
|
* Adjust (re-target) an e-mail alias
|
||||||
|
|
|
@ -29,22 +29,22 @@ import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import org.jclouds.glesys.domain.Console;
|
||||||
import org.jclouds.glesys.domain.Server;
|
import org.jclouds.glesys.domain.Server;
|
||||||
import org.jclouds.glesys.domain.ServerAllowedArguments;
|
import org.jclouds.glesys.domain.AllowedArgumentsForCreateServer;
|
||||||
import org.jclouds.glesys.domain.ServerConsole;
|
|
||||||
import org.jclouds.glesys.domain.ServerDetails;
|
import org.jclouds.glesys.domain.ServerDetails;
|
||||||
import org.jclouds.glesys.domain.ServerLimit;
|
import org.jclouds.glesys.domain.ServerLimit;
|
||||||
import org.jclouds.glesys.domain.ServerStatus;
|
import org.jclouds.glesys.domain.ServerStatus;
|
||||||
import org.jclouds.glesys.domain.ServerTemplate;
|
import org.jclouds.glesys.domain.Template;
|
||||||
import org.jclouds.glesys.functions.ParseServerTemplatesFromHttpResponse;
|
import org.jclouds.glesys.functions.ParseTemplatesFromHttpResponse;
|
||||||
import org.jclouds.glesys.options.ServerCloneOptions;
|
import org.jclouds.glesys.options.CloneServerOptions;
|
||||||
import org.jclouds.glesys.options.ServerCreateOptions;
|
import org.jclouds.glesys.options.CreateServerOptions;
|
||||||
import org.jclouds.glesys.options.ServerDestroyOptions;
|
import org.jclouds.glesys.options.DestroyServerOptions;
|
||||||
import org.jclouds.glesys.options.ServerEditOptions;
|
import org.jclouds.glesys.options.EditServerOptions;
|
||||||
import org.jclouds.glesys.options.ServerStatusOptions;
|
import org.jclouds.glesys.options.ServerStatusOptions;
|
||||||
import org.jclouds.glesys.options.ServerStopOptions;
|
|
||||||
import org.jclouds.http.filters.BasicAuthentication;
|
import org.jclouds.http.filters.BasicAuthentication;
|
||||||
import org.jclouds.rest.annotations.ExceptionParser;
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
|
import org.jclouds.rest.annotations.FormParams;
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
import org.jclouds.rest.annotations.ResponseParser;
|
import org.jclouds.rest.annotations.ResponseParser;
|
||||||
import org.jclouds.rest.annotations.SelectJson;
|
import org.jclouds.rest.annotations.SelectJson;
|
||||||
|
@ -107,33 +107,33 @@ public interface ServerAsyncClient {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ServerClient#getServerConsole
|
* @see ServerClient#getConsole
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/server/console/format/json")
|
@Path("/server/console/format/json")
|
||||||
@SelectJson("console")
|
@SelectJson("console")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<ServerConsole> getServerConsole(@FormParam("serverid") String id);
|
ListenableFuture<Console> getConsole(@FormParam("serverid") String id);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ServerClient#getServerAllowedArguments
|
* @see ServerClient#getAllowedArgumentsForCreateServerByPlatform
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/server/allowedarguments/format/json")
|
@Path("/server/allowedarguments/format/json")
|
||||||
@SelectJson("argumentslist")
|
@SelectJson("argumentslist")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
ListenableFuture<Map<String, ServerAllowedArguments>> getServerAllowedArguments();
|
ListenableFuture<Map<String, AllowedArgumentsForCreateServer>> getAllowedArgumentsForCreateServerByPlatform();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ServerClient#getTemplates
|
* @see ServerClient#getTemplates
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/server/templates/format/json")
|
@Path("/server/templates/format/json")
|
||||||
@ResponseParser(ParseServerTemplatesFromHttpResponse.class)
|
@ResponseParser(ParseTemplatesFromHttpResponse.class)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
ListenableFuture<Set<ServerTemplate>> getTemplates();
|
ListenableFuture<Set<Template>> getTemplates();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ServerClient#stopServer
|
* @see ServerClient#stopServer
|
||||||
|
@ -168,7 +168,17 @@ public interface ServerAsyncClient {
|
||||||
@SelectJson("server")
|
@SelectJson("server")
|
||||||
@Path("/server/stop/format/json")
|
@Path("/server/stop/format/json")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
ListenableFuture<ServerDetails> stopServer(@FormParam("serverid") String id, ServerStopOptions... options);
|
ListenableFuture<ServerDetails> stopServer(@FormParam("serverid") String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ServerClient#hardStopServer
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@SelectJson("server")
|
||||||
|
@Path("/server/stop/format/json")
|
||||||
|
@FormParams(keys = "type", values = "hard")
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
ListenableFuture<ServerDetails> hardStopServer(@FormParam("serverid") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ServerClient#createServer
|
* @see ServerClient#createServer
|
||||||
|
@ -186,7 +196,7 @@ public interface ServerAsyncClient {
|
||||||
@FormParam("cpucores") int cpuCores,
|
@FormParam("cpucores") int cpuCores,
|
||||||
@FormParam("rootpassword") String rootPassword,
|
@FormParam("rootpassword") String rootPassword,
|
||||||
@FormParam("transfer") int transfer,
|
@FormParam("transfer") int transfer,
|
||||||
ServerCreateOptions... options);
|
CreateServerOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ServerClient#cloneServer
|
* @see ServerClient#cloneServer
|
||||||
|
@ -197,7 +207,7 @@ public interface ServerAsyncClient {
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
ListenableFuture<ServerDetails> cloneServer(@FormParam("serverid") String serverid,
|
ListenableFuture<ServerDetails> cloneServer(@FormParam("serverid") String serverid,
|
||||||
@FormParam("hostname") String hostname,
|
@FormParam("hostname") String hostname,
|
||||||
ServerCloneOptions... options);
|
CloneServerOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ServerClient#editServer
|
* @see ServerClient#editServer
|
||||||
|
@ -206,14 +216,14 @@ public interface ServerAsyncClient {
|
||||||
@Path("/server/edit/format/json")
|
@Path("/server/edit/format/json")
|
||||||
@SelectJson("server")
|
@SelectJson("server")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
ListenableFuture<ServerDetails> editServer(@FormParam("serverid") String serverid, ServerEditOptions... options);
|
ListenableFuture<ServerDetails> editServer(@FormParam("serverid") String serverid, EditServerOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ServerClient#destroyServer
|
* @see ServerClient#destroyServer
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/server/destroy/format/json")
|
@Path("/server/destroy/format/json")
|
||||||
ListenableFuture<Void> destroyServer(@FormParam("serverid") String id, ServerDestroyOptions keepIp);
|
ListenableFuture<Void> destroyServer(@FormParam("serverid") String id, DestroyServerOptions keepIp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ServerClient#resetPassword
|
* @see ServerClient#resetPassword
|
||||||
|
|
|
@ -23,19 +23,20 @@ import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
|
import org.jclouds.glesys.domain.AllowedArgumentsForCreateServer;
|
||||||
|
import org.jclouds.glesys.domain.Console;
|
||||||
import org.jclouds.glesys.domain.Server;
|
import org.jclouds.glesys.domain.Server;
|
||||||
import org.jclouds.glesys.domain.ServerAllowedArguments;
|
|
||||||
import org.jclouds.glesys.domain.ServerConsole;
|
|
||||||
import org.jclouds.glesys.domain.ServerDetails;
|
import org.jclouds.glesys.domain.ServerDetails;
|
||||||
import org.jclouds.glesys.domain.ServerLimit;
|
import org.jclouds.glesys.domain.ServerLimit;
|
||||||
import org.jclouds.glesys.domain.ServerStatus;
|
import org.jclouds.glesys.domain.ServerStatus;
|
||||||
import org.jclouds.glesys.domain.ServerTemplate;
|
import org.jclouds.glesys.domain.Template;
|
||||||
import org.jclouds.glesys.options.ServerCloneOptions;
|
import org.jclouds.glesys.options.CloneServerOptions;
|
||||||
import org.jclouds.glesys.options.ServerCreateOptions;
|
import org.jclouds.glesys.options.CreateServerOptions;
|
||||||
import org.jclouds.glesys.options.ServerDestroyOptions;
|
import org.jclouds.glesys.options.DestroyServerOptions;
|
||||||
import org.jclouds.glesys.options.ServerEditOptions;
|
import org.jclouds.glesys.options.EditServerOptions;
|
||||||
import org.jclouds.glesys.options.ServerStatusOptions;
|
import org.jclouds.glesys.options.ServerStatusOptions;
|
||||||
import org.jclouds.glesys.options.ServerStopOptions;
|
|
||||||
|
import com.google.common.annotations.Beta;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Server.
|
* Provides synchronous access to Server.
|
||||||
|
@ -92,21 +93,21 @@ public interface ServerClient {
|
||||||
* @param id id of the server
|
* @param id id of the server
|
||||||
* @return the requested information about the server or null if not found
|
* @return the requested information about the server or null if not found
|
||||||
*/
|
*/
|
||||||
ServerConsole getServerConsole(String id);
|
Console getConsole(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get information about the OS templates available
|
* Get information about the OS templates available
|
||||||
*
|
*
|
||||||
* @return the set of information about each template
|
* @return the set of information about each template
|
||||||
*/
|
*/
|
||||||
Set<ServerTemplate> getTemplates();
|
Set<Template> getTemplates();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get information about valid arguments to #createServer for each platform
|
* Get information about valid arguments to #createServer for each platform
|
||||||
*
|
*
|
||||||
* @return a map of argument lists, keyed on platform
|
* @return a map of argument lists, keyed on platform
|
||||||
*/
|
*/
|
||||||
Map<String, ServerAllowedArguments> getServerAllowedArguments();
|
Map<String, AllowedArgumentsForCreateServer> getAllowedArgumentsForCreateServerByPlatform();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the fail count for a server limit (for OpenVZ only).
|
* Reset the fail count for a server limit (for OpenVZ only).
|
||||||
|
@ -134,9 +135,15 @@ public interface ServerClient {
|
||||||
* Stop a server
|
* Stop a server
|
||||||
*
|
*
|
||||||
* @param id id of the server
|
* @param id id of the server
|
||||||
* @param options optional parameters
|
|
||||||
*/
|
*/
|
||||||
void stopServer(String id, ServerStopOptions... options);
|
void stopServer(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hard stop a server
|
||||||
|
*
|
||||||
|
* @param id id of the server
|
||||||
|
*/
|
||||||
|
void hardStopServer(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new server
|
* Create a new server
|
||||||
|
@ -152,9 +159,11 @@ public interface ServerClient {
|
||||||
* @param transfer the transfer size
|
* @param transfer the transfer size
|
||||||
* @param options optional settings ex. description
|
* @param options optional settings ex. description
|
||||||
*/
|
*/
|
||||||
|
//TODO: make a ServerSpecification object like LaunchSpecification in ec2 as there are too many args
|
||||||
|
@Beta
|
||||||
ServerDetails createServer(String datacenter,String platform,String hostname,
|
ServerDetails createServer(String datacenter,String platform,String hostname,
|
||||||
String templateName, int diskSize, int memorySize, int cpuCores,
|
String templateName, int diskSize, int memorySize, int cpuCores,
|
||||||
String rootPassword, int transfer, ServerCreateOptions... options);
|
String rootPassword, int transfer, CreateServerOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit the configuration of a server
|
* Edit the configuration of a server
|
||||||
|
@ -162,7 +171,7 @@ public interface ServerClient {
|
||||||
* @param serverid the serverId of the server to edit
|
* @param serverid the serverId of the server to edit
|
||||||
* @param options the settings to change
|
* @param options the settings to change
|
||||||
*/
|
*/
|
||||||
ServerDetails editServer(String serverid, ServerEditOptions... options);
|
ServerDetails editServer(String serverid, EditServerOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone a server
|
* Clone a server
|
||||||
|
@ -171,15 +180,15 @@ public interface ServerClient {
|
||||||
* @param hostname the new host name of the cloned server
|
* @param hostname the new host name of the cloned server
|
||||||
* @param options the settings to change
|
* @param options the settings to change
|
||||||
*/
|
*/
|
||||||
ServerDetails cloneServer(String serverid, String hostname, ServerCloneOptions... options);
|
ServerDetails cloneServer(String serverid, String hostname, CloneServerOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy a server
|
* Destroy a server
|
||||||
*
|
*
|
||||||
* @param id the id of the server
|
* @param id the id of the server
|
||||||
* @param keepIp if ServerDestroyOptions.keepIp(true) the servers ip will be retained for use in your GleSYS account
|
* @param keepIp if DestroyServerOptions.keepIp(true) the servers ip will be retained for use in your GleSYS account
|
||||||
*/
|
*/
|
||||||
ServerDetails destroyServer(String id, ServerDestroyOptions keepIp);
|
ServerDetails destroyServer(String id, DestroyServerOptions keepIp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the root password of a server
|
* Reset the root password of a server
|
||||||
|
@ -196,7 +205,8 @@ public interface ServerClient {
|
||||||
* @param id the id of the server
|
* @param id the id of the server
|
||||||
* @param resource the name of the resource to retrieve usage information for
|
* @param resource the name of the resource to retrieve usage information for
|
||||||
*/
|
*/
|
||||||
|
@Beta
|
||||||
|
// TODO: better name
|
||||||
void resourceUsage(String id, String resource, String resolution);
|
void resourceUsage(String id, String resource, String resolution);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,95 +0,0 @@
|
||||||
/**
|
|
||||||
* 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.glesys.functions;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.domain.JsonBall;
|
|
||||||
import org.jclouds.http.HttpResponse;
|
|
||||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
|
||||||
import org.jclouds.io.payloads.StringPayload;
|
|
||||||
import org.jclouds.json.internal.GsonWrapper;
|
|
||||||
import org.jclouds.util.Strings2;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.inject.TypeLiteral;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* In GleSYS, the server responses are returned without the serverid. in this
|
|
||||||
* case, it is in a different json ball called arguments. We need to merge this
|
|
||||||
* jsonball before attempting to parse the server, otherwise the server will be
|
|
||||||
* without an id.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class MergeArgumentsAndParse<T> implements Function<HttpResponse, T> {
|
|
||||||
|
|
||||||
private final GsonWrapper jsonParser;
|
|
||||||
private final ParseFirstJsonValueNamed<Map<String, JsonBall>> parseArguments;
|
|
||||||
private final ParseFirstJsonValueNamed<Map<String, JsonBall>> parseServer;
|
|
||||||
private final TypeLiteral<T> type;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public MergeArgumentsAndParse(GsonWrapper json, TypeLiteral<T> type, String name) {
|
|
||||||
this.jsonParser = checkNotNull(json, "json");
|
|
||||||
this.parseArguments = new ParseFirstJsonValueNamed<Map<String, JsonBall>>(json,
|
|
||||||
new TypeLiteral<Map<String, JsonBall>>() {
|
|
||||||
}, "arguments");
|
|
||||||
this.parseServer = new ParseFirstJsonValueNamed<Map<String, JsonBall>>(json,
|
|
||||||
new TypeLiteral<Map<String, JsonBall>>() {
|
|
||||||
}, name);
|
|
||||||
this.type = checkNotNull(type, "type");
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public T apply(HttpResponse arg0) {
|
|
||||||
try {
|
|
||||||
if (arg0.getPayload() == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
arg0 = makePayloadReplayable(arg0);
|
|
||||||
|
|
||||||
Map<String, JsonBall> server = parseServer.apply(arg0);
|
|
||||||
if (server == null)
|
|
||||||
return null;
|
|
||||||
Map<String, JsonBall> arguments = parseArguments.apply(arg0);
|
|
||||||
if (arguments != null)
|
|
||||||
server = ImmutableMap.<String, JsonBall> builder().putAll(server).putAll(arguments).build();
|
|
||||||
return (T) jsonParser.fromJson(jsonParser.toJson(server), type.getRawType());
|
|
||||||
} catch (IOException e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// inputStreams are not replayable, yet we need to
|
|
||||||
public HttpResponse makePayloadReplayable(HttpResponse arg0) throws IOException {
|
|
||||||
String json = Strings2.toStringAndClose(arg0.getPayload().getInput());
|
|
||||||
arg0 = arg0.toBuilder().payload(new StringPayload(json)).build();
|
|
||||||
return arg0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
/**
|
|
||||||
* 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.glesys.functions;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.glesys.domain.ServerDetails;
|
|
||||||
import org.jclouds.json.internal.GsonWrapper;
|
|
||||||
|
|
||||||
import com.google.inject.TypeLiteral;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class MergeArgumentsAndReturnServerDetails extends MergeArgumentsAndParse<ServerDetails> {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public MergeArgumentsAndReturnServerDetails(GsonWrapper json) {
|
|
||||||
super(json, new TypeLiteral<ServerDetails>() {
|
|
||||||
}, "server");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -25,7 +25,7 @@ import java.util.Set;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.glesys.domain.ServerTemplate;
|
import org.jclouds.glesys.domain.Template;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||||
import org.jclouds.json.internal.GsonWrapper;
|
import org.jclouds.json.internal.GsonWrapper;
|
||||||
|
@ -40,19 +40,19 @@ import com.google.inject.TypeLiteral;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ParseServerTemplatesFromHttpResponse implements Function<HttpResponse, Set<ServerTemplate>> {
|
public class ParseTemplatesFromHttpResponse implements Function<HttpResponse, Set<Template>> {
|
||||||
private final ParseFirstJsonValueNamed<Map<String, Set<ServerTemplate>>> parser;
|
private final ParseFirstJsonValueNamed<Map<String, Set<Template>>> parser;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ParseServerTemplatesFromHttpResponse(GsonWrapper gsonWrapper) {
|
public ParseTemplatesFromHttpResponse(GsonWrapper gsonWrapper) {
|
||||||
this.parser = new ParseFirstJsonValueNamed<Map<String, Set<ServerTemplate>>>(checkNotNull(gsonWrapper,
|
this.parser = new ParseFirstJsonValueNamed<Map<String, Set<Template>>>(checkNotNull(gsonWrapper,
|
||||||
"gsonWrapper"), new TypeLiteral<Map<String, Set<ServerTemplate>>>() {
|
"gsonWrapper"), new TypeLiteral<Map<String, Set<Template>>>() {
|
||||||
}, "templates");
|
}, "templates");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<ServerTemplate> apply(HttpResponse response) {
|
public Set<Template> apply(HttpResponse response) {
|
||||||
checkNotNull(response, "response");
|
checkNotNull(response, "response");
|
||||||
Map<String, Set<ServerTemplate>> toParse = parser.apply(response);
|
Map<String, Set<Template>> toParse = parser.apply(response);
|
||||||
checkNotNull(toParse, "parsed result from %s", response);
|
checkNotNull(toParse, "parsed result from %s", response);
|
||||||
return ImmutableSet.copyOf(Iterables.concat(toParse.values()));
|
return ImmutableSet.copyOf(Iterables.concat(toParse.values()));
|
||||||
}
|
}
|
|
@ -20,7 +20,7 @@ package org.jclouds.glesys.functions.internal;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.jclouds.glesys.domain.ServerState;
|
import org.jclouds.glesys.domain.Server;
|
||||||
|
|
||||||
import com.google.gson.TypeAdapter;
|
import com.google.gson.TypeAdapter;
|
||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
|
@ -31,15 +31,15 @@ import com.google.gson.stream.JsonWriter;
|
||||||
*/
|
*/
|
||||||
public class GleSYSTypeAdapters {
|
public class GleSYSTypeAdapters {
|
||||||
|
|
||||||
public static class ServerStateAdapter extends TypeAdapter<ServerState> {
|
public static class ServerStateAdapter extends TypeAdapter<Server.State> {
|
||||||
@Override
|
@Override
|
||||||
public void write(JsonWriter writer, ServerState value) throws IOException {
|
public void write(JsonWriter writer, Server.State value) throws IOException {
|
||||||
writer.value(value.value());
|
writer.value(value.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServerState read(JsonReader reader) throws IOException {
|
public Server.State read(JsonReader reader) throws IOException {
|
||||||
return ServerState.fromValue(reader.nextString());
|
return Server.State.fromValue(reader.nextString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,62 +22,62 @@ package org.jclouds.glesys.options;
|
||||||
/**
|
/**
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
public class DomainAddOptions extends DomainOptions {
|
public class AddDomainOptions extends DomainOptions {
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
/**
|
/**
|
||||||
* @see DomainAddOptions#primaryNameServer
|
* @see AddDomainOptions#primaryNameServer
|
||||||
*/
|
*/
|
||||||
public static DomainAddOptions primaryNameServer(String primaryNameServer) {
|
public static AddDomainOptions primaryNameServer(String primaryNameServer) {
|
||||||
return DomainAddOptions.class.cast(new DomainAddOptions().primaryNameServer(primaryNameServer));
|
return AddDomainOptions.class.cast(new AddDomainOptions().primaryNameServer(primaryNameServer));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainAddOptions#responsiblePerson
|
* @see AddDomainOptions#responsiblePerson
|
||||||
*/
|
*/
|
||||||
public static DomainAddOptions responsiblePerson(String responsiblePerson) {
|
public static AddDomainOptions responsiblePerson(String responsiblePerson) {
|
||||||
return DomainAddOptions.class.cast(new DomainAddOptions().responsiblePerson(responsiblePerson));
|
return AddDomainOptions.class.cast(new AddDomainOptions().responsiblePerson(responsiblePerson));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainAddOptions#ttl
|
* @see AddDomainOptions#ttl
|
||||||
*/
|
*/
|
||||||
public static DomainAddOptions ttl(int ttl) {
|
public static AddDomainOptions ttl(int ttl) {
|
||||||
return DomainAddOptions.class.cast(new DomainAddOptions().ttl(ttl));
|
return AddDomainOptions.class.cast(new AddDomainOptions().ttl(ttl));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainAddOptions#refresh
|
* @see AddDomainOptions#refresh
|
||||||
*/
|
*/
|
||||||
public static DomainAddOptions refresh(int refresh) {
|
public static AddDomainOptions refresh(int refresh) {
|
||||||
return DomainAddOptions.class.cast(new DomainAddOptions().refresh(refresh));
|
return AddDomainOptions.class.cast(new AddDomainOptions().refresh(refresh));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainAddOptions#retry
|
* @see AddDomainOptions#retry
|
||||||
*/
|
*/
|
||||||
public static DomainAddOptions retry(int retry) {
|
public static AddDomainOptions retry(int retry) {
|
||||||
return DomainAddOptions.class.cast(new DomainAddOptions().retry(retry));
|
return AddDomainOptions.class.cast(new AddDomainOptions().retry(retry));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainAddOptions#expire
|
* @see AddDomainOptions#expire
|
||||||
*/
|
*/
|
||||||
public static DomainAddOptions expire(int expire) {
|
public static AddDomainOptions expire(int expire) {
|
||||||
return DomainAddOptions.class.cast(new DomainAddOptions().expire(expire));
|
return AddDomainOptions.class.cast(new AddDomainOptions().expire(expire));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainAddOptions#minimum
|
* @see AddDomainOptions#minimum
|
||||||
*/
|
*/
|
||||||
public static DomainAddOptions minimum(int minimum) {
|
public static AddDomainOptions minimum(int minimum) {
|
||||||
return DomainAddOptions.class.cast(new DomainAddOptions().minimum(minimum));
|
return AddDomainOptions.class.cast(new AddDomainOptions().minimum(minimum));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainAddOptions#minimalRecords
|
* @see AddDomainOptions#minimalRecords
|
||||||
*/
|
*/
|
||||||
public static DomainAddOptions minimalRecords() {
|
public static AddDomainOptions minimalRecords() {
|
||||||
return DomainAddOptions.class.cast(new DomainAddOptions().minimalRecords());
|
return AddDomainOptions.class.cast(new AddDomainOptions().minimalRecords());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,34 +23,34 @@ import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||||
/**
|
/**
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
public class DomainRecordAddOptions extends BaseHttpRequestOptions {
|
public class AddRecordOptions extends BaseHttpRequestOptions {
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
/**
|
/**
|
||||||
* @see DomainRecordAddOptions#ttl
|
* @see AddRecordOptions#ttl
|
||||||
*/
|
*/
|
||||||
public static DomainRecordAddOptions ttl(int ttl) {
|
public static AddRecordOptions ttl(int ttl) {
|
||||||
DomainRecordAddOptions options = new DomainRecordAddOptions();
|
AddRecordOptions options = new AddRecordOptions();
|
||||||
return options.ttl(ttl);
|
return options.ttl(ttl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainRecordAddOptions#mxPriority
|
* @see AddRecordOptions#mxPriority
|
||||||
*/
|
*/
|
||||||
public static DomainRecordAddOptions mxPriority(int mxPriority) {
|
public static AddRecordOptions mxPriority(int mxPriority) {
|
||||||
DomainRecordAddOptions options = new DomainRecordAddOptions();
|
AddRecordOptions options = new AddRecordOptions();
|
||||||
return options.mxPriority(mxPriority);
|
return options.mxPriority(mxPriority);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Configure TTL/Time-to-live for record */
|
/** Configure TTL/Time-to-live for record */
|
||||||
public DomainRecordAddOptions ttl(int ttl) {
|
public AddRecordOptions ttl(int ttl) {
|
||||||
formParameters.put("ttl", Integer.toString(ttl));
|
formParameters.put("ttl", Integer.toString(ttl));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Configure the priority of an MX record */
|
/** Configure the priority of an MX record */
|
||||||
public DomainRecordAddOptions mxPriority(int mxPriority) {
|
public AddRecordOptions mxPriority(int mxPriority) {
|
||||||
formParameters.put("mx_priority", Integer.toString(mxPriority));
|
formParameters.put("mx_priority", Integer.toString(mxPriority));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -21,55 +21,55 @@ package org.jclouds.glesys.options;
|
||||||
/**
|
/**
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
public class ServerCloneOptions extends ServerEditOptions {
|
public class CloneServerOptions extends EditServerOptions {
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.options.ServerCloneOptions#disksize
|
* @see org.jclouds.glesys.options.CloneServerOptions#disksize
|
||||||
*/
|
*/
|
||||||
public static ServerCloneOptions disksize(int disksize) {
|
public static CloneServerOptions disksize(int disksize) {
|
||||||
return ServerCloneOptions.class.cast(new ServerCloneOptions().disksize(disksize));
|
return CloneServerOptions.class.cast(new CloneServerOptions().disksize(disksize));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.options.ServerCloneOptions#memorysize
|
* @see org.jclouds.glesys.options.CloneServerOptions#memorysize
|
||||||
*/
|
*/
|
||||||
public static ServerCloneOptions memorysize(int memorysize) {
|
public static CloneServerOptions memorysize(int memorysize) {
|
||||||
return ServerCloneOptions.class.cast(new ServerCloneOptions().memorysize(memorysize));
|
return CloneServerOptions.class.cast(new CloneServerOptions().memorysize(memorysize));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.options.ServerCloneOptions#cpucores
|
* @see org.jclouds.glesys.options.CloneServerOptions#cpucores
|
||||||
*/
|
*/
|
||||||
public static ServerCloneOptions cpucores(int cpucores) {
|
public static CloneServerOptions cpucores(int cpucores) {
|
||||||
return ServerCloneOptions.class.cast(new ServerCloneOptions().cpucores(cpucores));
|
return CloneServerOptions.class.cast(new CloneServerOptions().cpucores(cpucores));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.options.ServerCloneOptions#cpucores
|
* @see org.jclouds.glesys.options.CloneServerOptions#cpucores
|
||||||
*/
|
*/
|
||||||
public static ServerCloneOptions transfer(int transfer) {
|
public static CloneServerOptions transfer(int transfer) {
|
||||||
return ServerCloneOptions.class.cast(new ServerCloneOptions().transfer(transfer));
|
return CloneServerOptions.class.cast(new CloneServerOptions().transfer(transfer));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.options.ServerEditOptions#description
|
* @see org.jclouds.glesys.options.EditServerOptions#description
|
||||||
*/
|
*/
|
||||||
public static ServerCloneOptions description(String description) {
|
public static CloneServerOptions description(String description) {
|
||||||
return ServerCloneOptions.class.cast(new ServerCloneOptions().description(description));
|
return CloneServerOptions.class.cast(new CloneServerOptions().description(description));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.options.ServerCloneOptions#dataCenter
|
* @see org.jclouds.glesys.options.CloneServerOptions#dataCenter
|
||||||
*/
|
*/
|
||||||
public static ServerCloneOptions dataCenter(String dataCenter) {
|
public static CloneServerOptions dataCenter(String dataCenter) {
|
||||||
return new ServerCloneOptions().dataCenter(dataCenter);
|
return new CloneServerOptions().dataCenter(dataCenter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure which datacenter to create the clone in
|
* Configure which datacenter to create the clone in
|
||||||
*/
|
*/
|
||||||
public ServerCloneOptions dataCenter(String dataCenter) {
|
public CloneServerOptions dataCenter(String dataCenter) {
|
||||||
formParameters.put("datacenter", dataCenter);
|
formParameters.put("datacenter", dataCenter);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -24,70 +24,70 @@ import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_createaccount" />
|
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_createaccount" />
|
||||||
*/
|
*/
|
||||||
public class EmailCreateOptions extends BaseHttpRequestOptions {
|
public class CreateAccountOptions extends BaseHttpRequestOptions {
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
/**
|
/**
|
||||||
* @see EmailCreateOptions#antispamLevel
|
* @see CreateAccountOptions#antispamLevel
|
||||||
*/
|
*/
|
||||||
public static EmailCreateOptions antispamLevel(int antispamLevel) {
|
public static CreateAccountOptions antispamLevel(int antispamLevel) {
|
||||||
return new EmailCreateOptions().antispamLevel(antispamLevel);
|
return new CreateAccountOptions().antispamLevel(antispamLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see EmailCreateOptions#antiVirus
|
* @see CreateAccountOptions#antiVirus
|
||||||
*/
|
*/
|
||||||
public static EmailCreateOptions antiVirus(boolean antiVirus) {
|
public static CreateAccountOptions antiVirus(boolean antiVirus) {
|
||||||
return new EmailCreateOptions().antiVirus(antiVirus);
|
return new CreateAccountOptions().antiVirus(antiVirus);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see EmailCreateOptions#autorespond
|
* @see CreateAccountOptions#autorespond
|
||||||
*/
|
*/
|
||||||
public static EmailCreateOptions autorespond(boolean autorespond) {
|
public static CreateAccountOptions autorespond(boolean autorespond) {
|
||||||
return new EmailCreateOptions().autorespond(autorespond);
|
return new CreateAccountOptions().autorespond(autorespond);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see EmailCreateOptions#autorespondSaveEmail
|
* @see CreateAccountOptions#autorespondSaveEmail
|
||||||
*/
|
*/
|
||||||
public static EmailCreateOptions autorespondSaveEmail(boolean autorespondSaveEmail) {
|
public static CreateAccountOptions autorespondSaveEmail(boolean autorespondSaveEmail) {
|
||||||
return new EmailCreateOptions().autorespondSaveEmail(autorespondSaveEmail);
|
return new CreateAccountOptions().autorespondSaveEmail(autorespondSaveEmail);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see EmailCreateOptions#autorespondMessage
|
* @see CreateAccountOptions#autorespondMessage
|
||||||
*/
|
*/
|
||||||
public static EmailCreateOptions autorespondMessage(String autorespondMessage) {
|
public static CreateAccountOptions autorespondMessage(String autorespondMessage) {
|
||||||
return new EmailCreateOptions().autorespondMessage(autorespondMessage);
|
return new CreateAccountOptions().autorespondMessage(autorespondMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Configure the antispam level of the account */
|
/** Configure the antispam level of the account */
|
||||||
public EmailCreateOptions antispamLevel(int antispamLevel) {
|
public CreateAccountOptions antispamLevel(int antispamLevel) {
|
||||||
formParameters.put("antispamlevel", Integer.toString(antispamLevel));
|
formParameters.put("antispamlevel", Integer.toString(antispamLevel));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Enable or disable virus checking */
|
/** Enable or disable virus checking */
|
||||||
public EmailCreateOptions antiVirus(boolean antiVirus) {
|
public CreateAccountOptions antiVirus(boolean antiVirus) {
|
||||||
formParameters.put("antivirus", Integer.toString(antiVirus ? 1 : 0));
|
formParameters.put("antivirus", Integer.toString(antiVirus ? 1 : 0));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Enable or disable auto-respond */
|
/** Enable or disable auto-respond */
|
||||||
public EmailCreateOptions autorespond(boolean autorespond) {
|
public CreateAccountOptions autorespond(boolean autorespond) {
|
||||||
formParameters.put("autorespond", Integer.toString(autorespond ? 1 : 0));
|
formParameters.put("autorespond", Integer.toString(autorespond ? 1 : 0));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Enable or disable saving of auto-respond e-mails */
|
/** Enable or disable saving of auto-respond e-mails */
|
||||||
public EmailCreateOptions autorespondSaveEmail(boolean autorespondSaveEmail) {
|
public CreateAccountOptions autorespondSaveEmail(boolean autorespondSaveEmail) {
|
||||||
formParameters.put("autorespondsaveemail", Integer.toString(autorespondSaveEmail ? 1 : 0));
|
formParameters.put("autorespondsaveemail", Integer.toString(autorespondSaveEmail ? 1 : 0));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Configure the auto-respond message */
|
/** Configure the auto-respond message */
|
||||||
public EmailCreateOptions autorespondMessage(String autorespondMessage) {
|
public CreateAccountOptions autorespondMessage(String autorespondMessage) {
|
||||||
formParameters.put("autorespondmessage", autorespondMessage);
|
formParameters.put("autorespondmessage", autorespondMessage);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -23,21 +23,21 @@ import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||||
/**
|
/**
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
public class ServerCreateOptions extends BaseHttpRequestOptions {
|
public class CreateServerOptions extends BaseHttpRequestOptions {
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
/**
|
/**
|
||||||
* @see ServerCreateOptions#description
|
* @see CreateServerOptions#description
|
||||||
*/
|
*/
|
||||||
public static ServerCreateOptions description(String primaryNameServer) {
|
public static CreateServerOptions description(String primaryNameServer) {
|
||||||
ServerCreateOptions options = new ServerCreateOptions();
|
CreateServerOptions options = new CreateServerOptions();
|
||||||
return options.description(primaryNameServer);
|
return options.description(primaryNameServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ServerCreateOptions#ip
|
* @see CreateServerOptions#ip
|
||||||
*/
|
*/
|
||||||
public static ServerCreateOptions ip(String ip) {
|
public static CreateServerOptions ip(String ip) {
|
||||||
ServerCreateOptions options = new ServerCreateOptions();
|
CreateServerOptions options = new CreateServerOptions();
|
||||||
return options.ip(ip);
|
return options.ip(ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public class ServerCreateOptions extends BaseHttpRequestOptions {
|
||||||
/**
|
/**
|
||||||
* @param description the description of the server
|
* @param description the description of the server
|
||||||
*/
|
*/
|
||||||
public ServerCreateOptions description(String description) {
|
public CreateServerOptions description(String description) {
|
||||||
formParameters.put("description", description);
|
formParameters.put("description", description);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class ServerCreateOptions extends BaseHttpRequestOptions {
|
||||||
/**
|
/**
|
||||||
* @param ip the ip address to assign to the server
|
* @param ip the ip address to assign to the server
|
||||||
*/
|
*/
|
||||||
public ServerCreateOptions ip(String ip) {
|
public CreateServerOptions ip(String ip) {
|
||||||
formParameters.put("ip", ip);
|
formParameters.put("ip", ip);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -23,20 +23,20 @@ import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||||
/**
|
/**
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
public class ServerDestroyOptions extends BaseHttpRequestOptions {
|
public class DestroyServerOptions extends BaseHttpRequestOptions {
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
/**
|
/**
|
||||||
* Discard the server's ip on destroy
|
* Discard the server's ip on destroy
|
||||||
*/
|
*/
|
||||||
public static ServerDestroyOptions keepIp() {
|
public static DestroyServerOptions keepIp() {
|
||||||
return new ServerDestroyOptions().keepIp(true);
|
return new DestroyServerOptions().keepIp(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Discard the server's ip on destroy
|
* Discard the server's ip on destroy
|
||||||
*/
|
*/
|
||||||
public static ServerDestroyOptions discardIp() {
|
public static DestroyServerOptions discardIp() {
|
||||||
return new ServerDestroyOptions().keepIp(false);
|
return new DestroyServerOptions().keepIp(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class ServerDestroyOptions extends BaseHttpRequestOptions {
|
||||||
*
|
*
|
||||||
* @param keepIp if true, keep the ip address
|
* @param keepIp if true, keep the ip address
|
||||||
*/
|
*/
|
||||||
public ServerDestroyOptions keepIp(boolean keepIp) {
|
public DestroyServerOptions keepIp(boolean keepIp) {
|
||||||
formParameters.put("keepip", Integer.toString(keepIp ? 1 : 0));
|
formParameters.put("keepip", Integer.toString(keepIp ? 1 : 0));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
/**
|
||||||
|
* 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.glesys.options;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adam Lowe
|
||||||
|
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_editaccount" />
|
||||||
|
*/
|
||||||
|
public class EditAccountOptions extends CreateAccountOptions {
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.glesys.options.EditAccountOptions#antispamLevel
|
||||||
|
*/
|
||||||
|
public static EditAccountOptions antispamLevel(int antispamLevel) {
|
||||||
|
return EditAccountOptions.class.cast(new EditAccountOptions().antispamLevel(antispamLevel));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.glesys.options.EditAccountOptions#antiVirus
|
||||||
|
*/
|
||||||
|
public static EditAccountOptions antiVirus(boolean antiVirus) {
|
||||||
|
return EditAccountOptions.class.cast(new EditAccountOptions().antiVirus(antiVirus));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.glesys.options.EditAccountOptions#autorespond
|
||||||
|
*/
|
||||||
|
public static EditAccountOptions autorespond(boolean autorespond) {
|
||||||
|
return EditAccountOptions.class.cast(new EditAccountOptions().autorespond(autorespond));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.glesys.options.EditAccountOptions#autorespondSaveEmail
|
||||||
|
*/
|
||||||
|
public static EditAccountOptions autorespondSaveEmail(boolean autorespondSaveEmail) {
|
||||||
|
return EditAccountOptions.class.cast(new EditAccountOptions().autorespondSaveEmail(autorespondSaveEmail));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.glesys.options.EditAccountOptions#autorespondMessage
|
||||||
|
*/
|
||||||
|
public static EditAccountOptions autorespondMessage(String autorespondMessage) {
|
||||||
|
return EditAccountOptions.class.cast(new EditAccountOptions().autorespondMessage(autorespondMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.glesys.options.EditAccountOptions#password
|
||||||
|
*/
|
||||||
|
public static EditAccountOptions password(String password) {
|
||||||
|
return new EditAccountOptions().password(password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Reset the password for this account */
|
||||||
|
public EditAccountOptions password(String password) {
|
||||||
|
formParameters.put("password", password);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,60 +21,60 @@ package org.jclouds.glesys.options;
|
||||||
/**
|
/**
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
public class DomainRecordEditOptions extends DomainRecordAddOptions {
|
public class EditRecordOptions extends AddRecordOptions {
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
/**
|
/**
|
||||||
* @see DomainRecordEditOptions#host
|
* @see EditRecordOptions#host
|
||||||
*/
|
*/
|
||||||
public static DomainRecordEditOptions host(String host) {
|
public static EditRecordOptions host(String host) {
|
||||||
return new DomainRecordEditOptions().host(host);
|
return new EditRecordOptions().host(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainRecordEditOptions#type
|
* @see EditRecordOptions#type
|
||||||
*/
|
*/
|
||||||
public static DomainRecordEditOptions type(String type) {
|
public static EditRecordOptions type(String type) {
|
||||||
return new DomainRecordEditOptions().type(type);
|
return new EditRecordOptions().type(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainRecordEditOptions#data
|
* @see EditRecordOptions#data
|
||||||
*/
|
*/
|
||||||
public static DomainRecordEditOptions data(String data) {
|
public static EditRecordOptions data(String data) {
|
||||||
return new DomainRecordEditOptions().data(data);
|
return new EditRecordOptions().data(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainRecordEditOptions#ttl
|
* @see EditRecordOptions#ttl
|
||||||
*/
|
*/
|
||||||
public static DomainRecordEditOptions ttl(int ttl) {
|
public static EditRecordOptions ttl(int ttl) {
|
||||||
return DomainRecordEditOptions.class.cast(new DomainRecordEditOptions().ttl(ttl));
|
return EditRecordOptions.class.cast(new EditRecordOptions().ttl(ttl));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DomainRecordEditOptions#mxPriority
|
* @see EditRecordOptions#mxPriority
|
||||||
*/
|
*/
|
||||||
public static DomainRecordEditOptions mxPriority(int mxPriority) {
|
public static EditRecordOptions mxPriority(int mxPriority) {
|
||||||
return DomainRecordEditOptions.class.cast(new DomainRecordEditOptions().mxPriority(mxPriority));
|
return EditRecordOptions.class.cast(new EditRecordOptions().mxPriority(mxPriority));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Configure the hostname attached to this record */
|
/** Configure the hostname attached to this record */
|
||||||
public DomainRecordEditOptions host(String host) {
|
public EditRecordOptions host(String host) {
|
||||||
formParameters.put("host", host);
|
formParameters.put("host", host);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Configure the type of record, ex. "A", "CNAME" or "MX" */
|
/** Configure the type of record, ex. "A", "CNAME" or "MX" */
|
||||||
public DomainRecordEditOptions type(String type) {
|
public EditRecordOptions type(String type) {
|
||||||
formParameters.put("type", type);
|
formParameters.put("type", type);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set the content of this record (depending on type, for an "A" record this would be an ip address) */
|
/** Set the content of this record (depending on type, for an "A" record this would be an ip address) */
|
||||||
public DomainRecordEditOptions data(String data) {
|
public EditRecordOptions data(String data) {
|
||||||
formParameters.put("data", data);
|
formParameters.put("data", data);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -24,90 +24,90 @@ import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
public class ServerEditOptions extends BaseHttpRequestOptions {
|
public class EditServerOptions extends BaseHttpRequestOptions {
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.options.ServerEditOptions#disksize
|
* @see org.jclouds.glesys.options.EditServerOptions#disksize
|
||||||
*/
|
*/
|
||||||
public static ServerEditOptions disksize(int disksize) {
|
public static EditServerOptions disksize(int disksize) {
|
||||||
ServerEditOptions options = new ServerEditOptions();
|
EditServerOptions options = new EditServerOptions();
|
||||||
return options.disksize(disksize);
|
return options.disksize(disksize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.options.ServerEditOptions#memorysize
|
* @see org.jclouds.glesys.options.EditServerOptions#memorysize
|
||||||
*/
|
*/
|
||||||
public static ServerEditOptions memorysize(int memorysize) {
|
public static EditServerOptions memorysize(int memorysize) {
|
||||||
ServerEditOptions options = new ServerEditOptions();
|
EditServerOptions options = new EditServerOptions();
|
||||||
return options.memorysize(memorysize);
|
return options.memorysize(memorysize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.options.ServerEditOptions#cpucores
|
* @see org.jclouds.glesys.options.EditServerOptions#cpucores
|
||||||
*/
|
*/
|
||||||
public static ServerEditOptions cpucores(int cpucores) {
|
public static EditServerOptions cpucores(int cpucores) {
|
||||||
ServerEditOptions options = new ServerEditOptions();
|
EditServerOptions options = new EditServerOptions();
|
||||||
return options.cpucores(cpucores);
|
return options.cpucores(cpucores);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.options.ServerEditOptions#cpucores
|
* @see org.jclouds.glesys.options.EditServerOptions#cpucores
|
||||||
*/
|
*/
|
||||||
public static ServerEditOptions transfer(int transfer) {
|
public static EditServerOptions transfer(int transfer) {
|
||||||
ServerEditOptions options = new ServerEditOptions();
|
EditServerOptions options = new EditServerOptions();
|
||||||
return options.transfer(transfer);
|
return options.transfer(transfer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.options.ServerEditOptions#hostname
|
* @see org.jclouds.glesys.options.EditServerOptions#hostname
|
||||||
*/
|
*/
|
||||||
public static ServerEditOptions hostname(String hostname) {
|
public static EditServerOptions hostname(String hostname) {
|
||||||
ServerEditOptions options = new ServerEditOptions();
|
EditServerOptions options = new EditServerOptions();
|
||||||
return options.hostname(hostname);
|
return options.hostname(hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.glesys.options.ServerEditOptions#description
|
* @see org.jclouds.glesys.options.EditServerOptions#description
|
||||||
*/
|
*/
|
||||||
public static ServerEditOptions description(String description) {
|
public static EditServerOptions description(String description) {
|
||||||
ServerEditOptions options = new ServerEditOptions();
|
EditServerOptions options = new EditServerOptions();
|
||||||
return options.description(description);
|
return options.description(description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Configure the size of the disk, in GB, of the server */
|
/** Configure the size of the disk, in GB, of the server */
|
||||||
public ServerEditOptions disksize(int disksize) {
|
public EditServerOptions disksize(int disksize) {
|
||||||
formParameters.put("disksize", Integer.toString(disksize));
|
formParameters.put("disksize", Integer.toString(disksize));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Configure the amount of RAM, in MB, allocated to the server */
|
/** Configure the amount of RAM, in MB, allocated to the server */
|
||||||
public ServerEditOptions memorysize(int memorysize) {
|
public EditServerOptions memorysize(int memorysize) {
|
||||||
formParameters.put("memorysize", Integer.toString(memorysize));
|
formParameters.put("memorysize", Integer.toString(memorysize));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Configure the number of CPU cores allocated to the server */
|
/** Configure the number of CPU cores allocated to the server */
|
||||||
public ServerEditOptions cpucores(int cpucores) {
|
public EditServerOptions cpucores(int cpucores) {
|
||||||
formParameters.put("cpucores", Integer.toString(cpucores));
|
formParameters.put("cpucores", Integer.toString(cpucores));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Configure the transfer setting for the server */
|
/** Configure the transfer setting for the server */
|
||||||
public ServerEditOptions transfer(int transfer) {
|
public EditServerOptions transfer(int transfer) {
|
||||||
formParameters.put("cpucores", Integer.toString(transfer));
|
formParameters.put("cpucores", Integer.toString(transfer));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Configure the host name of the server (must be unique within the GleSYS account) */
|
/** Configure the host name of the server (must be unique within the GleSYS account) */
|
||||||
public ServerEditOptions hostname(String hostname) {
|
public EditServerOptions hostname(String hostname) {
|
||||||
formParameters.put("hostname", hostname);
|
formParameters.put("hostname", hostname);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Configure the description of the server */
|
/** Configure the description of the server */
|
||||||
public ServerEditOptions description(String description) {
|
public EditServerOptions description(String description) {
|
||||||
formParameters.put("description", description);
|
formParameters.put("description", description);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -1,77 +0,0 @@
|
||||||
/**
|
|
||||||
* 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.glesys.options;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Adam Lowe
|
|
||||||
* @see <a href="https://customer.glesys.com/api.php?a=doc#email_editaccount" />
|
|
||||||
*/
|
|
||||||
public class EmailEditOptions extends EmailCreateOptions {
|
|
||||||
|
|
||||||
public static class Builder {
|
|
||||||
/**
|
|
||||||
* @see org.jclouds.glesys.options.EmailEditOptions#antispamLevel
|
|
||||||
*/
|
|
||||||
public static EmailEditOptions antispamLevel(int antispamLevel) {
|
|
||||||
return EmailEditOptions.class.cast(new EmailEditOptions().antispamLevel(antispamLevel));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.jclouds.glesys.options.EmailEditOptions#antiVirus
|
|
||||||
*/
|
|
||||||
public static EmailEditOptions antiVirus(boolean antiVirus) {
|
|
||||||
return EmailEditOptions.class.cast(new EmailEditOptions().antiVirus(antiVirus));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.jclouds.glesys.options.EmailEditOptions#autorespond
|
|
||||||
*/
|
|
||||||
public static EmailEditOptions autorespond(boolean autorespond) {
|
|
||||||
return EmailEditOptions.class.cast(new EmailEditOptions().autorespond(autorespond));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.jclouds.glesys.options.EmailEditOptions#autorespondSaveEmail
|
|
||||||
*/
|
|
||||||
public static EmailEditOptions autorespondSaveEmail(boolean autorespondSaveEmail) {
|
|
||||||
return EmailEditOptions.class.cast(new EmailEditOptions().autorespondSaveEmail(autorespondSaveEmail));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.jclouds.glesys.options.EmailEditOptions#autorespondMessage
|
|
||||||
*/
|
|
||||||
public static EmailEditOptions autorespondMessage(String autorespondMessage) {
|
|
||||||
return EmailEditOptions.class.cast(new EmailEditOptions().autorespondMessage(autorespondMessage));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.jclouds.glesys.options.EmailEditOptions#password
|
|
||||||
*/
|
|
||||||
public static EmailEditOptions password(String password) {
|
|
||||||
return new EmailEditOptions().password(password);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Reset the password for this account */
|
|
||||||
public EmailEditOptions password(String password) {
|
|
||||||
formParameters.put("password", password);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||||
public class ServerStatusOptions extends BaseHttpRequestOptions {
|
public class ServerStatusOptions extends BaseHttpRequestOptions {
|
||||||
|
|
||||||
public enum StatusTypes {
|
public enum StatusTypes {
|
||||||
state, cpu, memory, disk, bandwidth, uptime
|
STATE, CPU, MEMORY, DISK, BANDWIDTH, UPTIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
@ -35,7 +35,7 @@ public class ServerStatusOptions extends BaseHttpRequestOptions {
|
||||||
*/
|
*/
|
||||||
public static ServerStatusOptions state() {
|
public static ServerStatusOptions state() {
|
||||||
ServerStatusOptions options = new ServerStatusOptions();
|
ServerStatusOptions options = new ServerStatusOptions();
|
||||||
return options.statusType(StatusTypes.state);
|
return options.statusType(StatusTypes.STATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,7 +43,7 @@ public class ServerStatusOptions extends BaseHttpRequestOptions {
|
||||||
*/
|
*/
|
||||||
public static ServerStatusOptions cpu() {
|
public static ServerStatusOptions cpu() {
|
||||||
ServerStatusOptions options = new ServerStatusOptions();
|
ServerStatusOptions options = new ServerStatusOptions();
|
||||||
return options.statusType(StatusTypes.cpu);
|
return options.statusType(StatusTypes.CPU);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +51,7 @@ public class ServerStatusOptions extends BaseHttpRequestOptions {
|
||||||
*/
|
*/
|
||||||
public static ServerStatusOptions memory() {
|
public static ServerStatusOptions memory() {
|
||||||
ServerStatusOptions options = new ServerStatusOptions();
|
ServerStatusOptions options = new ServerStatusOptions();
|
||||||
return options.statusType(StatusTypes.memory);
|
return options.statusType(StatusTypes.MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +59,7 @@ public class ServerStatusOptions extends BaseHttpRequestOptions {
|
||||||
*/
|
*/
|
||||||
public static ServerStatusOptions disk() {
|
public static ServerStatusOptions disk() {
|
||||||
ServerStatusOptions options = new ServerStatusOptions();
|
ServerStatusOptions options = new ServerStatusOptions();
|
||||||
return options.statusType(StatusTypes.disk);
|
return options.statusType(StatusTypes.DISK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,7 +67,7 @@ public class ServerStatusOptions extends BaseHttpRequestOptions {
|
||||||
*/
|
*/
|
||||||
public static ServerStatusOptions bandwidth() {
|
public static ServerStatusOptions bandwidth() {
|
||||||
ServerStatusOptions options = new ServerStatusOptions();
|
ServerStatusOptions options = new ServerStatusOptions();
|
||||||
return options.statusType(StatusTypes.bandwidth);
|
return options.statusType(StatusTypes.BANDWIDTH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ public class ServerStatusOptions extends BaseHttpRequestOptions {
|
||||||
* Select the given type of information form the server
|
* Select the given type of information form the server
|
||||||
*/
|
*/
|
||||||
public ServerStatusOptions statusType(StatusTypes type) {
|
public ServerStatusOptions statusType(StatusTypes type) {
|
||||||
formParameters.put("statustype", type.name());
|
formParameters.put("statustype", type.name().toLowerCase());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
/**
|
|
||||||
* 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.glesys.options;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Adam Lowe
|
|
||||||
*/
|
|
||||||
public class ServerStopOptions extends ServerEditOptions {
|
|
||||||
public static class Builder {
|
|
||||||
/**
|
|
||||||
* @see org.jclouds.glesys.options.ServerStopOptions#hard
|
|
||||||
*/
|
|
||||||
public static ServerStopOptions hard() {
|
|
||||||
ServerStopOptions options = new ServerStopOptions();
|
|
||||||
return options.hard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hard stop - only supported on Xen platform
|
|
||||||
*/
|
|
||||||
public ServerStopOptions hard() {
|
|
||||||
formParameters.put("type", "hard");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -21,7 +21,7 @@ package org.jclouds.glesys;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import org.jclouds.glesys.features.BaseGleSYSAsyncClientTest;
|
import org.jclouds.glesys.internal.BaseGleSYSAsyncClientTest;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.jclouds.glesys.domain.ArchiveAllowedArguments;
|
import org.jclouds.glesys.domain.ArchiveAllowedArguments;
|
||||||
import org.jclouds.glesys.domain.ArchiveDetails;
|
import org.jclouds.glesys.domain.ArchiveDetails;
|
||||||
|
import org.jclouds.glesys.internal.BaseGleSYSClientLiveTest;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
import org.testng.annotations.AfterGroups;
|
import org.testng.annotations.AfterGroups;
|
||||||
import org.testng.annotations.BeforeGroups;
|
import org.testng.annotations.BeforeGroups;
|
||||||
|
|
|
@ -24,7 +24,7 @@ import com.google.common.collect.ImmutableSortedSet;
|
||||||
import org.jclouds.glesys.GleSYSClient;
|
import org.jclouds.glesys.GleSYSClient;
|
||||||
import org.jclouds.glesys.domain.Domain;
|
import org.jclouds.glesys.domain.Domain;
|
||||||
import org.jclouds.glesys.domain.DomainRecord;
|
import org.jclouds.glesys.domain.DomainRecord;
|
||||||
import org.jclouds.glesys.options.DomainAddOptions;
|
import org.jclouds.glesys.options.AddDomainOptions;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.rest.BaseRestClientExpectTest;
|
import org.jclouds.rest.BaseRestClientExpectTest;
|
||||||
|
@ -143,7 +143,7 @@ public class DomainClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
.put("ttl", "1")
|
.put("ttl", "1")
|
||||||
.build())).build(),
|
.build())).build(),
|
||||||
HttpResponse.builder().statusCode(200).build()).getDomainClient();
|
HttpResponse.builder().statusCode(200).build()).getDomainClient();
|
||||||
DomainAddOptions options = (DomainAddOptions) DomainAddOptions.Builder.primaryNameServer("ns1.somewhere.x")
|
AddDomainOptions options = (AddDomainOptions) AddDomainOptions.Builder.primaryNameServer("ns1.somewhere.x")
|
||||||
.expire(1).minimum(1).refresh(1).responsiblePerson("Tester").retry(1).ttl(1);
|
.expire(1).minimum(1).refresh(1).responsiblePerson("Tester").retry(1).ttl(1);
|
||||||
|
|
||||||
client.addDomain("cl66666_x", options);
|
client.addDomain("cl66666_x", options);
|
||||||
|
|
|
@ -27,8 +27,9 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.jclouds.glesys.domain.Domain;
|
import org.jclouds.glesys.domain.Domain;
|
||||||
import org.jclouds.glesys.domain.DomainRecord;
|
import org.jclouds.glesys.domain.DomainRecord;
|
||||||
|
import org.jclouds.glesys.internal.BaseGleSYSClientLiveTest;
|
||||||
import org.jclouds.glesys.options.DomainOptions;
|
import org.jclouds.glesys.options.DomainOptions;
|
||||||
import org.jclouds.glesys.options.DomainRecordEditOptions;
|
import org.jclouds.glesys.options.EditRecordOptions;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
import org.testng.annotations.AfterGroups;
|
import org.testng.annotations.AfterGroups;
|
||||||
import org.testng.annotations.BeforeGroups;
|
import org.testng.annotations.BeforeGroups;
|
||||||
|
@ -125,7 +126,7 @@ public class DomainClientLiveTest extends BaseGleSYSClientLiveTest {
|
||||||
|
|
||||||
assertNotNull(recordId);
|
assertNotNull(recordId);
|
||||||
|
|
||||||
client.editRecord(recordId, DomainRecordEditOptions.Builder.host("testeditafter"));
|
client.editRecord(recordId, EditRecordOptions.Builder.host("testeditafter"));
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for(DomainRecord record : client.listRecords(testDomain)) {
|
for(DomainRecord record : client.listRecords(testDomain)) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.glesys.GleSYSClient;
|
import org.jclouds.glesys.GleSYSClient;
|
||||||
import org.jclouds.glesys.domain.Email;
|
import org.jclouds.glesys.domain.EmailAccount;
|
||||||
import org.jclouds.glesys.domain.EmailOverview;
|
import org.jclouds.glesys.domain.EmailOverview;
|
||||||
import org.jclouds.glesys.domain.EmailOverviewDomain;
|
import org.jclouds.glesys.domain.EmailOverviewDomain;
|
||||||
import org.jclouds.glesys.domain.EmailOverviewSummary;
|
import org.jclouds.glesys.domain.EmailOverviewSummary;
|
||||||
|
@ -65,8 +65,8 @@ public class EmailClientExpectTest extends BaseRestClientExpectTest<GleSYSClient
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/email_list.json")).build()).getEmailClient();
|
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/email_list.json")).build()).getEmailClient();
|
||||||
|
|
||||||
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||||
Email.Builder builder = Email.builder().quota("200 MB").usedQuota("0 MB").antispamLevel(3).antiVirus(true).autoRespond(false).autoRespondSaveEmail(true).autoRespondMessage("false");
|
EmailAccount.Builder builder = EmailAccount.builder().quota("200 MB").usedQuota("0 MB").antispamLevel(3).antiVirus(true).autoRespond(false).autoRespondSaveEmail(true).autoRespondMessage("false");
|
||||||
Set<Email> expected =
|
Set<EmailAccount> expected =
|
||||||
ImmutableSet.of(
|
ImmutableSet.of(
|
||||||
builder.account("test@adamlowe.net").created(dateFormat.parse("2011-12-22T12:13:14")).modified(dateFormat.parse("2011-12-22T12:13:35")).build(),
|
builder.account("test@adamlowe.net").created(dateFormat.parse("2011-12-22T12:13:14")).modified(dateFormat.parse("2011-12-22T12:13:35")).build(),
|
||||||
builder.account("test2@adamlowe.net").created(dateFormat.parse("2011-12-22T12:14:29")).modified(dateFormat.parse("2011-12-22T12:14:31")).build()
|
builder.account("test2@adamlowe.net").created(dateFormat.parse("2011-12-22T12:14:29")).modified(dateFormat.parse("2011-12-22T12:14:31")).build()
|
||||||
|
|
|
@ -18,20 +18,26 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.glesys.features;
|
package org.jclouds.glesys.features;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import static org.testng.Assert.assertFalse;
|
||||||
import org.jclouds.glesys.domain.*;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import org.jclouds.glesys.options.EmailCreateOptions;
|
import static org.testng.Assert.assertTrue;
|
||||||
import org.jclouds.glesys.options.EmailEditOptions;
|
|
||||||
import org.jclouds.glesys.options.ServerDestroyOptions;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.jclouds.glesys.domain.EmailAccount;
|
||||||
|
import org.jclouds.glesys.domain.EmailOverview;
|
||||||
|
import org.jclouds.glesys.domain.EmailOverviewDomain;
|
||||||
|
import org.jclouds.glesys.internal.BaseGleSYSClientLiveTest;
|
||||||
|
import org.jclouds.glesys.options.CreateAccountOptions;
|
||||||
|
import org.jclouds.glesys.options.EditAccountOptions;
|
||||||
|
import org.jclouds.glesys.options.DestroyServerOptions;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
import org.testng.annotations.AfterGroups;
|
import org.testng.annotations.AfterGroups;
|
||||||
import org.testng.annotations.BeforeGroups;
|
import org.testng.annotations.BeforeGroups;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.Set;
|
import com.google.common.base.Predicate;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import static org.testng.Assert.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code EmailClient}
|
* Tests behavior of {@code EmailClient}
|
||||||
|
@ -66,7 +72,7 @@ public class EmailClientLiveTest extends BaseGleSYSClientLiveTest {
|
||||||
client.delete("test1@" + testDomain);
|
client.delete("test1@" + testDomain);
|
||||||
assertTrue(emailAccountCounter.apply(0));
|
assertTrue(emailAccountCounter.apply(0));
|
||||||
context.getApi().getDomainClient().deleteDomain(testDomain);
|
context.getApi().getDomainClient().deleteDomain(testDomain);
|
||||||
context.getApi().getServerClient().destroyServer(serverId, ServerDestroyOptions.Builder.discardIp());
|
context.getApi().getServerClient().destroyServer(serverId, DestroyServerOptions.Builder.discardIp());
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +84,7 @@ public class EmailClientLiveTest extends BaseGleSYSClientLiveTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateEmail() {
|
public void testCreateEmail() {
|
||||||
client.createAccount("test@" + testDomain, "password",
|
client.createAccount("test@" + testDomain, "password",
|
||||||
EmailCreateOptions.Builder.antiVirus(true).autorespond(true).autorespondMessage("out of office"));
|
CreateAccountOptions.Builder.antiVirus(true).autorespond(true).autorespondMessage("out of office"));
|
||||||
|
|
||||||
assertTrue(emailAccountCounter.apply(1));
|
assertTrue(emailAccountCounter.apply(1));
|
||||||
|
|
||||||
|
@ -120,23 +126,23 @@ public class EmailClientLiveTest extends BaseGleSYSClientLiveTest {
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateEmail")
|
@Test(dependsOnMethods = "testCreateEmail")
|
||||||
public void testListAccounts() throws Exception {
|
public void testListAccounts() throws Exception {
|
||||||
Set<Email> accounts = client.listAccounts(testDomain);
|
Set<EmailAccount> accounts = client.listAccounts(testDomain);
|
||||||
assertTrue(accounts.size() >= 1);
|
assertTrue(accounts.size() >= 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateEmail")
|
@Test(dependsOnMethods = "testCreateEmail")
|
||||||
public void testEditAccount() throws Exception {
|
public void testEditAccount() throws Exception {
|
||||||
Set<Email> accounts = client.listAccounts(testDomain);
|
Set<EmailAccount> accounts = client.listAccounts(testDomain);
|
||||||
for (Email account : accounts) {
|
for (EmailAccount account : accounts) {
|
||||||
if (account.getAccount().equals("test@" + testDomain)) {
|
if (account.getAccount().equals("test@" + testDomain)) {
|
||||||
assertTrue(account.getAntiVirus());
|
assertTrue(account.getAntiVirus());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
client.editAccount("test@" + testDomain, EmailEditOptions.Builder.antiVirus(false));
|
client.editAccount("test@" + testDomain, EditAccountOptions.Builder.antiVirus(false));
|
||||||
|
|
||||||
accounts = client.listAccounts(testDomain);
|
accounts = client.listAccounts(testDomain);
|
||||||
for (Email account : accounts) {
|
for (EmailAccount account : accounts) {
|
||||||
if (account.getAccount().equals("test@" + testDomain)) {
|
if (account.getAccount().equals("test@" + testDomain)) {
|
||||||
assertFalse(account.getAntiVirus());
|
assertFalse(account.getAntiVirus());
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.jclouds.glesys.features;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
import org.jclouds.glesys.internal.BaseGleSYSAsyncClientTest;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||||
|
|
|
@ -18,16 +18,17 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.glesys.features;
|
package org.jclouds.glesys.features;
|
||||||
|
|
||||||
import org.jclouds.glesys.domain.IpDetails;
|
import static org.testng.Assert.assertEquals;
|
||||||
import org.testng.annotations.BeforeGroups;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import org.testng.annotations.Test;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import org.jclouds.glesys.domain.IpDetails;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import org.jclouds.glesys.internal.BaseGleSYSClientLiveTest;
|
||||||
import static org.testng.Assert.assertTrue;
|
import org.testng.annotations.BeforeGroups;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code IpClient}
|
* Tests behavior of {@code IpClient}
|
||||||
|
|
|
@ -81,8 +81,8 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
.put("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build()).build(),
|
.put("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build()).build(),
|
||||||
HttpResponse.builder().statusCode(204).payload(payloadFromResource("/server_allowed_arguments.json")).build()).getServerClient();
|
HttpResponse.builder().statusCode(204).payload(payloadFromResource("/server_allowed_arguments.json")).build()).getServerClient();
|
||||||
|
|
||||||
Map<String, ServerAllowedArguments> expected = new LinkedHashMap<String, ServerAllowedArguments>();
|
Map<String, AllowedArgumentsForCreateServer> expected = new LinkedHashMap<String, AllowedArgumentsForCreateServer>();
|
||||||
ServerAllowedArguments openvz = ServerAllowedArguments.builder()
|
AllowedArgumentsForCreateServer openvz = AllowedArgumentsForCreateServer.builder()
|
||||||
.dataCenters("Amsterdam", "Falkenberg", "New York City", "Stockholm")
|
.dataCenters("Amsterdam", "Falkenberg", "New York City", "Stockholm")
|
||||||
.memorySizes(128, 256, 512, 768, 1024, 1536, 2048, 2560, 3072, 3584, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288)
|
.memorySizes(128, 256, 512, 768, 1024, 1536, 2048, 2560, 3072, 3584, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288)
|
||||||
.diskSizes(5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 150)
|
.diskSizes(5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 150)
|
||||||
|
@ -93,7 +93,7 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
"Ubuntu 10.04 LTS 32-bit", "Ubuntu 10.04 LTS 64-bit", "Ubuntu 11.04 64-bit")
|
"Ubuntu 10.04 LTS 32-bit", "Ubuntu 10.04 LTS 64-bit", "Ubuntu 11.04 64-bit")
|
||||||
.transfers(50, 100, 250, 500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000)
|
.transfers(50, 100, 250, 500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000)
|
||||||
.build();
|
.build();
|
||||||
ServerAllowedArguments xen = ServerAllowedArguments.builder()
|
AllowedArgumentsForCreateServer xen = AllowedArgumentsForCreateServer.builder()
|
||||||
.memorySizes(512, 768, 1024, 1536, 2048, 2560, 3072, 3584, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288, 14336, 16384)
|
.memorySizes(512, 768, 1024, 1536, 2048, 2560, 3072, 3584, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288, 14336, 16384)
|
||||||
.diskSizes(5, 10, 20, 30, 40, 50, 80, 100, 120, 140, 150, 160, 160, 200, 250, 300)
|
.diskSizes(5, 10, 20, 30, 40, 50, 80, 100, 120, 140, 150, 160, 160, 200, 250, 300)
|
||||||
.cpuCores(1, 2, 3, 4, 5, 6, 7, 8)
|
.cpuCores(1, 2, 3, 4, 5, 6, 7, 8)
|
||||||
|
@ -106,7 +106,7 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
.build();
|
.build();
|
||||||
expected.put("Xen", xen);
|
expected.put("Xen", xen);
|
||||||
expected.put("OpenVZ", openvz);
|
expected.put("OpenVZ", openvz);
|
||||||
assertEquals(client.getServerAllowedArguments(), expected);
|
assertEquals(client.getAllowedArgumentsForCreateServerByPlatform(), expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetTemplatesWhenResponseIs2xx() throws Exception {
|
public void testGetTemplatesWhenResponseIs2xx() throws Exception {
|
||||||
|
@ -117,23 +117,23 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
.put("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build()).build(),
|
.put("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build()).build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_templates.json")).build()).getServerClient();
|
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_templates.json")).build()).getServerClient();
|
||||||
|
|
||||||
ImmutableSet.Builder<ServerTemplate> expectedBuilder = ImmutableSet.<ServerTemplate> builder();
|
ImmutableSet.Builder<Template> expectedBuilder = ImmutableSet.<Template> builder();
|
||||||
|
|
||||||
for (String name : new String[] { "Centos 5", "Centos 5 64-bit", "Centos 6 32-bit", "Centos 6 64-bit",
|
for (String name : new String[] { "Centos 5", "Centos 5 64-bit", "Centos 6 32-bit", "Centos 6 64-bit",
|
||||||
"Debian 5.0 32-bit", "Debian 5.0 64-bit", "Debian 6.0 32-bit", "Debian 6.0 64-bit", "Fedora Core 11",
|
"Debian 5.0 32-bit", "Debian 5.0 64-bit", "Debian 6.0 32-bit", "Debian 6.0 64-bit", "Fedora Core 11",
|
||||||
"Fedora Core 11 64-bit", "Gentoo", "Gentoo 64-bit", "Scientific Linux 6", "Scientific Linux 6 64-bit",
|
"Fedora Core 11 64-bit", "Gentoo", "Gentoo 64-bit", "Scientific Linux 6", "Scientific Linux 6 64-bit",
|
||||||
"Slackware 12", "Ubuntu 10.04 LTS 32-bit", "Ubuntu 10.04 LTS 64-bit", "Ubuntu 11.04 64-bit" }) {
|
"Slackware 12", "Ubuntu 10.04 LTS 32-bit", "Ubuntu 10.04 LTS 64-bit", "Ubuntu 11.04 64-bit" }) {
|
||||||
expectedBuilder.add(new ServerTemplate(name, 5, 128, "linux", "OpenVZ"));
|
expectedBuilder.add(new Template(name, 5, 128, "linux", "OpenVZ"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String name : new String[] { "CentOS 5.5 x64", "CentOS 5.5 x86", "Centos 6 x64", "Centos 6 x86",
|
for (String name : new String[] { "CentOS 5.5 x64", "CentOS 5.5 x86", "Centos 6 x64", "Centos 6 x86",
|
||||||
"Debian-6 x64", "Debian 5.0.1 x64", "FreeBSD 8.2", "Gentoo 10.1 x64", "Ubuntu 8.04 x64",
|
"Debian-6 x64", "Debian 5.0.1 x64", "FreeBSD 8.2", "Gentoo 10.1 x64", "Ubuntu 8.04 x64",
|
||||||
"Ubuntu 10.04 LTS 64-bit", "Ubuntu 10.10 x64", "Ubuntu 11.04 x64" }) {
|
"Ubuntu 10.04 LTS 64-bit", "Ubuntu 10.10 x64", "Ubuntu 11.04 x64" }) {
|
||||||
expectedBuilder.add(new ServerTemplate(name, 5, 512, name.startsWith("FreeBSD") ? "freebsd" : "linux", "Xen"));
|
expectedBuilder.add(new Template(name, 5, 512, name.startsWith("FreeBSD") ? "freebsd" : "linux", "Xen"));
|
||||||
}
|
}
|
||||||
for (String name : new String[] { "Windows Server 2008 R2 x64 std", "Windows Server 2008 R2 x64 web",
|
for (String name : new String[] { "Windows Server 2008 R2 x64 std", "Windows Server 2008 R2 x64 web",
|
||||||
"Windows Server 2008 x64 web", "Windows Server 2008 x86 web" }) {
|
"Windows Server 2008 x64 web", "Windows Server 2008 x86 web" }) {
|
||||||
expectedBuilder.add(new ServerTemplate(name, 20, 1024, "windows", "Xen"));
|
expectedBuilder.add(new Template(name, 20, 1024, "windows", "Xen"));
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals(client.getTemplates(), expectedBuilder.build());
|
assertEquals(client.getTemplates(), expectedBuilder.build());
|
||||||
|
@ -220,7 +220,7 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
.put("ip", "10.0.0.1").build())).build(),
|
.put("ip", "10.0.0.1").build())).build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_details.json")).build()).getServerClient();
|
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_details.json")).build()).getServerClient();
|
||||||
|
|
||||||
ServerCreateOptions options = ServerCreateOptions.Builder.description("Description-of-server").ip("10.0.0.1");
|
CreateServerOptions options = CreateServerOptions.Builder.description("Description-of-server").ip("10.0.0.1");
|
||||||
|
|
||||||
assertEquals(client.createServer("Falkenberg", "OpenVZ", "jclouds-test", "Ubuntu 32-bit", 5, 512, 1, "password", 50, options), expectedServerDetails());
|
assertEquals(client.createServer("Falkenberg", "OpenVZ", "jclouds-test", "Ubuntu 32-bit", 5, 512, 1, "password", 50, options), expectedServerDetails());
|
||||||
}
|
}
|
||||||
|
@ -256,8 +256,8 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
.build())).build(),
|
.build())).build(),
|
||||||
HttpResponse.builder().statusCode(200).build()).getServerClient();
|
HttpResponse.builder().statusCode(200).build()).getServerClient();
|
||||||
|
|
||||||
ServerEditOptions options =
|
EditServerOptions options =
|
||||||
ServerEditOptions.Builder.description("Description-of-server").disksize(1).memorysize(512).cpucores(1).hostname("jclouds-test");
|
EditServerOptions.Builder.description("Description-of-server").disksize(1).memorysize(512).cpucores(1).hostname("jclouds-test");
|
||||||
|
|
||||||
client.editServer("server111", options);
|
client.editServer("server111", options);
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
.put("memorysize", "512")
|
.put("memorysize", "512")
|
||||||
.put("cpucores", "1").build())).build(),
|
.put("cpucores", "1").build())).build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_details.json")).build()).getServerClient();
|
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_details.json")).build()).getServerClient();
|
||||||
ServerCloneOptions options = (ServerCloneOptions) ServerCloneOptions.Builder.description("Description-of-server").disksize(1).memorysize(512).cpucores(1);
|
CloneServerOptions options = (CloneServerOptions) CloneServerOptions.Builder.description("Description-of-server").disksize(1).memorysize(512).cpucores(1);
|
||||||
|
|
||||||
assertEquals(client.cloneServer("server111", "hostname1", options), expectedServerDetails());
|
assertEquals(client.cloneServer("server111", "hostname1", options), expectedServerDetails());
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
client.getServerLimits("server321");
|
client.getServerLimits("server321");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetServerConsoleWhenResponseIs2xx() throws Exception {
|
public void testGetConsoleWhenResponseIs2xx() throws Exception {
|
||||||
ServerClient client = requestSendsResponse(
|
ServerClient client = requestSendsResponse(
|
||||||
HttpRequest.builder().method("POST").endpoint(URI.create("https://api.glesys.com/server/console/format/json"))
|
HttpRequest.builder().method("POST").endpoint(URI.create("https://api.glesys.com/server/console/format/json"))
|
||||||
.headers(ImmutableMultimap.<String, String>builder()
|
.headers(ImmutableMultimap.<String, String>builder()
|
||||||
|
@ -379,12 +379,12 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_console.json")).build())
|
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_console.json")).build())
|
||||||
.getServerClient();
|
.getServerClient();
|
||||||
|
|
||||||
ServerConsole expected = ServerConsole.builder().host("79.99.2.147").port(59478).password("1476897311").protocol("vnc").build();
|
Console expected = Console.builder().host("79.99.2.147").port(59478).password("1476897311").protocol("vnc").build();
|
||||||
|
|
||||||
assertEquals(client.getServerConsole("server322"), expected);
|
assertEquals(client.getConsole("server322"), expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetServerConsoleWhenResponseIs4xx() throws Exception {
|
public void testGetConsoleWhenResponseIs4xx() throws Exception {
|
||||||
ServerClient client = requestSendsResponse(
|
ServerClient client = requestSendsResponse(
|
||||||
HttpRequest.builder().method("POST").endpoint(URI.create("https://api.glesys.com/server/console/format/json"))
|
HttpRequest.builder().method("POST").endpoint(URI.create("https://api.glesys.com/server/console/format/json"))
|
||||||
.headers(ImmutableMultimap.<String, String>builder()
|
.headers(ImmutableMultimap.<String, String>builder()
|
||||||
|
@ -395,7 +395,7 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
HttpResponse.builder().statusCode(404).build())
|
HttpResponse.builder().statusCode(404).build())
|
||||||
.getServerClient();
|
.getServerClient();
|
||||||
|
|
||||||
assertNull(client.getServerConsole("server322"));
|
assertNull(client.getConsole("server322"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStartServerWhenResponseIs2xx() throws Exception {
|
public void testStartServerWhenResponseIs2xx() throws Exception {
|
||||||
|
@ -448,11 +448,11 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
.put("Accept", "application/json")
|
.put("Accept", "application/json")
|
||||||
.put("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build())
|
.put("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build())
|
||||||
.payload(newUrlEncodedFormPayload(ImmutableMultimap.<String, String>builder()
|
.payload(newUrlEncodedFormPayload(ImmutableMultimap.<String, String>builder()
|
||||||
.put("serverid", "server777").put("type", "hard").build())).build(),
|
.put("type", "hard").put("serverid", "server777").build())).build(),
|
||||||
HttpResponse.builder().statusCode(200).build())
|
HttpResponse.builder().statusCode(200).build())
|
||||||
.getServerClient();
|
.getServerClient();
|
||||||
|
|
||||||
client.stopServer("server777", ServerStopOptions.Builder.hard());
|
client.hardStopServer("server777");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expectedExceptions = {AuthorizationException.class})
|
@Test(expectedExceptions = {AuthorizationException.class})
|
||||||
|
@ -509,7 +509,7 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
HttpResponse.builder().statusCode(200).build())
|
HttpResponse.builder().statusCode(200).build())
|
||||||
.getServerClient();
|
.getServerClient();
|
||||||
|
|
||||||
client.destroyServer("server777", ServerDestroyOptions.Builder.keepIp());
|
client.destroyServer("server777", DestroyServerOptions.Builder.keepIp());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expectedExceptions = {AuthorizationException.class})
|
@Test(expectedExceptions = {AuthorizationException.class})
|
||||||
|
@ -523,7 +523,7 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
HttpResponse.builder().statusCode(401).build())
|
HttpResponse.builder().statusCode(401).build())
|
||||||
.getServerClient();
|
.getServerClient();
|
||||||
|
|
||||||
client.destroyServer("server777", ServerDestroyOptions.Builder.discardIp());
|
client.destroyServer("server777", DestroyServerOptions.Builder.discardIp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -532,7 +532,7 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
||||||
ResourceUsage disk = ResourceUsage.builder().unit("MB").usage(371.0).max(5120).build();
|
ResourceUsage disk = ResourceUsage.builder().unit("MB").usage(371.0).max(5120).build();
|
||||||
ResourceUsage memory = ResourceUsage.builder().unit("MB").usage(3.0).max(128).build();
|
ResourceUsage memory = ResourceUsage.builder().unit("MB").usage(3.0).max(128).build();
|
||||||
ServerUptime uptime = ServerUptime.builder().current(23).unit("seconds").build();
|
ServerUptime uptime = ServerUptime.builder().current(23).unit("seconds").build();
|
||||||
return ServerStatus.builder().state(ServerState.RUNNING).uptime(uptime).
|
return ServerStatus.builder().state(Server.State.RUNNING).uptime(uptime).
|
||||||
cpu(cpu).disk(disk).memory(memory).build();
|
cpu(cpu).disk(disk).memory(memory).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,25 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.glesys.features;
|
package org.jclouds.glesys.features;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import static org.testng.Assert.assertEquals;
|
||||||
import org.jclouds.glesys.domain.*;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import org.jclouds.glesys.options.ServerCloneOptions;
|
import static org.testng.Assert.assertTrue;
|
||||||
import org.jclouds.glesys.options.ServerDestroyOptions;
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.jclouds.glesys.domain.Console;
|
||||||
|
import org.jclouds.glesys.domain.ResourceUsage;
|
||||||
|
import org.jclouds.glesys.domain.Server;
|
||||||
|
import org.jclouds.glesys.domain.AllowedArgumentsForCreateServer;
|
||||||
|
import org.jclouds.glesys.domain.ServerDetails;
|
||||||
|
import org.jclouds.glesys.domain.ServerLimit;
|
||||||
|
import org.jclouds.glesys.domain.ServerStatus;
|
||||||
|
import org.jclouds.glesys.domain.Template;
|
||||||
|
import org.jclouds.glesys.internal.BaseGleSYSClientLiveTest;
|
||||||
|
import org.jclouds.glesys.options.CloneServerOptions;
|
||||||
|
import org.jclouds.glesys.options.DestroyServerOptions;
|
||||||
import org.jclouds.glesys.options.ServerStatusOptions;
|
import org.jclouds.glesys.options.ServerStatusOptions;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
import org.testng.annotations.AfterGroups;
|
import org.testng.annotations.AfterGroups;
|
||||||
|
@ -29,11 +44,7 @@ import org.testng.annotations.BeforeGroups;
|
||||||
import org.testng.annotations.BeforeMethod;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.Map;
|
import com.google.common.base.Predicate;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import static org.testng.Assert.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code ServerClient}
|
* Tests behavior of {@code ServerClient}
|
||||||
|
@ -56,9 +67,9 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
|
||||||
|
|
||||||
@AfterGroups(groups = {"live"})
|
@AfterGroups(groups = {"live"})
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
client.destroyServer(testServerId, ServerDestroyOptions.Builder.discardIp());
|
client.destroyServer(testServerId, DestroyServerOptions.Builder.discardIp());
|
||||||
if (testServerId2 != null) {
|
if (testServerId2 != null) {
|
||||||
client.destroyServer(testServerId2, ServerDestroyOptions.Builder.discardIp());
|
client.destroyServer(testServerId2, DestroyServerOptions.Builder.discardIp());
|
||||||
}
|
}
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
@ -70,12 +81,12 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
|
||||||
|
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
public void makeSureServerIsRunning() throws Exception {
|
public void makeSureServerIsRunning() throws Exception {
|
||||||
serverStatusChecker.apply(ServerState.RUNNING);
|
serverStatusChecker.apply(Server.State.RUNNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAllowedArguments() throws Exception {
|
public void testAllowedArguments() throws Exception {
|
||||||
Map<String,ServerAllowedArguments> templates = client.getServerAllowedArguments();
|
Map<String,AllowedArgumentsForCreateServer> templates = client.getAllowedArgumentsForCreateServerByPlatform();
|
||||||
|
|
||||||
assertTrue(templates.containsKey("OpenVZ"));
|
assertTrue(templates.containsKey("OpenVZ"));
|
||||||
assertTrue(templates.containsKey("Xen"));
|
assertTrue(templates.containsKey("Xen"));
|
||||||
|
@ -84,7 +95,7 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
|
||||||
checkAllowedArguments(templates.get("Xen"));
|
checkAllowedArguments(templates.get("Xen"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkAllowedArguments(ServerAllowedArguments t) {
|
private void checkAllowedArguments(AllowedArgumentsForCreateServer t) {
|
||||||
assertNotNull(t);
|
assertNotNull(t);
|
||||||
|
|
||||||
assert t.getDataCenters().size() > 0 : t;
|
assert t.getDataCenters().size() > 0 : t;
|
||||||
|
@ -98,14 +109,14 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListTemplates() throws Exception {
|
public void testListTemplates() throws Exception {
|
||||||
Set<ServerTemplate> templates = client.getTemplates();
|
Set<Template> templates = client.getTemplates();
|
||||||
|
|
||||||
for(ServerTemplate template : templates) {
|
for(Template template : templates) {
|
||||||
checkTemplate(template);
|
checkTemplate(template);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkTemplate(ServerTemplate t) {
|
private void checkTemplate(Template t) {
|
||||||
assertNotNull(t);
|
assertNotNull(t);
|
||||||
assertNotNull(t.getName());
|
assertNotNull(t.getName());
|
||||||
assertNotNull(t.getOs());
|
assertNotNull(t.getOs());
|
||||||
|
@ -168,18 +179,18 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
|
||||||
|
|
||||||
assertTrue(uptime < 20);
|
assertTrue(uptime < 20);
|
||||||
|
|
||||||
assertTrue(serverStatusChecker.apply(ServerState.RUNNING));
|
assertTrue(serverStatusChecker.apply(Server.State.RUNNING));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(enabled=false) // TODO
|
@Test(enabled=false) // TODO
|
||||||
public void testStopAndStartServer() throws Exception {
|
public void testStopAndStartServer() throws Exception {
|
||||||
client.stopServer(testServerId);
|
client.stopServer(testServerId);
|
||||||
|
|
||||||
assertTrue(serverStatusChecker.apply(ServerState.STOPPED));
|
assertTrue(serverStatusChecker.apply(Server.State.STOPPED));
|
||||||
|
|
||||||
client.startServer(testServerId);
|
client.startServer(testServerId);
|
||||||
|
|
||||||
assertTrue(serverStatusChecker.apply(ServerState.RUNNING));
|
assertTrue(serverStatusChecker.apply(Server.State.RUNNING));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -200,8 +211,8 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testServerConsole() throws Exception {
|
public void testConsole() throws Exception {
|
||||||
ServerConsole console = client.getServerConsole(testServerId);
|
Console console = client.getConsole(testServerId);
|
||||||
assertNotNull(console);
|
assertNotNull(console);
|
||||||
assertNotNull(console.getHost());
|
assertNotNull(console.getHost());
|
||||||
assertTrue(console.getPort() > 0 && console.getPort() < 65537);
|
assertTrue(console.getPort() > 0 && console.getPort() < 65537);
|
||||||
|
@ -211,7 +222,7 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
|
||||||
// takes a few minutes and requires an extra server (using 2 already)
|
// takes a few minutes and requires an extra server (using 2 already)
|
||||||
@Test(enabled=false)
|
@Test(enabled=false)
|
||||||
public void testCloneServer() throws Exception {
|
public void testCloneServer() throws Exception {
|
||||||
ServerDetails testServer2 = client.cloneServer(testServerId, testHostName2, ServerCloneOptions.Builder.cpucores(1));
|
ServerDetails testServer2 = client.cloneServer(testServerId, testHostName2, CloneServerOptions.Builder.cpucores(1));
|
||||||
|
|
||||||
assertNotNull(testServer2.getId());
|
assertNotNull(testServer2.getId());
|
||||||
assertEquals(testServer2.getHostname(), "jclouds-test2");
|
assertEquals(testServer2.getHostname(), "jclouds-test2");
|
||||||
|
@ -219,16 +230,16 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
|
||||||
|
|
||||||
testServerId2 = testServer2.getId();
|
testServerId2 = testServer2.getId();
|
||||||
|
|
||||||
RetryablePredicate<ServerState> cloneChecker = new ServerStatusChecker(client, testServerId2, 300, 10, TimeUnit.SECONDS);
|
RetryablePredicate<Server.State> cloneChecker = new ServerStatusChecker(client, testServerId2, 300, 10, TimeUnit.SECONDS);
|
||||||
assertTrue(cloneChecker.apply(ServerState.STOPPED));
|
assertTrue(cloneChecker.apply(Server.State.STOPPED));
|
||||||
|
|
||||||
client.startServer(testServer2.getId());
|
client.startServer(testServer2.getId());
|
||||||
|
|
||||||
// TODO ServerStatus==STOPPED suggests the previous call to start should have worked
|
// TODO ServerStatus==STOPPED suggests the previous call to start should have worked
|
||||||
cloneChecker = new RetryablePredicate<ServerState>(
|
cloneChecker = new RetryablePredicate<Server.State>(
|
||||||
new Predicate<ServerState>() {
|
new Predicate<Server.State>() {
|
||||||
|
|
||||||
public boolean apply(ServerState value) {
|
public boolean apply(Server.State value) {
|
||||||
ServerStatus status = client.getServerStatus(testServerId2, ServerStatusOptions.Builder.state());
|
ServerStatus status = client.getServerStatus(testServerId2, ServerStatusOptions.Builder.state());
|
||||||
if (status.getState() == value) {
|
if (status.getState() == value) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -240,7 +251,7 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
|
||||||
|
|
||||||
}, 300, 10, TimeUnit.SECONDS);
|
}, 300, 10, TimeUnit.SECONDS);
|
||||||
|
|
||||||
assertTrue(cloneChecker.apply(ServerState.RUNNING)
|
assertTrue(cloneChecker.apply(Server.State.RUNNING)
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.glesys.features;
|
package org.jclouds.glesys.internal;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
|
@ -16,17 +16,23 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.glesys.features;
|
package org.jclouds.glesys.internal;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static org.testng.Assert.*;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
import static org.testng.Assert.assertFalse;
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import org.jclouds.glesys.GleSYSAsyncClient;
|
import org.jclouds.glesys.GleSYSAsyncClient;
|
||||||
import org.jclouds.glesys.GleSYSClient;
|
import org.jclouds.glesys.GleSYSClient;
|
||||||
|
import org.jclouds.glesys.domain.Server;
|
||||||
import org.jclouds.glesys.domain.ServerDetails;
|
import org.jclouds.glesys.domain.ServerDetails;
|
||||||
import org.jclouds.glesys.domain.ServerState;
|
|
||||||
import org.jclouds.glesys.domain.ServerStatus;
|
import org.jclouds.glesys.domain.ServerStatus;
|
||||||
|
import org.jclouds.glesys.features.DomainClient;
|
||||||
|
import org.jclouds.glesys.features.ServerClient;
|
||||||
import org.jclouds.glesys.options.ServerStatusOptions;
|
import org.jclouds.glesys.options.ServerStatusOptions;
|
||||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
|
@ -37,11 +43,10 @@ import org.testng.annotations.AfterGroups;
|
||||||
import org.testng.annotations.BeforeGroups;
|
import org.testng.annotations.BeforeGroups;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code GleSYSClient}
|
* Tests behavior of {@code GleSYSClient}
|
||||||
*
|
*
|
||||||
|
@ -96,19 +101,19 @@ public class BaseGleSYSClientLiveTest {
|
||||||
|
|
||||||
ServerStatusChecker runningServerCounter = new ServerStatusChecker(client, testServer.getId(), 180, 10, TimeUnit.SECONDS);
|
ServerStatusChecker runningServerCounter = new ServerStatusChecker(client, testServer.getId(), 180, 10, TimeUnit.SECONDS);
|
||||||
|
|
||||||
assertTrue(runningServerCounter.apply(ServerState.RUNNING));
|
assertTrue(runningServerCounter.apply(Server.State.RUNNING));
|
||||||
return runningServerCounter;
|
return runningServerCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ServerStatusChecker extends RetryablePredicate<ServerState> {
|
public static class ServerStatusChecker extends RetryablePredicate<Server.State> {
|
||||||
private final String serverId;
|
private final String serverId;
|
||||||
public String getServerId() {
|
public String getServerId() {
|
||||||
return serverId;
|
return serverId;
|
||||||
}
|
}
|
||||||
public ServerStatusChecker(final ServerClient client, final String serverId, long maxWait, long period, TimeUnit unit) {
|
public ServerStatusChecker(final ServerClient client, final String serverId, long maxWait, long period, TimeUnit unit) {
|
||||||
super(new Predicate<ServerState>() {
|
super(new Predicate<Server.State>() {
|
||||||
|
|
||||||
public boolean apply(ServerState value) {
|
public boolean apply(Server.State value) {
|
||||||
ServerStatus status = client.getServerStatus(serverId, ServerStatusOptions.Builder.state());
|
ServerStatus status = client.getServerStatus(serverId, ServerStatusOptions.Builder.state());
|
||||||
return status.getState() == value;
|
return status.getState() == value;
|
||||||
}
|
}
|
Loading…
Reference in New Issue