|
111 | 111 | import org.cloudfoundry.client.v3.applications.ApplicationResource; |
112 | 112 | import org.cloudfoundry.client.v3.applications.GetApplicationEnvironmentRequest; |
113 | 113 | import org.cloudfoundry.client.v3.applications.GetApplicationEnvironmentResponse; |
| 114 | +import org.cloudfoundry.client.v3.applications.GetApplicationProcessRequest; |
| 115 | +import org.cloudfoundry.client.v3.applications.GetApplicationProcessResponse; |
114 | 116 | import org.cloudfoundry.client.v3.applications.GetApplicationProcessStatisticsRequest; |
115 | 117 | import org.cloudfoundry.client.v3.applications.GetApplicationProcessStatisticsResponse; |
116 | 118 | import org.cloudfoundry.client.v3.applications.GetApplicationResponse; |
|
135 | 137 | import org.cloudfoundry.client.v3.packages.PackageState; |
136 | 138 | import org.cloudfoundry.client.v3.packages.PackageType; |
137 | 139 | import org.cloudfoundry.client.v3.packages.UploadPackageRequest; |
| 140 | +import org.cloudfoundry.client.v3.processes.HealthCheck; |
| 141 | +import org.cloudfoundry.client.v3.processes.HealthCheckType; |
138 | 142 | import org.cloudfoundry.client.v3.processes.ProcessState; |
139 | 143 | import org.cloudfoundry.client.v3.processes.ProcessStatisticsResource; |
140 | 144 | import org.cloudfoundry.client.v3.resourcematch.MatchedResource; |
@@ -366,7 +370,11 @@ public Flux<ApplicationEvent> getEvents(GetApplicationEventsRequest request) { |
366 | 370 |
|
367 | 371 | @Override |
368 | 372 | public Mono<ApplicationHealthCheck> getHealthCheck(GetApplicationHealthCheckRequest request) { |
369 | | - return getApplication(request.getName()) |
| 373 | + return getApplicationV3(request.getName()) |
| 374 | + .map(ApplicationResource::getId) |
| 375 | + .flatMap(this::requestApplicationWebProcess) |
| 376 | + .map(GetApplicationProcessResponse::getHealthCheck) |
| 377 | + .map(HealthCheck::getType) |
370 | 378 | .map(DefaultApplications::toHealthCheck) |
371 | 379 | .transform(OperationsLogging.log("Get Application Health Check")) |
372 | 380 | .checkpoint(); |
@@ -1654,6 +1662,16 @@ private Mono<GetApplicationProcessStatisticsResponse> requestApplicationStatisti |
1654 | 1662 | .build()); |
1655 | 1663 | } |
1656 | 1664 |
|
| 1665 | + private Mono<GetApplicationProcessResponse> requestApplicationWebProcess(String applicationId) { |
| 1666 | + return this.cloudFoundryClient |
| 1667 | + .applicationsV3() |
| 1668 | + .getProcess( |
| 1669 | + GetApplicationProcessRequest.builder() |
| 1670 | + .applicationId(applicationId) |
| 1671 | + .type("web") |
| 1672 | + .build()); |
| 1673 | + } |
| 1674 | + |
1657 | 1675 | private Flux<org.cloudfoundry.client.v3.routes.RouteResource> requestApplicationRoutes( |
1658 | 1676 | String applicationId) { |
1659 | 1677 | return PaginationUtils.requestClientV3Resources( |
@@ -2417,17 +2435,15 @@ private static DomainSummary toDomain(PrivateDomainResource resource) { |
2417 | 2435 | .build(); |
2418 | 2436 | } |
2419 | 2437 |
|
2420 | | - private static ApplicationHealthCheck toHealthCheck(AbstractApplicationResource resource) { |
2421 | | - String type = resource.getEntity().getHealthCheckType(); |
2422 | | - |
2423 | | - if (ApplicationHealthCheck.HTTP.getValue().equals(type)) { |
| 2438 | + private static ApplicationHealthCheck toHealthCheck(HealthCheckType type) { |
| 2439 | + if (type == HealthCheckType.HTTP) { |
2424 | 2440 | return ApplicationHealthCheck.HTTP; |
2425 | | - } else if (ApplicationHealthCheck.NONE.getValue().equals(type)) { |
2426 | | - return ApplicationHealthCheck.NONE; |
2427 | | - } else if (ApplicationHealthCheck.PORT.getValue().equals(type)) { |
| 2441 | + } else if (type == HealthCheckType.PORT) { |
2428 | 2442 | return ApplicationHealthCheck.PORT; |
2429 | | - } else if (ApplicationHealthCheck.PROCESS.getValue().equals(type)) { |
| 2443 | + } else if (type == HealthCheckType.PROCESS) { |
2430 | 2444 | return ApplicationHealthCheck.PROCESS; |
| 2445 | + } else if (type == HealthCheckType.NONE) { |
| 2446 | + return ApplicationHealthCheck.NONE; |
2431 | 2447 | } else { |
2432 | 2448 | return null; |
2433 | 2449 | } |
|
0 commit comments