routetables: routetable-list --manager <provider-id>支持

This commit is contained in:
Yousong Zhou
2018-12-12 14:20:43 +00:00
parent 3e71b2247f
commit b736983fe9
2 changed files with 8 additions and 7 deletions
+7 -7
View File
@@ -108,13 +108,13 @@ func (man *SRouteTableManager) ListItemFilter(ctx context.Context, q *sqlchemy.S
}
userProjId := userCred.GetProjectId()
data := query.(*jsonutils.JSONDict)
for _, key := range []string{"vpc", "cloudregion"} {
v := validators.NewModelIdOrNameValidator(key, key, userProjId)
v.Optional(true)
q, err = v.QueryFilter(q, data)
if err != nil {
return nil, err
}
q, err = validators.ApplyModelFilters(q, data, []*validators.ModelFilterOptions{
{Key: "vpc", ModelKeyword: "vpc", ProjectId: userProjId},
{Key: "cloudregion", ModelKeyword: "cloudregion", ProjectId: userProjId},
{Key: "manager", ModelKeyword: "cloudprovider", ProjectId: userProjId},
})
if err != nil {
return nil, err
}
return q, nil
}
+1
View File
@@ -126,6 +126,7 @@ type RouteTableDeleteOptions struct {
}
type RouteTableListOptions struct {
Manager string
Vpc string
Cloudregion string