use of com.cloud.api.response.CiscoVnmcResourceResponse in project cloudstack by apache.
the class ListCiscoVnmcResourcesCmd method execute.
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
List<CiscoVnmcControllerVO> ciscoVnmcResources = _ciscoVnmcElementService.listCiscoVnmcResources(this);
ListResponse<CiscoVnmcResourceResponse> response = new ListResponse<CiscoVnmcResourceResponse>();
List<CiscoVnmcResourceResponse> ciscoVnmcResourcesResponse = new ArrayList<CiscoVnmcResourceResponse>();
if (ciscoVnmcResources != null && !ciscoVnmcResources.isEmpty()) {
for (CiscoVnmcController ciscoVnmcResourceVO : ciscoVnmcResources) {
CiscoVnmcResourceResponse ciscoVnmcResourceResponse = _ciscoVnmcElementService.createCiscoVnmcResourceResponse(ciscoVnmcResourceVO);
ciscoVnmcResourceResponse.setObjectName("CiscoVnmcResource");
ciscoVnmcResourcesResponse.add(ciscoVnmcResourceResponse);
}
}
response.setResponses(ciscoVnmcResourcesResponse);
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.CiscoVnmcResourceResponse in project cloudstack by apache.
the class AddCiscoVnmcResourceCmd method execute.
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
CiscoVnmcController CiscoVnmcResourceVO = _ciscoVnmcElementService.addCiscoVnmcResource(this);
if (CiscoVnmcResourceVO != null) {
CiscoVnmcResourceResponse response = _ciscoVnmcElementService.createCiscoVnmcResourceResponse(CiscoVnmcResourceVO);
response.setObjectName("CiscoVnmcResource");
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Cisco VNMC controller 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());
}
}
use of com.cloud.api.response.CiscoVnmcResourceResponse in project cloudstack by apache.
the class CiscoVnmcElement method createCiscoVnmcResourceResponse.
@Override
public CiscoVnmcResourceResponse createCiscoVnmcResourceResponse(CiscoVnmcController ciscoVnmcResourceVO) {
HostVO ciscoVnmcHost = _hostDao.findById(ciscoVnmcResourceVO.getHostId());
CiscoVnmcResourceResponse response = new CiscoVnmcResourceResponse();
response.setId(ciscoVnmcResourceVO.getUuid());
response.setPhysicalNetworkId(ciscoVnmcResourceVO.getPhysicalNetworkId());
response.setProviderName(ciscoVnmcResourceVO.getProviderName());
response.setResourceName(ciscoVnmcHost.getName());
return response;
}
Aggregations