Documentation ¶
Index ¶
- Constants
- Variables
- func Prettify(fact FactValue) (string, error)
- type Fact
- type FactGatheringError
- type FactRequest
- type FactValue
- type FactValueBool
- type FactValueFloat
- type FactValueInt
- type FactValueList
- type FactValueMap
- type FactValueNil
- type FactValueOption
- type FactValueString
- type FactsGathered
- type FactsGatheringRequested
- type FactsGatheringRequestedTarget
- type GroupedByGathererRequestedTarget
Constants ¶
const (
FactsGathererdEventSource = "https://github.com/trento-project/agent"
)
Variables ¶
var ValueNotFoundError = FactGatheringError{
Type: "value-not-found",
Message: "error getting value",
}
nolint:gochecknoglobals ValueNotFoundError is an error returned when the wanted value in GetValue function is not found
Functions ¶
Types ¶
type Fact ¶
type Fact struct { Name string CheckID string Value FactValue Error *FactGatheringError }
func NewFactGatheredWithError ¶
func NewFactGatheredWithError(req FactRequest, err *FactGatheringError) Fact
func NewFactGatheredWithRequest ¶
func NewFactGatheredWithRequest(factReq FactRequest, value FactValue) Fact
func NewFactsGatheredListWithError ¶
func NewFactsGatheredListWithError(reqs []FactRequest, err *FactGatheringError) []Fact
type FactGatheringError ¶
func (*FactGatheringError) Error ¶
func (e *FactGatheringError) Error() string
func (*FactGatheringError) Wrap ¶
func (e *FactGatheringError) Wrap(msg string) *FactGatheringError
type FactRequest ¶
type FactValue ¶
type FactValue interface { AsInterface() interface{} // contains filtered or unexported methods }
FactValue represents a dynamically typed value which can be either an int, a float, a string, a boolean, a recursive map[string] value, or a list of values. A producer of FactValue is expected to set one of that variants.
func NewFactValue ¶
func NewFactValue(factInterface interface{}, opts ...FactValueOption) (FactValue, error)
NewFactValue constructs a FactValue from a nested interface.
func ParseStringToFactValue ¶
ParseStringToFactValue parses a string to a FactValue type.
type FactValueBool ¶
type FactValueBool struct {
Value bool
}
func (*FactValueBool) AsInterface ¶
func (v *FactValueBool) AsInterface() interface{}
AsInterface converts a FactValueBool internal value to an interface{}.
type FactValueFloat ¶
type FactValueFloat struct {
Value float64
}
func (*FactValueFloat) AsInterface ¶
func (v *FactValueFloat) AsInterface() interface{}
AsInterface converts a FactValueFloat internal value to an interface{}.
type FactValueInt ¶
type FactValueInt struct {
Value int
}
func (*FactValueInt) AsInterface ¶
func (v *FactValueInt) AsInterface() interface{}
AsInterface converts a FactValueInt internal value to an interface{}.
type FactValueList ¶
type FactValueList struct {
Value []FactValue
}
func (*FactValueList) AppendValue ¶
func (v *FactValueList) AppendValue(value FactValue)
AsInterface converts a FactValueList internal value to an interface{}.
func (*FactValueList) AsInterface ¶
func (v *FactValueList) AsInterface() interface{}
AsInterface converts a FactValueList internal value to an interface{}.
type FactValueMap ¶
func (*FactValueMap) AsInterface ¶
func (v *FactValueMap) AsInterface() interface{}
AsInterface converts a FactValueMap internal value to an interface{}.
func (*FactValueMap) GetValue ¶
func (v *FactValueMap) GetValue(values string) (FactValue, *FactGatheringError)
GetValue returns a value using a dot access key format from a FactValue. Examples: foo.bar.buz access the {"foo": {"bar": {"baz": "value"}}} foo.0.buz access the {"foo": [{"buz": "value"}]}
type FactValueNil ¶
type FactValueNil struct{}
func (*FactValueNil) AsInterface ¶
func (v *FactValueNil) AsInterface() interface{}
AsInterface converts a FactValueNil internal value to an interface{}.
type FactValueOption ¶
type FactValueOption func(f *conf)
func WithSnakeCaseKeys ¶
func WithSnakeCaseKeys() FactValueOption
WithSnakeCaseKeys converts map keys to snake_case
func WithStringConversion ¶
func WithStringConversion() FactValueOption
WithStringConversion enables string automatic conversion to numeric fact values
type FactValueString ¶
type FactValueString struct {
Value string
}
func (*FactValueString) AsInterface ¶
func (v *FactValueString) AsInterface() interface{}
AsInterface converts a FactValueString internal value to an interface{}.
type FactsGathered ¶
type FactsGatheringRequested ¶
type FactsGatheringRequested struct { ExecutionID string GroupID string Targets []FactsGatheringRequestedTarget }
type FactsGatheringRequestedTarget ¶
type FactsGatheringRequestedTarget struct { AgentID string FactRequests []FactRequest }
type GroupedByGathererRequestedTarget ¶
type GroupedByGathererRequestedTarget struct {
FactRequests map[string][]FactRequest
}