client

package
v0.1.0-proto2f Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MPL-2.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 Client

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

Client provides a programmatic interface to interact with a running GAPI daemon.

func New

func New(cfg *config.Config) (*Client, error)

New creates a new Client using the provided configuration.

func NewFromBus

func NewFromBus(bus *eventbus.EventBus[*anypb.Any]) *Client

NewFromBus creates a new Client using an existing EventBus (for in-process use).

func (*Client) AgentStatus

func (c *Client) AgentStatus(ctx context.Context) ([]*protopkg.AgentStatus, error)

AgentStatus queries the daemon for the status of all agents.

func (*Client) GetLogs

func (c *Client) GetLogs(ctx context.Context, agentID string) (<-chan string, error)

GetLogs subscribes to the logs for a specific agent and returns a channel of log lines. The subscription is automatically cleaned up when the context is cancelled.

func (*Client) Lifecycle

func (c *Client) Lifecycle(ctx context.Context, agentIDs []string, action protopkg.LifecycleControl_Action) []Result

Lifecycle sends a lifecycle action to a set of agents and waits for their transition.

func (*Client) LifecycleWithOpts

func (c *Client) LifecycleWithOpts(ctx context.Context, agentIDs []string, action protopkg.LifecycleControl_Action, opts LifecycleOptions) []Result

LifecycleWithOpts sends a lifecycle action with options.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) (string, error)

Ping sends a ping to the daemon and waits for a pong.

func (*Client) ReloadAgents

func (c *Client) ReloadAgents(ctx context.Context) error

ReloadAgents triggers a reload of the agent registry on the daemon.

func (*Client) Shutdown

func (c *Client) Shutdown(ctx context.Context, action string) error

Shutdown requests a system shutdown from the daemon. action is one of "poweroff", "reboot", "halt" (the topic's documented payload vocabulary); in PID-1 mode the daemon answers with the full init teardown.

func (*Client) Start

func (c *Client) Start(ctx context.Context, agentIDs []string) []Result

Start triggers the START action for the given agents.

func (*Client) StartWithOpts

func (c *Client) StartWithOpts(ctx context.Context, agentIDs []string, opts LifecycleOptions) []Result

StartWithOpts triggers the START action with options.

func (*Client) Stop

func (c *Client) Stop(ctx context.Context, agentIDs []string) []Result

Stop triggers the STOP action for the given agents.

type LifecycleOptions

type LifecycleOptions struct {
	Env           map[string]string
	RestartPolicy string
}

LifecycleOptions defines optional parameters for lifecycle actions.

type Result

type Result struct {
	AgentID string
	Status  *protopkg.LifecycleStatus
	Err     error
}

Result represents the outcome of a lifecycle action on a specific agent.

Jump to

Keyboard shortcuts

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