Search in sources :

Example 81 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 82 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 83 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 84 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 85 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)136 ServerApiException (com.cloud.api.ServerApiException)128 InvalidParameterValueException (com.cloud.utils.exception.InvalidParameterValueException)10 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)8 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)7 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)5 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)4 NetworkRuleConflictException (com.cloud.exception.NetworkRuleConflictException)3 ResourceAllocationException (com.cloud.exception.ResourceAllocationException)3 StoragePool (com.cloud.storage.StoragePool)2 Account (com.cloud.user.Account)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 SimulatorManager (com.cloud.agent.manager.SimulatorManager)1 AlertType (com.cloud.alert.AlertService.AlertType)1 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)1 ResourceInUseException (com.cloud.exception.ResourceInUseException)1 ResourceTag (com.cloud.server.ResourceTag)1 UserVm (com.cloud.uservm.UserVm)1 ComponentLocator (com.cloud.utils.component.ComponentLocator)1