AutoScalingGroupProjectConstant.java
8.74 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
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,1);
}
public static String getTags(String cloudType,String groupName){
return getProjectsOrTags(cloudType,groupName,2);
}
public static String getMobjectPaths(String cloudType,String groupName){
return getProjectsOrTags(cloudType,groupName,3);
}
private static String getProjectsOrTags(String cloudType,String groupName,int retainProjectFlag){
String projects="";
String tags="";
String mobjectPaths="";
if("qcloud".equalsIgnoreCase(cloudType)){
switch (groupName){
case "gateway":
projects = "yoho-gateway";
tags = "java,gateway,";
mobjectPaths="YOHO,application,java_app,gateway";
break;
case "resources-user":
projects = "yohobuy-resources,yoho-users";
tags = "java,users,resources,";
mobjectPaths="YOHO,application,java_app,resources-users";
break;
case "product-message-sns":
projects = "yohobuy-product,yoho-message,yoho-sns";
tags = "java,product,message,sns,";
mobjectPaths="YOHO,application,java_app,product-message-sns";
break;
case "order-promotion":
projects = "yohobuy-order,yohobuy-promotion";
tags = "java,promotion,order,";
mobjectPaths="YOHO,application,java_app,order-promotion";
break;
/*
case "activity-bigdata":
projects = "yohobuy-activity,yohobuy-bigdata";
tags = "java,activity,bigdata,";
mobjectPaths="YOHO,application,java_app,activity-bigdata";
break;
*/
case "activity-bigdata-risk":
projects = "yohobuy-activity,yohobuy-bigdata,yohobuy-risk";
tags = "java,activity,bigdata,risk";
mobjectPaths="YOHO,application,java_app,activity-bigdata-risk";
break;
case "uic-brower":
projects = "uic,yohobuy-brower";
tags = "java,uic,brower,";
mobjectPaths="YOHO,application,java_app,uic-brower";
break;
/////**************** node项目 *****************/
case "PCH5-AutoScaling":
projects = "YOHOBUY-PC-NODE,YOHOBUY-WAP-NODE,YOHOBLK-WAP";
tags = "pch5,BLK,node,";
break;
/////**************** es类型 *****************/
case "ELASTICSEARCH":
projects = "";
tags = "search-es,";
break;
/////**************** nginx类型 *****************/
case "java-nginx":
////// 只有tag projects="";
tags = "nginx,Nginx-JAVA,limit-switch,upstream-switch,";
mobjectPaths="YOHO,middleware,nginx,java_nginx,nginx_gateway";
break;
case "pch5-nginx":
tags = "java,pch5,nginx,";
mobjectPaths="YOHO,middleware,nginx,pch5_nginx";
break;
/////**************** memcache 类型 *****************/
case "PCH5-memcache":
projects = "PCH5-memcache";
tags = "memcached,pch5,";
mobjectPaths="YOHO,middleware,memcached,qcloud_pc_h5";
break;
case "java-gateway-memcache":
projects = "java-gateway-memcache";
tags = "java,memcached,";
mobjectPaths="YOHO,middleware,memcached,qcloud_java_gateway";
break;
}
}else if("aws".equalsIgnoreCase(cloudType)){
switch (groupName){
case "java-gateway":
projects = "yoho-gateway";
tags = "java,gateway,";
mobjectPaths="YOHO,application,java_app,gateway";
break;
case "java-product-message-sns":
projects = "yohobuy-product,yoho-message,yoho-sns";
tags = "java,product,message,sns,";
mobjectPaths="YOHO,application,java_app,product-message-sns";
break;
case "product-message-sns":
projects = "yohobuy-product,yoho-message,yoho-sns";
tags = "java,product,message,sns,";
mobjectPaths="YOHO,application,java_app,product-message-sns";
break;
case "order-promotion":
projects = "yohobuy-order,yohobuy-promotion";
tags = "java,promotion,order,";
mobjectPaths="YOHO,application,java_app,order-promotion";
break;
case "resources-user":
projects = "yohobuy-resources,yoho-users";
tags = "java,users,resources,";
mobjectPaths="YOHO,application,java_app,resources-users";
break;
/*
case "activity-bigdata":
projects = "yohobuy-activity,yohobuy-bigdata";
tags = "java,activity,bigdata,";
mobjectPaths="YOHO,application,java_app,activity-bigdata";
break;
*/
case "activity-bigdata-risk":
projects = "yohobuy-activity,yohobuy-bigdata,yohobuy-risk";
tags = "java,activity,bigdata,risk";
mobjectPaths="YOHO,application,java_app,activity-bigdata-risk";
break;
case "uic-brower":
projects = "uic,yohobuy-brower";
tags = "java,uic,brower,";
mobjectPaths="YOHO,application,java_app,uic-brower";
break;
case "yoho-now":
projects = "yoho-now";
tags = "java,yohonow";
mobjectPaths="YOHO,application,java_app,yoho!now";
break;
/////**************** node项目 *****************/
case "PCH5-NODE":
projects = "YOHOBUY-PC-NODE,YOHOBUY-WAP-NODE,YOHOBLK-WAP";
tags = "pch5,BLK,node,";
break;
/////**************** es类型 *****************/
case "ELASTICSEARCH":
projects = "";
tags = "search-es,";
break;
/////**************** nginx类型 *****************/
case "java-nginx":
////// 只有tag projects="";
tags = "nginx,Nginx-JAVA,limit-switch,upstream-switch,";
mobjectPaths="YOHO,middleware,nginx,java_nginx,nginx_gateway";
break;
case "pch5-nginx":
tags = "java,pch5,nginx,";
mobjectPaths="YOHO,middleware,nginx,pch5_nginx";
break;
/////**************** memcache 类型 *****************/
case "PCH5-memcache":
projects = "PCH5-memcache";
tags = "memcached,pch5,";
mobjectPaths="YOHO,middleware,memcached,aws_pc_h5";
break;
case "java-gateway-memcache":
projects = "java-gateway-memcache";
tags = "java,memcached,";
mobjectPaths="YOHO,middleware,memcached,aws_java_gateway";
break;
}
}
if(1==retainProjectFlag){
if(StringUtils.isNotBlank(projects)){
return projects;
}else{
return groupName;
}
}else if(2==retainProjectFlag){
if(StringUtils.isNotBlank(tags)){
return tags;
}else{
if(groupName.contains("java")){
return groupName.replace("-",",")+",";
}else{
return "java,"+groupName.replace("-",",")+",";
}
}
}else if(3==retainProjectFlag){
return mobjectPaths;
}
return "";
}
}