mirror of https://github.com/apache/jclouds.git
Add GlobalHost[Async]Client.updateHostPassword()
This commit is contained in:
parent
9bb9312d4a
commit
2b1c5f78f3
|
@ -90,6 +90,18 @@ public interface GlobalHostAsyncClient {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<Host> updateHost(@QueryParam("id") long hostId, UpdateHostOptions... options);
|
||||
|
||||
/**
|
||||
* Update password of a host on management server.
|
||||
*
|
||||
* @param hostId the host ID
|
||||
* @param username the username for the host
|
||||
* @param password the password for the host
|
||||
*/
|
||||
@GET
|
||||
@QueryParams(keys = "command", values = "updateHostPassword")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<Void> updateHostPassword(@QueryParam("hostid") long hostId, @QueryParam("username") String username, @QueryParam("password") String password);
|
||||
|
||||
/**
|
||||
* @see GlobalHostClient#listClusters
|
||||
*/
|
||||
|
|
|
@ -72,6 +72,15 @@ public interface GlobalHostClient {
|
|||
*/
|
||||
Host updateHost(long hostId, UpdateHostOptions... options);
|
||||
|
||||
/**
|
||||
* Update password of a host on management server.
|
||||
*
|
||||
* @param hostId the host ID
|
||||
* @param username the username for the host
|
||||
* @param password the password for the host
|
||||
*/
|
||||
void updateHostPassword(long hostId, String username, String password);
|
||||
|
||||
/**
|
||||
* Lists clusters
|
||||
*
|
||||
|
|
|
@ -138,6 +138,19 @@ public class GlobalHostClientExpectTest extends BaseCloudStackRestClientExpectTe
|
|||
assertEquals(actual, expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateHostPasswordWhenResponseIs2xx() {
|
||||
HttpRequest request = HttpRequest.builder()
|
||||
.method("GET")
|
||||
.endpoint(URI.create("http://localhost:8080/client/api?response=json&command=updateHostPassword&hostid=1&password=sekrit&username=fred&apiKey=identity&signature=g9nMKDWoiU72y0HhaRFekZCgfJc%3D"))
|
||||
.headers(ImmutableMultimap.<String, String>builder().put("Accept", "application/json").build())
|
||||
.build();
|
||||
HttpResponse response = HttpResponse.builder()
|
||||
.statusCode(200).build();
|
||||
|
||||
requestSendsResponse(request, response).updateHostPassword(1, "fred", "sekrit");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListClustersWhenResponseIs2xx() {
|
||||
HttpRequest request = HttpRequest.builder()
|
||||
|
|
Loading…
Reference in New Issue