mirror of https://github.com/apache/jclouds.git
Add GlobalHost[Async]Client.updateClusterPassword()
This commit is contained in:
parent
fc50e80eb7
commit
7284d7db2f
|
@ -204,4 +204,17 @@ public interface GlobalHostAsyncClient {
|
||||||
@SelectJson("cluster")
|
@SelectJson("cluster")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
ListenableFuture<Cluster> updateCluster(@QueryParam("id") long clusterId, UpdateClusterOptions... options);
|
ListenableFuture<Cluster> updateCluster(@QueryParam("id") long clusterId, UpdateClusterOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update password of a cluster on management server.
|
||||||
|
*
|
||||||
|
* @param clusterId the cluster ID
|
||||||
|
* @param username the username for the cluster
|
||||||
|
* @param password the password for the cluster
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@QueryParams(keys = "command", values = "updateHostPassword")
|
||||||
|
@SelectJson("cluster")
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
ListenableFuture<Void> updateClusterPassword(@QueryParam("clusterid") long clusterId, @QueryParam("username") String username, @QueryParam("password") String password);
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,4 +154,13 @@ public interface GlobalHostClient {
|
||||||
* @return the modified cluster
|
* @return the modified cluster
|
||||||
*/
|
*/
|
||||||
Cluster updateCluster(long clusterId, UpdateClusterOptions... options);
|
Cluster updateCluster(long clusterId, UpdateClusterOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update password of a cluster on management server.
|
||||||
|
*
|
||||||
|
* @param hostId the cluster ID
|
||||||
|
* @param username the username for the cluster
|
||||||
|
* @param password the password for the cluster
|
||||||
|
*/
|
||||||
|
void updateClusterPassword(long clusterId, String username, String password);
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,6 +303,19 @@ public class GlobalHostClientExpectTest extends BaseCloudStackRestClientExpectTe
|
||||||
assertEquals(actual, expected);
|
assertEquals(actual, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateClusterPasswordWhenResponseIs2xx() {
|
||||||
|
HttpRequest request = HttpRequest.builder()
|
||||||
|
.method("GET")
|
||||||
|
.endpoint(URI.create("http://localhost:8080/client/api?response=json&command=updateHostPassword&clusterid=1&password=sekrit&username=fred&apiKey=identity&signature=xwc83%2BoYK0cuAiFQAlg%2F7%2F1IVHE%3D"))
|
||||||
|
.headers(ImmutableMultimap.<String, String>builder().put("Accept", "application/json").build())
|
||||||
|
.build();
|
||||||
|
HttpResponse response = HttpResponse.builder()
|
||||||
|
.statusCode(200).build();
|
||||||
|
|
||||||
|
requestSendsResponse(request, response).updateClusterPassword(1, "fred", "sekrit");
|
||||||
|
}
|
||||||
|
|
||||||
private Date makeDate(int year, int month, int date, int hour, int minute, int second, String timeZoneName) {
|
private Date makeDate(int year, int month, int date, int hour, int minute, int second, String timeZoneName) {
|
||||||
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(timeZoneName));
|
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(timeZoneName));
|
||||||
cal.set(Calendar.YEAR, year);
|
cal.set(Calendar.YEAR, year);
|
||||||
|
|
Loading…
Reference in New Issue