use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class ExpungeVMCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
CallContext.current().setEventDetails("Vm Id: " + getId());
try {
UserVm result = _userVmService.expungeVm(this.getId());
if (result != null) {
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to expunge vm");
}
} catch (InvalidParameterValueException ipve) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
} catch (CloudRuntimeException cre) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
}
}
use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class DeleteZoneCmd method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("Zone Id: " + getId());
boolean result = _configService.deleteZone(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete zone");
}
}
use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class AddAccountToProjectCmd method execute.
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() {
if (accountName == null && email == null) {
throw new InvalidParameterValueException("Either accountName or email is required");
}
CallContext.current().setEventDetails("Project ID: " + projectId + "; accountName " + accountName);
boolean result = _projectService.addAccountToProject(getProjectId(), getAccountName(), getEmail());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add account to the project");
}
}
use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class DeletePrivateGatewayCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
CallContext.current().setEventDetails("Network ACL Id: " + id);
boolean result = _vpcService.deleteVpcPrivateGateway(id);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete private gateway");
}
}
use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.
the class DeleteVPCOfferingCmd method execute.
@Override
public void execute() {
boolean result = _vpcProvSvc.deleteVpcOffering(getId());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete VPC offering");
}
}
Aggregations