Search in sources :

Example 1 with ApiHealthSummary

use of com.cloudera.api.model.ApiHealthSummary in project kylo by Teradata.

the class DefaultClouderaRootResource method getPopulatedClusterList.

/**
 * @return cluster list with initialised service health status
 */
public ApiClusterList getPopulatedClusterList() {
    ApiClusterList clusters = rootResource.getClustersResource().readClusters(DataView.SUMMARY);
    if (clusters != null && clusters.getClusters() != null) {
        for (ApiCluster cluster : clusters.getClusters()) {
            String clusterName = cluster.getName();
            ApiServiceList services = rootResource.getClustersResource().getServicesResource(clusterName).readServices(DataView.SUMMARY);
            if (services != null && services.getServices() != null) {
                cluster.setServices(services.getServices());
                for (ApiService service : services.getServices()) {
                    String serviceName = service.getName();
                    ApiHealthSummary healthSummary = service.getHealthSummary();
                    List<ApiHealthCheck> healthChecks = service.getHealthChecks();
                    service.setHealthChecks(healthChecks);
                    service.setHealthSummary(healthSummary);
                    ApiRoleList roles = rootResource.getClustersResource().getServicesResource(clusterName).getRolesResource(serviceName).readRoles();
                    if (roles != null && roles.getRoles() != null) {
                        service.setRoles(roles.getRoles());
                        for (ApiRole role : roles.getRoles()) {
                            ApiHealthSummary roleHealthSummary = role.getHealthSummary();
                            List<ApiHealthCheck> roleHealthChecks = role.getHealthChecks();
                            role.setHealthSummary(roleHealthSummary);
                            role.setHealthChecks(roleHealthChecks);
                        }
                    }
                }
            }
        }
    }
    return clusters;
}
Also used : ApiRole(com.cloudera.api.model.ApiRole) ApiClusterList(com.cloudera.api.model.ApiClusterList) ApiCluster(com.cloudera.api.model.ApiCluster) ApiService(com.cloudera.api.model.ApiService) ApiHealthCheck(com.cloudera.api.model.ApiHealthCheck) ApiRoleList(com.cloudera.api.model.ApiRoleList) ApiServiceList(com.cloudera.api.model.ApiServiceList) ApiHealthSummary(com.cloudera.api.model.ApiHealthSummary)

Aggregations

ApiCluster (com.cloudera.api.model.ApiCluster)1 ApiClusterList (com.cloudera.api.model.ApiClusterList)1 ApiHealthCheck (com.cloudera.api.model.ApiHealthCheck)1 ApiHealthSummary (com.cloudera.api.model.ApiHealthSummary)1 ApiRole (com.cloudera.api.model.ApiRole)1 ApiRoleList (com.cloudera.api.model.ApiRoleList)1 ApiService (com.cloudera.api.model.ApiService)1 ApiServiceList (com.cloudera.api.model.ApiServiceList)1