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());
}
}
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;
}
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());
}
}
Aggregations