plugins

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group = types.Group

type Host

type Host = types.Host

type Inventory

type Inventory = types.Inventory

Use shared types from pkg/types to avoid duplication

type InventoryPlugin

type InventoryPlugin interface {
	// Name returns the name of the plugin
	Name() string

	// Execute runs the plugin with the given configuration and returns inventory data
	Execute(ctx context.Context, config map[string]interface{}) (*PluginInventoryResult, error)
}

InventoryPlugin defines the interface that all inventory plugins must implement

type PluginGroup

type PluginGroup struct {
	Hosts    []string               `json:"hosts,omitempty"`
	Children []string               `json:"children,omitempty"`
	Vars     map[string]interface{} `json:"vars,omitempty"`
}

PluginGroup represents a group from a plugin

type PluginHost

type PluginHost struct {
	Name string                 `json:"-"`
	Vars map[string]interface{} `json:"hostvars,omitempty"`
}

PluginHost represents a host from a plugin

type PluginInventoryResult

type PluginInventoryResult struct {
	Hosts  map[string]*PluginHost  `json:"_meta"`
	Groups map[string]*PluginGroup `json:",inline"`
}

PluginInventoryResult represents the result from an inventory plugin

type PluginManager

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

PluginManager manages inventory plugin discovery and execution

func NewPluginManager

func NewPluginManager() *PluginManager

NewPluginManager creates a new plugin manager

func (*PluginManager) DiscoverPlugins

func (pm *PluginManager) DiscoverPlugins() ([]string, error)

DiscoverPlugins discovers available inventory plugins

func (*PluginManager) LoadInventoryFromExecutable

func (pm *PluginManager) LoadInventoryFromExecutable(ctx context.Context, execPath string, args ...string) (*Inventory, error)

LoadInventoryFromExecutable executes an external inventory script/binary that outputs Ansible-compatible JSON for `--list` and converts it into the standard Inventory format. It reuses the same JSON parsing logic used for Python plugins.

func (*PluginManager) LoadInventoryFromPlugin

func (pm *PluginManager) LoadInventoryFromPlugin(ctx context.Context, pluginName string, config map[string]interface{}, inventoryContent []byte) (*Inventory, error)

LoadInventoryFromPlugin loads inventory from a plugin and converts to standard Inventory format

func (*PluginManager) LoadPlugin

func (pm *PluginManager) LoadPlugin(ctx context.Context, pluginName string, config map[string]interface{}, inventoryContent []byte) (*PluginInventoryResult, error)

LoadPlugin attempts to load an inventory plugin by name

Jump to

Keyboard shortcuts

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