Skip to content

Commit fa26bcb

Browse files
author
codezhang
committed
完成DescribeRouteTable
1 parent 8502cab commit fa26bcb

5 files changed

Lines changed: 383 additions & 8 deletions

File tree

ucloud-sdk-java-vpc/src/main/java/cn/ucloud/client/DefaultVPCClient.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,18 @@ public void deleteRouteTable(DeleteRouteTableParam param, UcloudHandler handler,
267267
}
268268

269269
@Override
270-
public BaseResponseResult describeRouteTable(BaseRequestParam param) throws Exception {
271-
return null;
270+
public DescribeRouteTableResult describeRouteTable(DescribeRouteTableParam param) throws Exception {
271+
UcloudHttp http = new UcloudHttpImpl(DescribeRouteTableResult.class);
272+
DescribeRouteTableResult result = (DescribeRouteTableResult) http.doGet(param, config, null);
273+
return result;
272274
}
273275

274276
@Override
275-
public void describeRouteTable(BaseRequestParam param, UcloudHandler handler, Boolean... asyncFlag) {
276-
277+
public void describeRouteTable(DescribeRouteTableParam param, UcloudHandler handler, Boolean... asyncFlag) {
278+
UcloudHttp http = new UcloudHttpImpl(DescribeRouteTableResult.class);
279+
try {
280+
http.doGet(param, config, handler,asyncFlag);
281+
} catch (Exception e) { }
277282
}
278283

279284
@Override

ucloud-sdk-java-vpc/src/main/java/cn/ucloud/client/VPCClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,20 +288,20 @@ public interface VPCClient {
288288

289289

290290
/**
291-
*
291+
* 获取路由表详细信息(包括路由策略)
292292
* @param param 参数对象
293293
* @return 结果对象
294294
* @throws Exception 出错则抛出异常
295295
*/
296-
BaseResponseResult describeRouteTable(BaseRequestParam param) throws Exception;
296+
DescribeRouteTableResult describeRouteTable(DescribeRouteTableParam param) throws Exception;
297297

298298
/**
299-
*
299+
* 获取路由表详细信息(包括路由策略)
300300
* @param param 参数对象
301301
* @param handler 回调处理器
302302
* @param asyncFlag 异步标记,默认异步true
303303
*/
304-
void describeRouteTable(BaseRequestParam param, UcloudHandler handler, Boolean... asyncFlag);
304+
void describeRouteTable(DescribeRouteTableParam param, UcloudHandler handler, Boolean... asyncFlag);
305305

306306

307307
/**
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
package cn.ucloud.model;
2+
3+
import cn.ucloud.annotation.UcloudParam;
4+
import cn.ucloud.pojo.BaseRequestParam;
5+
6+
import javax.validation.constraints.NotEmpty;
7+
8+
/**
9+
* @description: 获取路由表详细信息(包括路由策略) 参数类
10+
* @author: codezhang
11+
* @date: 2018-09-21 18:48
12+
**/
13+
14+
public class DescribeRouteTableParam extends BaseRequestParam {
15+
16+
/**
17+
* require 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
18+
*/
19+
@NotEmpty(message = "region can not be empty")
20+
@UcloudParam("Region")
21+
private String region;
22+
23+
24+
/**
25+
* optional VPC ID
26+
*/
27+
@UcloudParam("VPCId")
28+
private String vpcId;
29+
30+
/**
31+
* optional 路由表ID
32+
*/
33+
@UcloudParam("RouteTableId")
34+
private String routeTableId;
35+
36+
/**
37+
* optional 业务组ID
38+
*/
39+
@UcloudParam("BusinessId")
40+
private String businessId;
41+
42+
/**
43+
* optional 个数
44+
*/
45+
@UcloudParam("Limit")
46+
private Integer limit;
47+
48+
/**
49+
* optional 偏移
50+
*/
51+
@UcloudParam("Offset")
52+
private Integer offset;
53+
54+
public DescribeRouteTableParam( @NotEmpty(message = "region can not be empty") String region) {
55+
super("DescribeRouteTable");
56+
this.region = region;
57+
}
58+
59+
public String getRegion() {
60+
return region;
61+
}
62+
63+
public void setRegion(String region) {
64+
this.region = region;
65+
}
66+
67+
public String getVpcId() {
68+
return vpcId;
69+
}
70+
71+
public void setVpcId(String vpcId) {
72+
this.vpcId = vpcId;
73+
}
74+
75+
public String getRouteTableId() {
76+
return routeTableId;
77+
}
78+
79+
public void setRouteTableId(String routeTableId) {
80+
this.routeTableId = routeTableId;
81+
}
82+
83+
public String getBusinessId() {
84+
return businessId;
85+
}
86+
87+
public void setBusinessId(String businessId) {
88+
this.businessId = businessId;
89+
}
90+
91+
public Integer getLimit() {
92+
return limit;
93+
}
94+
95+
public void setLimit(Integer limit) {
96+
this.limit = limit;
97+
}
98+
99+
public Integer getOffset() {
100+
return offset;
101+
}
102+
103+
public void setOffset(Integer offset) {
104+
this.offset = offset;
105+
}
106+
}
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
package cn.ucloud.model;
2+
3+
import cn.ucloud.pojo.BaseResponseResult;
4+
import com.google.gson.annotations.SerializedName;
5+
6+
import java.util.List;
7+
8+
/**
9+
* @description: 获取路由表详细信息(包括路由策略) 结果类
10+
* @author: codezhang
11+
* @date: 2018-09-21 18:48
12+
**/
13+
14+
public class DescribeRouteTableResult extends BaseResponseResult {
15+
16+
17+
public static class RouteTable{
18+
19+
/**
20+
* 创建时间
21+
*/
22+
@SerializedName("CreateTime")
23+
private Integer createTime;
24+
25+
/**
26+
* 名称
27+
*/
28+
@SerializedName("Name")
29+
private String name;
30+
31+
/**
32+
* 掩码
33+
*/
34+
@SerializedName("Remark")
35+
private String remark;
36+
37+
/**
38+
* 路由规则
39+
*/
40+
@SerializedName("RouteRules")
41+
private List<RouteRule> routeRules;
42+
43+
/**
44+
* id
45+
*/
46+
@SerializedName("RouteTableId")
47+
private String routeTableId;
48+
49+
/**
50+
* 路由表类型
51+
*/
52+
@SerializedName("RouteTableType")
53+
private Integer routeTableType;
54+
55+
/**
56+
* 子网数目
57+
*/
58+
@SerializedName("SubnetCount")
59+
private Integer subnetCount;
60+
61+
62+
/**
63+
* 业务组
64+
*/
65+
@SerializedName("Tag")
66+
private String tag;
67+
68+
/**
69+
* vpcId
70+
*/
71+
@SerializedName("VPCId")
72+
private String vpcId;
73+
74+
/**
75+
* vpcName
76+
*/
77+
@SerializedName("VPCName")
78+
private String vpcName;
79+
80+
}
81+
82+
83+
public static class RouteRule{
84+
85+
/**
86+
* 目标地址
87+
*/
88+
@SerializedName("DstAddr")
89+
private String dstAddr;
90+
91+
/**
92+
* 下一跳
93+
*/
94+
@SerializedName("NextHop")
95+
private String nextHop;
96+
97+
/**
98+
* 下一跳名称
99+
*/
100+
@SerializedName("NextHopName")
101+
private String nextHopName;
102+
103+
/**
104+
* 下一跳类型
105+
*/
106+
@SerializedName("NextHopType")
107+
private String nextHopType;
108+
109+
/**
110+
* 备注
111+
*/
112+
@SerializedName("Remark")
113+
private String remark;
114+
115+
/**
116+
* 路由ID
117+
*/
118+
@SerializedName("RouteRuleId")
119+
private String routeRuleId;
120+
121+
public String getDstAddr() {
122+
return dstAddr;
123+
}
124+
125+
public void setDstAddr(String dstAddr) {
126+
this.dstAddr = dstAddr;
127+
}
128+
129+
public String getNextHop() {
130+
return nextHop;
131+
}
132+
133+
public void setNextHop(String nextHop) {
134+
this.nextHop = nextHop;
135+
}
136+
137+
public String getNextHopName() {
138+
return nextHopName;
139+
}
140+
141+
public void setNextHopName(String nextHopName) {
142+
this.nextHopName = nextHopName;
143+
}
144+
145+
public String getNextHopType() {
146+
return nextHopType;
147+
}
148+
149+
public void setNextHopType(String nextHopType) {
150+
this.nextHopType = nextHopType;
151+
}
152+
153+
public String getRemark() {
154+
return remark;
155+
}
156+
157+
public void setRemark(String remark) {
158+
this.remark = remark;
159+
}
160+
161+
public String getRouteRuleId() {
162+
return routeRuleId;
163+
}
164+
165+
public void setRouteRuleId(String routeRuleId) {
166+
this.routeRuleId = routeRuleId;
167+
}
168+
169+
@Override
170+
public String toString() {
171+
return "RouteRule{" +
172+
"dstAddr='" + dstAddr + '\'' +
173+
", nextHop='" + nextHop + '\'' +
174+
", nextHopName='" + nextHopName + '\'' +
175+
", nextHopType='" + nextHopType + '\'' +
176+
", remark='" + remark + '\'' +
177+
", routeRuleId='" + routeRuleId + '\'' +
178+
'}';
179+
}
180+
}
181+
182+
183+
/**
184+
* 路由表信息
185+
*/
186+
@SerializedName("RouteTables")
187+
private List<RouteTable> routeTables;
188+
189+
/**
190+
* RouteTables的数量
191+
*/
192+
@SerializedName("TotalCount")
193+
private Integer totalCount;
194+
195+
196+
197+
198+
public List<RouteTable> getRouteTables() {
199+
return routeTables;
200+
}
201+
202+
public void setRouteTables(List<RouteTable> routeTables) {
203+
this.routeTables = routeTables;
204+
}
205+
206+
public Integer getTotalCount() {
207+
return totalCount;
208+
}
209+
210+
public void setTotalCount(Integer totalCount) {
211+
this.totalCount = totalCount;
212+
}
213+
214+
@Override
215+
public String toString() {
216+
return "DescribeRouteTableResult{" +
217+
"routeTables=" + routeTables +
218+
", totalCount=" + totalCount +
219+
", retCode=" + retCode +
220+
", action='" + action + '\'' +
221+
", message='" + message + '\'' +
222+
'}';
223+
}
224+
}

0 commit comments

Comments
 (0)