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