Search in sources :

Example 1 with CiscoAsa1000vResourceResponse

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

the class ListCiscoAsa1000vResourcesCmd method execute.

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    try {
        List<CiscoAsa1000vDeviceVO> ciscoAsa1000vDevices = _ciscoAsa1000vService.listCiscoAsa1000vResources(this);
        ListResponse<CiscoAsa1000vResourceResponse> response = new ListResponse<CiscoAsa1000vResourceResponse>();
        List<CiscoAsa1000vResourceResponse> ciscoAsa1000vResourcesResponse = new ArrayList<CiscoAsa1000vResourceResponse>();
        if (ciscoAsa1000vDevices != null && !ciscoAsa1000vDevices.isEmpty()) {
            for (CiscoAsa1000vDevice ciscoAsa1000vDeviceVO : ciscoAsa1000vDevices) {
                CiscoAsa1000vResourceResponse ciscoAsa1000vResourceResponse = _ciscoAsa1000vService.createCiscoAsa1000vResourceResponse(ciscoAsa1000vDeviceVO);
                ciscoAsa1000vResourceResponse.setObjectName("CiscoAsa1000vResource");
                ciscoAsa1000vResourcesResponse.add(ciscoAsa1000vResourceResponse);
            }
        }
        response.setResponses(ciscoAsa1000vResourcesResponse);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } catch (InvalidParameterValueException invalidParamExcp) {
        throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
    } catch (CloudRuntimeException runtimeExcp) {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
    }
}
Also used : CiscoAsa1000vDeviceVO(com.cloud.network.cisco.CiscoAsa1000vDeviceVO) ListResponse(org.apache.cloudstack.api.response.ListResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) CiscoAsa1000vResourceResponse(com.cloud.api.response.CiscoAsa1000vResourceResponse) ArrayList(java.util.ArrayList) CiscoAsa1000vDevice(com.cloud.network.cisco.CiscoAsa1000vDevice)

Example 2 with CiscoAsa1000vResourceResponse

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

the class CiscoVnmcElement method createCiscoAsa1000vResourceResponse.

@Override
public CiscoAsa1000vResourceResponse createCiscoAsa1000vResourceResponse(CiscoAsa1000vDevice ciscoAsa1000vDeviceVO) {
    CiscoAsa1000vResourceResponse response = new CiscoAsa1000vResourceResponse();
    response.setId(ciscoAsa1000vDeviceVO.getUuid());
    response.setManagementIp(ciscoAsa1000vDeviceVO.getManagementIp());
    response.setInPortProfile(ciscoAsa1000vDeviceVO.getInPortProfile());
    NetworkAsa1000vMapVO networkAsaMap = _networkAsa1000vMapDao.findByAsa1000vId(ciscoAsa1000vDeviceVO.getId());
    if (networkAsaMap != null) {
        response.setGuestNetworkId(networkAsaMap.getNetworkId());
    }
    return response;
}
Also used : CiscoAsa1000vResourceResponse(com.cloud.api.response.CiscoAsa1000vResourceResponse) NetworkAsa1000vMapVO(com.cloud.network.cisco.NetworkAsa1000vMapVO)

Example 3 with CiscoAsa1000vResourceResponse

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

the class AddCiscoAsa1000vResourceCmd method execute.

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    try {
        CiscoAsa1000vDevice ciscoAsa1000v = _ciscoAsa1000vService.addCiscoAsa1000vResource(this);
        if (ciscoAsa1000v != null) {
            CiscoAsa1000vResourceResponse response = _ciscoAsa1000vService.createCiscoAsa1000vResourceResponse(ciscoAsa1000v);
            response.setObjectName("CiscoAsa1000vResource");
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Cisco ASA 1000v appliance 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) CiscoAsa1000vResourceResponse(com.cloud.api.response.CiscoAsa1000vResourceResponse) CiscoAsa1000vDevice(com.cloud.network.cisco.CiscoAsa1000vDevice)

Aggregations

CiscoAsa1000vResourceResponse (com.cloud.api.response.CiscoAsa1000vResourceResponse)3 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)2 CiscoAsa1000vDevice (com.cloud.network.cisco.CiscoAsa1000vDevice)2 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)2 ServerApiException (org.apache.cloudstack.api.ServerApiException)2 CiscoAsa1000vDeviceVO (com.cloud.network.cisco.CiscoAsa1000vDeviceVO)1 NetworkAsa1000vMapVO (com.cloud.network.cisco.NetworkAsa1000vMapVO)1 ArrayList (java.util.ArrayList)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1