modules

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTargets

func GetTargets(targets []labels.Labels, port, group string) ([]labels.Labels, error)

GetTargets transforms targets into prometheus targets

func MarshalYAMLWithInlineConfigs

func MarshalYAMLWithInlineConfigs(in interface{}) (interface{}, error)

MarshalYAMLWithInlineConfigs helps implement yaml.Marshal for structs that have a Configs field that should be inlined.

func RegisterConfig

func RegisterConfig(config Config)

RegisterConfig registers the given Config type for YAML marshaling and unmarshaling.

func UnmarshalYAMLWithInlineConfigs

func UnmarshalYAMLWithInlineConfigs(out interface{}, unmarshal func(interface{}) error) error

UnmarshalYAMLWithInlineConfigs helps implement yaml.Unmarshal for structs that have a Configs field that should be inlined.

Types

type Config

type Config interface {
	// Name returns the name of the discovery mechanism.
	Name() string

	// IsEnabled returns a boolean indicating if the Module is enabled.
	IsEnabled() bool

	// NewModule returns a Discoverer for the Config
	// with the given DiscovererOptions.
	NewModule(ModuleOptions) (Module, error)
}

A Config provides the configuration and constructor for a Module.

type Configs

type Configs []Config

Configs is a slice of Config values that uses custom YAML marshaling and unmarshaling to represent itself as a mapping of the Config values grouped by their types.

func (Configs) MarshalYAML

func (c Configs) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (*Configs) SetDirectory

func (c *Configs) SetDirectory(dir string)

SetDirectory joins any relative file paths with dir.

func (*Configs) UnmarshalYAML

func (c *Configs) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type Module

type Module interface {
	Playbook(context.Context) (*ansible.Playbook, error)
	HostVars() (map[string]string, error)
	GetTargets([]labels.Labels, string) ([]labels.Labels, error)
	GetRules(string) rulefmt.RuleGroup
	GetDashboards() []map[string]interface{}
	GetDashboardFiles() map[string][]byte
}

Module is the interface for modules.

type ModuleOptions

type ModuleOptions struct {
	Logger log.Logger
}

ModuleOptions provides options for a Module.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL