From 2fe912f51a7ca8dcc40a60e658ceb36818773e14 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Wed, 27 Jan 2021 09:46:19 +0800 Subject: [PATCH] feat(region): wire: allow filter by bandwidth --- pkg/apis/compute/wire.go | 2 ++ pkg/compute/models/wires.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/pkg/apis/compute/wire.go b/pkg/apis/compute/wire.go index 5f3bc63041..4fa9f2dafa 100644 --- a/pkg/apis/compute/wire.go +++ b/pkg/apis/compute/wire.go @@ -87,4 +87,6 @@ type WireListInput struct { ZonalFilterListBase HostResourceInput + + Bandwidth *int `json:"bandwidth"` } diff --git a/pkg/compute/models/wires.go b/pkg/compute/models/wires.go index e1afdf72e2..56b41a78ee 100644 --- a/pkg/compute/models/wires.go +++ b/pkg/compute/models/wires.go @@ -1012,6 +1012,10 @@ func (manager *SWireManager) ListItemFilter( q = q.Filter(sqlchemy.In(q.Field("id"), sq.SubQuery())) } + if query.Bandwidth != nil { + q = q.Equals("bandwidth", *query.Bandwidth) + } + return q, nil }