use of org.apache.cloudstack.api.response.AccountResponse in project cloudstack by apache.
the class UpdateAccountCmd method execute.
@Override
public void execute() {
Account result = _regionService.updateAccount(this);
if (result != null) {
AccountResponse response = _responseGenerator.createAccountResponse(ResponseView.Full, result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update account");
}
}
use of org.apache.cloudstack.api.response.AccountResponse in project cloudstack by apache.
the class CreateAccountCmd method execute.
@Override
public void execute() {
validateParams();
CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId());
UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(), getRoleId(), getDomainId(), getNetworkDomain(), getDetails(), getAccountUUID(), getUserUUID());
if (userAccount != null) {
AccountResponse response = _responseGenerator.createUserAccountResponse(ResponseView.Full, userAccount);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user account");
}
}
use of org.apache.cloudstack.api.response.AccountResponse in project cloudstack by apache.
the class MarkDefaultZoneForAccountCmd method execute.
@Override
public void execute() {
Account result = _configService.markDefaultZone(getAccountName(), getDomainId(), getDefaultZoneId());
if (result != null) {
AccountResponse response = _responseGenerator.createAccountResponse(ResponseView.Full, result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to mark the account with the default zone");
}
}
use of org.apache.cloudstack.api.response.AccountResponse in project cloudstack by apache.
the class QueryManagerImpl method searchForAccounts.
@Override
public ListResponse<AccountResponse> searchForAccounts(ListAccountsCmd cmd) {
Pair<List<AccountJoinVO>, Integer> result = searchForAccountsInternal(cmd);
ListResponse<AccountResponse> response = new ListResponse<AccountResponse>();
ResponseView respView = ResponseView.Restricted;
if (cmd instanceof ListAccountsCmdByAdmin) {
respView = ResponseView.Full;
}
List<AccountResponse> accountResponses = ViewResponseHelper.createAccountResponse(respView, result.first().toArray(new AccountJoinVO[result.first().size()]));
response.setResponses(accountResponses, result.second());
return response;
}
use of org.apache.cloudstack.api.response.AccountResponse in project cloudstack by apache.
the class DisableAccountCmd method execute.
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId());
Account result = _regionService.disableAccount(this);
if (result != null) {
AccountResponse response = _responseGenerator.createAccountResponse(ResponseView.Full, result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account");
}
}
Aggregations