agents

package
v0.0.0-...-9e7e4f5 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	Authenticate(Heartbeat) error
}

Authenticator abstracts over operations that authenticate agents to determine whether an agent should be allowed to persist a heartbeat.

type Environment

type Environment struct {
	Init      string   `json:"init"`
	Ident     string   `json:"ident"`
	OS        string   `json:"os"`
	Arch      string   `json:"arch"`
	IsProxied bool     `json:"isProxied"`
	Proxy     string   `json:"proxy"`
	Addresses []string `json:"addresses"`
	PublicIP  string   `json:"publicIP"`
	Modules   []string `json:"modules"`
}

Environment contains information about the environment an agent is running in.

type Heartbeat

type Heartbeat struct {
	Name        string      `json:"name"`
	Mode        string      `json:"mode"`
	Version     string      `json:"version"`
	PID         uint        `json:"pid"`
	QueueLoc    string      `json:"queueLoc"`
	StartTime   time.Time   `json:"startTime"`
	RefreshTime time.Time   `json:"refreshTime"`
	Environment Environment `json:"environment"`
	Tags        []Tag       `json:"tags"`
}

Heartbeat contains information describing an active agent.

func (Heartbeat) ToMigAgent

func (hb Heartbeat) ToMigAgent() mig.Agent

type NilAuthenticator

type NilAuthenticator struct{}

NilAuthenticator implements Authenticator in such a way that all attempts to upload a heartbeat will be allowed.

func NewNilAuthenticator

func NewNilAuthenticator() NilAuthenticator

NewNilAuthenticator constructs a new NilAuthenticator.

func (NilAuthenticator) Authenticate

func (auth NilAuthenticator) Authenticate(_ Heartbeat) error

Authenticate always returns nil.

type PersistHeartbeat

type PersistHeartbeat interface {
	PersistHeartbeat(Heartbeat) error
}

PersistHeartbeat abstracts over operations that allow the MIG API to save some information about agents sent in a heartbeat message.

type PersistHeartbeatPostgres

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

func NewPersistHeartbeatPostgres

func NewPersistHeartbeatPostgres(db *migdb.DB) PersistHeartbeatPostgres

func (PersistHeartbeatPostgres) PersistHeartbeat

func (persist PersistHeartbeatPostgres) PersistHeartbeat(heartbeat Heartbeat) error

type Tag

type Tag struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Tag is a label associated with an agent.

type UploadHeartbeat

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

UploadHeartbeat is an HTTP request handler that serves POST requests containing a Heartbeat encoded as JSON.

func NewUploadHeartbeat

func NewUploadHeartbeat(persist PersistHeartbeat, auth Authenticator) UploadHeartbeat

NewUploadHeartbeat constructs a new UploadHeartbeat.

func (UploadHeartbeat) ServeHTTP

func (handler UploadHeartbeat) ServeHTTP(response http.ResponseWriter, request *http.Request)

Jump to

Keyboard shortcuts

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