use of org.openkilda.messaging.payload.history.FlowHistoryEntry in project open-kilda by telstra.
the class NorthboundServiceImpl method getFlowHistory.
@Override
public List<FlowHistoryEntry> getFlowHistory(String flowId, Long timeFrom, Long timeTo, Integer maxCount) {
UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString("/api/v1/flows/{flow_id}/history");
if (timeFrom != null) {
uriBuilder.queryParam("timeFrom", timeFrom);
}
if (timeTo != null) {
uriBuilder.queryParam("timeTo", timeTo);
}
if (maxCount != null) {
uriBuilder.queryParam("max_count", maxCount);
}
FlowHistoryEntry[] flowHistory = restTemplate.exchange(uriBuilder.build().toString(), HttpMethod.GET, new HttpEntity(buildHeadersWithCorrelationId()), FlowHistoryEntry[].class, flowId).getBody();
return Arrays.asList(flowHistory);
}
use of org.openkilda.messaging.payload.history.FlowHistoryEntry in project open-kilda by telstra.
the class FlowServiceImpl method listFlowEvents.
@Override
public CompletableFuture<List<FlowHistoryEntry>> listFlowEvents(String flowId, long timestampFrom, long timestampTo, int maxCount) {
if (maxCount < 1) {
throw new MessageException(RequestCorrelationId.getId(), System.currentTimeMillis(), ErrorType.PARAMETERS_INVALID, format("Invalid `max_count` argument '%s'.", maxCount), "`max_count` argument must be positive.");
}
String correlationId = RequestCorrelationId.getId();
GetFlowHistoryRequest request = GetFlowHistoryRequest.builder().flowId(flowId).timestampFrom(timestampFrom).timestampTo(timestampTo).maxCount(maxCount).build();
CommandMessage command = new CommandMessage(request, System.currentTimeMillis(), correlationId);
return messagingChannel.sendAndGetChunked(nbworkerTopic, command).thenApply(result -> result.stream().map(FlowHistoryEntry.class::cast).collect(Collectors.toList()));
}
Aggregations