use of org.openkilda.northbound.dto.v2.switches.PortHistoryResponse in project open-kilda by telstra.
the class NorthboundServiceV2Impl method getPortHistory.
@Override
public List<PortHistoryResponse> getPortHistory(SwitchId switchId, Integer port, Long timeFrom, Long timeTo) {
UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString("/api/v2/switches/{switch_id}/ports/{port}/history");
if (timeFrom != null) {
uriBuilder.queryParam("timeFrom", dateFormat.format(new Date(timeFrom)));
}
if (timeTo != null) {
uriBuilder.queryParam("timeTo", dateFormat.format(new Date(timeTo)));
}
PortHistoryResponse[] portHistory = restTemplate.exchange(uriBuilder.build().toString(), HttpMethod.GET, new HttpEntity(buildHeadersWithCorrelationId()), PortHistoryResponse[].class, switchId, port).getBody();
return Arrays.asList(portHistory);
}
Aggregations