Search in sources :

Example 21 with SuccessResponse

use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.

the class DeleteServiceOfferingCmd method execute.

@Override
public void execute() {
    boolean result = _configService.deleteServiceOffering(this);
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete service offering");
    }
}
Also used : SuccessResponse(org.apache.cloudstack.api.response.SuccessResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException)

Example 22 with SuccessResponse

use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.

the class DeletePortableIpRangeCmd method execute.

@Override
public void execute() {
    boolean result = _configService.deletePortableIpRange(this);
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete portable ip range");
    }
}
Also used : SuccessResponse(org.apache.cloudstack.api.response.SuccessResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException)

Example 23 with SuccessResponse

use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.

the class RemoveVpnUserCmd method execute.

@Override
public void execute() {
    Account owner = _accountService.getAccount(getEntityOwnerId());
    boolean result = _ravService.removeVpnUser(owner.getId(), userName, CallContext.current().getCallingAccount());
    if (!result) {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove vpn user");
    }
    try {
        if (!_ravService.applyVpnUsers(owner.getId(), userName)) {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to apply vpn user removal");
        }
    } catch (Exception ex) {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove vpn user due to resource unavailable");
    }
    SuccessResponse response = new SuccessResponse(getCommandName());
    setResponseObject(response);
}
Also used : Account(com.cloud.user.Account) SuccessResponse(org.apache.cloudstack.api.response.SuccessResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException) ServerApiException(org.apache.cloudstack.api.ServerApiException)

Example 24 with SuccessResponse

use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.

the class DeleteVpnCustomerGatewayCmd method execute.

@Override
public void execute() {
    boolean result = _s2sVpnService.deleteCustomerGateway(this);
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete customer VPN gateway");
    }
}
Also used : SuccessResponse(org.apache.cloudstack.api.response.SuccessResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException)

Example 25 with SuccessResponse

use of org.apache.cloudstack.api.response.SuccessResponse in project cloudstack by apache.

the class DeleteVpnGatewayCmd method execute.

@Override
public void execute() {
    boolean result = false;
    result = _s2sVpnService.deleteVpnGateway(this);
    if (result) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete customer VPN gateway");
    }
}
Also used : SuccessResponse(org.apache.cloudstack.api.response.SuccessResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException)

Aggregations

SuccessResponse (org.apache.cloudstack.api.response.SuccessResponse)137 ServerApiException (org.apache.cloudstack.api.ServerApiException)125 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)26 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)19 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)9 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)8 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)6 NetworkRuleConflictException (com.cloud.exception.NetworkRuleConflictException)5 ResourceAllocationException (com.cloud.exception.ResourceAllocationException)5 ResourceInUseException (com.cloud.exception.ResourceInUseException)4 ArrayList (java.util.ArrayList)3 Role (org.apache.cloudstack.acl.Role)3 Account (com.cloud.user.Account)2 List (java.util.List)2 RolePermission (org.apache.cloudstack.acl.RolePermission)2 Domain (com.cloud.domain.Domain)1 Host (com.cloud.host.Host)1 ResourceTag (com.cloud.server.ResourceTag)1 StoragePool (com.cloud.storage.StoragePool)1 UserAccount (com.cloud.user.UserAccount)1