Search in sources :

Example 56 with SuccessResponse

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

the class DeleteLoadBalancerRuleCmd method execute.

@Override
public void execute() {
    CallContext.current().setEventDetails("Load balancer ID: " + getId());
    boolean result = _firewallService.revokeRelatedFirewallRule(id, true);
    result = result && _lbService.deleteLoadBalancerRule(id, true);
    if (result) {
        final SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete load balancer");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 57 with SuccessResponse

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

the class DeleteSslCertCmd method execute.

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
    try {
        _certService.deleteSslCert(this);
        final SuccessResponse rsp = new SuccessResponse();
        rsp.setResponseName(getCommandName());
        rsp.setObjectName("success");
        this.setResponseObject(rsp);
    } catch (final Exception e) {
        throw new CloudRuntimeException(e);
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) ServerApiException(com.cloud.api.ServerApiException) NetworkRuleConflictException(com.cloud.exception.NetworkRuleConflictException) ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) ResourceAllocationException(com.cloud.exception.ResourceAllocationException) ConcurrentOperationException(com.cloud.exception.ConcurrentOperationException) InsufficientCapacityException(com.cloud.exception.InsufficientCapacityException)

Example 58 with SuccessResponse

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

the class DeleteNetworkACLCmd method execute.

@Override
public void execute() throws ResourceUnavailableException {
    CallContext.current().setEventDetails("Network ACL item ID: " + id);
    final boolean result = _networkACLService.revokeNetworkACLItem(id);
    if (result) {
        final SuccessResponse response = new SuccessResponse(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL item");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 59 with SuccessResponse

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

the class DeleteNetworkACLListCmd method execute.

@Override
public void execute() throws ResourceUnavailableException {
    CallContext.current().setEventDetails("Network ACL ID: " + id);
    final boolean result = _networkACLService.deleteNetworkACL(id);
    if (result) {
        final SuccessResponse response = new SuccessResponse(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL");
    }
}
Also used : SuccessResponse(com.cloud.api.response.SuccessResponse) ServerApiException(com.cloud.api.ServerApiException)

Example 60 with SuccessResponse

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

the class RestartNetworkCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
    final boolean result = _networkService.restartNetwork(this, getCleanup());
    if (result) {
        final SuccessResponse response = new SuccessResponse(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restart network");
    }
}
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