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"` 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 }