mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
可根据代理过滤云账号
This commit is contained in:
@@ -55,6 +55,7 @@ func init() {
|
||||
Capability []string `help:"capability filter" choices:"project|compute|network|loadbalancer|objectstore|rds|cache|event"`
|
||||
|
||||
DistinctField string `help:"distinct field"`
|
||||
ProxySetting string `help:"Proxy setting id or name"`
|
||||
}
|
||||
R(&CloudaccountListOptions{}, "cloud-account-list", "List cloud accounts", func(s *mcclient.ClientSession, args *CloudaccountListOptions) error {
|
||||
var params *jsonutils.JSONDict
|
||||
@@ -67,6 +68,9 @@ func init() {
|
||||
if len(args.Capability) > 0 {
|
||||
params.Add(jsonutils.NewStringArray(args.Capability), "capability")
|
||||
}
|
||||
if len(args.ProxySetting) > 0 {
|
||||
params.Add(jsonutils.NewString(args.ProxySetting), "proxy_setting")
|
||||
}
|
||||
}
|
||||
if len(args.DistinctField) > 0 {
|
||||
params.Add(jsonutils.NewString(args.DistinctField), "extra_field")
|
||||
|
||||
@@ -223,6 +223,11 @@ type CloudaccountListInput struct {
|
||||
|
||||
// 共享模式
|
||||
ShareMode []string `json:"share_mode"`
|
||||
|
||||
// 代理
|
||||
ProxySetting string `json:"proxy_setting"`
|
||||
// swagger:ignore
|
||||
ProxySettingId string `json:"proxy_setting_id" "yunion:deprecated-by":"proxy_setting"`
|
||||
}
|
||||
|
||||
type ProviderProject struct {
|
||||
|
||||
@@ -1496,6 +1496,17 @@ func (manager *SCloudaccountManager) ListItemFilter(
|
||||
return nil, errors.Wrap(err, "SSyncableBaseResourceManager.ListItemFilter")
|
||||
}
|
||||
|
||||
if len(query.ProxySetting) > 0 {
|
||||
proxy, err := proxy.ProxySettingManager.FetchByIdOrName(nil, query.ProxySetting)
|
||||
if err != nil {
|
||||
if errors.Cause(err) == sql.ErrNoRows {
|
||||
return nil, httperrors.NewResourceNotFoundError2("proxy_setting", query.ProxySetting)
|
||||
}
|
||||
return nil, httperrors.NewGeneralError(err)
|
||||
}
|
||||
q = q.Equals("proxy_setting_id", proxy.GetId())
|
||||
}
|
||||
|
||||
managerStr := query.Cloudprovider
|
||||
if len(managerStr) > 0 {
|
||||
providerObj, err := CloudproviderManager.FetchByIdOrName(userCred, managerStr)
|
||||
|
||||
Reference in New Issue
Block a user