searchrun

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package searchrun wires CLI flags and YAML config to host search and caching.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildProviders

func BuildProviders(cfg *config.File, f ProviderFlags) []hosts.Backend

BuildProviders returns backends from the config file when it defines at least one backend entry; otherwise it requests the default backend from each registered provider.

func ListBackendRows added in v0.2.3

func ListBackendRows(cfg *config.File) []config.BackendRow

ListBackendRows queries all registered providers to build a list of configured backends.

func ListSearchProviderIDs added in v0.2.7

func ListSearchProviderIDs(f ProviderFlags) []string

ListSearchProviderIDs returns hosts.Backend.ID() for each registered factory's default backend, in registration order (matches implicit providers when config has no backend entries).

func Register added in v0.2.3

func Register(f ProviderFactory)

Register adds a new provider factory to the registry. This is typically called from an init() function within each provider package.

func RegisterCRUD added in v0.2.6

func RegisterCRUD(c ProviderCRUD)

RegisterCRUD registers a ProviderCRUD implementation.

func RunSearch

func RunSearch(
	ctx context.Context,
	q hosts.Query,
	provs []hosts.Backend,
	cacheDir string,
	cacheTTL time.Duration,
	noCache bool,
	refresh bool,
) ([]hosts.Record, error)

RunSearch executes hosts.RunParallel with an on-disk cache under cacheDir. If cacheDir is empty, hosts.DefaultCacheDir is used.

Types

type ProviderCRUD added in v0.2.6

type ProviderCRUD interface {
	// ID returns the provider identifier (e.g. "gcp", "aws")
	ID() string
	// Name returns the human readable name (e.g. "GCP", "AWS")
	Name() string

	// ListOptions returns a list of huh options for the edit/delete menus
	ListOptions(cfg *config.File) []huh.Option[string]

	// Add runs the interactive prompt to add a new backend to the config
	Add(cfg *config.File) error
	// Edit runs the interactive prompt to edit an existing backend at the given index
	Edit(cfg *config.File, idx int) error
	// Delete removes the backend at the given index
	Delete(cfg *config.File, idx int) error
}

ProviderCRUD defines the interface for creating, editing, and deleting backends interactively.

func GetCRUDHandler added in v0.2.6

func GetCRUDHandler(id string) ProviderCRUD

GetCRUDHandler returns a specific ProviderCRUD implementation by ID.

func GetCRUDHandlers added in v0.2.6

func GetCRUDHandlers() []ProviderCRUD

GetCRUDHandlers returns all registered ProviderCRUD implementations.

type ProviderFactory added in v0.2.3

type ProviderFactory interface {
	// FromConfig returns a list of configured backends based on the user's YAML config.
	FromConfig(cfg *config.File, f ProviderFlags) []hosts.Backend
	// Default returns a single backend instance using CLI flags / defaults when no config is provided.
	Default(f ProviderFlags) hosts.Backend
	// BackendRows returns a summary of configured backends for listing purposes (e.g. `honey backends`).
	BackendRows(cfg *config.File) []config.BackendRow
}

ProviderFactory defines the interface that each backend provider must implement to register itself with the search engine.

type ProviderFlags

type ProviderFlags struct {
	GCPProject       string
	GCPZone          string
	AWSProfile       string
	AWSRegion        string
	KubeContext      string
	K8sMode          string
	K8sDebugImage    string
	Kubeconfig       string
	ConsulAddr       string
	ConsulDatacenter string
	ConsulToken      string

	ProxmoxURL         string
	ProxmoxUser        string
	ProxmoxPassword    string
	ProxmoxTokenID     string
	ProxmoxTokenSecret string
	ProxmoxInsecure    bool
}

ProviderFlags carries CLI / MCP provider-related string options used when building backends (mirrors honey search flags).

Jump to

Keyboard shortcuts

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