Updated names for add/remove in GleSYS IP client.

This commit is contained in:
Mattias Holmqvist 2012-01-07 23:37:28 +01:00
parent 948a004b60
commit ad2c2a03e0
3 changed files with 61 additions and 61 deletions

View File

@ -64,8 +64,8 @@ public interface IpAsyncClient {
*/
@POST
@Path("/ip/add/format/json")
ListenableFuture<Void> add(@FormParam("serverid") String serverId,
@FormParam("ipaddress") String ipAddress);
ListenableFuture<Void> addIpToServer(@FormParam("ipaddress") String ipAddress,
@FormParam("serverid") String serverId);
/**
@ -75,7 +75,7 @@ public interface IpAsyncClient {
*/
@POST
@Path("/ip/remove/format/json")
ListenableFuture<Void> remove(@FormParam("ipaddress") String ipAddress,
ListenableFuture<Void> removeIpFromServer(@FormParam("ipaddress") String ipAddress,
@FormParam("serverid") String serverId);

View File

@ -35,61 +35,60 @@ import java.util.concurrent.TimeUnit;
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
public interface IpClient {
/**
* Take a free IP address and add it to this account. You can list free IP addresses with the function listFree().
* Once your free IP on this account you can add it to a server with the add() function.
*
* @param ipAddress
* @return
*/
void take(String ipAddress);
/**
* Take a free IP address and add it to this account. You can list free IP addresses with the function listFree().
* Once your free IP on this account you can add it to a server with the add() function.
*
* @param ipAddress
*/
void take(String ipAddress);
/**
* Return an unused IP address to the pool of free ips. If the IP address is allocated to a server,
* it must first be removed by calling remove(ipAddress) before it can be released.
*
* @param ipAddress the IP address to be released
*/
void release(String ipAddress);
/**
* Return an unused IP address to the pool of free ips. If the IP address is allocated to a server,
* it must first be removed by calling remove(ipAddress) before it can be released.
*
* @param ipAddress the IP address to be released
*/
void release(String ipAddress);
/**
* Add an IP address to an server. The IP has to be free, but reserved to this account. You are able to list such addresses
* with listOwn() and reserve an address for this account by using take(). To find free ips you can use ip/listfree
* ip to an Xen-server you have to configure the server yourself, unless the ip was added during the c
* server (server/create). You can get detailed information such as gateway and netmask using the ip
*
* @param serverId the server to add the IP address to
* @param ipAddress the IP address to remove
*/
void add(String serverId, String ipAddress);
/**
* Add an IP address to an server. The IP has to be free, but reserved to this account. You are able to list such addresses
* with listOwn() and reserve an address for this account by using take(). To find free ips you can use ip/listfree
* ip to an Xen-server you have to configure the server yourself, unless the ip was added during the c
* server (server/create). You can get detailed information such as gateway and netmask using the ip
*
* @param ipAddress the IP address to remove
* @param serverId the server to add the IP address to
*/
void addIpToServer(String ipAddress, String serverId);
/**
* Remove an IP address from a server. This does not release it back to GleSYS pool of free ips. The address will be
* kept on the account so that you can use it for other servers or the same server at a later time. To completely remove
* the IP address from this account, use the function release().
*
* @param ipAddress the IP address to remove
* @param serverId the server to remove the IP address from
*/
void remove(String ipAddress, String serverId);
/**
* Remove an IP address from a server. This does not release it back to GleSYS pool of free ips. The address will be
* kept on the account so that you can use it for other servers or the same server at a later time. To completely remove
* the IP address from this account, use the function release().
*
* @param ipAddress the IP address to remove
* @param serverId the server to remove the IP address from
*/
void removeIpFromServer(String ipAddress, String serverId);
/**
* Get a set of all IP addresses that are available and not used on any account or server.
*
* @param ipversion "4" or "6", for IPV4 or IPV6, respectively
* @param datacenter the datacenter
* @param platform the platform
* @return a set of free IP addresses
*/
Set<String> listFree(String ipversion, String datacenter, String platform);
/**
* Get a set of all IP addresses that are available and not used on any account or server.
*
* @param ipversion "4" or "6", for IPV4 or IPV6, respectively
* @param datacenter the datacenter
* @param platform the platform
* @return a set of free IP addresses
*/
Set<String> listFree(String ipversion, String datacenter, String platform);
/**
* Get details about the given IP address such as gateway and netmask. Different details are available
* on different platforms.
*
* @param ipAddress the ip address
* @return details about the given IP address
*/
IpDetails getIpDetails(String ipAddress);
/**
* Get details about the given IP address such as gateway and netmask. Different details are available
* on different platforms.
*
* @param ipAddress the ip address
* @return details about the given IP address
*/
IpDetails getIpDetails(String ipAddress);
}

View File

@ -180,12 +180,12 @@ public class IpClientExpectTest extends BaseRestClientExpectTest<GleSYSClient> {
"Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build())
.payload(newUrlEncodedFormPayload(
ImmutableMultimap.<String, String>builder()
.put("serverid", "vz1946889")
.put("ipaddress", "31.192.227.37").build())).build(),
.put("ipaddress", "31.192.227.37")
.put("serverid", "vz1946889").build())).build(),
HttpResponse.builder().statusCode(200).build())
.getIpClient();
client.add("vz1946889", "31.192.227.37");
client.addIpToServer("31.192.227.37", "vz1946889");
}
public void testAddWhenResponseIs4xxThrowsHttpException() {
@ -196,13 +196,14 @@ public class IpClientExpectTest extends BaseRestClientExpectTest<GleSYSClient> {
"Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build())
.payload(newUrlEncodedFormPayload(
ImmutableMultimap.<String, String>builder()
.put("ipaddress", "31.192.227.37")
.put("serverid", "vz1946889")
.put("ipaddress", "31.192.227.37").build())).build(),
.build())).build(),
HttpResponse.builder().statusCode(400).build())
.getIpClient();
try {
client.add("vz1946889", "31.192.227.37");
client.addIpToServer("31.192.227.37", "vz1946889");
fail();
} catch (HttpResponseException e) {
// Expected
@ -222,7 +223,7 @@ public class IpClientExpectTest extends BaseRestClientExpectTest<GleSYSClient> {
HttpResponse.builder().statusCode(200).build())
.getIpClient();
client.remove("31.192.227.37", "vz1946889");
client.removeIpFromServer("31.192.227.37", "vz1946889");
}
public void testRemoveWhenResponseIs4xxThrowsHttpException() {
@ -239,7 +240,7 @@ public class IpClientExpectTest extends BaseRestClientExpectTest<GleSYSClient> {
.getIpClient();
try {
client.remove("31.192.227.37", "vz1946889");
client.removeIpFromServer("31.192.227.37", "vz1946889");
fail();
} catch (HttpResponseException e) {
// Expected