Search in sources :

Example 26 with SuccessResponse

use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.

the class RevokeSecurityGroupIngressCmd method execute.

@Override
public void execute() {
    boolean result = _securityGroupService.revokeSecurityGroupIngress(this);
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to revoke security group ingress rule");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 27 with SuccessResponse

use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.

the class UpdateProjectInvitationCmd method execute.

@Override
public void execute() {
    UserContext.current().setEventDetails("Project id: " + projectId + "; accountName " + accountName + "; accept " + getAccept());
    boolean result = _projectService.updateInvitation(projectId, accountName, token, getAccept());
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to join the project");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 28 with SuccessResponse

use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.

the class RemoveFromLoadBalancerRuleCmd method execute.

@Override
public void execute() {
    UserContext.current().setEventDetails("Load balancer Id: " + getId() + " VmIds: " + StringUtils.join(getVirtualMachineIds(), ","));
    boolean result = _lbService.removeFromLoadBalancer(id, virtualMachineIds);
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to remove instance from load balancer rule");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 29 with SuccessResponse

use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.

the class RemoveVpnUserCmd method execute.

@Override
public void execute() {
    Account owner = _accountService.getAccount(getEntityOwnerId());
    boolean result = _ravService.removeVpnUser(owner.getId(), userName);
    if (!result) {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to remove vpn user");
    }
    if (!_ravService.applyVpnUsers(owner.getId())) {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to apply vpn user removal");
    }
    SuccessResponse response = new SuccessResponse(getCommandName());
    setResponseObject(response);
}
Also used : Account(com.cloud.user.Account) SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 30 with SuccessResponse

use of com.cloud.api.response.SuccessResponse in project CloudStack-archive by CloudStack-extras.

the class ConfigureSimulator method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
    SimulatorManager _simMgr = locator.getManager(SimulatorManager.class);
    boolean result = _simMgr.configureSimulator(zoneId, podId, clusterId, hostId, command, values);
    if (!result) {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to configure simulator");
    }
    SuccessResponse response = new SuccessResponse(getCommandName());
    this.setResponseObject(response);
}
Also used : ComponentLocator(com.cloud.utils.component.ComponentLocator) SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException) SimulatorManager(com.cloud.agent.manager.SimulatorManager)

Aggregations

SuccessResponse (com.cloud.api.response.SuccessResponse)48 ServerApiException (com.cloud.api.ServerApiException)46 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)2 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)2 SimulatorManager (com.cloud.agent.manager.SimulatorManager)1 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)1 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)1 NetworkRuleConflictException (com.cloud.exception.NetworkRuleConflictException)1 ResourceAllocationException (com.cloud.exception.ResourceAllocationException)1 ResourceInUseException (com.cloud.exception.ResourceInUseException)1 StoragePool (com.cloud.storage.StoragePool)1 Account (com.cloud.user.Account)1 ComponentLocator (com.cloud.utils.component.ComponentLocator)1