data

package
v0.0.0-...-2ecac8d Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllAgents = Agents{
	// contains filtered or unexported fields
}

Functions

This section is empty.

Types

type Agent

type Agent struct {

	// Agent's instance id. This is an immutable field.
	InstanceId    InstanceId
	InstanceIdStr string

	// Agent's current status.
	Status *protobufs.AgentToServer

	// The time when the agent has started. Valid only if Status.Health.Up==true
	StartedAt time.Time

	// Effective config reported by the Agent.
	EffectiveConfig string

	// Optional special remote config for this particular instance defined by
	// the user in the UI.
	CustomInstanceConfig string

	// Client certificate
	ClientCert                  *x509.Certificate
	ClientCertSha256Fingerprint string
	ClientCertOfferError        string
	// contains filtered or unexported fields
}

Agent represents a connected Agent.

func NewAgent

func NewAgent(
	instanceId InstanceId,
	conn types.Connection,
) *Agent

func (*Agent) CloneReadonly

func (agent *Agent) CloneReadonly() *Agent

CloneReadonly returns a copy of the Agent that is safe to read. Functions that modify the Agent should not be called on the cloned copy.

func (*Agent) OfferConnectionSettings

func (agent *Agent) OfferConnectionSettings(offers *protobufs.ConnectionSettingsOffers)

func (*Agent) SendToAgent

func (agent *Agent) SendToAgent(msg *protobufs.ServerToAgent)

func (*Agent) SetCustomConfig

func (agent *Agent) SetCustomConfig(
	config *protobufs.AgentConfigMap,
	notifyWhenConfigIsApplied chan<- struct{},
)

SetCustomConfig sets a custom config for this Agent. notifyWhenConfigIsApplied channel is notified after the remote config is applied to the Agent and after the Agent reports back the effective config. If the provided config is equal to the current remoteConfig of the Agent then we will not send any config to the Agent and notifyWhenConfigIsApplied channel will be notified immediately. This requires that notifyWhenConfigIsApplied channel has a buffer size of at least 1.

func (*Agent) UpdateStatus

func (agent *Agent) UpdateStatus(
	statusMsg *protobufs.AgentToServer,
	response *protobufs.ServerToAgent,
)

UpdateStatus updates the status of the Agent struct based on the newly received status report and sets appropriate fields in the response message to be sent to the Agent.

type Agents

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

func (*Agents) FindAgent

func (agents *Agents) FindAgent(agentId InstanceId) *Agent

func (*Agents) FindOrCreateAgent

func (agents *Agents) FindOrCreateAgent(agentId InstanceId, conn types.Connection) *Agent

func (*Agents) GetAgentReadonlyClone

func (agents *Agents) GetAgentReadonlyClone(agentId InstanceId) *Agent

func (*Agents) GetAllAgentsReadonlyClone

func (agents *Agents) GetAllAgentsReadonlyClone() map[InstanceId]*Agent

func (*Agents) OfferAgentConnectionSettings

func (a *Agents) OfferAgentConnectionSettings(
	id InstanceId,
	offers *protobufs.ConnectionSettingsOffers,
)

func (*Agents) RemoveConnection

func (agents *Agents) RemoveConnection(conn types.Connection)

RemoveConnection removes the connection all Agent instances associated with the connection.

func (*Agents) SetCustomConfigForAgent

func (agents *Agents) SetCustomConfigForAgent(
	agentId InstanceId,
	config *protobufs.AgentConfigMap,
	notifyNextStatusUpdate chan<- struct{},
)

type InstanceId

type InstanceId uuid.UUID

Jump to

Keyboard shortcuts

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