mirror of
https://github.com/fleetdm/fleet
synced 2026-05-02 10:57:25 +00:00
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #38534 moved `/api/_version_/fleet/hosts/{id:[0-9]+}/activities` endpoint and `MarkActivitiesAsStreamed` to activity bounded context # Checklist for submitter - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. ## Testing - [x] Added/updated automated tests - [x] Where appropriate, [automated tests simulate multiple hosts and test for host isolation](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/reference/patterns-backend.md#unit-testing) (updates to one hosts's records do not affect another) - [x] QA'd all new/changed functionality manually <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added new endpoint to retrieve host-specific past activities with pagination metadata. * **Refactor** * Refactored activity service architecture and authorization layer to improve data provider integration and activity streaming capabilities. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
21 lines
703 B
Go
21 lines
703 B
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
)
|
|
|
|
// JSONLogger defines an interface for loggers that can write JSON to various
|
|
// output sources.
|
|
type JSONLogger interface {
|
|
// Write writes the JSON log entries to the appropriate destination,
|
|
// returning any errors that occurred.
|
|
Write(ctx context.Context, logs []json.RawMessage) error
|
|
}
|
|
|
|
// StreamActivitiesService streams activities to an audit logger.
|
|
type StreamActivitiesService interface {
|
|
// StreamActivities streams unstreamed activities to the provided audit logger.
|
|
// The systemCtx should be a context with system-level authorization (no user context).
|
|
StreamActivities(systemCtx context.Context, auditLogger JSONLogger) error
|
|
}
|