mirror of https://github.com/apache/jclouds.git
Add GlobalHost[Async]Client.reconnectHost()
This commit is contained in:
parent
528fa0ae5a
commit
20f58c4a12
|
@ -138,6 +138,18 @@ public interface GlobalHostAsyncClient {
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
ListenableFuture<Long> cancelHostMaintenance(@QueryParam("id") long hostId);
|
ListenableFuture<Long> cancelHostMaintenance(@QueryParam("id") long hostId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reconnects a host.
|
||||||
|
*
|
||||||
|
* @param hostId
|
||||||
|
* @return a job reference number for tracking this asynchronous job.
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@QueryParams(keys = "command", values = "reconnectHost")
|
||||||
|
@SelectJson("jobid")
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
ListenableFuture<Long> reconnectHost(@QueryParam("id") long hostId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see GlobalHostClient#listClusters
|
* @see GlobalHostClient#listClusters
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -106,6 +106,14 @@ public interface GlobalHostClient {
|
||||||
*/
|
*/
|
||||||
Long cancelHostMaintenance(long hostId);
|
Long cancelHostMaintenance(long hostId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reconnects a host.
|
||||||
|
*
|
||||||
|
* @param hostId
|
||||||
|
* @return a job reference number for tracking this asynchronous job.
|
||||||
|
*/
|
||||||
|
Long reconnectHost(long hostId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists clusters
|
* Lists clusters
|
||||||
*
|
*
|
||||||
|
|
|
@ -195,6 +195,21 @@ public class GlobalHostClientExpectTest extends BaseCloudStackRestClientExpectTe
|
||||||
assertEquals(actual, Long.valueOf(2036L));
|
assertEquals(actual, Long.valueOf(2036L));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReconnectHostWhenResponseIs2xx() {
|
||||||
|
HttpRequest request = HttpRequest.builder()
|
||||||
|
.method("GET")
|
||||||
|
.endpoint(URI.create("http://localhost:8080/client/api?response=json&command=reconnectHost&id=1&apiKey=identity&signature=wJEF02vwdyOnJOTa%2BWMMK906aRU%3D"))
|
||||||
|
.headers(ImmutableMultimap.<String, String>builder().put("Accept", "application/json").build())
|
||||||
|
.build();
|
||||||
|
HttpResponse response = HttpResponse.builder()
|
||||||
|
.payload(payloadFromResource("/reconnecthostresponse.json"))
|
||||||
|
.statusCode(200).build();
|
||||||
|
|
||||||
|
Long actual = requestSendsResponse(request, response).reconnectHost(1);
|
||||||
|
assertEquals(actual, Long.valueOf(2036L));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListClustersWhenResponseIs2xx() {
|
public void testListClustersWhenResponseIs2xx() {
|
||||||
HttpRequest request = HttpRequest.builder()
|
HttpRequest request = HttpRequest.builder()
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
{ "reconnecthostresponse" : {"warning":"this test data is fabricated","jobid":2036,"id":2017} }
|
Loading…
Reference in New Issue