Search in sources :

Example 1 with NetscalerControlCenterResponse

use of com.cloud.api.response.NetscalerControlCenterResponse in project cloudstack by apache.

the class RegisterNetscalerControlCenterCmd method execute.

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    try {
        NetScalerControlCenterVO nccVO = _netsclarLbService.registerNetscalerControlCenter(this);
        if (nccVO != null) {
            NetscalerControlCenterResponse response = _netsclarLbService.createNetscalerControlCenterResponse(nccVO);
            response.setObjectName("netscalerloadbalancer");
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add netscaler load balancer due to internal error.");
        }
    } catch (InvalidParameterValueException invalidParamExcp) {
        throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
    } catch (CloudRuntimeException runtimeExcp) {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
    }
}
Also used : ServerApiException(org.apache.cloudstack.api.ServerApiException) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) NetScalerControlCenterVO(com.cloud.network.NetScalerControlCenterVO) NetscalerControlCenterResponse(com.cloud.api.response.NetscalerControlCenterResponse)

Example 2 with NetscalerControlCenterResponse

use of com.cloud.api.response.NetscalerControlCenterResponse in project cloudstack by apache.

the class NetscalerElement method createNetscalerControlCenterResponse.

@Override
public NetscalerControlCenterResponse createNetscalerControlCenterResponse(NetScalerControlCenterVO lncCentersVO) {
    NetscalerControlCenterResponse response = new NetscalerControlCenterResponse(lncCentersVO);
    response.setObjectName("netscalercontrolcenter");
    return response;
}
Also used : NetscalerControlCenterResponse(com.cloud.api.response.NetscalerControlCenterResponse)

Example 3 with NetscalerControlCenterResponse

use of com.cloud.api.response.NetscalerControlCenterResponse in project cloudstack by apache.

the class ListNetscalerControlCenterCmd method execute.

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    try {
        List<NetScalerControlCenterVO> lncCenters = _netsclarLbService.listNetscalerControlCenter(this);
        if (lncCenters != null) {
            ListResponse<NetscalerControlCenterResponse> response = new ListResponse<NetscalerControlCenterResponse>();
            List<NetscalerControlCenterResponse> lncCentersResponse = new ArrayList<NetscalerControlCenterResponse>();
            if (lncCenters != null && !lncCenters.isEmpty()) {
                for (NetScalerControlCenterVO lncCentersVO : lncCenters) {
                    NetscalerControlCenterResponse lncCentreResponse = _netsclarLbService.createNetscalerControlCenterResponse(lncCentersVO);
                    lncCentersResponse.add(lncCentreResponse);
                }
            }
            response.setResponses(lncCentersResponse);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to list Net scalar Control Center due to some  internal error.");
        }
    } catch (InvalidParameterValueException invalidParamExcp) {
        throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
    } catch (CloudRuntimeException runtimeExcp) {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
    }
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) NetScalerControlCenterVO(com.cloud.network.NetScalerControlCenterVO) ArrayList(java.util.ArrayList) NetscalerControlCenterResponse(com.cloud.api.response.NetscalerControlCenterResponse)

Aggregations

NetscalerControlCenterResponse (com.cloud.api.response.NetscalerControlCenterResponse)3 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)2 NetScalerControlCenterVO (com.cloud.network.NetScalerControlCenterVO)2 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)2 ServerApiException (org.apache.cloudstack.api.ServerApiException)2 ArrayList (java.util.ArrayList)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1