api: Display network name for IP in shared networks (#4073)

In the list publicipaddress api call, display the network
name if ip is associated to shared network

Co-authored-by: Rakesh Venkatesh <r.venkatesh@global.leaseweb.com>
This commit is contained in:
Rakesh 2020-06-13 02:30:46 +02:00 committed by GitHub
parent 1fe96cc426
commit 20f9639842
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -150,6 +150,10 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
@Param(description = "is public ip for display to the regular user", since = "4.4", authorized = {RoleType.Admin})
private Boolean forDisplay;
@SerializedName(ApiConstants.NETWORK_NAME)
@Param(description="the name of the Network where ip belongs to")
private String networkName;
/*
@SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the volume")
private IdentityProxy jobId = new IdentityProxy("async_job");
@ -288,4 +292,8 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
public void setForDisplay(Boolean forDisplay) {
this.forDisplay = forDisplay;
}
public void setNetworkName(String networkName) {
this.networkName = networkName;
}
}

View File

@ -894,6 +894,7 @@ public class ApiResponseHelper implements ResponseGenerator {
NetworkVO nw = ApiDBUtils.findNetworkById(networkId);
if (nw != null) {
ipResponse.setNetworkId(nw.getUuid());
ipResponse.setNetworkName(nw.getName());
}
}
ipResponse.setState(ipAddr.getState().toString());