You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2012/08/22 00:39:54 UTC
[2/6] git commit: PublicIpAddress api response: new parameter
"associatednetworkname" - the name of the guest network associated with the
ip address Reviewed-by: Frank Zhang
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
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/e252de49
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/e252de49
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/e252de49
Branch: refs/heads/master
Commit: e252de49993c98619c67d198a3bd87ec001a4c66
Parents: 2bf5c99
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Tue Aug 21 10:51:32 2012 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Tue Aug 21 15:35:40 2012 -0700
----------------------------------------------------------------------
api/src/com/cloud/api/ApiConstants.java | 1 +
.../com/cloud/api/response/IPAddressResponse.java | 7 +++++++
server/src/com/cloud/api/ApiResponseHelper.java | 9 +++++++--
3 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e252de49/api/src/com/cloud/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/ApiConstants.java b/api/src/com/cloud/api/ApiConstants.java
index 825e276..425b9fb 100755
--- a/api/src/com/cloud/api/ApiConstants.java
+++ b/api/src/com/cloud/api/ApiConstants.java
@@ -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";
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e252de49/api/src/com/cloud/api/response/IPAddressResponse.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/response/IPAddressResponse.java b/api/src/com/cloud/api/response/IPAddressResponse.java
index da73b69..a9c1769 100644
--- a/api/src/com/cloud/api/response/IPAddressResponse.java
+++ b/api/src/com/cloud/api/response/IPAddressResponse.java
@@ -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;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e252de49/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index a0a4c17..7334488 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -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;
}
-}
\ No newline at end of file
+}