mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
53a1fe8d84
* osquery services via go-kit * Visual Studio Code configurations * create query and pack endpoints * organizing files more scalably * modify query and pack endpoints * delete query and pack endpoints * get query and pack endpoints * get all queries and packs endpoints * add and remove queries from packs * test stubs * removing some indirection * query service tests * service pack tests * transport tests * adding config file flag back * organizing package kolide * get queries in pack endpoint * run tests on 1.7? * no 1.7 image :( * typo in circle.yml
56 lines
1.3 KiB
Go
56 lines
1.3 KiB
Go
package kolide
|
|
|
|
import (
|
|
"time"
|
|
|
|
"golang.org/x/net/context"
|
|
)
|
|
|
|
type PackStore interface {
|
|
// Pack methods
|
|
NewPack(pack *Pack) error
|
|
SavePack(pack *Pack) error
|
|
DeletePack(pack *Pack) error
|
|
Pack(id uint) (*Pack, error)
|
|
Packs() ([]*Pack, error)
|
|
|
|
// Modifying the queries in packs
|
|
AddQueryToPack(query *Query, pack *Pack) error
|
|
GetQueriesInPack(pack *Pack) ([]*Query, error)
|
|
RemoveQueryFromPack(query *Query, pack *Pack) error
|
|
}
|
|
|
|
type PackService interface {
|
|
GetAllPacks(ctx context.Context) ([]*Pack, error)
|
|
GetPack(ctx context.Context, id uint) (*Pack, error)
|
|
NewPack(ctx context.Context, p PackPayload) (*Pack, error)
|
|
ModifyPack(ctx context.Context, id uint, p PackPayload) (*Pack, error)
|
|
DeletePack(ctx context.Context, id uint) error
|
|
|
|
AddQueryToPack(ctx context.Context, qid, pid uint) error
|
|
GetQueriesInPack(ctx context.Context, id uint) ([]*Query, error)
|
|
RemoveQueryFromPack(ctx context.Context, qid, pid uint) error
|
|
}
|
|
|
|
type Pack struct {
|
|
ID uint `gorm:"primary_key"`
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
Name string `gorm:"not null;unique_index:idx_pack_unique_name"`
|
|
Platform string
|
|
}
|
|
|
|
type PackQuery struct {
|
|
ID uint `gorm:"primary_key"`
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
PackID uint
|
|
QueryID uint
|
|
}
|
|
|
|
type PackTarget struct {
|
|
ID uint `gorm:"primary_key"`
|
|
PackID uint
|
|
TargetID uint
|
|
}
|