use of com.cloud.api.response.SuccessResponse in project cosmic by MissionCriticalCloud.
the class ArchiveEventsCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
if (ids == null && type == null && endDate == null) {
throw new InvalidParameterValueException("either ids, type or enddate must be specified");
} else if (startDate != null && endDate == null) {
throw new InvalidParameterValueException("enddate must be specified with startdate parameter");
}
final boolean result = _mgr.archiveEvents(this);
if (result) {
final SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to archive Events, one or more parameters has invalid values");
}
}
use of com.cloud.api.response.SuccessResponse in project cosmic by MissionCriticalCloud.
the class DeleteVMGroupCmd method execute.
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final boolean result = _userVmService.deleteVmGroup(this);
if (result) {
final SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm group");
}
}
use of com.cloud.api.response.SuccessResponse in project cosmic by MissionCriticalCloud.
the class DeleteVMSnapshotCmd method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("vmsnapshot id: " + getId());
final boolean result = _vmSnapshotService.deleteVMSnapshot(getId());
if (result) {
final SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm snapshot");
}
}
use of com.cloud.api.response.SuccessResponse in project cosmic by MissionCriticalCloud.
the class AddResourceDetailCmd method execute.
@Override
public void execute() {
_resourceMetaDataService.addResourceMetaData(getResourceId(), getResourceType(), getDetails(), forDisplay());
setResponseObject(new SuccessResponse(getCommandName()));
}
use of com.cloud.api.response.SuccessResponse in project cosmic by MissionCriticalCloud.
the class DisassociateIPAddrCmd method execute.
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws InsufficientAddressCapacityException {
CallContext.current().setEventDetails("IP ID: " + getIpAddressId());
boolean result = false;
result = _networkService.releaseIpAddress(getIpAddressId());
if (result) {
final SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disassociate IP address");
}
}
Aggregations