Search in sources :

Example 1 with ApiServiceList

use of com.cloudera.api.model.ApiServiceList in project components by Talend.

the class HadoopCMCluster method getHostedServices.

@Override
public Map<HadoopHostedService, HadoopClusterService> getHostedServices() {
    ApiServiceList services = cluster.readServices(DataView.SUMMARY);
    Map<HadoopHostedService, HadoopClusterService> servicesMapping = new HashMap<HadoopHostedService, HadoopClusterService>();
    for (ApiService service : services.getServices()) {
        if (HadoopHostedService.isSupport(service.getType())) {
            HadoopCMClusterService clusterService = new HadoopCMClusterService(service.getName(), cluster, blacklistParams);
            if (clusterService.hasConfigurations()) {
                servicesMapping.put(HadoopHostedService.fromString(service.getType()), clusterService);
            }
        }
    }
    return servicesMapping;
}
Also used : HashMap(java.util.HashMap) ApiService(com.cloudera.api.model.ApiService) ApiServiceList(com.cloudera.api.model.ApiServiceList)

Example 2 with ApiServiceList

use of com.cloudera.api.model.ApiServiceList 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

ApiService (com.cloudera.api.model.ApiService)2 ApiServiceList (com.cloudera.api.model.ApiServiceList)2 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 HashMap (java.util.HashMap)1