mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 01:15:22 +00:00
59ba129718
Refactor fleetctl get & apply to use constants for spec kinds Closes #2283
51 lines
1.3 KiB
Go
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
|
|
)
|