mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
PublicIpAddress api response: new parameter "associatednetworkname" - the name of the guest network associated with the ip address
Reviewed-by: Frank Zhang Conflicts: api/src/com/cloud/api/ApiConstants.java server/src/com/cloud/api/ApiResponseHelper.java
This commit is contained in:
parent
2bf5c99bc6
commit
e252de4999
@ -317,6 +317,7 @@ public class ApiConstants {
|
||||
public static final String FIREWALL_DEVICE_DEDICATED = "fwdevicededicated";
|
||||
public static final String SERVICE = "service";
|
||||
public static final String ASSOCIATED_NETWORK_ID = "associatednetworkid";
|
||||
public static final String ASSOCIATED_NETWORK_NAME = "associatednetworkname";
|
||||
public static final String SOURCE_NAT_SUPPORTED = "sourcenatsupported";
|
||||
public static final String RESOURCE_STATE = "resourcestate";
|
||||
public static final String PROJECT_INVITE_REQUIRED = "projectinviterequired";
|
||||
|
||||
@ -86,6 +86,9 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
|
||||
@SerializedName(ApiConstants.ASSOCIATED_NETWORK_ID) @Param(description="the ID of the Network associated with the IP address")
|
||||
private IdentityProxy associatedNetworkId = new IdentityProxy("networks");
|
||||
|
||||
@SerializedName(ApiConstants.ASSOCIATED_NETWORK_NAME) @Param(description="the name of the Network associated with the IP address")
|
||||
private String associatedNetworkName;
|
||||
|
||||
@SerializedName(ApiConstants.NETWORK_ID) @Param(description="the ID of the Network where ip belongs to")
|
||||
private IdentityProxy networkId = new IdentityProxy("networks");
|
||||
|
||||
@ -226,4 +229,8 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
|
||||
public void setTags(List<ResourceTagResponse> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public void setAssociatedNetworkName(String associatedNetworkName) {
|
||||
this.associatedNetworkName = associatedNetworkName;
|
||||
}
|
||||
}
|
||||
|
||||
@ -806,7 +806,12 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
ipResponse.setAssociatedNetworkId(ipAddr.getAssociatedWithNetworkId());
|
||||
if (ipAddr.getAssociatedWithNetworkId() != null) {
|
||||
Network ntwk = ApiDBUtils.findNetworkById(ipAddr.getAssociatedWithNetworkId());
|
||||
ipResponse.setAssociatedNetworkId(ipAddr.getAssociatedWithNetworkId());
|
||||
ipResponse.setAssociatedNetworkName(ntwk.getName());
|
||||
}
|
||||
|
||||
ipResponse.setVpcId(ipAddr.getVpcId());
|
||||
|
||||
// Network id the ip is associated with (if associated networkId is null, try to get this information from vlan)
|
||||
@ -3918,4 +3923,4 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
response.setObjectName("vpnconnection");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user