Skip to content

Commit b0bb9bc

Browse files
author
codezhang
committed
完成DescribeUFSVolumePrice CreateUFSVolume
1 parent f6d50cb commit b0bb9bc

8 files changed

Lines changed: 495 additions & 14 deletions

File tree

ucloud-sdk-java-ufs/src/main/java/cn/ucloud/ufs/client/DefaultUFSClient.java

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import cn.ucloud.common.http.UcloudHttpImpl;
66
import cn.ucloud.common.pojo.BaseRequestParam;
77
import cn.ucloud.common.pojo.BaseResponseResult;
8-
import cn.ucloud.ufs.model.DescribeUFSVolumeParam;
9-
import cn.ucloud.ufs.model.DescribeUFSVolumeResult;
8+
import cn.ucloud.ufs.model.*;
109
import cn.ucloud.ufs.pojo.UFSConfig;
1110

1211
/**
@@ -28,13 +27,19 @@ public DefaultUFSClient(UFSConfig config) {
2827

2928

3029
@Override
31-
public BaseResponseResult createUFSVolume(BaseRequestParam param) throws Exception {
32-
return null;
30+
public CreateUFSVolumeResult createUFSVolume(CreateUFSVolumeParam param) throws Exception {
31+
UcloudHttp http = new UcloudHttpImpl(CreateUFSVolumeResult.class);
32+
CreateUFSVolumeResult result = (CreateUFSVolumeResult) http.doGet(param, config, null);
33+
return result;
3334
}
3435

3536
@Override
36-
public void createUFSVolume(BaseRequestParam param, UcloudHandler<BaseResponseResult> handler, Boolean... asyncFlag) {
37-
37+
public void createUFSVolume(CreateUFSVolumeParam param, UcloudHandler<CreateUFSVolumeResult> handler, Boolean... asyncFlag) {
38+
UcloudHttp http = new UcloudHttpImpl(CreateUFSVolumeResult.class);
39+
try {
40+
http.doGet(param, config, handler, asyncFlag);
41+
} catch (Exception e) {
42+
}
3843
}
3944

4045
@Override
@@ -54,13 +59,19 @@ public void describeUFSVolume(DescribeUFSVolumeParam param, UcloudHandler<Descri
5459
}
5560

5661
@Override
57-
public BaseResponseResult describeUFSVolumePrice(BaseRequestParam param) throws Exception {
58-
return null;
62+
public DescribeUFSVolumePriceResult describeUFSVolumePrice(DescribeUFSVolumePriceParam param) throws Exception {
63+
UcloudHttp http = new UcloudHttpImpl(DescribeUFSVolumePriceResult.class);
64+
DescribeUFSVolumePriceResult result = (DescribeUFSVolumePriceResult) http.doGet(param, config, null);
65+
return result;
5966
}
6067

6168
@Override
62-
public void describeUFSVolumePrice(BaseRequestParam param, UcloudHandler<BaseResponseResult> handler, Boolean... asyncFlag) {
63-
69+
public void describeUFSVolumePrice(DescribeUFSVolumePriceParam param, UcloudHandler<DescribeUFSVolumePriceResult> handler, Boolean... asyncFlag) {
70+
UcloudHttp http = new UcloudHttpImpl(DescribeUFSVolumePriceResult.class);
71+
try {
72+
http.doGet(param, config, handler, asyncFlag);
73+
} catch (Exception e) {
74+
}
6475
}
6576

6677
@Override

ucloud-sdk-java-ufs/src/main/java/cn/ucloud/ufs/client/UFSClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ public interface UFSClient {
1818
* @return 结果对象
1919
* @throws Exception 出错则抛出异常
2020
*/
21-
BaseResponseResult createUFSVolume(BaseRequestParam param) throws Exception;
21+
CreateUFSVolumeResult createUFSVolume(CreateUFSVolumeParam param) throws Exception;
2222

2323
/**
2424
* 创建文件系统
2525
* @param param 参数对象
2626
* @param handler 回调处理器
2727
* @param asyncFlag 异步标记,默认异步true
2828
*/
29-
void createUFSVolume(BaseRequestParam param, UcloudHandler<BaseResponseResult> handler, Boolean... asyncFlag);
29+
void createUFSVolume(CreateUFSVolumeParam param, UcloudHandler<CreateUFSVolumeResult> handler, Boolean... asyncFlag);
3030

3131

3232
/**
@@ -52,15 +52,15 @@ public interface UFSClient {
5252
* @return 结果对象
5353
* @throws Exception 出错则抛出异常
5454
*/
55-
BaseResponseResult describeUFSVolumePrice(BaseRequestParam param) throws Exception;
55+
DescribeUFSVolumePriceResult describeUFSVolumePrice(DescribeUFSVolumePriceParam param) throws Exception;
5656

5757
/**
5858
* 获取文件系统价格
5959
* @param param 参数对象
6060
* @param handler 回调处理器
6161
* @param asyncFlag 异步标记,默认异步true
6262
*/
63-
void describeUFSVolumePrice(BaseRequestParam param, UcloudHandler<BaseResponseResult> handler, Boolean... asyncFlag);
63+
void describeUFSVolumePrice(DescribeUFSVolumePriceParam param, UcloudHandler<DescribeUFSVolumePriceResult> handler, Boolean... asyncFlag);
6464

6565

6666

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
package cn.ucloud.ufs.model;
2+
3+
import cn.ucloud.common.annotation.UcloudParam;
4+
import cn.ucloud.common.pojo.BaseRequestParam;
5+
6+
import javax.validation.constraints.NotEmpty;
7+
import javax.validation.constraints.NotNull;
8+
9+
/**
10+
* @description: 创建文件系统 参数类
11+
* @author: codezhang
12+
* @date: 2018-10-08 16:07
13+
**/
14+
15+
public class CreateUFSVolumeParam extends BaseRequestParam {
16+
17+
/**
18+
* require 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
19+
*/
20+
@NotEmpty(message = "region can not be empty")
21+
@UcloudParam("Region")
22+
private String region;
23+
24+
/**
25+
* optional 文件系统大小,大小1024G ~ 25600G (1T ~ 25T),必须为1024的整数倍。
26+
*/
27+
@UcloudParam("Size")
28+
@NotNull(message = "size can not be null")
29+
private Integer size;
30+
31+
/**
32+
* optional 文件系统名称
33+
*/
34+
@UcloudParam("VolumeName")
35+
private String volumeName;
36+
37+
/**
38+
* optional 备注
39+
*/
40+
@UcloudParam("Remark")
41+
private String remark;
42+
43+
/**
44+
* optional 文件系统所属业务组
45+
*/
46+
@UcloudParam("Tag")
47+
private String tag;
48+
49+
/**
50+
* optional
51+
* 计费模式,枚举值为:
52+
* Year,按年付费;
53+
* Month,按月付费;
54+
* Dynamic,按需付费(需开启权限);
55+
* Trial,试用(需开启权限)
56+
* 默认为Dynamic
57+
*/
58+
@UcloudParam("ChargeType")
59+
private String chargeType;
60+
61+
/**
62+
* optional 购买时长 默认: 1
63+
*/
64+
@UcloudParam("Quantity")
65+
private Integer quantity;
66+
67+
/**
68+
* optional 使用的代金券id
69+
*/
70+
@UcloudParam("CouponId")
71+
private String couponId;
72+
73+
public CreateUFSVolumeParam(@NotEmpty(message = "region can not be empty") String region,
74+
@NotNull(message = "size can not be null") Integer size) {
75+
super("CreateUFSVolume");
76+
this.region = region;
77+
this.size = size;
78+
}
79+
80+
public String getRegion() {
81+
return region;
82+
}
83+
84+
public void setRegion(String region) {
85+
this.region = region;
86+
}
87+
88+
public Integer getSize() {
89+
return size;
90+
}
91+
92+
public void setSize(Integer size) {
93+
this.size = size;
94+
}
95+
96+
public String getVolumeName() {
97+
return volumeName;
98+
}
99+
100+
public void setVolumeName(String volumeName) {
101+
this.volumeName = volumeName;
102+
}
103+
104+
public String getRemark() {
105+
return remark;
106+
}
107+
108+
public void setRemark(String remark) {
109+
this.remark = remark;
110+
}
111+
112+
public String getTag() {
113+
return tag;
114+
}
115+
116+
public void setTag(String tag) {
117+
this.tag = tag;
118+
}
119+
120+
public String getChargeType() {
121+
return chargeType;
122+
}
123+
124+
public void setChargeType(String chargeType) {
125+
this.chargeType = chargeType;
126+
}
127+
128+
public Integer getQuantity() {
129+
return quantity;
130+
}
131+
132+
public void setQuantity(Integer quantity) {
133+
this.quantity = quantity;
134+
}
135+
136+
public String getCouponId() {
137+
return couponId;
138+
}
139+
140+
public void setCouponId(String couponId) {
141+
this.couponId = couponId;
142+
}
143+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package cn.ucloud.ufs.model;
2+
3+
import cn.ucloud.common.pojo.BaseResponseResult;
4+
import com.google.gson.annotations.SerializedName;
5+
6+
/**
7+
* @description: 创建文件系统 结果类
8+
* @author: codezhang
9+
* @date: 2018-10-08 16:07
10+
**/
11+
12+
public class CreateUFSVolumeResult extends BaseResponseResult {
13+
14+
/**
15+
* 文件系统名称
16+
*/
17+
@SerializedName("VolumeName")
18+
private String volumeName;
19+
20+
/**
21+
* 文件系统ID
22+
*/
23+
@SerializedName("VolumeId")
24+
private String volumeId;
25+
26+
/**
27+
* 文件系统挂载点状态
28+
*/
29+
@SerializedName("VolumeStatus")
30+
private String volumeStatus;
31+
32+
33+
public String getVolumeName() {
34+
return volumeName;
35+
}
36+
37+
public void setVolumeName(String volumeName) {
38+
this.volumeName = volumeName;
39+
}
40+
41+
public String getVolumeId() {
42+
return volumeId;
43+
}
44+
45+
public void setVolumeId(String volumeId) {
46+
this.volumeId = volumeId;
47+
}
48+
49+
public String getVolumeStatus() {
50+
return volumeStatus;
51+
}
52+
53+
public void setVolumeStatus(String volumeStatus) {
54+
this.volumeStatus = volumeStatus;
55+
}
56+
57+
@Override
58+
public String toString() {
59+
return "CreateUFSVolumeResult{" +
60+
"volumeName='" + volumeName + '\'' +
61+
", volumeId='" + volumeId + '\'' +
62+
", volumeStatus='" + volumeStatus + '\'' +
63+
", retCode=" + retCode +
64+
", action='" + action + '\'' +
65+
", message='" + message + '\'' +
66+
'}';
67+
}
68+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
package cn.ucloud.ufs.model;
2+
3+
import cn.ucloud.common.annotation.UcloudParam;
4+
import cn.ucloud.common.pojo.BaseRequestParam;
5+
6+
import javax.validation.constraints.NotEmpty;
7+
import javax.validation.constraints.NotNull;
8+
9+
/**
10+
* @description: 获取文件系统价格 参数类
11+
* @author: codezhang
12+
* @date: 2018-10-08 16:19
13+
**/
14+
15+
public class DescribeUFSVolumePriceParam extends BaseRequestParam {
16+
17+
/**
18+
* require 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
19+
*/
20+
@NotEmpty(message = "region can not be empty")
21+
@UcloudParam("Region")
22+
private String region;
23+
24+
/**
25+
* require 文件系统大小,大小1024G ~ 25600G (1T ~ 25T),必须为1024的整数倍。
26+
*/
27+
@UcloudParam("Size")
28+
@NotNull(message = "size can not be null")
29+
private Integer size;
30+
31+
/**
32+
* optional
33+
* 计费模式,枚举值为:
34+
* Year,按年付费;
35+
* Month,按月付费;
36+
* Dynamic,按需付费(需开启权限);
37+
* Trial,试用(需开启权限)
38+
* 默认为Dynamic
39+
*/
40+
@UcloudParam("ChangeType")
41+
private String changeType;
42+
43+
/**
44+
* optional 购买UFS的时长, 默认为1
45+
*/
46+
@UcloudParam("Quantity")
47+
private Integer quantity;
48+
49+
50+
public DescribeUFSVolumePriceParam(@NotEmpty(message = "region can not be empty") String region,
51+
@NotNull(message = "size can not be null") Integer size) {
52+
super("DescribeUFSVolumePrice");
53+
this.region = region;
54+
this.size = size;
55+
}
56+
57+
public String getRegion() {
58+
return region;
59+
}
60+
61+
public void setRegion(String region) {
62+
this.region = region;
63+
}
64+
65+
public Integer getSize() {
66+
return size;
67+
}
68+
69+
public void setSize(Integer size) {
70+
this.size = size;
71+
}
72+
73+
public String getChangeType() {
74+
return changeType;
75+
}
76+
77+
public void setChangeType(String changeType) {
78+
this.changeType = changeType;
79+
}
80+
81+
public Integer getQuantity() {
82+
return quantity;
83+
}
84+
85+
public void setQuantity(Integer quantity) {
86+
this.quantity = quantity;
87+
}
88+
}

0 commit comments

Comments
 (0)