Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ public class ApiConstants {
public static final String TARGET_IQN = "targetiqn";
public static final String TEMPLATE_FILTER = "templatefilter";
public static final String TEMPLATE_ID = "templateid";
public static final String TEMPLATE_NAME = "templatename";
public static final String ISO_ID = "isoid";
public static final String TIMEOUT = "timeout";
public static final String TIMEZONE = "timezone";
Expand Down Expand Up @@ -566,8 +567,10 @@ public class ApiConstants {
public static final String END_POINT = "endpoint";
public static final String REGION_ID = "regionid";
public static final String VPC_OFF_ID = "vpcofferingid";
public static final String VPC_OFF_NAME = "vpcofferingname";
public static final String NETWORK = "network";
public static final String VPC_ID = "vpcid";
public static final String VPC_NAME = "vpcname";
public static final String GATEWAY_ID = "gatewayid";
public static final String CAN_USE_FOR_DEPLOY = "canusefordeploy";
public static final String RESOURCE_IDS = "resourceids";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
@Param(description = "the Pod ID for the router")
private String podId;

@SerializedName(ApiConstants.POD_NAME)
@Param(description = "the Pod name for the router", since = "4.13.2")
private String podName;

@SerializedName(ApiConstants.HOST_ID)
@Param(description = "the host ID for the router")
private String hostId;
Expand Down Expand Up @@ -145,6 +149,10 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
@Param(description = "the template ID for the router")
private String templateId;

@SerializedName(ApiConstants.TEMPLATE_NAME)
@Param(description = "the template name for the router", since = "4.13.2")
private String templateName;

@SerializedName(ApiConstants.CREATED)
@Param(description = "the date and time the router was created")
private Date created;
Expand Down Expand Up @@ -266,6 +274,10 @@ public void setPodId(String podId) {
this.podId = podId;
}

public void setPodName(String podName) {
this.podName = podName;
}

public void setHostId(String hostId) {
this.hostId = hostId;
}
Expand Down Expand Up @@ -310,6 +322,10 @@ public void setTemplateId(String templateId) {
this.templateId = templateId;
}

public void setTemplateName(String templateName) {
this.templateName = templateName;
}

public void setCreated(Date created) {
this.created = created;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,13 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
private String purpose;

@SerializedName(ApiConstants.VPC_ID)
@Param(description = "VPC the ip belongs to")
@Param(description = "VPC id the ip belongs to")
private String vpcId;

@SerializedName(ApiConstants.VPC_NAME)
@Param(description = "VPC name the ip belongs to", since = "4.13.2")
private String vpcName;

@SerializedName(ApiConstants.TAGS)
@Param(description = "the list of resource tags associated with ip address", responseObject = ResourceTagResponse.class)
private List<ResourceTagResponse> tags;
Expand Down Expand Up @@ -273,6 +278,10 @@ public void setVpcId(String vpcId) {
this.vpcId = vpcId;
}

public void setVpcName(String vpcName) {
this.vpcName = vpcName;
}

public void setTags(List<ResourceTagResponse> tags) {
this.tags = tags;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@ public class PrivateGatewayResponse extends BaseResponse implements ControlledEn
private String broadcastUri;

@SerializedName(ApiConstants.VPC_ID)
@Param(description = "VPC the private gateaway belongs to")
@Param(description = "VPC id the private gateway belongs to")
private String vpcId;

@SerializedName(ApiConstants.VPC_NAME)
@Param(description = "VPC name the private gateway belongs to", since = "4.13.2")
private String vpcName;

@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
@Param(description = "the physical network id")
private String physicalNetworkId;
Expand Down Expand Up @@ -130,6 +134,10 @@ public void setVpcId(String vpcId) {
this.vpcId = vpcId;
}

public void setVpcName(String vpcName) {
this.vpcName = vpcName;
}

public void setAddress(String address) {
this.address = address;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public class Site2SiteVpnGatewayResponse extends BaseResponse implements Control
@Param(description = "the vpc id of this gateway")
private String vpcId;

@SerializedName(ApiConstants.VPC_NAME)
@Param(description = "the vpc name of this gateway", since = "4.13.2")
private String vpcName;

@SerializedName(ApiConstants.ACCOUNT)
@Param(description = "the owner")
private String accountName;
Expand Down Expand Up @@ -82,6 +86,10 @@ public void setVpcId(String vpcId) {
this.vpcId = vpcId;
}

public void setVpcName(String vpcName) {
this.vpcName = vpcName;
}

public void setRemoved(Date removed) {
this.removed = removed;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ public class SystemVmResponse extends BaseResponse {
@Param(description = "the Pod ID for the system VM")
private String podId;

@SerializedName("podname")
@Param(description = "the Pod name for the system VM", since = "4.13.2")
private String podName;

@SerializedName("hostid")
@Param(description = "the host ID for the system VM")
private String hostId;
Expand Down Expand Up @@ -130,6 +134,10 @@ public class SystemVmResponse extends BaseResponse {
@Param(description = "the template ID for the system VM")
private String templateId;

@SerializedName("templatename")
@Param(description = "the template name for the system VM", since = "4.13.2")
private String templateName;

@SerializedName("created")
@Param(description = "the date and time the system VM was created")
private Date created;
Expand Down Expand Up @@ -243,10 +251,18 @@ public String getPodId() {
return podId;
}

public String getPodName() {
return podName;
}

public void setPodId(String podId) {
this.podId = podId;
}

public void setPodName(String podName) {
this.podName = podName;
}

public String getHostId() {
return hostId;
}
Expand Down Expand Up @@ -323,10 +339,18 @@ public String getTemplateId() {
return templateId;
}

public String getTemplateName() {
return templateName;
}

public void setTemplateId(String templateId) {
this.templateId = templateId;
}

public void setTemplateName(String templateName) {
this.templateName = templateName;
}

public Date getCreated() {
return created;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
@Param(description = "OS type id of the vm", since = "4.4")
private String osTypeId;

@SerializedName(ApiConstants.OS_DISPLAY_NAME)
@Param(description = "OS name of the vm", since = "4.13.2")
private String osDisplayName;

public UserVmResponse() {
securityGroupList = new LinkedHashSet<SecurityGroupResponse>();
nics = new LinkedHashSet<NicResponse>();
Expand Down Expand Up @@ -822,6 +826,10 @@ public void setOsTypeId(String osTypeId) {
this.osTypeId = osTypeId;
}

public void setOsDisplayName(String osDisplayName) {
this.osDisplayName = osDisplayName;
}

public Set<Long> getTagIds() {
return tagIds;
}
Expand Down Expand Up @@ -849,4 +857,8 @@ public void setDynamicallyScalable(Boolean dynamicallyScalable) {
public String getOsTypeId() {
return osTypeId;
}

public String getOsDisplayName() {
return osDisplayName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public class VpcResponse extends BaseResponse implements ControlledEntityRespons
@Param(description = "vpc offering id the VPC is created from")
private String vpcOfferingId;

@SerializedName(ApiConstants.VPC_OFF_NAME)
@Param(description = "vpc offering name the VPC is created from", since = "4.13.2")
private String vpcOfferingName;

@SerializedName(ApiConstants.CREATED)
@Param(description = "the date this VPC was created")
private Date created;
Expand Down Expand Up @@ -184,6 +188,10 @@ public void setVpcOfferingId(final String vpcOfferingId) {
this.vpcOfferingId = vpcOfferingId;
}

public void setVpcOfferingName(final String vpcOfferingName) {
this.vpcOfferingName = vpcOfferingName;
}

public List<NetworkResponse> getNetworks() {
return networks;
}
Expand Down
6 changes: 6 additions & 0 deletions server/src/main/java/com/cloud/api/ApiResponseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ public IPAddressResponse createIPAddressResponse(ResponseView view, IpAddress ip
Vpc vpc = ApiDBUtils.findVpcById(ipAddr.getVpcId());
if (vpc != null) {
ipResponse.setVpcId(vpc.getUuid());
ipResponse.setVpcName(vpc.getName());
}
}

Expand Down Expand Up @@ -1361,11 +1362,13 @@ public SystemVmResponse createSystemVmResponse(VirtualMachine vm) {
HostPodVO pod = ApiDBUtils.findPodById(vm.getPodIdToDeployIn());
if (pod != null) {
vmResponse.setPodId(pod.getUuid());
vmResponse.setPodName(pod.getName());
}
}
VMTemplateVO template = ApiDBUtils.findTemplateById(vm.getTemplateId());
if (template != null) {
vmResponse.setTemplateId(template.getUuid());
vmResponse.setTemplateName(template.getName());
}
vmResponse.setCreated(vm.getCreated());

Expand Down Expand Up @@ -2884,6 +2887,7 @@ public VpcResponse createVpcResponse(ResponseView view, Vpc vpc) {
VpcOffering voff = ApiDBUtils.findVpcOfferingById(vpc.getVpcOfferingId());
if (voff != null) {
response.setVpcOfferingId(voff.getUuid());
response.setVpcOfferingName(voff.getName());
}
response.setCidr(vpc.getCidr());
response.setRestartRequired(vpc.isRestartRequired());
Expand Down Expand Up @@ -2956,6 +2960,7 @@ public PrivateGatewayResponse createPrivateGatewayResponse(PrivateGateway result
if (result.getVpcId() != null) {
Vpc vpc = ApiDBUtils.findVpcById(result.getVpcId());
response.setVpcId(vpc.getUuid());
response.setVpcName(vpc.getName());
}

DataCenter zone = ApiDBUtils.findZoneById(result.getZoneId());
Expand Down Expand Up @@ -3146,6 +3151,7 @@ public Site2SiteVpnGatewayResponse createSite2SiteVpnGatewayResponse(Site2SiteVp
Vpc vpc = ApiDBUtils.findVpcById(result.getVpcId());
if (vpc != null) {
response.setVpcId(vpc.getUuid());
response.setVpcName(vpc.getName());
}
response.setRemoved(result.getRemoved());
response.setForDisplay(result.isDisplay());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.utils.CloudStackVersion;

import com.cloud.api.ApiDBUtils;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.query.vo.DomainRouterJoinVO;
import com.cloud.dc.HostPodVO;
import com.cloud.network.Networks.TrafficType;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.router.VirtualRouter.Role;
import com.cloud.storage.VMTemplateVO;
import com.cloud.user.Account;
import com.cloud.user.AccountManager;
import com.cloud.utils.db.GenericDaoBase;
Expand All @@ -46,7 +49,7 @@ public class DomainRouterJoinDaoImpl extends GenericDaoBase<DomainRouterJoinVO,
public static final Logger s_logger = Logger.getLogger(DomainRouterJoinDaoImpl.class);

@Inject
private ConfigurationDao _configDao;
private ConfigurationDao _configDao;
@Inject
public AccountManager _accountMgr;

Expand Down Expand Up @@ -74,6 +77,10 @@ public DomainRouterResponse newDomainRouterResponse(DomainRouterJoinVO router, A
routerResponse.setZoneId(router.getDataCenterUuid());
routerResponse.setName(router.getName());
routerResponse.setTemplateId(router.getTemplateUuid());
VMTemplateVO template = ApiDBUtils.findTemplateById(router.getTemplateId());
if (template != null) {
routerResponse.setTemplateName(template.getName());
}
routerResponse.setCreated(router.getCreated());
routerResponse.setState(router.getState());
routerResponse.setIsRedundantRouter(router.isRedundantRouter());
Expand All @@ -98,6 +105,10 @@ public DomainRouterResponse newDomainRouterResponse(DomainRouterJoinVO router, A
routerResponse.setHypervisor(router.getHypervisorType().toString());
}
routerResponse.setPodId(router.getPodUuid());
HostPodVO pod = ApiDBUtils.findPodById(router.getPodId());
if (pod != null) {
routerResponse.setPodName(pod.getName());
}
long nic_id = router.getNicId();
if (nic_id > 0) {
TrafficType ty = router.getTrafficType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import com.cloud.api.query.vo.UserVmJoinVO;
import com.cloud.gpu.GPU;
import com.cloud.service.ServiceOfferingDetailsVO;
import com.cloud.storage.GuestOS;
import com.cloud.user.Account;
import com.cloud.user.AccountManager;
import com.cloud.user.User;
Expand All @@ -68,7 +69,7 @@ public class UserVmJoinDaoImpl extends GenericDaoBaseWithTagInformation<UserVmJo
public static final Logger s_logger = Logger.getLogger(UserVmJoinDaoImpl.class);

@Inject
private ConfigurationDao _configDao;
private ConfigurationDao _configDao;
@Inject
public AccountManager _accountMgr;
@Inject
Expand Down Expand Up @@ -201,6 +202,10 @@ public UserVmResponse newUserVmResponse(ResponseView view, String objectName, Us
userVmResponse.setPublicIp(userVm.getPublicIpAddress());
userVmResponse.setKeyPairName(userVm.getKeypairName());
userVmResponse.setOsTypeId(userVm.getGuestOsUuid());
GuestOS guestOS = ApiDBUtils.findGuestOSById(userVm.getGuestOsId());
if (guestOS != null) {
userVmResponse.setOsDisplayName(guestOS.getDisplayName());
}

if (details.contains(VMDetails.all) || details.contains(VMDetails.stats)) {
// stats calculation
Expand Down