mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
Merge pull request #12793 from ioito/hotfix/qx-network-filter-by-route-table
fix(region): add route table filter for networks
This commit is contained in:
@@ -78,6 +78,9 @@ type NetworkListInput struct {
|
||||
|
||||
UsableResourceListInput
|
||||
|
||||
// filter by route table which associate with it
|
||||
RouteTableId string `json:"route_table_id"`
|
||||
|
||||
// description: Exact matching ip address in network.
|
||||
// example: 10.168.222.1
|
||||
Ip string `json:"ip"`
|
||||
|
||||
@@ -2057,6 +2057,11 @@ func (manager *SNetworkManager) ListItemFilter(
|
||||
return nil, errors.Wrap(err, "SWireResourceBaseManager.ListItemFilter")
|
||||
}
|
||||
|
||||
if len(input.RouteTableId) > 0 {
|
||||
sq := RouteTableAssociationManager.Query("associated_resource_id").Equals("route_table_id", input.RouteTableId).Equals("association_type", string(cloudprovider.RouteTableAssociaToSubnet))
|
||||
q = q.In("id", sq.SubQuery())
|
||||
}
|
||||
|
||||
if input.Usable != nil && *input.Usable {
|
||||
regions := CloudregionManager.Query("id").Equals("status", api.CLOUD_REGION_STATUS_INSERVER)
|
||||
zones := ZoneManager.Query("id").Equals("status", api.ZONE_ENABLE).In("cloudregion_id", regions)
|
||||
|
||||
@@ -44,8 +44,9 @@ type NetworkListOptions struct {
|
||||
GuestIpStart []string `help:"search by guest_ip_start"`
|
||||
GuestIpEnd []string `help:"search by guest_ip_end"`
|
||||
|
||||
BgpType []string `help:"filter by bgp_type"`
|
||||
HostType string `help:"filter by host_type"`
|
||||
BgpType []string `help:"filter by bgp_type"`
|
||||
HostType string `help:"filter by host_type"`
|
||||
RouteTableId string `help:"Filter by RouteTable"`
|
||||
}
|
||||
|
||||
func (opts *NetworkListOptions) GetContextId() string {
|
||||
|
||||
Reference in New Issue
Block a user