use of org.cloudfoundry.client.v2.applications.ApplicationInstanceInfo in project cf-java-client by cloudfoundry.
the class DefaultApplications method toInstanceDetail.
private static InstanceDetail toInstanceDetail(Map.Entry<String, ApplicationInstanceInfo> entry, ApplicationStatisticsResponse statisticsResponse) {
InstanceStatistics instanceStatistics = Optional.ofNullable(statisticsResponse.getInstances().get(entry.getKey())).orElse(emptyInstanceStats());
Statistics stats = Optional.ofNullable(instanceStatistics.getStatistics()).orElse(emptyApplicationStatistics());
Usage usage = Optional.ofNullable(stats.getUsage()).orElse(emptyApplicationUsage());
return InstanceDetail.builder().index(entry.getKey()).state(entry.getValue().getState()).since(toDate(entry.getValue().getSince())).cpu(usage.getCpu()).memoryUsage(usage.getMemory()).diskUsage(usage.getDisk()).diskQuota(stats.getDiskQuota()).memoryQuota(stats.getMemoryQuota()).build();
}
Aggregations