Search in sources :

Example 6 with AccountResponse

use of com.cloud.api.response.AccountResponse in project CloudStack-archive by CloudStack-extras.

the class DisableAccountCmd method execute.

@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
    UserContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId());
    Account result = null;
    if (lockRequested)
        result = _accountService.lockAccount(getAccountName(), getDomainId(), getId());
    else
        result = _accountService.disableAccount(getAccountName(), getDomainId(), getId());
    if (result != null) {
        AccountResponse response = _responseGenerator.createAccountResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account");
    }
}
Also used : Account(com.cloud.user.Account) ServerApiException(com.cloud.api.ServerApiException) AccountResponse(com.cloud.api.response.AccountResponse)

Aggregations

AccountResponse (com.cloud.api.response.AccountResponse)6 ServerApiException (com.cloud.api.ServerApiException)5 Account (com.cloud.user.Account)5 ListResponse (com.cloud.api.response.ListResponse)1 UserAccount (com.cloud.user.UserAccount)1 ArrayList (java.util.ArrayList)1