private Mono<String> waitForStarting(String applicationId) { return this.cloudFoundryClient .applicationsV2() .instances(ApplicationInstancesRequest.builder().applicationId(applicationId).build()) .flatMap(response -> Stream.fromIterable(response.values())) .as(Stream::from) .filter(applicationInstanceInfo -> "RUNNING".equals(applicationInstanceInfo.getState())) .repeatWhen(DelayUtils.exponentialBackOff(1, 10, SECONDS, 10)) .single() .map(info -> applicationId); }
private static List<String> toUrls(List<Route> routes) { return Stream.fromIterable(routes) .map( new Function<Route, String>() { @Override public String apply(Route route) { return toUrl(route); } }) .toList() .get(); }
private static List<ApplicationDetail.InstanceDetail> toInstanceDetailList( ApplicationInstancesResponse instancesResponse, final ApplicationStatisticsResponse statisticsResponse) { return Stream.fromIterable(instancesResponse.entrySet()) .map( new Function< Map.Entry<String, ApplicationInstanceInfo>, ApplicationDetail.InstanceDetail>() { @Override public ApplicationDetail.InstanceDetail apply( Map.Entry<String, ApplicationInstanceInfo> entry) { return toInstanceDetail(entry, statisticsResponse); } }) .toList() .get(); }
/** * Return a stream of resources from a response * * @param response the response * @param <R> the resource type * @param <U> the response type * @return a stream of resources from the response */ public static <R extends Resource<?>, U extends PaginatedResponse<R>> Stream<R> getResources( U response) { return Stream.fromIterable(response.getResources()); }
private static Stream<SpaceApplicationSummary> extractApplications( GetSpaceSummaryResponse getSpaceSummaryResponse) { return Stream.fromIterable(getSpaceSummaryResponse.getApplications()); }