use of org.apache.cloudstack.api.response.UserResponse in project cloudstack by apache.
the class CreateUserCmd method execute.
@Override
public void execute() {
validateParams();
CallContext.current().setEventDetails("UserName: " + getUserName() + ", FirstName :" + getFirstName() + ", LastName: " + getLastName());
User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId(), getUserUUID());
if (user != null) {
UserResponse response = _responseGenerator.createUserResponse(user);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user");
}
}
use of org.apache.cloudstack.api.response.UserResponse in project cloudstack by apache.
the class DisableUserCmd method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("UserId: " + getId());
UserAccount user = _regionService.disableUser(this);
if (user != null) {
UserResponse response = _responseGenerator.createUserResponse(user);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable user");
}
}
use of org.apache.cloudstack.api.response.UserResponse in project cloudstack by apache.
the class GetUserCmd method execute.
@Override
public void execute() {
UserAccount result = _accountService.getUserByApiKey(getApiKey());
if (result != null) {
UserResponse response = _responseGenerator.createUserResponse(result);
response.setResponseName(getCommandName());
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new InvalidParameterValueException("User with specified API key does not exist");
}
}
use of org.apache.cloudstack.api.response.UserResponse in project cloudstack by apache.
the class ListUsersCmd method updateUserResponse.
private void updateUserResponse(List<UserResponse> response) {
for (UserResponse userResponse : response) {
ResourceIcon resourceIcon = resourceIconManager.getByResourceTypeAndUuid(ResourceTag.ResourceObjectType.User, userResponse.getObjectId());
if (resourceIcon == null) {
resourceIcon = resourceIconManager.getByResourceTypeAndUuid(ResourceTag.ResourceObjectType.Account, userResponse.getAccountId());
if (resourceIcon == null) {
continue;
}
}
ResourceIconResponse iconResponse = _responseGenerator.createResourceIconResponse(resourceIcon);
userResponse.setResourceIconResponse(iconResponse);
}
}
use of org.apache.cloudstack.api.response.UserResponse in project cloudstack by apache.
the class UpdateUserCmd method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("UserId: " + getId());
UserAccount user = _regionService.updateUser(this);
if (user != null) {
UserResponse response = _responseGenerator.createUserResponse(user);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update user");
}
}
Aggregations