Skip to content

Commit 2b6f3d4

Browse files
author
Kelven Yang
committed
UUID support for XML responses
1 parent 92f4a88 commit 2b6f3d4

32 files changed

Lines changed: 216 additions & 395 deletions

api/src/com/cloud/api/response/AsyncJobResponse.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
import com.google.gson.annotations.SerializedName;
2727

2828
public class AsyncJobResponse extends BaseResponse {
29-
/*
30-
@SerializedName(ApiConstants.JOB_ID) @Param(description="async job ID")
31-
private IdentityProxy id = new IdentityProxy("async_job");
32-
*/
33-
3429
@SerializedName("accountid") @Param(description="the account that executed the async command")
3530
private IdentityProxy accountId = new IdentityProxy("account");
3631

api/src/com/cloud/api/response/CapacityResponse.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package com.cloud.api.response;
1919

2020
import com.cloud.api.ApiConstants;
21+
import com.cloud.api.IdentityProxy;
2122
import com.cloud.serializer.Param;
2223
import com.google.gson.annotations.SerializedName;
2324

@@ -26,19 +27,19 @@ public class CapacityResponse extends BaseResponse {
2627
private Short capacityType;
2728

2829
@SerializedName(ApiConstants.ZONE_ID) @Param(description="the Zone ID")
29-
private Long zoneId;
30+
private IdentityProxy zoneId = new IdentityProxy("data_center");
3031

3132
@SerializedName("zonename") @Param(description="the Zone name")
3233
private String zoneName;
3334

3435
@SerializedName(ApiConstants.POD_ID) @Param(description="the Pod ID")
35-
private Long podId;
36+
private IdentityProxy podId = new IdentityProxy("host_pod_ref");
3637

3738
@SerializedName("podname") @Param(description="the Pod name")
3839
private String podName;
3940

4041
@SerializedName(ApiConstants.CLUSTER_ID) @Param(description="the Cluster ID")
41-
private Long clusterId;
42+
private IdentityProxy clusterId = new IdentityProxy("cluster");
4243

4344
@SerializedName("clustername") @Param(description="the Cluster name")
4445
private String clusterName;
@@ -61,11 +62,11 @@ public void setCapacityType(Short capacityType) {
6162
}
6263

6364
public Long getZoneId() {
64-
return zoneId;
65+
return zoneId.getValue();
6566
}
6667

6768
public void setZoneId(Long zoneId) {
68-
this.zoneId = zoneId;
69+
this.zoneId.setValue(zoneId);
6970
}
7071

7172
public String getZoneName() {
@@ -77,11 +78,11 @@ public void setZoneName(String zoneName) {
7778
}
7879

7980
public Long getPodId() {
80-
return podId;
81+
return podId.getValue();
8182
}
8283

8384
public void setPodId(Long podId) {
84-
this.podId = podId;
85+
this.podId.setValue(podId);
8586
}
8687

8788
public String getPodName() {
@@ -93,11 +94,11 @@ public void setPodName(String podName) {
9394
}
9495

9596
public Long getClusterId() {
96-
return clusterId;
97+
return clusterId.getValue();
9798
}
9899

99100
public void setClusterId(Long clusterId) {
100-
this.clusterId = clusterId;
101+
this.clusterId.setValue(clusterId);
101102
}
102103

103104
public String getClusterName() {

api/src/com/cloud/api/response/CreateCmdResponse.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,9 @@
2323
import com.google.gson.annotations.SerializedName;
2424

2525
public class CreateCmdResponse extends BaseResponse {
26-
/*
27-
@SerializedName(ApiConstants.JOB_ID)
28-
private Long jobId;
29-
*/
30-
3126
@SerializedName(ApiConstants.ID)
3227
private IdentityProxy id = new IdentityProxy();
3328

34-
/*
35-
public Long getJobId() {
36-
return super.getJobId();
37-
}
38-
39-
public void setJobId(Long jobId) {
40-
super.setJobId(jobId);
41-
}
42-
*/
43-
4429
public Long getId() {
4530
return id.getValue();
4631
}

api/src/com/cloud/api/response/DomainRouterResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti
7070
private String linkLocalNetmask;
7171

7272
@SerializedName(ApiConstants.LINK_LOCAL_NETWORK_ID) @Param(description="the ID of the corresponding link local network")
73-
private Long linkLocalNetworkId;
73+
private IdentityProxy linkLocalNetworkId = new IdentityProxy("networks");
7474

7575
@SerializedName(ApiConstants.PUBLIC_IP) @Param(description="the public IP address for the router")
7676
private String publicIp;
@@ -263,7 +263,7 @@ public void setLinkLocalNetmask(String linkLocalNetmask) {
263263
}
264264

265265
public void setLinkLocalNetworkId(Long linkLocalNetworkId) {
266-
this.linkLocalNetworkId = linkLocalNetworkId;
266+
this.linkLocalNetworkId.setValue(linkLocalNetworkId);
267267
}
268268

269269
public void setServiceOfferingId(Long serviceOfferingId) {

api/src/com/cloud/api/response/EgressRuleResponse.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
package com.cloud.api.response;
1919

2020
import com.cloud.api.ApiConstants;
21+
import com.cloud.api.IdentityProxy;
2122
import com.cloud.serializer.Param;
2223
import com.google.gson.annotations.SerializedName;
2324

2425
public class EgressRuleResponse extends BaseResponse {
2526
@SerializedName("ruleid") @Param(description="the id of the ingress rule")
26-
private Long ruleId;
27+
private IdentityProxy ruleId = new IdentityProxy("security_egress_rule");
2728

2829
@SerializedName("protocol") @Param(description="the protocol of the ingress rule")
2930
private String protocol;
@@ -50,11 +51,11 @@ public class EgressRuleResponse extends BaseResponse {
5051
private String cidr;
5152

5253
public Long getRuleId() {
53-
return ruleId;
54+
return ruleId.getValue();
5455
}
5556

5657
public void setRuleId(Long ruleId) {
57-
this.ruleId = ruleId;
58+
this.ruleId.setValue(ruleId);
5859
}
5960

6061
public String getProtocol() {

api/src/com/cloud/api/response/HostResponse.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,6 @@ public class HostResponse extends BaseResponse {
139139
@SerializedName("events") @Param(description="events available for the host")
140140
private String events;
141141

142-
/*
143-
@SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the host")
144-
private IdentityProxy jobId = new IdentityProxy("async_job");
145-
146-
147-
@SerializedName("jobstatus") @Param(description="shows the current pending asynchronous job status")
148-
private Integer jobStatus;
149-
*/
150142
@SerializedName("hosttags") @Param(description="comma-separated list of tags for the host")
151143
private String hostTags;
152144

@@ -168,28 +160,6 @@ public Long getObjectId() {
168160
return getId();
169161
}
170162

171-
/*
172-
@Override
173-
public Long getJobId() {
174-
return super.getJobId();
175-
}
176-
177-
@Override
178-
public void setJobId(Long jobId) {
179-
super.setJobId(jobId);
180-
}
181-
182-
@Override
183-
public Integer getJobStatus() {
184-
return jobStatus;
185-
}
186-
187-
@Override
188-
public void setJobStatus(Integer jobStatus) {
189-
this.jobStatus = jobStatus;
190-
}
191-
*/
192-
193163
public Long getId() {
194164
return id.getValue();
195165
}

api/src/com/cloud/api/response/IpForwardingRuleResponse.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@
1818
package com.cloud.api.response;
1919

2020
import com.cloud.api.ApiConstants;
21+
import com.cloud.api.IdentityProxy;
2122
import com.cloud.serializer.Param;
2223
import com.google.gson.annotations.SerializedName;
2324

2425
public class IpForwardingRuleResponse extends BaseResponse {
2526
@SerializedName(ApiConstants.ID) @Param(description="the ID of the port forwarding rule")
26-
private Long id;
27+
private IdentityProxy id = new IdentityProxy("firewall_rules");
2728

2829
@SerializedName(ApiConstants.PROTOCOL) @Param(description="the protocol of the port forwarding rule")
2930
private String protocol;
3031

3132
@SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) @Param(description="the VM ID for the port forwarding rule")
32-
private Long virtualMachineId;
33+
private IdentityProxy virtualMachineId = new IdentityProxy("vm_instance");
3334

3435
@SerializedName("virtualmachinename") @Param(description="the VM name for the port forwarding rule")
3536
private String virtualMachineName;
@@ -53,11 +54,11 @@ public class IpForwardingRuleResponse extends BaseResponse {
5354
private String state;
5455

5556
public Long getId() {
56-
return id;
57+
return id.getValue();
5758
}
5859

5960
public void setId(Long id) {
60-
this.id = id;
61+
this.id.setValue(id);
6162
}
6263

6364
public String getProtocol() {
@@ -69,11 +70,11 @@ public void setProtocol(String protocol) {
6970
}
7071

7172
public Long getVirtualMachineId() {
72-
return virtualMachineId;
73+
return virtualMachineId.getValue();
7374
}
7475

7576
public void setVirtualMachineId(Long virtualMachineId) {
76-
this.virtualMachineId = virtualMachineId;
77+
this.virtualMachineId.setValue(virtualMachineId);
7778
}
7879

7980
public String getVirtualMachineName() {

api/src/com/cloud/api/response/IsoVmResponse.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
*/
1818
package com.cloud.api.response;
1919

20+
import com.cloud.api.IdentityProxy;
2021
import com.cloud.serializer.Param;
2122
import com.google.gson.annotations.SerializedName;
2223

2324
public class IsoVmResponse extends BaseResponse {
2425
@SerializedName("id") @Param(description="the ISO ID")
25-
private long id;
26+
private IdentityProxy id = new IdentityProxy("vm_template");
2627

2728
@SerializedName("name") @Param(description="the ISO name")
2829
private String name;
@@ -37,13 +38,13 @@ public class IsoVmResponse extends BaseResponse {
3738
private Boolean featured;
3839

3940
@SerializedName("ostypeid") @Param(description="the ID of the OS type for this template.")
40-
private Long osTypeId;
41+
private IdentityProxy osTypeId = new IdentityProxy("guest_os");
4142

4243
@SerializedName("ostypename") @Param(description="the name of the OS type for this template.")
4344
private String osTypeName;
4445

4546
@SerializedName("virtualmachineid") @Param(description="id of the virtual machine")
46-
private Long virtualMachineId;
47+
private IdentityProxy virtualMachineId = new IdentityProxy("vm_instance");
4748

4849
@SerializedName("vmname") @Param(description="name of the virtual machine")
4950
private String virtualMachineName;
@@ -56,11 +57,11 @@ public class IsoVmResponse extends BaseResponse {
5657

5758

5859
public Long getOsTypeId() {
59-
return osTypeId;
60+
return osTypeId.getValue();
6061
}
6162

6263
public void setOsTypeId(Long osTypeId) {
63-
this.osTypeId = osTypeId;
64+
this.osTypeId.setValue(osTypeId);
6465
}
6566

6667
public String getOsTypeName() {
@@ -71,12 +72,12 @@ public void setOsTypeName(String osTypeName) {
7172
this.osTypeName = osTypeName;
7273
}
7374

74-
public long getId() {
75-
return id;
75+
public Long getId() {
76+
return id.getValue();
7677
}
7778

78-
public void setId(long id) {
79-
this.id = id;
79+
public void setId(Long id) {
80+
this.id.setValue(id);
8081
}
8182

8283
public String getName() {
@@ -112,11 +113,11 @@ public void setFeatured(Boolean featured) {
112113
}
113114

114115
public Long getVirtualMachineId() {
115-
return virtualMachineId;
116+
return virtualMachineId.getValue();
116117
}
117118

118119
public void setVirtualMachineId(Long virtualMachineId) {
119-
this.virtualMachineId = virtualMachineId;
120+
this.virtualMachineId.setValue(virtualMachineId);
120121
}
121122

122123
public String getVirtualMachineName() {

api/src/com/cloud/api/response/NicResponse.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@
1717
*/
1818
package com.cloud.api.response;
1919

20+
import com.cloud.api.IdentityProxy;
2021
import com.cloud.serializer.Param;
2122
import com.google.gson.annotations.SerializedName;
2223

2324
public class NicResponse extends BaseResponse {
2425

2526
@SerializedName("id") @Param(description="the ID of the nic")
26-
private Long id;
27+
private IdentityProxy id = new IdentityProxy("nics");
2728

2829
@SerializedName("networkid") @Param(description="the ID of the corresponding network")
29-
private Long networkid;
30+
private IdentityProxy networkid = new IdentityProxy("networks");
3031

3132
@SerializedName("netmask") @Param(description="the netmask of the nic")
3233
private String netmask;
@@ -56,19 +57,19 @@ public class NicResponse extends BaseResponse {
5657
private String macAddress;
5758

5859
public Long getId() {
59-
return id;
60+
return id.getValue();
6061
}
6162

6263
public void setId(Long id) {
63-
this.id = id;
64+
this.id.setValue(id);
6465
}
6566

6667
public Long getNetworkid() {
67-
return networkid;
68+
return networkid.getValue();
6869
}
6970

7071
public void setNetworkid(Long networkid) {
71-
this.networkid = networkid;
72+
this.networkid.setValue(networkid);
7273
}
7374

7475
public String getNetmask() {

0 commit comments

Comments
 (0)