Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 79e947f

Browse files
committed
batchCompute sdk 支持VPC
1 parent 088b33c commit 79e947f

File tree

13 files changed

+336
-168
lines changed

13 files changed

+336
-168
lines changed

aliyun-java-sdk-batchcompute/Readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Batchcompute SDK For Java
66

77
#### (1) pom.xml 中配置
88

9-
前往[http://repo.alibaba-inc.com/nexus]中查找下面2个包。
10-
将其xml描述放到pom.xml的dependencies标签中。例如
9+
10+
将下面xml描述放到pom.xml的dependencies标签中:
1111

1212
```xml
1313
<dependency>
@@ -20,7 +20,7 @@ Batchcompute SDK For Java
2020
<dependency>
2121
<groupId>com.aliyun</groupId>
2222
<artifactId>aliyun-java-sdk-batchcompute</artifactId>
23-
<version>4.1.0</version>
23+
<version>4.2.0</version>
2424
</dependency>
2525
```
2626

aliyun-java-sdk-batchcompute/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<groupId>com.aliyun</groupId>
44
<artifactId>aliyun-java-sdk-batchcompute</artifactId>
55
<packaging>jar</packaging>
6-
<version>4.1.0</version>
6+
<version>4.2.0</version>
77
<name>aliyun-java-sdk-batchcompute</name>
88
<url>http://www.aliyun.com</url>
99
<description>Aliyun Open API SDK for Java

aliyun-java-sdk-batchcompute/src/main/java/com/aliyuncs/batchcompute/model/v20151111/ChangeClusterDesiredVMCountRequest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,17 @@ public void setClusterId(String clusterId) {
6161
public void setClusterDescription(ClusterDescription d){
6262
clusterDesc = d;
6363

64-
for(Map.Entry<String, GroupDescription> set: clusterDesc.getGroups().entrySet()){
65-
set.getValue().setResourceType(null);
66-
}
64+
// for(Map.Entry<String, GroupDescription> set: clusterDesc.getGroups().entrySet()){
65+
// set.getValue().setResourceType(null);
66+
// }
6767

6868
ChangeClusterDesiredVMCountRequestMarshaller.marshall(this);
6969
}
7070
public void setDesiredVmCount(String groupName, int count) throws ClientException {
7171

7272
GroupDescription groupDesc = new GroupDescription();
7373
groupDesc.setDesiredVMCount(count);
74-
groupDesc.setResourceType(null);
74+
//groupDesc.setResourceType(null);
7575
clusterDesc.addGroup(groupName, groupDesc);
7676

7777
ChangeClusterDesiredVMCountRequestMarshaller.marshall(this);

aliyun-java-sdk-batchcompute/src/main/java/com/aliyuncs/batchcompute/pojo/v20151111/Networks.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,16 @@ public void setClassic(ClassicNetWork classic) {
2424
private ClassicNetWork classic;
2525

2626

27+
public VPC getVpc() {
28+
return vpc;
29+
}
30+
31+
public void setVpc(VPC vpc) {
32+
this.vpc = vpc;
33+
}
34+
35+
@JsonProperty("VPC")
36+
private VPC vpc;
37+
2738

2839
}
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
package com.aliyuncs.batchcompute.pojo.v20151111;
2+
3+
import com.aliyuncs.batchcompute.main.v20151111.CustomJsonDateDeserializer;
4+
import org.codehaus.jackson.annotate.JsonIgnore;
5+
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
6+
import org.codehaus.jackson.annotate.JsonProperty;
7+
import org.codehaus.jackson.map.annotate.JsonDeserialize;
8+
9+
import java.util.Date;
10+
11+
/**
12+
* Created by guangchun.luo on 2017-5-3
13+
*/
14+
@JsonIgnoreProperties(ignoreUnknown = true)
15+
public class VPC {
16+
17+
@JsonProperty("CidrBlock")
18+
private String cidrBlock;
19+
20+
@JsonProperty("ExpressConnectSpec")
21+
private String expressConnectSpec;
22+
23+
@JsonProperty("OppositeRegionId")
24+
private String oppositeRegionId;
25+
26+
@JsonProperty("OppositeAccessPointId")
27+
private String oppositeAccessPointId;
28+
29+
@JsonProperty("OppositeRouterType")
30+
private String oppositeRouterType;
31+
32+
@JsonProperty("OppositeRouterId")
33+
private String oppositeRouterId;
34+
35+
@JsonProperty("OppositeInterfaceId")
36+
private String oppositeInterfaceId;
37+
38+
39+
@JsonIgnore
40+
public String getCidrBlock() {
41+
return cidrBlock;
42+
}
43+
44+
@JsonIgnore
45+
public void setCidrBlock(String cidrBlock) {
46+
this.cidrBlock = cidrBlock;
47+
}
48+
49+
@JsonIgnore
50+
public String getExpressConnectSpec() {
51+
return expressConnectSpec;
52+
}
53+
54+
@JsonIgnore
55+
public void setExpressConnectSpec(String expressConnectSpec) {
56+
this.expressConnectSpec = expressConnectSpec;
57+
}
58+
59+
@JsonIgnore
60+
public String getOppositeRegionId() {
61+
return oppositeRegionId;
62+
}
63+
64+
@JsonIgnore
65+
public void setOppositeRegionId(String oppositeRegionId) {
66+
this.oppositeRegionId = oppositeRegionId;
67+
}
68+
69+
@JsonIgnore
70+
public String getOppositeAccessPointId() {
71+
return oppositeAccessPointId;
72+
}
73+
74+
@JsonIgnore
75+
public void setOppositeAccessPointId(String oppositeAccessPointId) {
76+
this.oppositeAccessPointId = oppositeAccessPointId;
77+
}
78+
79+
@JsonIgnore
80+
public String getOppositeRouterType() {
81+
return oppositeRouterType;
82+
}
83+
84+
@JsonIgnore
85+
public void setOppositeRouterType(String oppositeRouterType) {
86+
this.oppositeRouterType = oppositeRouterType;
87+
}
88+
89+
@JsonIgnore
90+
public String getOppositeRouterId() {
91+
return oppositeRouterId;
92+
}
93+
94+
@JsonIgnore
95+
public void setOppositeRouterId(String oppositeRouterId) {
96+
this.oppositeRouterId = oppositeRouterId;
97+
}
98+
99+
@JsonIgnore
100+
public String getOppositeInterfaceId() {
101+
return oppositeInterfaceId;
102+
}
103+
104+
@JsonIgnore
105+
public void setOppositeInterfaceId(String oppositeInterfaceId) {
106+
this.oppositeInterfaceId = oppositeInterfaceId;
107+
}
108+
}

aliyun-java-sdk-batchcompute/src/main/java/com/aliyuncs/batchcompute/transform/v20151111/ChangeClusterDesiredVMCountRequestMarshaller.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public static ChangeClusterDesiredVMCountRequest marshall(ChangeClusterDesiredVM
1515

1616
ObjectMapper mapper = new ObjectMapper();
1717

18-
//null或“”不序列化
19-
mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_EMPTY);
18+
//默认值不序列化
19+
mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_DEFAULT);
2020

2121
String contentString = null;
2222

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
/*
2-
* Licensed to the Apache Software Foundation (ASF) under one
3-
* or more contributor license agreements. See the NOTICE file
4-
* distributed with this work for additional information
5-
* regarding copyright ownership. The ASF licenses this file
6-
* to you under the Apache License, Version 2.0 (the
7-
* "License"); you may not use this file except in compliance
8-
* with the License. You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
18-
*/
19-
package com.aliyuncs.batchcompute.transform.v20151111;
20-
21-
import com.aliyuncs.batchcompute.model.v20151111.CreateClusterRequest;
22-
import com.aliyuncs.exceptions.ClientException;
23-
import org.codehaus.jackson.map.ObjectMapper;
24-
import org.codehaus.jackson.map.annotate.JsonSerialize;
25-
26-
import java.io.IOException;
27-
import java.security.NoSuchAlgorithmException;
28-
29-
30-
public class CreateClusterRequestMarshaller {
31-
32-
public static CreateClusterRequest marshall(CreateClusterRequest req) throws ClientException {
33-
34-
ObjectMapper mapper = new ObjectMapper();
35-
36-
//null或“”不序列化
37-
mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_EMPTY);
38-
39-
String contentString = null;
40-
try {
41-
contentString = mapper.writeValueAsString(req.getClusterDescription());
42-
} catch (IOException e) {
43-
//e.printStackTrace();
44-
throw new ClientException("API.EncodeError", "encode request body error");
45-
}
46-
47-
48-
req.setContent(contentString.getBytes(), req.getEncoding(), req.getAcceptFormat());
49-
50-
return req;
51-
}
52-
}
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package com.aliyuncs.batchcompute.transform.v20151111;
20+
21+
import com.aliyuncs.batchcompute.model.v20151111.CreateClusterRequest;
22+
import com.aliyuncs.exceptions.ClientException;
23+
import org.codehaus.jackson.map.ObjectMapper;
24+
import org.codehaus.jackson.map.annotate.JsonSerialize;
25+
26+
import java.io.IOException;
27+
import java.security.NoSuchAlgorithmException;
28+
29+
30+
public class CreateClusterRequestMarshaller {
31+
32+
public static CreateClusterRequest marshall(CreateClusterRequest req) throws ClientException {
33+
34+
ObjectMapper mapper = new ObjectMapper();
35+
36+
//默认值不序列化
37+
mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_DEFAULT);
38+
39+
String contentString = null;
40+
try {
41+
contentString = mapper.writeValueAsString(req.getClusterDescription());
42+
} catch (IOException e) {
43+
//e.printStackTrace();
44+
throw new ClientException("API.EncodeError", "encode request body error");
45+
}
46+
47+
48+
req.setContent(contentString.getBytes(), req.getEncoding(), req.getAcceptFormat());
49+
50+
return req;
51+
}
52+
}
Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
/*
2-
* Licensed to the Apache Software Foundation (ASF) under one
3-
* or more contributor license agreements. See the NOTICE file
4-
* distributed with this work for additional information
5-
* regarding copyright ownership. The ASF licenses this file
6-
* to you under the Apache License, Version 2.0 (the
7-
* "License"); you may not use this file except in compliance
8-
* with the License. You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
18-
*/
19-
package com.aliyuncs.batchcompute.transform.v20151111;
20-
21-
import com.aliyuncs.batchcompute.model.v20151111.CreateImageRequest;
22-
import com.aliyuncs.exceptions.ClientException;
23-
import org.codehaus.jackson.map.ObjectMapper;
24-
import org.codehaus.jackson.map.annotate.JsonSerialize;
25-
26-
import java.io.IOException;
27-
28-
29-
public class CreateImageRequestMarshaller {
30-
31-
public static CreateImageRequest marshall(CreateImageRequest req) throws ClientException {
32-
33-
ObjectMapper mapper = new ObjectMapper();
34-
35-
//null或“”不序列化
36-
mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_EMPTY);
37-
38-
String contentString = null;
39-
try {
40-
contentString = mapper.writeValueAsString(req.getImageDescription());
41-
} catch (IOException e) {
42-
//e.printStackTrace();
43-
throw new ClientException("API.EncodeError", "encode request body error");
44-
}
45-
46-
req.setContent(contentString.getBytes(), req.getEncoding(), req.getAcceptFormat());
47-
48-
return req;
49-
}
50-
}
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package com.aliyuncs.batchcompute.transform.v20151111;
20+
21+
import com.aliyuncs.batchcompute.model.v20151111.CreateImageRequest;
22+
import com.aliyuncs.exceptions.ClientException;
23+
import org.codehaus.jackson.map.ObjectMapper;
24+
import org.codehaus.jackson.map.annotate.JsonSerialize;
25+
26+
import java.io.IOException;
27+
28+
29+
public class CreateImageRequestMarshaller {
30+
31+
public static CreateImageRequest marshall(CreateImageRequest req) throws ClientException {
32+
33+
ObjectMapper mapper = new ObjectMapper();
34+
35+
//默认值不序列化
36+
mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_DEFAULT);
37+
38+
String contentString = null;
39+
try {
40+
contentString = mapper.writeValueAsString(req.getImageDescription());
41+
} catch (IOException e) {
42+
//e.printStackTrace();
43+
throw new ClientException("API.EncodeError", "encode request body error");
44+
}
45+
46+
req.setContent(contentString.getBytes(), req.getEncoding(), req.getAcceptFormat());
47+
48+
return req;
49+
}
50+
}

0 commit comments

Comments
 (0)