Search in sources :

Example 1 with SuccessResponse

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

the class DeleteAccountCmd method execute.

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

Example 2 with SuccessResponse

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

the class DeleteClusterCmd method execute.

@Override
public void execute() {
    boolean result = _resourceService.deleteCluster(this);
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete cluster");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 3 with SuccessResponse

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

the class AssignToLoadBalancerRuleCmd method execute.

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

Example 4 with SuccessResponse

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

the class DeleteDomainCmd method execute.

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

Example 5 with SuccessResponse

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

the class DeleteHostCmd method execute.

@Override
public void execute() {
    boolean result = _resourceService.deleteHost(getId(), isForced(), isForceDestoryLocalStorage());
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete host");
    }
}
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