mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
VPC: added "forVpc" (boolean) parameter to listRouters call - filter by the fact if router belongs to VPC or not
This commit is contained in:
parent
234ae447ee
commit
83f566cfe7
@ -71,6 +71,9 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
|
||||
@Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, description="List networks by VPC")
|
||||
private Long vpcId;
|
||||
|
||||
@Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="if true is passed for this parameter, list only VPC routers")
|
||||
private Boolean forVpc;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -107,6 +110,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
public Boolean getForVpc() {
|
||||
return forVpc;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -1596,6 +1596,7 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
String keyword = cmd.getKeyword();
|
||||
Long networkId = cmd.getNetworkId();
|
||||
Long vpcId = cmd.getVpcId();
|
||||
Boolean forVpc = cmd.getForVpc();
|
||||
|
||||
Account caller = UserContext.current().getCaller();
|
||||
List<Long> permittedAccounts = new ArrayList<Long>();
|
||||
@ -1618,6 +1619,14 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
sb.and("hostId", sb.entity().getHostId(), SearchCriteria.Op.EQ);
|
||||
sb.and("vpcId", sb.entity().getVpcId(), SearchCriteria.Op.EQ);
|
||||
|
||||
if (forVpc != null) {
|
||||
if (forVpc) {
|
||||
sb.and("forVpc", sb.entity().getVpcId(), SearchCriteria.Op.NNULL);
|
||||
} else {
|
||||
sb.and("forVpc", sb.entity().getVpcId(), SearchCriteria.Op.NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (networkId != null) {
|
||||
SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder();
|
||||
nicSearch.and("networkId", nicSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user