agent

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package agent provide support for hidra-agents

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartAgent

func StartAgent(apiURL, secretToken, datadir string)

StartAgent Initialize an agent

Types

type Agent

type Agent struct {
	APIURL  string
	Secret  string
	DataDir string
}

Agent Represent one agent configuration

func (*Agent) DoAPICall

func (a *Agent) DoAPICall(endpoint, method string, body io.Reader) (*http.Response, error)

DoAPICall Make a request to hidra API

func (*Agent) GetSample

func (a *Agent) GetSample(id string) []byte

GetSample Get one sample

func (*Agent) ListSamples

func (a *Agent) ListSamples() []models.Sample

ListSamples List all samples related to current agent

func (*Agent) PushMetrics

func (a *Agent) PushMetrics(sampleID string, metrics *models.ScenarioResult) error

PushMetrics Push metrics to API

func (*Agent) RemoveDeprecatedSamples

func (a *Agent) RemoveDeprecatedSamples(samples []models.Sample, files []fs.FileInfo)

RemoveDeprecatedSamples Clean up old samples

func (*Agent) RunAllSamples

func (a *Agent) RunAllSamples()

RunAllSamples Run all samples in current agent

func (*Agent) UpdateLocalResources

func (a *Agent) UpdateLocalResources()

UpdateLocalResources Try to update local resources

func (*Agent) UpdateSamplesIfNeeded

func (a *Agent) UpdateSamplesIfNeeded(samples []models.Sample, files []fs.FileInfo)

UpdateSamplesIfNeeded Check if current sample should be updated

Jump to

Keyboard shortcuts

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