fleet/server/kolide/osquery_options.go
Zachary Wasserman c5f0e5a6b4
Add endpoints for apply/get of each spec type (#1752)
- Osquery Options (to be renamed to Options after current Options removed)
- Labels
- Queries
- Packs
2018-05-03 18:01:57 -07:00

51 lines
1.3 KiB
Go

package kolide
import (
"context"
"encoding/json"
)
type OsqueryOptionsStore interface {
ApplyOptions(options *OptionsSpec) error
GetOptions() (*OptionsSpec, error)
OptionsForPlatform(platform string) (json.RawMessage, error)
}
type OsqueryOptionsService interface {
ApplyOptionsSpec(ctx context.Context, spec *OptionsSpec) error
GetOptionsSpec(ctx context.Context) (*OptionsSpec, error)
}
type OptionsObject struct {
ObjectMetadata
Spec OptionsSpec `json:"spec"`
}
type OptionsSpec struct {
Config json.RawMessage `json:"config"`
Overrides OptionsOverrides `json:"overrides,omitempty"`
}
type OptionsOverrides struct {
Platforms map[string]json.RawMessage `json:"platforms,omitempty"`
}
const (
OptionsKind = "Options"
)
// OptionOverrideType is used to designate which override type a given set of
// options is used for. Currently the only supported override type is by
// platform.
type OptionOverrideType int
const (
// OptionOverrideTypeDefault indicates that this is the default config
// (provided to hosts when there is no override set for them).
OptionOverrideTypeDefault OptionOverrideType = iota
// OptionOverrideTypePlatform indicates that this is a
// platform-specific config override (with precedence over the default
// config).
OptionOverrideTypePlatform
)