Search in sources :

Example 46 with ServerApiException

use of org.apache.cloudstack.api.ServerApiException in project cloudstack by apache.

the class UploadCustomCertificateCmd method execute.

@Override
public void execute() {
    String result = _mgr.uploadCertificate(this);
    if (result != null) {
        CustomCertificateResponse response = new CustomCertificateResponse();
        response.setResponseName(getCommandName());
        response.setResultMessage(result);
        response.setObjectName("customcertificate");
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upload custom certificate");
    }
}
Also used : CustomCertificateResponse(org.apache.cloudstack.api.response.CustomCertificateResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException)

Example 47 with ServerApiException

use of org.apache.cloudstack.api.ServerApiException in project cloudstack by apache.

the class ConfigureOvsElementCmd method execute.

@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
    CallContext.current().setEventDetails("Ovs element: " + id);
    OvsProvider result = _service.get(0).configure(this);
    if (result != null) {
        OvsProviderResponse ovsResponse = _responseGenerator.createOvsProviderResponse(result);
        ovsResponse.setResponseName(getCommandName());
        this.setResponseObject(ovsResponse);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure the ovs provider");
    }
}
Also used : OvsProvider(com.cloud.network.OvsProvider) ServerApiException(org.apache.cloudstack.api.ServerApiException) OvsProviderResponse(org.apache.cloudstack.api.response.OvsProviderResponse)

Example 48 with ServerApiException

use of org.apache.cloudstack.api.ServerApiException in project cloudstack by apache.

the class CreateServiceOfferingCmd method execute.

@Override
public void execute() {
    ServiceOffering result = _configService.createServiceOffering(this);
    if (result != null) {
        ServiceOfferingResponse response = _responseGenerator.createServiceOfferingResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create service offering");
    }
}
Also used : ServiceOfferingResponse(org.apache.cloudstack.api.response.ServiceOfferingResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException) ServiceOffering(com.cloud.offering.ServiceOffering)

Example 49 with ServerApiException

use of org.apache.cloudstack.api.ServerApiException in project cloudstack by apache.

the class DeleteDiskOfferingCmd method execute.

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

Example 50 with ServerApiException

use of org.apache.cloudstack.api.ServerApiException 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)

Aggregations

ServerApiException (org.apache.cloudstack.api.ServerApiException)513 SuccessResponse (org.apache.cloudstack.api.response.SuccessResponse)125 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)116 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)61 ArrayList (java.util.ArrayList)58 UserVm (com.cloud.uservm.UserVm)44 ListResponse (org.apache.cloudstack.api.response.ListResponse)44 UserVmResponse (org.apache.cloudstack.api.response.UserVmResponse)42 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)39 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)33 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)26 ResourceAllocationException (com.cloud.exception.ResourceAllocationException)25 Account (com.cloud.user.Account)24 Host (com.cloud.host.Host)20 NetworkRuleConflictException (com.cloud.exception.NetworkRuleConflictException)18 Volume (com.cloud.storage.Volume)16 Test (org.junit.Test)16 VirtualMachineTemplate (com.cloud.template.VirtualMachineTemplate)15 VolumeResponse (org.apache.cloudstack.api.response.VolumeResponse)15 UserAccount (com.cloud.user.UserAccount)13