discovery

package
v0.123.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: AGPL-3.0 Imports: 13 Imported by: 2

Documentation

Overview

Package discovery implements the discovery service, which lets users surface resource configs for their machines to use. For more information, see the Discovery service docs.

Index

Constants

View Source
const (
	SubtypeName = "discovery"
)

SubtypeName is the name of the type of service.

Variables

View Source
var API = resource.APINamespaceRDK.WithServiceType(SubtypeName)

API is a variable that identifies the discovery resource API.

Functions

func Named

func Named(name string) resource.Name

Named is a helper for getting the named service's typed resource name.

func NewRPCServiceServer

func NewRPCServiceServer(coll resource.APIResourceGetter[Service], logger logging.Logger) interface{}

NewRPCServiceServer constructs a the discovery gRPC service server. It is intentionally untyped to prevent use outside of tests.

Types

type Service

type Service interface {
	resource.Resource
	DiscoverResources(ctx context.Context, extra map[string]any) ([]resource.Config, error)
}

Service describes the functions that are available to the service.

For more information, see the Discovery service docs.

DiscoverResources example:

	// Get the discovered resources of a Discovery Service.
	cfgs, err := myDiscoveryService.DiscoverResources(ctx, nil)
	if err != nil {
		logger.Fatal(err)
	}
 	// Print out the discovered resources.
	for _, cfg := range cfgs {
		fmt.Printf("Name: %v\tModel: %v\tAPI: %v", cfg.Name, cfg.Model, cfg.API)
		fmt.Printf("Attributes: ", cfg.Attributes)
	}

For more information, see the discover resources method docs.

func FromDependencies deprecated

func FromDependencies(deps resource.Dependencies, name string) (Service, error)

Deprecated: FromDependencies is a helper for getting the named discovery service from a collection of dependencies. Use FromProvider instead.

func FromProvider added in v0.98.0

func FromProvider(provider resource.Provider, name string) (Service, error)

FromProvider is a helper for getting the named Discovery service from a resource Provider (collection of Dependencies or a Robot).

func FromRobot deprecated

func FromRobot(r robot.Robot, name string) (Service, error)

Deprecated: FromRobot is a helper for getting the named discovery service from the given Robot. Use FromProvider instead.

func NewClientFromConn

func NewClientFromConn(
	ctx context.Context,
	conn rpc.ClientConn,
	remoteName string,
	name resource.Name,
	logger logging.Logger,
) (Service, error)

NewClientFromConn constructs a new Client from the connection passed in.

Directories

Path Synopsis
Package fake implements a fake discovery service.
Package fake implements a fake discovery service.
Package register registers all relevant discovery models and also API specific functions
Package register registers all relevant discovery models and also API specific functions

Jump to

Keyboard shortcuts

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