use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class DeleteSspCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
s_logger.trace("execute");
SuccessResponse resp = new SuccessResponse();
resp.setSuccess(_service.deleteSspHost(this));
this.setResponseObject(resp);
}
use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class ConfigureSimulatorHAProviderState method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
final Host host = _resourceService.getHost(getHostId());
if (host == null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find host by ID: " + getHostId());
}
final SimulatorHAState haState = new SimulatorHAState(healthy, activity, recovery, fenceable);
final SimulatorHAProvider simulatorHAProvider = (SimulatorHAProvider) haManager.getHAProvider(SimulatorHAProvider.class.getSimpleName().toLowerCase());
if (simulatorHAProvider != null) {
simulatorHAProvider.setHAStateForHost(host.getId(), haState);
}
final SuccessResponse response = new SuccessResponse();
response.setSuccess(simulatorHAProvider != null);
response.setResponseName(getCommandName());
response.setObjectName("simulatorhaprovider");
setResponseObject(response);
}
use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class CleanupSimulatorMockCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
boolean result = _simMgr.clearSimulatorMock(id);
if (!result) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to cleanup mock");
}
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
}
use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class DeletePaloAltoFirewallCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
boolean result = _paElementService.deletePaloAltoFirewall(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Palo Alto firewall device");
}
} catch (InvalidParameterValueException invalidParamExcp) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
} catch (CloudRuntimeException runtimeExcp) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
}
}
use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class DeleteProjectRoleCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
ProjectRole role = projRoleService.findProjectRole(getId(), getProjectId());
if (role == null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot find project role with provided id");
}
CallContext.current().setEventDetails("Deleting Project Role with id: " + role.getId());
boolean result = projRoleService.deleteProjectRole(role, getProjectId());
SuccessResponse response = new SuccessResponse(getCommandName());
response.setSuccess(result);
setResponseObject(response);
}
Aggregations