inventory

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DataSchema = "https://choria.io/schemas/choria/discovery/v1/inventory_file.json"

DataSchema the schema of supported inventory files

Variables

This section is empty.

Functions

func ValidateInventory

func ValidateInventory(i []byte) (warnings []string, err error)

Types

type DataFile

type DataFile struct {
	Schema string  `json:"$schema" yaml:"$schema"`
	Groups []Group `json:"groups,omitempty" yaml:"groups,omitempty"`
	Nodes  []Node  `json:"nodes" yaml:"nodes"`
}

DataFile is a source for discovery information that describes a fleet

func ReadInventory

func ReadInventory(path string, noValidate bool) (*DataFile, error)

ReadInventory reads and validates an inventory file

func (*DataFile) LookupGroup

func (d *DataFile) LookupGroup(name string) (*Group, bool)

LookupGroup finds a group by name

type DiscoverOption

type DiscoverOption func(o *dOpts)

DiscoverOption configures the broadcast discovery method

func Collective

func Collective(c string) DiscoverOption

Collective sets the collective to discover in, else main collective is used

func DiscoveryOptions

func DiscoveryOptions(opt map[string]string) DiscoverOption

DiscoveryOptions sets the key value pairs that make user supplied discovery options.

Supported options:

file - set the file to read

func File

func File(f string) DiscoverOption

File sets the file to read nodes from

func Filter

func Filter(f *protocol.Filter) DiscoverOption

Filter sets the filter to use for the discovery, else a blank one is used

type Group

type Group struct {
	Name   string       `json:"name" yaml:"name"`
	Filter *GroupFilter `json:"filter,omitempty" yaml:"filter,omitempty"`
}

Group is a view over the inventory expressed as a filter saved by name

type GroupFilter

type GroupFilter struct {
	Agents     []string `json:"agents,omitempty" yaml:"agents,omitempty"`
	Classes    []string `json:"classes,omitempty" yaml:"classes,omitempty"`
	Facts      []string `json:"facts,omitempty" yaml:"facts,omitempty"`
	Identities []string `json:"identities,omitempty" yaml:"identities,omitempty"`
	Compound   string   `json:"compound,omitempty" yaml:"compound,omitempty"`
}

func (*GroupFilter) ToProtocolFilter

func (f *GroupFilter) ToProtocolFilter() (*protocol.Filter, error)

type Inventory

type Inventory struct {
	// contains filtered or unexported fields
}

func New

func New(fw inter.Framework) *Inventory

New creates a new puppetdb discovery client

func (*Inventory) Discover

func (i *Inventory) Discover(ctx context.Context, opts ...DiscoverOption) (n []string, err error)

Discover performs a broadcast discovery using the supplied filter

type Node

type Node struct {
	Name        string          `json:"name" yaml:"name"`
	Collectives []string        `json:"collectives" yaml:"collectives"`
	Facts       json.RawMessage `json:"facts" yaml:"facts"`
	Classes     []string        `json:"classes" yaml:"classes"`
	Agents      []string        `json:"agents" yaml:"agents"`
}

Node describes a single node on the network

Jump to

Keyboard shortcuts

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