mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix: 添加cloudevent过滤参数
This commit is contained in:
@@ -22,9 +22,21 @@ import (
|
||||
)
|
||||
|
||||
type CloudeventListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
apis.ModelBaseListInput
|
||||
|
||||
compute.ManagedResourceListInput
|
||||
compute.CloudenvResourceListInput
|
||||
|
||||
// 服务类型
|
||||
Service []string `json:"service"`
|
||||
|
||||
// 订阅
|
||||
Manager []string `json:"manager"`
|
||||
|
||||
// 账号
|
||||
Account []string `json:"account"`
|
||||
|
||||
// 操作类型
|
||||
Action []string `json:"action"`
|
||||
|
||||
// 操作日志起始时间
|
||||
Since time.Time `json:"since"`
|
||||
|
||||
@@ -91,19 +91,6 @@ func (manager *SCloudeventManager) ListItemFilter(
|
||||
return nil, errors.Wrap(err, "SVirtualResourceBaseManager.ListItemFilter")
|
||||
}
|
||||
|
||||
/* input.Cloudprovider = input.CloudproviderStr()
|
||||
if len(input.Cloudprovider) > 0 {
|
||||
providerObj, err := CloudproviderManager.FetchByIdOrName(userCred, input.Cloudprovider)
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, httperrors.NewResourceNotFoundError2(CloudproviderManager.Keyword(), input.Cloudprovider)
|
||||
} else {
|
||||
return nil, httperrors.NewGeneralError(err)
|
||||
}
|
||||
}
|
||||
q = q.Equals("cloudprovider_id", providerObj.GetId())
|
||||
}*/
|
||||
|
||||
if len(input.Providers) > 0 {
|
||||
q = q.In("provider", input.Providers)
|
||||
}
|
||||
@@ -112,6 +99,22 @@ func (manager *SCloudeventManager) ListItemFilter(
|
||||
q = q.In("brand", input.Brands)
|
||||
}
|
||||
|
||||
if len(input.Service) > 0 {
|
||||
q = q.In("service", input.Service)
|
||||
}
|
||||
|
||||
if len(input.Manager) > 0 {
|
||||
q = q.In("manager", input.Manager)
|
||||
}
|
||||
|
||||
if len(input.Account) > 0 {
|
||||
q = q.In("account", input.Account)
|
||||
}
|
||||
|
||||
if len(input.Action) > 0 {
|
||||
q = q.In("action", input.Action)
|
||||
}
|
||||
|
||||
if !input.Since.IsZero() {
|
||||
q = q.GT("created_at", input.Since)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user