Added DomainAccountClient methods for disabling and enabling an account

This commit is contained in:
andreisavu 2011-12-11 13:10:39 +02:00
parent ed9e4c8232
commit 39cd3cba2a
2 changed files with 56 additions and 2 deletions

View File

@ -18,14 +18,24 @@
*/
package org.jclouds.cloudstack.features;
import com.google.common.util.concurrent.ListenableFuture;
import org.jclouds.cloudstack.domain.Account;
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 Account features available to Domain
* Admin users.
*
*
* @author Adrian Cole
* @see <a href=
* "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Domain_Admin.html"
@ -34,5 +44,27 @@ import org.jclouds.rest.annotations.RequestFilters;
@RequestFilters(QuerySigner.class)
@QueryParams(keys = "response", values = "json")
public interface DomainAccountAsyncClient extends AccountAsyncClient {
/**
* @see DomainAccountClient#enableAccount
*/
@GET
@QueryParams(keys = "command", values = "enableAccount")
@SelectJson("account")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Account> enableAccount(@QueryParam("account") long accountId, @QueryParam("domainid") long domainId);
/**
* @see DomainAccountAsyncClient#disableAccount
*/
@GET
@QueryParams(keys = "command", values = "disableAccount")
@SelectJson("account")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Account> disableAccount(@QueryParam("account") long accountId,
@QueryParam("domainid") long domainId, @QueryParam("lock") boolean onlyLock);
}

View File

@ -20,6 +20,7 @@ package org.jclouds.cloudstack.features;
import java.util.concurrent.TimeUnit;
import org.jclouds.cloudstack.domain.Account;
import org.jclouds.concurrent.Timeout;
/**
@ -34,5 +35,26 @@ import org.jclouds.concurrent.Timeout;
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
public interface DomainAccountClient extends AccountClient {
/**
* Enable an account
*
* @param accountId
* the account ID you are enabling
* @param domainId
* the domain ID
*/
public Account enableAccount(long accountId, long domainId);
/**
* Disable or lock an account
*
* @param accountId
* the account ID you are disabling
* @param domainId
* the domain ID
* @param onlyLock
* only lock if true disable otherwise
*/
public Account disableAccount(long accountId, long domainId, boolean onlyLock);
}