Search in sources :

Example 96 with SuccessResponse

use of com.cloud.api.response.SuccessResponse in project cosmic by MissionCriticalCloud.

the class ArchiveEventsCmd method execute.

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
    if (ids == null && type == null && endDate == null) {
        throw new InvalidParameterValueException("either ids, type or enddate must be specified");
    } else if (startDate != null && endDate == null) {
        throw new InvalidParameterValueException("enddate must be specified with startdate parameter");
    }
    final boolean result = _mgr.archiveEvents(this);
    if (result) {
        final SuccessResponse response = new SuccessResponse(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to archive Events, one or more parameters has invalid values");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException) InvalidParameterValueException(com.cloud.utils.exception.InvalidParameterValueException)

Example 97 with SuccessResponse

use of com.cloud.api.response.SuccessResponse in project cosmic by MissionCriticalCloud.

the class DeleteVMGroupCmd method execute.

// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
    final boolean result = _userVmService.deleteVmGroup(this);
    if (result) {
        final SuccessResponse response = new SuccessResponse(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm group");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 98 with SuccessResponse

use of com.cloud.api.response.SuccessResponse in project cosmic by MissionCriticalCloud.

the class DeleteVMSnapshotCmd method execute.

@Override
public void execute() {
    CallContext.current().setEventDetails("vmsnapshot id: " + getId());
    final boolean result = _vmSnapshotService.deleteVMSnapshot(getId());
    if (result) {
        final SuccessResponse response = new SuccessResponse(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm snapshot");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 99 with SuccessResponse

use of com.cloud.api.response.SuccessResponse in project cosmic by MissionCriticalCloud.

the class AddResourceDetailCmd method execute.

@Override
public void execute() {
    _resourceMetaDataService.addResourceMetaData(getResourceId(), getResourceType(), getDetails(), forDisplay());
    setResponseObject(new SuccessResponse(getCommandName()));
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse)

Example 100 with SuccessResponse

use of com.cloud.api.response.SuccessResponse in project cosmic by MissionCriticalCloud.

the class DisassociateIPAddrCmd method execute.

// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws InsufficientAddressCapacityException {
    CallContext.current().setEventDetails("IP ID: " + getIpAddressId());
    boolean result = false;
    result = _networkService.releaseIpAddress(getIpAddressId());
    if (result) {
        final SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disassociate IP address");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

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