Search in sources :

Example 11 with ClusterDTO

use of com.ctrip.framework.apollo.common.dto.ClusterDTO in project apollo by ctripcorp.

the class ConfigsExportServiceTest method genCluster.

private ClusterDTO genCluster(String name, String appId) {
    ClusterDTO clusterDTO = new ClusterDTO();
    clusterDTO.setAppId(appId);
    clusterDTO.setName(name);
    return clusterDTO;
}
Also used : ClusterDTO(com.ctrip.framework.apollo.common.dto.ClusterDTO)

Example 12 with ClusterDTO

use of com.ctrip.framework.apollo.common.dto.ClusterDTO in project apollo by ctripcorp.

the class ClusterService method createCluster.

public ClusterDTO createCluster(Env env, ClusterDTO cluster) {
    if (!clusterAPI.isClusterUnique(cluster.getAppId(), env, cluster.getName())) {
        throw new BadRequestException(String.format("cluster %s already exists.", cluster.getName()));
    }
    ClusterDTO clusterDTO = clusterAPI.create(env, cluster);
    Tracer.logEvent(TracerEventType.CREATE_CLUSTER, cluster.getAppId(), "0", cluster.getName());
    return clusterDTO;
}
Also used : ClusterDTO(com.ctrip.framework.apollo.common.dto.ClusterDTO) BadRequestException(com.ctrip.framework.apollo.common.exception.BadRequestException)

Aggregations

ClusterDTO (com.ctrip.framework.apollo.common.dto.ClusterDTO)12 Test (org.junit.Test)6 AppDTO (com.ctrip.framework.apollo.common.dto.AppDTO)4 ItemDTO (com.ctrip.framework.apollo.common.dto.ItemDTO)4 NamespaceDTO (com.ctrip.framework.apollo.common.dto.NamespaceDTO)4 Sql (org.springframework.test.context.jdbc.Sql)4 Item (com.ctrip.framework.apollo.biz.entity.Item)3 ItemChangeSets (com.ctrip.framework.apollo.common.dto.ItemChangeSets)3 TestRestTemplate (org.springframework.boot.test.web.client.TestRestTemplate)3 RestTemplate (org.springframework.web.client.RestTemplate)3 OpenEnvClusterDTO (com.ctrip.framework.apollo.openapi.dto.OpenEnvClusterDTO)2 Env (com.ctrip.framework.apollo.portal.environment.Env)2 LinkedList (java.util.LinkedList)2 HttpClientErrorException (org.springframework.web.client.HttpClientErrorException)2 HttpStatusCodeException (org.springframework.web.client.HttpStatusCodeException)2 ReleaseDTO (com.ctrip.framework.apollo.common.dto.ReleaseDTO)1 App (com.ctrip.framework.apollo.common.entity.App)1 AppNamespace (com.ctrip.framework.apollo.common.entity.AppNamespace)1 BadRequestException (com.ctrip.framework.apollo.common.exception.BadRequestException)1 ServiceException (com.ctrip.framework.apollo.common.exception.ServiceException)1