mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
feat(region): add host_type filter for listing wires
This commit is contained in:
@@ -90,7 +90,8 @@ type WireListInput struct {
|
||||
|
||||
HostResourceInput
|
||||
|
||||
Bandwidth *int `json:"bandwidth"`
|
||||
Bandwidth *int `json:"bandwidth"`
|
||||
HostType string `json:"host_type"`
|
||||
}
|
||||
|
||||
type WireMergeInput struct {
|
||||
|
||||
@@ -1301,6 +1301,12 @@ func (manager *SWireManager) ListItemFilter(
|
||||
sq := HostwireManager.Query("wire_id").Equals("host_id", hostObj.GetId())
|
||||
q = q.Filter(sqlchemy.In(q.Field("id"), sq.SubQuery()))
|
||||
}
|
||||
if len(query.HostType) > 0 {
|
||||
hs := HostManager.Query("id").Equals("host_type", query.HostType).SubQuery()
|
||||
sq := HostwireManager.Query("wire_id")
|
||||
sq = sq.Join(hs, sqlchemy.Equals(sq.Field("host_id"), hs.Field("id")))
|
||||
q = q.Filter(sqlchemy.In(q.Field("id"), sq.SubQuery()))
|
||||
}
|
||||
|
||||
if query.Bandwidth != nil {
|
||||
q = q.Equals("bandwidth", *query.Bandwidth)
|
||||
|
||||
@@ -21,10 +21,11 @@ type WireListOptions struct {
|
||||
|
||||
Bandwidth *int `help:"List wires by bandwidth"`
|
||||
|
||||
Region string `help:"List wires in region"`
|
||||
Zone string `help:"list wires in zone" json:"-"`
|
||||
Vpc string `help:"List wires in vpc"`
|
||||
Host string `help:"List wires attached to a host"`
|
||||
Region string `help:"List wires in region"`
|
||||
Zone string `help:"list wires in zone" json:"-"`
|
||||
Vpc string `help:"List wires in vpc"`
|
||||
Host string `help:"List wires attached to a host"`
|
||||
HostType string `help:"List wires attached to host with HostType"`
|
||||
}
|
||||
|
||||
func (wo *WireListOptions) GetContextId() string {
|
||||
|
||||
Reference in New Issue
Block a user