Skip to content

Commit 7161591

Browse files
committed
Adding missing fields
1 parent 97f21c1 commit 7161591

10 files changed

Lines changed: 76 additions & 2 deletions

File tree

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ public class ApiConstants {
326326
public static final String TARGET_IQN = "targetiqn";
327327
public static final String TEMPLATE_FILTER = "templatefilter";
328328
public static final String TEMPLATE_ID = "templateid";
329+
public static final String TEMPLATE_NAME = "templatename";
329330
public static final String ISO_ID = "isoid";
330331
public static final String TIMEOUT = "timeout";
331332
public static final String TIMEZONE = "timezone";
@@ -566,8 +567,10 @@ public class ApiConstants {
566567
public static final String END_POINT = "endpoint";
567568
public static final String REGION_ID = "regionid";
568569
public static final String VPC_OFF_ID = "vpcofferingid";
570+
public static final String VPC_OFF_NAME = "vpcofferingname";
569571
public static final String NETWORK = "network";
570572
public static final String VPC_ID = "vpcid";
573+
public static final String VPC_NAME = "vpcname";
571574
public static final String GATEWAY_ID = "gatewayid";
572575
public static final String CAN_USE_FOR_DEPLOY = "canusefordeploy";
573576
public static final String RESOURCE_IDS = "resourceids";

api/src/main/java/org/apache/cloudstack/api/response/DomainRouterResponse.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
7777
@Param(description = "the Pod ID for the router")
7878
private String podId;
7979

80+
@SerializedName(ApiConstants.POD_NAME)
81+
@Param(description = "the Pod name for the router")
82+
private String podName;
83+
8084
@SerializedName(ApiConstants.HOST_ID)
8185
@Param(description = "the host ID for the router")
8286
private String hostId;
@@ -145,6 +149,10 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
145149
@Param(description = "the template ID for the router")
146150
private String templateId;
147151

152+
@SerializedName(ApiConstants.TEMPLATE_NAME)
153+
@Param(description = "the template name for the router")
154+
private String templateName;
155+
148156
@SerializedName(ApiConstants.CREATED)
149157
@Param(description = "the date and time the router was created")
150158
private Date created;
@@ -266,6 +274,10 @@ public void setPodId(String podId) {
266274
this.podId = podId;
267275
}
268276

277+
public void setPodName(String podName) {
278+
this.podName = podName;
279+
}
280+
269281
public void setHostId(String hostId) {
270282
this.hostId = hostId;
271283
}
@@ -310,6 +322,10 @@ public void setTemplateId(String templateId) {
310322
this.templateId = templateId;
311323
}
312324

325+
public void setTemplateName(String templateName) {
326+
this.templateName = templateName;
327+
}
328+
313329
public void setCreated(Date created) {
314330
this.created = created;
315331
}

api/src/main/java/org/apache/cloudstack/api/response/IPAddressResponse.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,13 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
136136
private String purpose;
137137

138138
@SerializedName(ApiConstants.VPC_ID)
139-
@Param(description = "VPC the ip belongs to")
139+
@Param(description = "VPC id the ip belongs to")
140140
private String vpcId;
141+
142+
@SerializedName(ApiConstants.VPC_NAME)
143+
@Param(description = "VPC name the ip belongs to")
144+
private String vpcName;
145+
141146
@SerializedName(ApiConstants.TAGS)
142147
@Param(description = "the list of resource tags associated with ip address", responseObject = ResourceTagResponse.class)
143148
private List<ResourceTagResponse> tags;
@@ -273,6 +278,10 @@ public void setVpcId(String vpcId) {
273278
this.vpcId = vpcId;
274279
}
275280

281+
public void setVpcName(String vpcName) {
282+
this.vpcName = vpcName;
283+
}
284+
276285
public void setTags(List<ResourceTagResponse> tags) {
277286
this.tags = tags;
278287
}

api/src/main/java/org/apache/cloudstack/api/response/PrivateGatewayResponse.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,13 @@ public class PrivateGatewayResponse extends BaseResponse implements ControlledEn
5858
private String broadcastUri;
5959

6060
@SerializedName(ApiConstants.VPC_ID)
61-
@Param(description = "VPC the private gateaway belongs to")
61+
@Param(description = "VPC id the private gateway belongs to")
6262
private String vpcId;
6363

64+
@SerializedName(ApiConstants.VPC_NAME)
65+
@Param(description = "VPC name the private gateway belongs to")
66+
private String vpcName;
67+
6468
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
6569
@Param(description = "the physical network id")
6670
private String physicalNetworkId;
@@ -130,6 +134,10 @@ public void setVpcId(String vpcId) {
130134
this.vpcId = vpcId;
131135
}
132136

137+
public void setVpcName(String vpcName) {
138+
this.vpcName = vpcName;
139+
}
140+
133141
public void setAddress(String address) {
134142
this.address = address;
135143
}

api/src/main/java/org/apache/cloudstack/api/response/Site2SiteVpnGatewayResponse.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ public class Site2SiteVpnGatewayResponse extends BaseResponse implements Control
4242
@Param(description = "the vpc id of this gateway")
4343
private String vpcId;
4444

45+
@SerializedName(ApiConstants.VPC_NAME)
46+
@Param(description = "the vpc name of this gateway")
47+
private String vpcName;
48+
4549
@SerializedName(ApiConstants.ACCOUNT)
4650
@Param(description = "the owner")
4751
private String accountName;
@@ -82,6 +86,10 @@ public void setVpcId(String vpcId) {
8286
this.vpcId = vpcId;
8387
}
8488

89+
public void setVpcName(String vpcName) {
90+
this.vpcName = vpcName;
91+
}
92+
8593
public void setRemoved(Date removed) {
8694
this.removed = removed;
8795
}

api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
290290
@Param(description = "OS type id of the vm", since = "4.4")
291291
private String osTypeId;
292292

293+
@SerializedName(ApiConstants.OS_DISPLAY_NAME)
294+
@Param(description = "OS name of the vm", since = "4.13.2")
295+
private String osDisplayName;
296+
293297
public UserVmResponse() {
294298
securityGroupList = new LinkedHashSet<SecurityGroupResponse>();
295299
nics = new LinkedHashSet<NicResponse>();
@@ -822,6 +826,10 @@ public void setOsTypeId(String osTypeId) {
822826
this.osTypeId = osTypeId;
823827
}
824828

829+
public void setOsDisplayName(String osDisplayName) {
830+
this.osDisplayName = osDisplayName;
831+
}
832+
825833
public Set<Long> getTagIds() {
826834
return tagIds;
827835
}
@@ -849,4 +857,8 @@ public void setDynamicallyScalable(Boolean dynamicallyScalable) {
849857
public String getOsTypeId() {
850858
return osTypeId;
851859
}
860+
861+
public String getOsDisplayName() {
862+
return osDisplayName;
863+
}
852864
}

api/src/main/java/org/apache/cloudstack/api/response/VpcResponse.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ public class VpcResponse extends BaseResponse implements ControlledEntityRespons
6767
@Param(description = "vpc offering id the VPC is created from")
6868
private String vpcOfferingId;
6969

70+
@SerializedName(ApiConstants.VPC_OFF_NAME)
71+
@Param(description = "vpc offering name the VPC is created from")
72+
private String vpcOfferingName;
73+
7074
@SerializedName(ApiConstants.CREATED)
7175
@Param(description = "the date this VPC was created")
7276
private Date created;
@@ -184,6 +188,10 @@ public void setVpcOfferingId(final String vpcOfferingId) {
184188
this.vpcOfferingId = vpcOfferingId;
185189
}
186190

191+
public void setVpcOfferingName(final String vpcOfferingName) {
192+
this.vpcOfferingName = vpcOfferingName;
193+
}
194+
187195
public List<NetworkResponse> getNetworks() {
188196
return networks;
189197
}

server/src/main/java/com/cloud/api/ApiResponseHelper.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,7 @@ public IPAddressResponse createIPAddressResponse(ResponseView view, IpAddress ip
860860
Vpc vpc = ApiDBUtils.findVpcById(ipAddr.getVpcId());
861861
if (vpc != null) {
862862
ipResponse.setVpcId(vpc.getUuid());
863+
ipResponse.setVpcName(vpc.getName());
863864
}
864865
}
865866

@@ -2884,6 +2885,7 @@ public VpcResponse createVpcResponse(ResponseView view, Vpc vpc) {
28842885
VpcOffering voff = ApiDBUtils.findVpcOfferingById(vpc.getVpcOfferingId());
28852886
if (voff != null) {
28862887
response.setVpcOfferingId(voff.getUuid());
2888+
response.setVpcOfferingName(voff.getName());
28872889
}
28882890
response.setCidr(vpc.getCidr());
28892891
response.setRestartRequired(vpc.isRestartRequired());
@@ -2956,6 +2958,7 @@ public PrivateGatewayResponse createPrivateGatewayResponse(PrivateGateway result
29562958
if (result.getVpcId() != null) {
29572959
Vpc vpc = ApiDBUtils.findVpcById(result.getVpcId());
29582960
response.setVpcId(vpc.getUuid());
2961+
response.setVpcName(vpc.getName());
29592962
}
29602963

29612964
DataCenter zone = ApiDBUtils.findZoneById(result.getZoneId());
@@ -3146,6 +3149,7 @@ public Site2SiteVpnGatewayResponse createSite2SiteVpnGatewayResponse(Site2SiteVp
31463149
Vpc vpc = ApiDBUtils.findVpcById(result.getVpcId());
31473150
if (vpc != null) {
31483151
response.setVpcId(vpc.getUuid());
3152+
response.setVpcName(vpc.getName());
31493153
}
31503154
response.setRemoved(result.getRemoved());
31513155
response.setForDisplay(result.isDisplay());

server/src/main/java/com/cloud/api/query/dao/DomainRouterJoinDaoImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public DomainRouterResponse newDomainRouterResponse(DomainRouterJoinVO router, A
7474
routerResponse.setZoneId(router.getDataCenterUuid());
7575
routerResponse.setName(router.getName());
7676
routerResponse.setTemplateId(router.getTemplateUuid());
77+
// routerResponse.setTemplateName(router.getTemplateId());
7778
routerResponse.setCreated(router.getCreated());
7879
routerResponse.setState(router.getState());
7980
routerResponse.setIsRedundantRouter(router.isRedundantRouter());

server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import com.cloud.api.query.vo.UserVmJoinVO;
4949
import com.cloud.gpu.GPU;
5050
import com.cloud.service.ServiceOfferingDetailsVO;
51+
import com.cloud.storage.dao.GuestOSDao;
5152
import com.cloud.user.Account;
5253
import com.cloud.user.AccountManager;
5354
import com.cloud.user.User;
@@ -77,6 +78,9 @@ public class UserVmJoinDaoImpl extends GenericDaoBaseWithTagInformation<UserVmJo
7778
private UserDao _userDao;
7879
@Inject
7980
private NicExtraDhcpOptionDao _nicExtraDhcpOptionDao;
81+
@Inject
82+
private GuestOSDao _guestOsDao;
83+
8084

8185
private final SearchBuilder<UserVmJoinVO> VmDetailSearch;
8286
private final SearchBuilder<UserVmJoinVO> activeVmByIsoSearch;
@@ -201,6 +205,7 @@ public UserVmResponse newUserVmResponse(ResponseView view, String objectName, Us
201205
userVmResponse.setPublicIp(userVm.getPublicIpAddress());
202206
userVmResponse.setKeyPairName(userVm.getKeypairName());
203207
userVmResponse.setOsTypeId(userVm.getGuestOsUuid());
208+
userVmResponse.setOsDisplayName(_guestOsDao.findById(userVm.getGuestOsId()).getDisplayName());
204209

205210
if (details.contains(VMDetails.all) || details.contains(VMDetails.stats)) {
206211
// stats calculation

0 commit comments

Comments
 (0)