api: Display VPC name to which the network belongs to (#4483)

* Display VPC name to which the network belongs to

If an isolated network is created in VPC then display
its name along with vpc id which is used for UI

* Change description
This commit is contained in:
Rakesh 2020-11-20 21:50:40 +01:00 committed by GitHub
parent dfa09fc856
commit 0a2a54aeba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -190,6 +190,10 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
@Param(description = "VPC the network belongs to")
private String vpcId;
@SerializedName(ApiConstants.VPC_NAME)
@Param(description = "Name of the VPC to which this network belongs", since = "4.15")
private String vpcName;
@SerializedName(ApiConstants.CAN_USE_FOR_DEPLOY)
@Param(description = "list networks available for vm deployment")
private Boolean canUseForDeploy;
@ -470,4 +474,12 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
public void setRedundantRouter(Boolean redundantRouter) {
this.redundantRouter = redundantRouter;
}
public String getVpcName() {
return vpcName;
}
public void setVpcName(String vpcName) {
this.vpcName = vpcName;
}
}

View File

@ -2262,6 +2262,7 @@ public class ApiResponseHelper implements ResponseGenerator {
Vpc vpc = ApiDBUtils.findVpcById(network.getVpcId());
if (vpc != null) {
response.setVpcId(vpc.getUuid());
response.setVpcName(vpc.getName());
}
}
response.setCanUseForDeploy(ApiDBUtils.canUseForDeploy(network));