use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class GenerateUsageRecordsCmd method execute.
@Override
public void execute() {
boolean result = _usageService.generateUsageRecords(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to generate usage records");
}
}
use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class DeletePoolCmd method execute.
@Override
public void execute() {
boolean result = _storageService.deletePool(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
StoragePool pool = _storageService.getStoragePool(id);
if (pool != null && pool.getStatus() == StoragePoolStatus.Removed) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to finish storage pool removal. The storage pool will not be used but cleanup is needed");
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete storage pool");
}
}
}
use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class DeleteTrafficTypeCmd method execute.
@Override
public void execute() {
boolean result = _networkService.deletePhysicalNetworkTrafficType(getId());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete traffic type");
}
}
use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class MoveUserCmd method execute.
@Override
public void execute() {
Preconditions.checkNotNull(getId(), "I have to have an user to move!");
Preconditions.checkState(ObjectUtils.anyNotNull(getAccountId(), getAccountName()), "provide either an account name or an account id!");
CallContext.current().setEventDetails("UserId: " + getId());
boolean result = _regionService.moveUser(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to move the user to a new account");
}
}
use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class DeleteImageStoreCmd method execute.
@Override
public void execute() {
boolean result = _storageService.deleteImageStore(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete image store");
}
}
Aggregations