mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +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
556 B
Go
21 lines
556 B
Go
package activity
|
|
|
|
import "context"
|
|
|
|
// Host represents minimal host info needed by the activity context for authorization.
|
|
type Host struct {
|
|
ID uint
|
|
TeamID *uint
|
|
}
|
|
|
|
// AuthzType returns the authorization type for hosts.
|
|
func (h *Host) AuthzType() string {
|
|
return "host"
|
|
}
|
|
|
|
// HostProvider is the interface for fetching host data.
|
|
type HostProvider interface {
|
|
// GetHostLite returns minimal host information for authorization.
|
|
// If the host doesn't exist, returns a NotFoundError.
|
|
GetHostLite(ctx context.Context, hostID uint) (*Host, error)
|
|
}
|