use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.
the class DeleteTemplateCmd method execute.
@Override
public void execute() {
UserContext.current().setEventDetails("Template Id: " + getId());
boolean result = _templateService.deleteTemplate(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete template");
}
}
use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.
the class DeleteUserCmd method execute.
@Override
public void execute() {
UserContext.current().setEventDetails("UserId: " + getId());
boolean result = _accountService.deleteUser(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete user");
}
}
use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.
the class DeleteVolumeCmd method execute.
@Override
public void execute() throws ConcurrentOperationException {
UserContext.current().setEventDetails("Volume Id: " + getId());
boolean result = _storageService.deleteVolume(id);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete volume");
}
}
use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.
the class DeleteZoneCmd method execute.
@Override
public void execute() {
UserContext.current().setEventDetails("Zone Id: " + getId());
boolean result = _configService.deleteZone(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete zone");
}
}
use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.
the class DeleteNetworkServiceProviderCmd method execute.
@Override
public void execute() {
try {
boolean result = _networkService.deleteNetworkServiceProvider(getId());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network service provider");
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
}
}
Aggregations