mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 14156: return instancename parameter in userVm response to ROOT admin only
This commit is contained in:
parent
fb141dd5ef
commit
f3935d667f
@ -332,6 +332,7 @@ public class ApiConstants {
|
||||
public static final String CHANGE_CIDR = "changecidr";
|
||||
public static final String PURPOSE = "purpose";
|
||||
public static final String IS_TAGGED = "istagged";
|
||||
public static final String INSTANCE_NAME = "instancename";
|
||||
|
||||
public enum HostDetails {
|
||||
all, capacity, events, stats, min;
|
||||
|
||||
@ -152,6 +152,9 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
|
||||
|
||||
@SerializedName(ApiConstants.PUBLIC_IP) @Param(description="public IP address id associated with vm via Static nat rule")
|
||||
private String publicIp;
|
||||
|
||||
@SerializedName(ApiConstants.INSTANCE_NAME) @Param(description="instance name of the user vm; this parameter is returned to the ROOT admin only")
|
||||
private String instanceName;
|
||||
|
||||
public void setHypervisor(String hypervisor) {
|
||||
this.hypervisor = hypervisor;
|
||||
@ -335,4 +338,8 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
|
||||
public void setPublicIp(String publicIp) {
|
||||
this.publicIp = publicIp;
|
||||
}
|
||||
|
||||
public void setInstanceName(String instanceName) {
|
||||
this.instanceName = instanceName;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1268,7 +1268,12 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
} else {
|
||||
userVmResponse.setDisplayName(userVm.getHostName());
|
||||
}
|
||||
|
||||
|
||||
if (caller.getType() == Account.ACCOUNT_TYPE_ADMIN) {
|
||||
userVmResponse.setInstanceName(userVm.getInstanceName());
|
||||
}
|
||||
|
||||
|
||||
if (userVm.getPassword() != null) {
|
||||
userVmResponse.setPassword(userVm.getPassword());
|
||||
}
|
||||
@ -2904,6 +2909,8 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
} else {
|
||||
userVmData.setDisplayName(userVm.getHostName());
|
||||
}
|
||||
userVmData.setInstanceName(userVm.getInstanceName());
|
||||
|
||||
userVmData.setDomainId(userVm.getDomainId());
|
||||
|
||||
Account caller = UserContext.current().getCaller();
|
||||
@ -2939,6 +2946,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
userVmResponse.setZoneId(userVmData.getZoneId());
|
||||
userVmResponse.setZoneName(userVmData.getZoneName());
|
||||
if (caller_is_admin) {
|
||||
userVmResponse.setInstanceName(userVmData.getInstanceName());
|
||||
userVmResponse.setHostId(userVmData.getHostId());
|
||||
userVmResponse.setHostName(userVmData.getHostName());
|
||||
}
|
||||
|
||||
@ -70,6 +70,7 @@ public class UserVmData {
|
||||
private long accountId;
|
||||
private Long publicIpId;
|
||||
private String publicIp;
|
||||
private String instanceName;
|
||||
|
||||
private boolean initialized;
|
||||
|
||||
@ -701,6 +702,14 @@ public class UserVmData {
|
||||
|
||||
public void setPublicIp(String publicIp) {
|
||||
this.publicIp = publicIp;
|
||||
}
|
||||
}
|
||||
|
||||
public String getInstanceName() {
|
||||
return instanceName;
|
||||
}
|
||||
|
||||
public void setInstanceName(String instanceName) {
|
||||
this.instanceName = instanceName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user