Search in sources :

Example 1 with OpenEnvClusterDTO

use of com.ctrip.framework.apollo.openapi.dto.OpenEnvClusterDTO in project apollo by ctripcorp.

the class AppController method loadEnvClusterInfo.

@RequestMapping(value = "/apps/{appId}/envclusters", method = RequestMethod.GET)
public List<OpenEnvClusterDTO> loadEnvClusterInfo(@PathVariable String appId) {
    List<OpenEnvClusterDTO> envClusters = new LinkedList<>();
    List<Env> envs = portalSettings.getActiveEnvs();
    for (Env env : envs) {
        OpenEnvClusterDTO envCluster = new OpenEnvClusterDTO();
        envCluster.setEnv(env.name());
        List<ClusterDTO> clusterDTOs = clusterService.findClusters(env, appId);
        envCluster.setClusters(BeanUtils.toPropertySet("name", clusterDTOs));
        envClusters.add(envCluster);
    }
    return envClusters;
}
Also used : OpenEnvClusterDTO(com.ctrip.framework.apollo.openapi.dto.OpenEnvClusterDTO) OpenEnvClusterDTO(com.ctrip.framework.apollo.openapi.dto.OpenEnvClusterDTO) ClusterDTO(com.ctrip.framework.apollo.common.dto.ClusterDTO) Env(com.ctrip.framework.apollo.core.enums.Env) LinkedList(java.util.LinkedList) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with OpenEnvClusterDTO

use of com.ctrip.framework.apollo.openapi.dto.OpenEnvClusterDTO in project apollo by ctripcorp.

the class ServerAppOpenApiService method getEnvClusterInfo.

@Override
public List<OpenEnvClusterDTO> getEnvClusterInfo(String appId) {
    List<OpenEnvClusterDTO> envClusters = new LinkedList<>();
    List<Env> envs = portalSettings.getActiveEnvs();
    for (Env env : envs) {
        OpenEnvClusterDTO envCluster = new OpenEnvClusterDTO();
        envCluster.setEnv(env.getName());
        List<ClusterDTO> clusterDTOs = clusterService.findClusters(env, appId);
        envCluster.setClusters(BeanUtils.toPropertySet("name", clusterDTOs));
        envClusters.add(envCluster);
    }
    return envClusters;
}
Also used : OpenEnvClusterDTO(com.ctrip.framework.apollo.openapi.dto.OpenEnvClusterDTO) OpenEnvClusterDTO(com.ctrip.framework.apollo.openapi.dto.OpenEnvClusterDTO) ClusterDTO(com.ctrip.framework.apollo.common.dto.ClusterDTO) Env(com.ctrip.framework.apollo.portal.environment.Env) LinkedList(java.util.LinkedList)

Aggregations

ClusterDTO (com.ctrip.framework.apollo.common.dto.ClusterDTO)2 OpenEnvClusterDTO (com.ctrip.framework.apollo.openapi.dto.OpenEnvClusterDTO)2 LinkedList (java.util.LinkedList)2 Env (com.ctrip.framework.apollo.core.enums.Env)1 Env (com.ctrip.framework.apollo.portal.environment.Env)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1