diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainAccountAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainAccountAsyncClient.java index 67e33aef47..ce35be08e9 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainAccountAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainAccountAsyncClient.java @@ -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 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 disableAccount(@QueryParam("account") long accountId, + @QueryParam("domainid") long domainId, @QueryParam("lock") boolean onlyLock); + } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainAccountClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainAccountClient.java index b1a8d367c2..921123169d 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainAccountClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainAccountClient.java @@ -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); }