From 20fd01adc35789e8afe9f03ea16c6cd46d0dabab Mon Sep 17 00:00:00 2001 From: wanyaoqi Date: Tue, 14 Aug 2018 11:07:12 +0800 Subject: [PATCH] climc list add joint filter --- cmd/climc/shell/shell.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/climc/shell/shell.go b/cmd/climc/shell/shell.go index 25caa0e188..03246aa46c 100644 --- a/cmd/climc/shell/shell.go +++ b/cmd/climc/shell/shell.go @@ -2,6 +2,7 @@ package shell import ( "fmt" + "yunion.io/x/jsonutils" ) @@ -27,6 +28,7 @@ type BaseListOptions struct { Search string `help:"Filter results by a simple keyword search"` Meta bool `help:"Piggyback metadata information"` Filter []string `help:"Filters"` + JointFilter []string `help:"Filters with joint table col; joint_tbl(related_key).filter_col.filter_cond(filters)"` FilterAny bool `help:"If true, match if any of the filters matches; otherwise, match if all of the filters match"` Admin bool `help:"Is an admin call?"` Tenant string `help:"Tenant ID or Name"` @@ -62,6 +64,13 @@ func FetchPagingParams(options BaseListOptions) *jsonutils.JSONDict { if options.Meta { params.Add(jsonutils.JSONTrue, "with_meta") } + if len(options.JointFilter) > 0 { + arr := jsonutils.NewArray() + for _, f := range options.JointFilter { + arr.Add(jsonutils.NewString(f)) + } + params.Add(arr, "joint_filter") + } if len(options.Filter) > 0 { arr := jsonutils.NewArray() for _, f := range options.Filter {