mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 09:18:59 +00:00
f109b14f9d
* Moving query attributes from the query object to the pack-query relationship * some additional tests * http request parsing test * QueryOptions in new test_util code * initial scaffolding of new request structures * service and datastore * test outline * l2 merge conflict scrub * service tests for scheduled query service * service and datastore tests * most endpoints and transports * order of values are not deterministic with inmem * transport tests * rename PackQuery to ScheduledQuery * removing existing implementation of adding queries to packs * accounting for the new argument to NewQuery * fix alignment in sql query * removing underscore * add removed to the datastore * removed differential from the schema
38 lines
1.3 KiB
Go
38 lines
1.3 KiB
Go
package kolide
|
|
|
|
import (
|
|
"golang.org/x/net/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) (*ScheduledQuery, error)
|
|
GetScheduledQueriesInPack(ctx context.Context, id uint, opts ListOptions) ([]*ScheduledQuery, error)
|
|
ScheduleQuery(ctx context.Context, sq *ScheduledQuery) (*ScheduledQuery, error)
|
|
DeleteScheduledQuery(ctx context.Context, id uint) error
|
|
ModifyScheduledQuery(ctx context.Context, sq *ScheduledQuery) (*ScheduledQuery, error)
|
|
}
|
|
|
|
type ScheduledQuery struct {
|
|
UpdateCreateTimestamps
|
|
DeleteFields
|
|
ID uint
|
|
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"`
|
|
}
|