AutoScalingGroupProjectConstant.java
4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package com.ui.ctrl;
import org.apache.commons.lang.StringUtils;
/**
* Created by craig.qin on 2017/8/23.
*/
public class AutoScalingGroupProjectConstant {
public static String getProjectNames(String cloudType,String groupName){
return getProjectsOrTags(cloudType,groupName,true);
}
public static String getTags(String cloudType,String groupName){
return getProjectsOrTags(cloudType,groupName,false);
}
private static String getProjectsOrTags(String cloudType,String groupName,boolean retainProjectFlag){
String projects="";
String tags="";
if("qcloud".equalsIgnoreCase(cloudType)){
switch (groupName){
case "PCH5-AutoScaling":
projects = "YOHOBUY-PC-NODE,YOHOBUY-WAP-NODE,YOHOBLK-WAP";
tags = "PC/H5,BLK,node,";
break;
case "gateway":
projects = "yoho-gateway";
tags = "java,gateway,";
break;
case "resources-user":
projects = "yohobuy-resources,yoho-users";
tags = "java,users,resources,";
break;
case "product-message-sns":
projects = "yohobuy-product,yoho-message,yoho-sns";
tags = "java,product,message,sns,";
break;
case "order-promotion":
projects = "yohobuy-order,yohobuy-promotion";
tags = "java,promotion,order,";
break;
case "uic":
projects = "uic";
tags = "java,uic,";
break;
case "activity-brower-bigdata":
projects = "yohobuy-activity,yohobuy-brower,yohobuy-bigdata";
tags = "java,activity,brower,bigdata,";
break;
}
}else if("aws".equalsIgnoreCase(cloudType)){
switch (groupName){
case "PCH5-AutoScaling":
projects = "YOHOBUY-PC-NODE,YOHOBUY-WAP-NODE,YOHOBLK-WAP";
tags = "PC/H5,BLK,node,";
break;
case "gateway":
projects = "yoho-gateway";
tags = "java,gateway,";
break;
case "product-message-sns":
projects = "yohobuy-product,yoho-message,yoho-sns";
tags = "java,product,message,sns,";
break;
case "order-promotion":
projects = "yohobuy-order,yohobuy-promotion";
tags = "java,promotion,order,";
break;
case "resources-user":
projects = "yohobuy-resources,yoho-users";
tags = "java,users,resources,";
break;
case "activity-bigdata":
projects = "yohobuy-activity,yohobuy-bigdata";
tags = "java,activity,bigdata,";
break;
case "uic-social-brower":
projects = "uic,yoho-social,yohobuy-brower";
tags = "java,uic,social,brower,";
break;
case "yoho-now":
projects = "yoho-now";
tags = "java,yohonow";
break;
case "java-nginx":
////// 只有tag projects="";
tags = "nginx,Nginx-JAVA,limit-switch,upstream-switch,";
break;
}
}
if(retainProjectFlag){
if(StringUtils.isNotBlank(projects)){
return projects;
}else{
return groupName;
}
}else{
if(StringUtils.isNotBlank(tags)){
return tags;
}else{
if(groupName.contains("java")){
return groupName.replace("-",",")+",";
}else{
return "java,"+groupName.replace("-",",")+",";
}
}
}
}
}