Enable / disable user account domain API calls

This commit is contained in:
andreisavu 2011-12-11 14:31:46 +02:00
parent 40fbe9da57
commit 18ca69503c
2 changed files with 45 additions and 2 deletions

View File

@ -18,9 +18,19 @@
*/
package org.jclouds.cloudstack.features;
import com.google.common.util.concurrent.ListenableFuture;
import org.jclouds.cloudstack.domain.User;
import org.jclouds.cloudstack.filters.QuerySigner;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
/**
* Provides asynchronous access to CloudStack User features available to Domain
@ -33,6 +43,26 @@ import org.jclouds.rest.annotations.RequestFilters;
*/
@RequestFilters(QuerySigner.class)
@QueryParams(keys = "response", values = "json")
public interface DomainUserAsyncClient extends AccountAsyncClient {
public interface DomainUserAsyncClient {
/**
* @see DomainUserClient#enableUser
*/
@GET
@QueryParams(keys = "command", values = "enableUser")
@SelectJson("user")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<User> enableUser(@QueryParam("id") long userId);
/**
* @see DomainUserClient#disableUser
*/
@GET
@QueryParams(keys = "command", values = "disableUser")
@SelectJson("user")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<User> disableUser(@QueryParam("id") long userId);
}

View File

@ -18,6 +18,7 @@
*/
package org.jclouds.cloudstack.features;
import org.jclouds.cloudstack.domain.User;
import org.jclouds.concurrent.Timeout;
import java.util.concurrent.TimeUnit;
@ -32,7 +33,19 @@ import java.util.concurrent.TimeUnit;
* />
*/
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
public interface DomainUserClient extends AccountClient {
public interface DomainUserClient {
/**
* Enable a user with a specific ID
*
* @param userId
* the user ID to enable
*/
User enableUser(long userId);
/**
* Disable a user with a specific ID
*/
User disableUser(long userId);
}