Documentation
¶
Overview ¶
SPDX-License-Identifier: Apache-2.0
Package client provides a typed Go client for the Pylon service registry. It connects to Pylon's HTTP API to discover WorkFort services at runtime.
Usage:
c := client.New("http://pylon:18000", serviceAPIKey)
svc, err := c.ServiceByName(ctx, "hive")
if err != nil { log.Fatal(err) }
hiveClient := hive.New(svc.BaseURL, serviceAPIKey)
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned by ServiceByName when the named service // is not in the registry. ErrNotFound = errors.New("service not found") ErrUnauthorized = errors.New("unauthorized") // ErrForbidden is returned when Pylon responds with 403. ErrForbidden = errors.New("forbidden") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an HTTP client for the Pylon service registry API.
func New ¶
New creates a Pylon client that authenticates with a Passport API key (Authorization: ApiKey-v1 <key>). API keys are recognizable by the wf-agent_ or wf-svc_ prefix.
Pylon's outbound clients are API-key-only — JWTs are reserved for browser-routed traffic which never originates here.
func (*Client) ServiceByName ¶
ServiceByName returns a specific service by its registered name. Returns ErrNotFound if the service is not in the registry.
type Service ¶
type Service struct {
Name string `json:"name"`
Label string `json:"label"`
Route string `json:"route"`
BaseURL string `json:"base_url"`
UI bool `json:"ui"`
Connected bool `json:"connected"`
SetupMode bool `json:"setup_mode"`
AdminOnly bool `json:"admin_only"`
Display string `json:"display"`
WSPaths []string `json:"ws_paths"`
NotificationPath *string `json:"notification_path,omitempty"`
}
Service represents a discovered WorkFort service.