GeezerVison is showing github.com — 删除GetRegion和GetProductList对外参数;其他*Client extends UcloudClient · ucloud/ucloud-sdk-java@502ead9
File treeExpand file treeCollapse file tree Open diff view settings ucloud-sdk-java-common/src main/java/cn/ucloud/common/client test/java/cn/ucloud/common/client
ucloud-sdk-java-udisk/src/main/java/cn/ucloud/udisk/client ucloud-sdk-java-ufs/src/main/java/cn/ucloud/ufs/client ucloud-sdk-java-uhost/src main/java/cn/ucloud/uhost/client test/java/cn/ucloud/uhost/client
ucloud-sdk-java-ulb/src/main/java/cn/ucloud/ulb/client ucloud-sdk-java-unet/src/main/java/cn/ucloud/unet/client ucloud-sdk-java-vpc/src/main/java/cn/ucloud/vpc/client
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-common/src/main/java/cn/ucloud/common/client/DefaultUcloudClient.java +8-8Lines changed: 8 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,33 +23,33 @@ public DefaultUcloudClient(UcloudConfig config) { | 23 | 23 | } | 24 | 24 |
| 25 | 25 | @Override | 26 | | - public GetRegionResult getRegion(GetRegionParam param) throws Exception { | | 26 | + public GetRegionResult getRegion() throws Exception { | 27 | 27 | UcloudHttp http = new UcloudHttpImpl(GetRegionResult.class); | 28 | | - GetRegionResult result = (GetRegionResult) http.doGet(param, config, null); | | 28 | + GetRegionResult result = (GetRegionResult) http.doGet(new GetRegionParam(), config, null); | 29 | 29 | return result; | 30 | 30 | } | 31 | 31 |
| 32 | 32 | @Override | 33 | | - public void getRegion(GetRegionParam param, UcloudHandler<GetRegionResult> handler, Boolean... asyncFlag) { | | 33 | + public void getRegion( UcloudHandler<GetRegionResult> handler, Boolean... asyncFlag) { | 34 | 34 | UcloudHttp http = new UcloudHttpImpl(GetRegionResult.class); | 35 | 35 | try { | 36 | | - http.doGet(param, config, handler, asyncFlag); | | 36 | + http.doGet(new GetRegionParam(), config, handler, asyncFlag); | 37 | 37 | } catch (Exception e) { | 38 | 38 | } | 39 | 39 | } | 40 | 40 |
| 41 | 41 | @Override | 42 | | - public GetProjectListResult getProductList(GetProjectListParam param) throws Exception { | | 42 | + public GetProjectListResult getProductList() throws Exception { | 43 | 43 | UcloudHttp http = new UcloudHttpImpl(GetProjectListResult.class); | 44 | | - GetProjectListResult result = (GetProjectListResult) http.doGet(param, config, null); | | 44 | + GetProjectListResult result = (GetProjectListResult) http.doGet(new GetProjectListParam(), config, null); | 45 | 45 | return result; | 46 | 46 | } | 47 | 47 |
| 48 | 48 | @Override | 49 | | - public void getProductList(GetProjectListParam param, UcloudHandler<GetProjectListResult> handler, Boolean... asyncFlag) { | | 49 | + public void getProductList(UcloudHandler<GetProjectListResult> handler, Boolean... asyncFlag) { | 50 | 50 | UcloudHttp http = new UcloudHttpImpl(GetProjectListResult.class); | 51 | 51 | try { | 52 | | - http.doGet(param, config, handler, asyncFlag); | | 52 | + http.doGet(new GetProjectListParam(), config, handler, asyncFlag); | 53 | 53 | } catch (Exception e) { | 54 | 54 | } | 55 | 55 | } | |
Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-common/src/main/java/cn/ucloud/common/client/UcloudClient.java +4-11Lines changed: 4 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 |
| 3 | 3 |
| 4 | 4 | import cn.ucloud.common.handler.UcloudHandler; | 5 | | -import cn.ucloud.common.model.GetProjectListParam; | 6 | 5 | import cn.ucloud.common.model.GetProjectListResult; | 7 | | -import cn.ucloud.common.model.GetRegionParam; | 8 | 6 | import cn.ucloud.common.model.GetRegionResult; | 9 | 7 |
| 10 | 8 | /** | @@ -18,38 +16,33 @@ public interface UcloudClient { | 18 | 16 | /** | 19 | 17 | * 获取地域信息-GetRegion | 20 | 18 | * | 21 | | - * @param param {@link GetRegionParam}参数对象 | 22 | 19 | * @return {@link GetRegionResult} 结果对象 | 23 | 20 | * @throws Exception 出错抛出异常 | 24 | 21 | */ | 25 | | - GetRegionResult getRegion(GetRegionParam param) throws Exception; | | 22 | + GetRegionResult getRegion() throws Exception; | 26 | 23 |
| 27 | 24 | /** | 28 | 25 | * 获取地域信息-GetRegion (回调) | 29 | 26 | * | 30 | | - * @param param {@link GetRegionParam} 参数对象 | 31 | 27 | * @param handler {@link UcloudHandler}回调callback | 32 | 28 | * @param asyncFlag 是否异步 | 33 | 29 | */ | 34 | | - void getRegion(GetRegionParam param, UcloudHandler<GetRegionResult> handler, Boolean... asyncFlag); | | 30 | + void getRegion(UcloudHandler<GetRegionResult> handler, Boolean... asyncFlag); | 35 | 31 |
| 36 | 32 |
| 37 | 33 | /** | 38 | 34 | * 获取项目列表-GetProjectList | 39 | 35 | * | 40 | | - * @param param {@link GetProjectListParam}参数对象 | 41 | 36 | * @return {@link GetProjectListResult} 结果对象 | 42 | 37 | * @throws Exception 出错抛出异常 | 43 | 38 | */ | 44 | | - GetProjectListResult getProductList(GetProjectListParam param) throws Exception; | | 39 | + GetProjectListResult getProductList() throws Exception; | 45 | 40 |
| 46 | 41 | /** | 47 | 42 | * 获取项目列表-GetProjectList (回调) | 48 | | - * | 49 | | - * @param param {@link GetProjectListParam} 参数对象 | 50 | 43 | * @param handler {@link UcloudHandler}回调callback | 51 | 44 | * @param asyncFlag 是否异步 | 52 | 45 | */ | 53 | | - void getProductList(GetProjectListParam param, UcloudHandler<GetProjectListResult> handler, Boolean... asyncFlag); | | 46 | + void getProductList( UcloudHandler<GetProjectListResult> handler, Boolean... asyncFlag); | 54 | 47 |
| 55 | 48 | } |
Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-common/src/test/java/cn/ucloud/common/client/GetProjectListTest.java +1-6Lines changed: 1 addition & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | package cn.ucloud.common.client; | 2 | 2 |
| 3 | | -import cn.ucloud.common.model.GetProjectListParam; | 4 | 3 | import cn.ucloud.common.model.GetProjectListResult; | 5 | 4 | import cn.ucloud.common.pojo.Account; | 6 | 5 | import cn.ucloud.common.pojo.UcloudConfig; | | 15 | 14 | public class GetProjectListTest { | 16 | 15 |
| 17 | 16 | private UcloudClient client; | 18 | | - | 19 | | - private GetProjectListParam param; | 20 | | - | 21 | 17 | @Before | 22 | 18 | public void initData() { | 23 | 19 | client = new DefaultUcloudClient(new UcloudConfig( | 24 | 20 | new Account(System.getenv("UcloudPrivateKey"), | 25 | 21 | System.getenv("UcloudPublicKey")))); | 26 | | - param = new GetProjectListParam(); | 27 | 22 | } | 28 | 23 |
| 29 | 24 | @Test | 30 | 25 | public void getProductList() { | 31 | 26 | try { | 32 | | - GetProjectListResult productList = client.getProductList(param); | | 27 | + GetProjectListResult productList = client.getProductList(); | 33 | 28 | System.out.println(productList); | 34 | 29 | } catch (Exception e) { | 35 | 30 | e.printStackTrace(); | |
Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-common/src/test/java/cn/ucloud/common/client/GetRegionTest.java +1-6Lines changed: 1 addition & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | package cn.ucloud.common.client; | 2 | 2 |
| 3 | | -import cn.ucloud.common.model.GetRegionParam; | 4 | 3 | import cn.ucloud.common.model.GetRegionResult; | 5 | 4 | import cn.ucloud.common.pojo.Account; | 6 | 5 | import cn.ucloud.common.pojo.UcloudConfig; | 7 | 6 | import org.junit.Before; | 8 | 7 | import org.junit.Test; | 9 | 8 |
| 10 | | -import static org.junit.Assert.*; | 11 | | - | 12 | 9 | /** | 13 | 10 | * @description: | 14 | 11 | * @author: codezhang | | 17 | 14 | public class GetRegionTest { | 18 | 15 | private UcloudClient client; | 19 | 16 |
| 20 | | - private GetRegionParam param; | 21 | 17 |
| 22 | 18 | @Before | 23 | 19 | public void initData() { | 24 | 20 | client = new DefaultUcloudClient(new UcloudConfig( | 25 | 21 | new Account(System.getenv("UcloudPrivateKey"), | 26 | 22 | System.getenv("UcloudPublicKey")))); | 27 | | - param = new GetRegionParam(); | 28 | 23 | } | 29 | 24 |
| 30 | 25 | @Test | 31 | 26 | public void getRegion() { | 32 | 27 | try { | 33 | | - GetRegionResult region = client.getRegion(param); | | 28 | + GetRegionResult region = client.getRegion(); | 34 | 29 | System.out.println(region); | 35 | 30 | } catch (Exception e) { | 36 | 31 | e.printStackTrace(); | |
Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-udisk/src/main/java/cn/ucloud/udisk/client/DefaultUdiskClient.java +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | package cn.ucloud.udisk.client; | 2 | 2 |
| | 3 | +import cn.ucloud.common.client.DefaultUcloudClient; | 3 | 4 | import cn.ucloud.common.handler.UcloudHandler; | 4 | 5 | import cn.ucloud.common.http.UcloudHttp; | 5 | 6 | import cn.ucloud.common.http.UcloudHttpImpl; | | 12 | 13 | | 13 | 14 | * @date: 2018/9/18 10:37 | 14 | 15 | */ | 15 | | -public class DefaultUdiskClient implements UdiskClient { | | 16 | +public class DefaultUdiskClient extends DefaultUcloudClient implements UdiskClient { | 16 | 17 |
| 17 | 18 | private UdiskConfig config; | 18 | 19 |
| 19 | 20 | public DefaultUdiskClient(UdiskConfig config) { | | 21 | + super(config); | 20 | 22 | this.config = config; | 21 | 23 | } | 22 | 24 |
| |
Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-udisk/src/main/java/cn/ucloud/udisk/client/UdiskClient.java +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | package cn.ucloud.udisk.client; | 2 | 2 |
| | 3 | +import cn.ucloud.common.client.UcloudClient; | 3 | 4 | import cn.ucloud.common.handler.UcloudHandler; | 4 | 5 | import cn.ucloud.udisk.model.*; | 5 | 6 |
| | 9 | 10 | | 10 | 11 | * @date: 2018/9/17 19:07 | 11 | 12 | */ | 12 | | -public interface UdiskClient { | | 13 | +public interface UdiskClient extends UcloudClient { | 13 | 14 |
| 14 | 15 | /** | 15 | 16 | * 获取云硬盘价格-DescribeUDiskPrice | |
Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-ufs/src/main/java/cn/ucloud/ufs/client/DefaultUFSClient.java +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | package cn.ucloud.ufs.client; | 2 | 2 |
| | 3 | +import cn.ucloud.common.client.DefaultUcloudClient; | 3 | 4 | import cn.ucloud.common.handler.UcloudHandler; | 4 | 5 | import cn.ucloud.common.http.UcloudHttp; | 5 | 6 | import cn.ucloud.common.http.UcloudHttpImpl; | 6 | | -import cn.ucloud.common.pojo.BaseRequestParam; | 7 | | -import cn.ucloud.common.pojo.BaseResponseResult; | 8 | 7 | import cn.ucloud.ufs.model.*; | 9 | 8 | import cn.ucloud.ufs.pojo.UFSConfig; | 10 | 9 |
| | 14 | 13 | * @date: 2018-10-08 14:32 | 15 | 14 | **/ | 16 | 15 |
| 17 | | -public class DefaultUFSClient implements UFSClient { | | 16 | +public class DefaultUFSClient extends DefaultUcloudClient implements UFSClient { | 18 | 17 |
| 19 | 18 | /** | 20 | 19 | * UFS配置参数 | 21 | 20 | */ | 22 | 21 | private UFSConfig config; | 23 | 22 |
| 24 | 23 | public DefaultUFSClient(UFSConfig config) { | | 24 | + super(config); | 25 | 25 | this.config = config; | 26 | 26 | } | 27 | 27 |
| |
Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-ufs/src/main/java/cn/ucloud/ufs/client/UFSClient.java +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | package cn.ucloud.ufs.client; | 2 | 2 |
| | 3 | +import cn.ucloud.common.client.UcloudClient; | 3 | 4 | import cn.ucloud.common.handler.UcloudHandler; | 4 | | -import cn.ucloud.common.pojo.BaseRequestParam; | 5 | | -import cn.ucloud.common.pojo.BaseResponseResult; | 6 | 5 | import cn.ucloud.ufs.model.*; | 7 | 6 |
| 8 | 7 | /** | 9 | 8 | * @description: 文件存储接口 | 10 | 9 | * @author: codezhang | 11 | 10 | * @date: 2018-10-08 14:31 | 12 | 11 | **/ | 13 | | -public interface UFSClient { | | 12 | +public interface UFSClient extends UcloudClient { | 14 | 13 |
| 15 | 14 | /** | 16 | 15 | * 创建文件系统 | |
Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-uhost/src/main/java/cn/ucloud/uhost/client/DefaultUhostClient.java +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | package cn.ucloud.uhost.client; | 2 | 2 |
| | 3 | +import cn.ucloud.common.client.DefaultUcloudClient; | 3 | 4 | import cn.ucloud.common.handler.UcloudHandler; | 4 | 5 | import cn.ucloud.common.http.UcloudHttp; | 5 | 6 | import cn.ucloud.common.http.UcloudHttpImpl; | | 12 | 13 | * @date: 2018-09-14 10:57 | 13 | 14 | **/ | 14 | 15 |
| 15 | | -public class DefaultUhostClient implements UhostClient { | | 16 | +public class DefaultUhostClient extends DefaultUcloudClient implements UhostClient { | 16 | 17 |
| 17 | 18 | /** | 18 | 19 | * uhost配置 | @@ -21,6 +22,7 @@ public class DefaultUhostClient implements UhostClient { | 21 | 22 |
| 22 | 23 |
| 23 | 24 | public DefaultUhostClient(UhostConfig config) { | | 25 | + super(config); | 24 | 26 | this.config = config; | 25 | 27 | } | 26 | 28 |
| |
Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-uhost/src/test/java/cn/ucloud/uhost/client/DescribeImageTest.java +1-3Lines changed: 1 addition & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | package cn.ucloud.uhost.client; | 2 | 2 |
| 3 | | -import cn.ucloud.uhost.client.DefaultUhostClient; | 4 | | -import cn.ucloud.uhost.client.UhostClient; | | 3 | +import cn.ucloud.common.pojo.Account; | 5 | 4 | import cn.ucloud.uhost.model.DescribeImageParam; | 6 | 5 | import cn.ucloud.uhost.model.DescribeImageResult; | 7 | | -import cn.ucloud.common.pojo.Account; | 8 | 6 | import cn.ucloud.uhost.pojo.UhostConfig; | 9 | 7 | import org.junit.Before; | 10 | 8 | import org.junit.Test; | |
|