Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
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 ¶
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 ¶
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 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)