From 2fe912f51a7ca8dcc40a60e658ceb36818773e14 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Wed, 27 Jan 2021 09:46:19 +0800 Subject: [PATCH 1/2] 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 } From 57eceae70d85399bd3c29bb599c8a970579004a1 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Wed, 27 Jan 2021 09:47:22 +0800 Subject: [PATCH 2/2] feat(climc): wires: allow filter by bandwidth --- cmd/climc/shell/compute/wires.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/climc/shell/compute/wires.go b/cmd/climc/shell/compute/wires.go index 18c3f6682a..91648314f8 100644 --- a/cmd/climc/shell/compute/wires.go +++ b/cmd/climc/shell/compute/wires.go @@ -27,6 +27,8 @@ func init() { type WireListOptions struct { options.BaseListOptions + 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"`