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
- Variables
- func Named(name string) resource.Name
- func NewRPCServiceServer(coll resource.APIResourceGetter[Service], logger logging.Logger) interface{}
- type Service
- func FromDependencies(deps resource.Dependencies, name string) (Service, error)deprecated
- func FromProvider(provider resource.Provider, name string) (Service, error)
- func FromRobot(r robot.Robot, name string) (Service, error)deprecated
- func NewClientFromConn(ctx context.Context, conn rpc.ClientConn, remoteName string, ...) (Service, error)
Constants ¶
const (
SubtypeName = "discovery"
)
SubtypeName is the name of the type of service.
Variables ¶
var API = resource.APINamespaceRDK.WithServiceType(SubtypeName)
API is a variable that identifies the discovery resource API.
Functions ¶
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
FromProvider is a helper for getting the named Discovery service from a resource Provider (collection of Dependencies or a Robot).
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 |