Search in sources :

Example 11 with SuccessResponse

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

the class DeletePoolCmd method execute.

@Override
public void execute() {
    boolean result = _storageService.deletePool(this);
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        StoragePool pool = _storageService.getStoragePool(id);
        if (pool != null && pool.getStatus() == StoragePoolStatus.Removed) {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to finish storage pool removal. The storage pool will not be used but cleanup is needed");
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete storage pool");
        }
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) StoragePool(com.cloud.storage.StoragePool) ServerApiException(com.cloud.api.ServerApiException)

Example 12 with SuccessResponse

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

the class DeleteProjectCmd method execute.

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() {
    UserContext.current().setEventDetails("Project Id: " + id);
    boolean result = _projectService.deleteProject(id);
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete project");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 13 with SuccessResponse

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

the class DeleteProjectInvitationCmd method execute.

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

Example 14 with SuccessResponse

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

the class DeleteSSHKeyPairCmd method execute.

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() {
    boolean result = _mgr.deleteSSHKeyPair(this);
    SuccessResponse response = new SuccessResponse(getCommandName());
    response.setSuccess(result);
    this.setResponseObject(response);
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse)

Example 15 with SuccessResponse

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

the class DeleteSecurityGroupCmd method execute.

@Override
public void execute() {
    try {
        boolean result = _securityGroupService.deleteSecurityGroup(this);
        if (result) {
            SuccessResponse response = new SuccessResponse(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete security group");
        }
    } catch (ResourceInUseException ex) {
        s_logger.warn("Exception: ", ex);
        throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex.getMessage());
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException) ResourceInUseException(com.cloud.exception.ResourceInUseException)

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