GeezerVison is showing github.com — 完成ImportCustomImage · ucloud/ucloud-sdk-java@9bea96d
File treeExpand file treeCollapse file tree Open diff view settings ucloud-sdk-java-uhost/src main/java/cn/ucloud/uhost/model test/java/cn/ucloud/uhost/client
main/java/cn/ucloud/ulb/model test/java/cn/ucloud/ulb/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-uhost/src/main/java/cn/ucloud/uhost/model/ImportCustomImageParam.java +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 | import cn.ucloud.common.pojo.BaseRequestParam; | 5 | 5 |
| 6 | 6 | import javax.validation.constraints.NotEmpty; | | 7 | +import javax.validation.constraints.NotNull; | 7 | 8 |
| 8 | 9 | /** | 9 | 10 | * @description: 导入镜像 参数对象 | @@ -63,7 +64,7 @@ public class ImportCustomImageParam extends BaseRequestParam { | 63 | 64 | * require 是否授权。必须填true | 64 | 65 | */ | 65 | 66 | @UcloudParam("Auth") | 66 | | - @NotEmpty(message = "auth can not ne null") | | 67 | + @NotNull(message = "auth can not ne null") | 67 | 68 | private Boolean auth; | 68 | 69 |
| 69 | 70 | /** | |
Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-uhost/src/test/java/cn/ucloud/uhost/client/CreateCustomImageTest.java +1-2Lines changed: 1 addition & 2 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 | + | 5 | 4 | import cn.ucloud.uhost.model.CreateCustomImageParam; | 6 | 5 | import cn.ucloud.uhost.model.CreateCustomImageResult; | 7 | 6 | import cn.ucloud.common.pojo.Account; | |
Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-uhost/src/test/java/cn/ucloud/uhost/client/ImportCustomImageTest.java +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,14 +23,13 @@ public void initData() { | 23 | 23 | client = new DefaultUhostClient(new UhostConfig( | 24 | 24 | new Account(System.getenv("UcloudPrivateKey"), | 25 | 25 | System.getenv("UcloudPublicKey")))); | 26 | | - param = new ImportCustomImageParam("cn-bj2","java-sdk-import-test","", | 27 | | - "","","",true); | | 26 | + param = new ImportCustomImageParam("cn-bj2","java-sdk-import-test","ufile-url", | | 27 | + "Other","Other","qcow2",true); | 28 | 28 | param.setProjectId("org-4nfe1i"); | 29 | 29 | } | 30 | 30 |
| 31 | 31 | @Test | 32 | 32 | public void importCustomImage() { | 33 | | - // todo 测试 依赖UFILE | 34 | 33 | try { | 35 | 34 | ImportCustomImageResult importCustomImageResult = client.importCustomImage(param); | 36 | 35 | System.out.println(importCustomImageResult); | |
Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-ulb/src/main/java/cn/ucloud/ulb/model/AllocateBackendBatchParam.java +7-5Lines changed: 7 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -38,13 +38,13 @@ public static class Backend { | 38 | 38 |
| 39 | 39 | /** | 40 | 40 | * optional | 41 | | - * 所添加的后端资源服务端口,取值范围[1-65535],默认80 | | 41 | + * 所添加的后端资源服务端口,取值范围[1-65535] | 42 | 42 | */ | 43 | 43 | private Integer port; | 44 | 44 |
| 45 | 45 | /** | 46 | 46 | * optional | 47 | | - * 后端实例状态开关,枚举值: 1:启用; 0:禁用 默认为启用 | | 47 | + * 后端实例状态开关,枚举值: 1:启用; 0:禁用 | 48 | 48 | */ | 49 | 49 | private Integer enabled; | 50 | 50 |
| @@ -54,9 +54,11 @@ public static class Backend { | 54 | 54 | */ | 55 | 55 | private String ip; | 56 | 56 |
| 57 | | - public Backend(String resourceId, String resourceType,String ip) { | | 57 | + public Backend(String resourceId, String resourceType,Integer port,Integer enabled,String ip) { | 58 | 58 | this.resourceId = resourceId; | 59 | 59 | this.resourceType = resourceType; | | 60 | + this.port = port; | | 61 | + this.enabled = enabled; | 60 | 62 | this.ip = ip; | 61 | 63 | } | 62 | 64 |
| @@ -150,12 +152,12 @@ public List<Param> checkBackends() throws Exception { | 150 | 152 | if (backend.port != null){ | 151 | 153 | valueBuild.append("|"+backend.port); | 152 | 154 | }else { | 153 | | - valueBuild.append("|80"); | | 155 | + throw new ValidationException("backend["+i+"].port can not be null"); | 154 | 156 | } | 155 | 157 | if (backend.enabled != null){ | 156 | 158 | valueBuild.append("|"+backend.enabled); | 157 | 159 | }else { | 158 | | - valueBuild.append("|1"); | | 160 | + throw new ValidationException("backend["+i+"].enabled can not be null"); | 159 | 161 | } | 160 | 162 | if (backend.ip != null && backend.ip.length() > 0){ | 161 | 163 | valueBuild.append("|"+backend.ip); | |
Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-ulb/src/test/java/cn/ucloud/ulb/client/AllocateBackendBatchTest.java +5-7Lines changed: 5 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | package cn.ucloud.ulb.client; | 2 | 2 |
| 3 | | -import cn.ucloud.ulb.client.DefaultULBClient; | 4 | | -import cn.ucloud.ulb.client.ULBClient; | | 3 | +import cn.ucloud.common.pojo.Account; | 5 | 4 | import cn.ucloud.ulb.model.AllocateBackendBatchParam; | 6 | 5 | import cn.ucloud.ulb.model.AllocateBackendBatchResult; | 7 | | -import cn.ucloud.common.pojo.Account; | 8 | 6 | import cn.ucloud.ulb.pojo.ULBConfig; | 9 | 7 | import org.junit.Before; | 10 | 8 | import org.junit.Test; | @@ -28,19 +26,19 @@ public void initData() { | 28 | 26 | client = new DefaultULBClient(new ULBConfig( | 29 | 27 | new Account(System.getenv("UcloudPrivateKey"), | 30 | 28 | System.getenv("UcloudPublicKey")))); | 31 | | - param = new AllocateBackendBatchParam("cn-bj2","ulb-0kawkr","vserver-se0ay2"); | | 29 | + param = new AllocateBackendBatchParam("cn-bj2","ulb-wo45wj","vserver-qrtil3"); | 32 | 30 | param.setProjectId("org-4nfe1i"); | 33 | 31 | List<AllocateBackendBatchParam.Backend> backends = new ArrayList<>(); | 34 | | - AllocateBackendBatchParam.Backend backend1 =new AllocateBackendBatchParam.Backend("uhost-zzsffd", "UHost","10.9.146.72"); | 35 | | - AllocateBackendBatchParam.Backend backend2 =new AllocateBackendBatchParam.Backend("uhost-ewq1eu", "UHost","10.9.128.212"); | | 32 | + AllocateBackendBatchParam.Backend backend1 =new AllocateBackendBatchParam.Backend("uhost-kdegdk", "UHost",80,1,"10.9.146.72"); | | 33 | + AllocateBackendBatchParam.Backend backend2 =new AllocateBackendBatchParam.Backend("uhost-zzsffd", "UHost",80,1,"10.9.128.212"); | 36 | 34 | backends.add(backend1); | 37 | 35 | backends.add(backend2); | 38 | 36 | param.setBackends(backends); | 39 | 37 | } | 40 | 38 |
| 41 | 39 | @Test | 42 | 40 | public void allocateBackendBatch() { | 43 | | - // todo 测试 | | 41 | + // todo 测试 Service error and break | 44 | 42 | try { | 45 | 43 | AllocateBackendBatchResult allocateBackendBatchResult = client.allocateBackendBatch(param); | 46 | 44 | System.out.println(allocateBackendBatchResult); | |
Collapse file Copy file name to clipboardExpand all lines: ucloud-sdk-java-vpc/src/main/java/cn/ucloud/vpc/client/DefaultVPCClient.java +11-8Lines changed: 11 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -298,18 +298,21 @@ public void describeRouteTable(DescribeRouteTableParam param, UcloudHandler<Desc | 298 | 298 |
| 299 | 299 | @Override | 300 | 300 | public ModifyRouteRuleResult modifyRouteRule(ModifyRouteRuleParam param) throws Exception { | 301 | | - UcloudHttp http = new UcloudHttpImpl(ModifyRouteRuleResult.class); | 302 | | - ModifyRouteRuleResult result = (ModifyRouteRuleResult) http.doGet(param, config, null); | 303 | | - return result; | | 301 | + // 未上线 | | 302 | + return null; | | 303 | + //UcloudHttp http = new UcloudHttpImpl(ModifyRouteRuleResult.class); | | 304 | + //ModifyRouteRuleResult result = (ModifyRouteRuleResult) http.doGet(param, config, null); | | 305 | + //return result; | 304 | 306 | } | 305 | 307 |
| 306 | 308 | @Override | 307 | 309 | public void modifyRouteRule(ModifyRouteRuleParam param, UcloudHandler<ModifyRouteRuleResult> handler, Boolean... asyncFlag) { | 308 | | - UcloudHttp http = new UcloudHttpImpl(ModifyRouteRuleResult.class); | 309 | | - try { | 310 | | - http.doGet(param, config, handler, asyncFlag); | 311 | | - } catch (Exception e) { | 312 | | - } | | 310 | + // 未上线 | | 311 | + //UcloudHttp http = new UcloudHttpImpl(ModifyRouteRuleResult.class); | | 312 | + //try { | | 313 | + // http.doGet(param, config, handler, asyncFlag); | | 314 | + //} catch (Exception e) { | | 315 | + //} | 313 | 316 | } | 314 | 317 |
| 315 | 318 | @Override | |
|