use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.
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");
}
UserContext.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(BaseCmd.INTERNAL_ERROR, "Failed to add account to the project");
}
}
use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.
the class DisableStaticNatCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, NetworkRuleConflictException, InsufficientAddressCapacityException {
boolean result = _rulesService.disableStaticNat(ipAddressId);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disable static nat");
}
}
use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.
the class DeleteAccountFromProjectCmd method execute.
@Override
public void execute() {
UserContext.current().setEventDetails("Project id: " + projectId + "; accountName " + accountName);
boolean result = _projectService.deleteAccountFromProject(projectId, accountName);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete account from the project");
}
}
use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.
the class DeleteSnapshotCmd method execute.
@Override
public void execute() {
UserContext.current().setEventDetails("Snapshot Id: " + getId());
boolean result = _snapshotService.deleteSnapshot(getId());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete snapshot");
}
}
use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.
the class DeleteSnapshotPoliciesCmd method execute.
@Override
public void execute() {
boolean result = _snapshotService.deleteSnapshotPolicies(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete snapshot policy");
}
}
Aggregations