mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 09:18:59 +00:00
715d908613
Notable refactoring: - Use stdlib "context" in place of "golang.org/x/net/context" - Go-kit no longer wraps errors, so we remove the unwrap in transport_error.go - Use MakeHandler when setting up endpoint tests (fixes test bug caught during this refactoring) Closes #1411.
49 lines
1.7 KiB
Go
49 lines
1.7 KiB
Go
package kolide
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
type ScheduledQueryStore interface {
|
|
NewScheduledQuery(sq *ScheduledQuery) (*ScheduledQuery, error)
|
|
SaveScheduledQuery(sq *ScheduledQuery) (*ScheduledQuery, error)
|
|
DeleteScheduledQuery(id uint) error
|
|
ScheduledQuery(id uint) (*ScheduledQuery, error)
|
|
ListScheduledQueriesInPack(id uint, opts ListOptions) ([]*ScheduledQuery, error)
|
|
}
|
|
|
|
type ScheduledQueryService interface {
|
|
GetScheduledQuery(ctx context.Context, id uint) (query *ScheduledQuery, err error)
|
|
GetScheduledQueriesInPack(ctx context.Context, id uint, opts ListOptions) (queries []*ScheduledQuery, err error)
|
|
ScheduleQuery(ctx context.Context, sq *ScheduledQuery) (query *ScheduledQuery, err error)
|
|
DeleteScheduledQuery(ctx context.Context, id uint) (err error)
|
|
ModifyScheduledQuery(ctx context.Context, id uint, p ScheduledQueryPayload) (query *ScheduledQuery, err error)
|
|
}
|
|
|
|
type ScheduledQuery struct {
|
|
UpdateCreateTimestamps
|
|
DeleteFields
|
|
ID uint `json:"id"`
|
|
PackID uint `json:"pack_id" db:"pack_id"`
|
|
QueryID uint `json:"query_id" db:"query_id"`
|
|
Query string `json:"query"` // populated via a join on queries
|
|
Name string `json:"name"` // populated via a join on queries
|
|
Interval uint `json:"interval"`
|
|
Snapshot *bool `json:"snapshot"`
|
|
Removed *bool `json:"removed"`
|
|
Platform *string `json:"platform"`
|
|
Version *string `json:"version"`
|
|
Shard *uint `json:"shard"`
|
|
}
|
|
|
|
type ScheduledQueryPayload struct {
|
|
PackID *uint `json:"pack_id"`
|
|
QueryID *uint `json:"query_id"`
|
|
Interval *uint `json:"interval"`
|
|
Snapshot *bool `json:"snapshot"`
|
|
Removed *bool `json:"removed"`
|
|
Platform *string `json:"platform"`
|
|
Version *string `json:"version"`
|
|
Shard *uint `json:"shard"`
|
|
}
|