mirror of https://github.com/apache/jclouds.git
Add GlobalHost[Async]Client.deleteCluster()
This commit is contained in:
parent
7284d7db2f
commit
17fb7b55d0
|
@ -217,4 +217,15 @@ public interface GlobalHostAsyncClient {
|
|||
@SelectJson("cluster")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<Void> updateClusterPassword(@QueryParam("clusterid") long clusterId, @QueryParam("username") String username, @QueryParam("password") String password);
|
||||
|
||||
/**
|
||||
* Deletes a cluster.
|
||||
*
|
||||
* @param clusterId the cluster ID
|
||||
*/
|
||||
@GET
|
||||
@QueryParams(keys = "command", values = "deleteCluster")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<Void> deleteCluster(@QueryParam("id") long clusterId);
|
||||
|
||||
}
|
||||
|
|
|
@ -163,4 +163,12 @@ public interface GlobalHostClient {
|
|||
* @param password the password for the cluster
|
||||
*/
|
||||
void updateClusterPassword(long clusterId, String username, String password);
|
||||
|
||||
/**
|
||||
* Deletes a cluster.
|
||||
*
|
||||
* @param clusterId the cluster ID
|
||||
*/
|
||||
void deleteCluster(long clusterId);
|
||||
|
||||
}
|
||||
|
|
|
@ -316,6 +316,19 @@ public class GlobalHostClientExpectTest extends BaseCloudStackRestClientExpectTe
|
|||
requestSendsResponse(request, response).updateClusterPassword(1, "fred", "sekrit");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteClusterWhenResponseIs2xx() {
|
||||
HttpRequest request = HttpRequest.builder()
|
||||
.method("GET")
|
||||
.endpoint(URI.create("http://localhost:8080/client/api?response=json&command=deleteCluster&id=1&apiKey=identity&signature=CKH26MFgKGY7Sosd17LjBMNa3AI%3D"))
|
||||
.headers(ImmutableMultimap.<String, String>builder().put("Accept", "application/json").build())
|
||||
.build();
|
||||
HttpResponse response = HttpResponse.builder()
|
||||
.statusCode(200).build();
|
||||
|
||||
requestSendsResponse(request, response).deleteCluster(1);
|
||||
}
|
||||
|
||||
private Date makeDate(int year, int month, int date, int hour, int minute, int second, String timeZoneName) {
|
||||
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(timeZoneName));
|
||||
cal.set(Calendar.YEAR, year);
|
||||
|
|
Loading…
Reference in New Issue