mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +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
@ -70,6 +70,9 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
|
||||
@IdentityMapper(entityTableName="vpc")
|
||||
@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 ///////////////////////
|
||||
@ -106,6 +109,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
|
||||
public Long getVpcId() {
|
||||
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>();
|
||||
@ -1617,6 +1618,14 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
sb.and("podId", sb.entity().getPodIdToDeployIn(), SearchCriteria.Op.EQ);
|
||||
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();
|
||||
@ -1627,7 +1636,7 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
|
||||
sb.join("nicSearch", nicSearch, sb.entity().getId(), nicSearch.entity().getInstanceId(), JoinBuilder.JoinType.INNER);
|
||||
}
|
||||
|
||||
|
||||
SearchCriteria<DomainRouterVO> sc = sb.create();
|
||||
_accountMgr.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user