Help us shape the future of Go! Take the 2026 Go Developer Survey

agents

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: MIT Imports: 27 Imported by: 6

Documentation

Index

Constants

View Source
const (
	AgentKind   = "agent"
	ServiceKind = "service"
)
View Source
const (
	InitError   = servicev1.InitStatus_ERROR
	InitSuccess = servicev1.InitStatus_READY
)

Variables

View Source
var HandshakeConfig = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "codefly::agents",
	MagicCookieValue: "0.0.0",
}

Functions

func Cleanup

func Cleanup(unique string)

func ClearAgents

func ClearAgents()

func Download

func Download(p *configurations.Agent) error

func DownloadURL

func DownloadURL(p *configurations.Agent) string

func LatestRelease added in v0.0.33

func LatestRelease(p *configurations.Agent) (string, error)

func Load

func Load[P AgentContext, Instance any](p *configurations.Agent, unique string, opts ...Option) (*Instance, error)

func NewServerLogger

func NewServerLogger() hclog.Logger

func NoLogger

func NoLogger() hclog.Logger

func Register

func Register(agents ...AgentImplementation)

func RegisterLogCallback

func RegisterLogCallback(callback LogCallback)

func ToKind

func ToKind(s string) agentsv1.Log_Kind

Types

type Agent

type Agent struct {
	Configuration  *configurations.Agent
	Type           string
	Implementation plugin.Plugin
}

type AgentContext

type AgentContext interface {
	Key(p *configurations.Agent, unique string) string
	Default() plugin.Plugin
}

type AgentImplementation

type AgentImplementation struct {
	Agent         plugin.Plugin
	Configuration *configurations.Agent
}

type AgentLogger

type AgentLogger struct {
	AgentIdentifier string
	Service         string
	Application     string
	// contains filtered or unexported fields
}

func NewAgentLogger

func NewAgentLogger(identity *servicev1.ServiceIdentity, agent *configurations.Agent) *AgentLogger

func (*AgentLogger) Catch

func (l *AgentLogger) Catch()

func (*AgentLogger) DebugMe

func (l *AgentLogger) DebugMe(format string, args ...any)

func (*AgentLogger) Debugf

func (l *AgentLogger) Debugf(format string, args ...any)

func (*AgentLogger) Errorf

func (l *AgentLogger) Errorf(format string, args ...any) error

func (*AgentLogger) Info

func (l *AgentLogger) Info(format string, args ...any)

func (*AgentLogger) NewLogEntry

func (l *AgentLogger) NewLogEntry(b []byte) LogEntry

func (*AgentLogger) SetDebug

func (l *AgentLogger) SetDebug()

func (*AgentLogger) SetLevel

func (l *AgentLogger) SetLevel(lvl shared.LogLevel)

func (*AgentLogger) SetTrace

func (l *AgentLogger) SetTrace()

func (*AgentLogger) TODO

func (l *AgentLogger) TODO(format string, args ...any)

func (*AgentLogger) Tracef

func (l *AgentLogger) Tracef(format string, args ...any)

func (*AgentLogger) UnsafeWrite

func (l *AgentLogger) UnsafeWrite(s string)

func (*AgentLogger) Warn

func (l *AgentLogger) Warn(format string, args ...any)

func (*AgentLogger) Wrapf

func (l *AgentLogger) Wrapf(err error, format string, args ...any) error

func (*AgentLogger) Write

func (l *AgentLogger) Write(b []byte) (n int, err error)

func (*AgentLogger) WriteEntry

func (l *AgentLogger) WriteEntry(entry LogEntry) (n int, err error)

type ColorPicker

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

func NewColorPicker

func NewColorPicker() *ColorPicker

func (*ColorPicker) PickStyle

func (cp *ColorPicker) PickStyle(app string, service string) lipgloss.Style

type GithubSource added in v0.0.33

type GithubSource struct {
	Owner string
	Repo  string
}

type LogCallback

type LogCallback func(log *agentsv1.Log)

type LogEntry

type LogEntry struct {
	Msg             string
	AgentIdentifier string
	Service         string
	Application     string
	Kind            string
	DebugMe         bool
}

type LogMessage

type LogMessage struct {
	Level     string    `json:"@level"`
	Timestamp time.Time `json:"@timestamp"`

	RawMessage string `json:"@message"`

	Message LogMessageContent
}

type LogMessageContent

type LogMessageContent struct {
	Msg             string `json:"Msg"`
	Application     string `json:"Application"`
	Service         string `json:"Service"`
	Kind            string `json:"Kind"`
	AgentIdentifier string `json:"AgentIdentifier"`
	Level           string `json:"Level"`
}

type Option

type Option = func(options *Options)

func WithApplication

func WithApplication(app *configurations.Application) Option

func WithQuiet

func WithQuiet() Option

type Options

type Options struct {
	Quiet       bool
	Application *configurations.Application
}

type Pluggable

type Pluggable interface {
	ImplementationKind() string
	Path() (string, error)
	Name() string
	Unique() string
}

type ServerFormatter

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

func NewServerFormatter

func NewServerFormatter(debug bool) *ServerFormatter

func (*ServerFormatter) Write

func (out *ServerFormatter) Write(p []byte) (n int, err error)

type ServiceLogger

type ServiceLogger struct {
	AgentIdentifier string
	Service         string
	Application     string
	JSON            bool
	// contains filtered or unexported fields
}

func NewServiceLogger

func NewServiceLogger(identity *servicev1.ServiceIdentity, agent *configurations.Agent) *ServiceLogger

func (*ServiceLogger) DebugMe

func (l *ServiceLogger) DebugMe(format string, args ...any)

func (*ServiceLogger) Debugf

func (l *ServiceLogger) Debugf(format string, args ...any)

func (*ServiceLogger) Errorf

func (l *ServiceLogger) Errorf(format string, args ...any) error

func (*ServiceLogger) Info

func (l *ServiceLogger) Info(format string, args ...any)

func (*ServiceLogger) SetLevel

func (l *ServiceLogger) SetLevel(lvl shared.LogLevel)

func (*ServiceLogger) TODO

func (l *ServiceLogger) TODO(format string, args ...any)

func (*ServiceLogger) Tracef

func (l *ServiceLogger) Tracef(format string, args ...any)

func (*ServiceLogger) UnsafeWrite

func (l *ServiceLogger) UnsafeWrite(s string)

func (*ServiceLogger) Wrapf

func (l *ServiceLogger) Wrapf(err error, format string, args ...any) error

func (*ServiceLogger) Write

func (l *ServiceLogger) Write(p []byte) (n int, err error)

Directories

Path Synopsis
helpers
api
go

Jump to

Keyboard shortcuts

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