Search in sources :

Example 36 with SuccessResponse

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

the class DeleteTemplateCmd method execute.

@Override
public void execute() {
    UserContext.current().setEventDetails("Template Id: " + getId());
    boolean result = _templateService.deleteTemplate(this);
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete template");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 37 with SuccessResponse

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

the class DeleteUserCmd method execute.

@Override
public void execute() {
    UserContext.current().setEventDetails("UserId: " + getId());
    boolean result = _accountService.deleteUser(this);
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete user");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 38 with SuccessResponse

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

the class DeleteVolumeCmd method execute.

@Override
public void execute() throws ConcurrentOperationException {
    UserContext.current().setEventDetails("Volume Id: " + getId());
    boolean result = _storageService.deleteVolume(id);
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete volume");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 39 with SuccessResponse

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

the class DeleteZoneCmd method execute.

@Override
public void execute() {
    UserContext.current().setEventDetails("Zone Id: " + getId());
    boolean result = _configService.deleteZone(this);
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete zone");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 40 with SuccessResponse

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

the class DeleteNetworkServiceProviderCmd method execute.

@Override
public void execute() {
    try {
        boolean result = _networkService.deleteNetworkServiceProvider(getId());
        if (result) {
            SuccessResponse response = new SuccessResponse(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network service provider");
        }
    } catch (ResourceUnavailableException ex) {
        s_logger.warn("Exception: ", ex);
        throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
    } catch (ConcurrentOperationException ex) {
        s_logger.warn("Exception: ", ex);
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException) ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) ConcurrentOperationException(com.cloud.exception.ConcurrentOperationException)

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