use of com.cloud.api.response.NetworkDeviceResponse in project cosmic by MissionCriticalCloud.
the class AddNetworkDeviceCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
final Host device = nwDeviceMgr.addNetworkDevice(this);
final NetworkDeviceResponse response = nwDeviceMgr.getApiResponse(device);
response.setObjectName("networkdevice");
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (final InvalidParameterValueException ipve) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
} catch (final CloudRuntimeException cre) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
}
}
use of com.cloud.api.response.NetworkDeviceResponse in project cosmic by MissionCriticalCloud.
the class ListNetworkDeviceCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
final List<Host> devices = nwDeviceMgr.listNetworkDevice(this);
final List<NetworkDeviceResponse> nwdeviceResponses = new ArrayList<>();
final ListResponse<NetworkDeviceResponse> listResponse = new ListResponse<>();
for (final Host d : devices) {
final NetworkDeviceResponse response = nwDeviceMgr.getApiResponse(d);
response.setObjectName("networkdevice");
response.setResponseName(getCommandName());
nwdeviceResponses.add(response);
}
listResponse.setResponses(nwdeviceResponses);
listResponse.setResponseName(getCommandName());
this.setResponseObject(listResponse);
} catch (final InvalidParameterValueException ipve) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
} catch (final CloudRuntimeException cre) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
}
}
Aggregations