class CloudFoundryPlatform extends Platform {

    @Override
    public PlatformHealth getPlatformHealth () {
        Flux<ApplicationSummary> runningInstances = cloudFoundryOperations.applications()
                                                                          .list()
                                                                          .filter(a -> a.getRequestedState().equals(CloudFoundryConstants.CLOUDFOUNDRY_APPLICATION_STARTED));
        if (runningInstances.filter(a -> a.getInstances() > 0)
                            .filter(a -> a.getRunningInstances() == 0)
                            .hasElements()
                            .blockOptional()
                            .orElseThrow(EMPTY_RESPONSE.asChaosException())) {
            return PlatformHealth.FAILED;
        } else if (runningInstances.filter(a -> a.getInstances() > 0)
                                   .filter(a -> a.getRunningInstances() < a.getInstances())
                                   .hasElements()
                                   .blockOptional()
                                   .orElseThrow(EMPTY_RESPONSE.asChaosException())) {
            return PlatformHealth.DEGRADED;
        }
        return PlatformHealth.OK;
    }

    @Autowired public  CloudFoundryPlatform();

}