diff --git a/pkg/apis/cloudevent/cloudevent.go b/pkg/apis/cloudevent/cloudevent.go index 1ad0fbc069..a53ea50402 100644 --- a/pkg/apis/cloudevent/cloudevent.go +++ b/pkg/apis/cloudevent/cloudevent.go @@ -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"` diff --git a/pkg/cloudevent/models/cloudevents.go b/pkg/cloudevent/models/cloudevents.go index caf10a5100..03f2c567fe 100644 --- a/pkg/cloudevent/models/cloudevents.go +++ b/pkg/cloudevent/models/cloudevents.go @@ -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) }