fleet/server/kolide/packs.go
Mike Arpaia f109b14f9d Moving query attributes from the query object to the pack-query relationship (#559)
* 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
2016-12-13 14:22:05 -08:00

61 lines
1.6 KiB
Go

package kolide
import (
"golang.org/x/net/context"
)
type PackStore interface {
// Pack methods
NewPack(pack *Pack) (*Pack, error)
SavePack(pack *Pack) error
DeletePack(pid uint) error
Pack(pid uint) (*Pack, error)
ListPacks(opt ListOptions) ([]*Pack, error)
// Modifying the labels for packs
AddLabelToPack(lid uint, pid uint) error
ListLabelsForPack(pid uint) ([]*Label, error)
RemoveLabelFromPack(label *Label, pack *Pack) error
ListHostsInPack(pid uint, opt ListOptions) ([]*Host, error)
}
type PackService interface {
ListPacks(ctx context.Context, opt ListOptions) ([]*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
AddLabelToPack(ctx context.Context, lid, pid uint) error
ListLabelsForPack(ctx context.Context, pid uint) ([]*Label, error)
RemoveLabelFromPack(ctx context.Context, lid, pid uint) error
ListPacksForHost(ctx context.Context, hid uint) ([]*Pack, error)
ListHostsInPack(ctx context.Context, pid uint, opt ListOptions) ([]*Host, error)
}
type Pack struct {
UpdateCreateTimestamps
DeleteFields
ID uint `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Platform string `json:"platform"`
CreatedBy uint `json:"created_by" db:"created_by"`
Disabled bool `json:"disabled"`
}
type PackPayload struct {
Name *string
Description *string
Platform *string
Disabled *bool
}
type PackTarget struct {
ID uint
PackID uint
Target
}