Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ListActiveHunts Function to Hunt Dispatcher Interface #3460

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion services/hunt_dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ type IHuntDispatcher interface {
acl_manager vql_subsystem.ACLManager,
hunt *api_proto.Hunt) (*api_proto.Hunt, error)

// Deprecated - use GetHunts for paged access
ListActiveHunts(ctx context.Context,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this function is deprecated we probably dont want to add another function like it. We need a better approach

config_obj *config_proto.Config,
in *api_proto.ListHuntsRequest) (*api_proto.ListHuntsResponse, error)

ListHunts(ctx context.Context,
config_obj *config_proto.Config,
in *api_proto.ListHuntsRequest) (*api_proto.ListHuntsResponse, error)
Expand Down
13 changes: 13 additions & 0 deletions services/hunt_dispatcher/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ func FindCollectedArtifacts(
}
}

func (self *HuntDispatcher) ListActiveHunts(
ctx context.Context, config_obj *config_proto.Config,
in *api_proto.ListHuntsRequest) (*api_proto.ListHuntsResponse, error) {
hunts, _ := self.ListHunts(ctx, config_obj, in)

for i, hunt := range hunts.GetItems() {
if hunt.State != api_proto.Hunt_RUNNING {
hunts.Items = append(hunts.Items[:i], hunts.Items[i+1:]...)
}
}
return hunts, nil
}

// This function is deprecated.
func (self *HuntDispatcher) ListHunts(
ctx context.Context, config_obj *config_proto.Config,
Expand Down
Loading