Documentation ¶
Index ¶
- Constants
- func AgentAuthMiddleware(agentCache *cache.Cache) func(echo.HandlerFunc) echo.HandlerFunc
- func DeleteHandler(c echo.Context) error
- func DeleteOnUpstream(ctx context.Context, req *PushData) error
- func GetOrCreateAgent(ctx context.Context, name string) (*models.Agent, error)
- func InsertUpstreamMsg(ctx context.Context, req *PushData) error
- func NewPushHandler(ringManager StatusRingManager) echo.HandlerFunc
- func PingHandler(c echo.Context) error
- func UpdateAgentLastReceived(ctx context.Context, id uuid.UUID) error
- func UpdateAgentLastSeen(ctx context.Context, id uuid.UUID) error
- type PushData
- func (p *PushData) AddMetrics(counter context.Counter)
- func (t *PushData) ApplyLabels(labels map[string]string)
- func (p *PushData) Attributes() map[string]any
- func (t *PushData) Count() int
- func (t *PushData) PopulateAgentID(id uuid.UUID)
- func (t *PushData) ReplaceTopologyID(id *uuid.UUID)
- func (t PushData) Size() (int, error)
- func (p *PushData) String() string
- type PushFKError
- type PushGroup
- type ReconcileSummary
- func (t *ReconcileSummary) AddSkipped(tables ...pushableTable)
- func (t *ReconcileSummary) AddStat(table string, success, foreignKeyFailures int, err error)
- func (t ReconcileSummary) DidReconcile(tables []string) bool
- func (t ReconcileSummary) Error() error
- func (t ReconcileSummary) GetSuccessFailure() (int, int)
- type ReconcileTableSummary
- type StatusRingManager
- type UpstreamClient
- func (t *UpstreamClient) Delete(ctx context.Context, msg *PushData) error
- func (t *UpstreamClient) Ping(ctx context.Context) error
- func (t *UpstreamClient) Push(ctx context.Context, msg *PushData) error
- func (t *UpstreamClient) PushArtifacts(ctx context.Context, artifactID uuid.UUID, reader io.ReadCloser) error
- type UpstreamConfig
Constants ¶
const ( StatusAgentError = "agent-error" StatusError = "error" StatusOK = "ok" StatusLabel = "status" AgentLabel = "agent" )
const AgentNameQueryParam = "agent_name"
AgentNameQueryParam is the name of the query param that's used to authenticate an agent when using basic auth instead of access tokens.
Variables ¶
This section is empty.
Functions ¶
func AgentAuthMiddleware ¶ added in v1.0.356
func AgentAuthMiddleware(agentCache *cache.Cache) func(echo.HandlerFunc) echo.HandlerFunc
func DeleteHandler ¶ added in v1.0.283
func DeleteHandler(c echo.Context) error
PushHandler returns an echo handler that deletes the push data from the upstream.
func DeleteOnUpstream ¶ added in v1.0.283
DeleteOnUpstream deletes the given resources by agent on the upstream.
func GetOrCreateAgent ¶ added in v1.0.274
func InsertUpstreamMsg ¶ added in v1.0.274
func NewPushHandler ¶ added in v1.0.608
func NewPushHandler(ringManager StatusRingManager) echo.HandlerFunc
NewPushHandler returns an echo handler that saves the push data from agents.
func PingHandler ¶ added in v1.0.337
func PingHandler(c echo.Context) error
func UpdateAgentLastReceived ¶ added in v1.0.337
Types ¶
type PushData ¶
type PushData struct { Canaries []models.Canary `json:"canaries,omitempty"` Checks []models.Check `json:"checks,omitempty"` Components []models.Component `json:"components,omitempty"` ConfigScrapers []models.ConfigScraper `json:"config_scrapers,omitempty"` ConfigAnalysis []models.ConfigAnalysis `json:"config_analysis,omitempty"` ConfigChanges []models.ConfigChange `json:"config_changes,omitempty"` ConfigItems []models.ConfigItem `json:"config_items,omitempty"` CheckStatuses []models.CheckStatus `json:"check_statuses,omitempty"` ConfigRelationships []models.ConfigRelationship `json:"config_relationships,omitempty"` ComponentRelationships []models.ComponentRelationship `json:"component_relationships,omitempty"` ConfigComponentRelationships []models.ConfigComponentRelationship `json:"config_component_relationships,omitempty"` Topologies []models.Topology `json:"topologies,omitempty"` PlaybookActions []models.PlaybookRunAction `json:"playbook_actions,omitempty"` Artifacts []models.Artifact `json:"artifacts,omitempty"` JobHistory []models.JobHistory `json:"job_history,omitempty"` }
PushData consists of data about changes to components, configs, analysis.
func NewPushData ¶ added in v1.0.362
func (*PushData) AddMetrics ¶ added in v1.0.317
func (*PushData) ApplyLabels ¶
ApplyLabels injects additional labels to the suitable fields
func (*PushData) Attributes ¶ added in v1.0.205
func (*PushData) PopulateAgentID ¶
PopulateAgentID sets agent_id on all the data
func (*PushData) ReplaceTopologyID ¶
ReplaceTopologyID replaces the topology_id for all the components with the provided id.
type PushFKError ¶ added in v1.0.428
type PushFKError struct {
IDs []string `json:"ids"`
}
func (*PushFKError) Empty ¶ added in v1.0.724
func (t *PushFKError) Empty() bool
type PushGroup ¶ added in v1.0.529
type PushGroup struct { Name string Tables []pushableTable // DependsOn is a list of tables that need to be reconciled // for this group to be reconciled. DependsOn []string }
PushGroup are a set of tables that need to be reconciled in order. If one fails, the rest are skipped.
type ReconcileSummary ¶ added in v1.0.529
type ReconcileSummary map[string]ReconcileTableSummary
func ReconcileAll ¶ added in v1.0.362
func ReconcileAll(ctx context.Context, config UpstreamConfig, batchSize int) ReconcileSummary
func ReconcileSome ¶ added in v1.0.362
func ReconcileSome(ctx context.Context, config UpstreamConfig, batchSize int, runOnly ...string) ReconcileSummary
func (*ReconcileSummary) AddSkipped ¶ added in v1.0.529
func (t *ReconcileSummary) AddSkipped(tables ...pushableTable)
func (*ReconcileSummary) AddStat ¶ added in v1.0.529
func (t *ReconcileSummary) AddStat(table string, success, foreignKeyFailures int, err error)
func (ReconcileSummary) DidReconcile ¶ added in v1.0.529
func (t ReconcileSummary) DidReconcile(tables []string) bool
DidReconcile returns true if all of the given tables reconciled successfully.
func (ReconcileSummary) Error ¶ added in v1.0.529
func (t ReconcileSummary) Error() error
func (ReconcileSummary) GetSuccessFailure ¶ added in v1.0.529
func (t ReconcileSummary) GetSuccessFailure() (int, int)
type ReconcileTableSummary ¶ added in v1.0.529
type StatusRingManager ¶ added in v1.0.608
type StatusRingManager interface { // Add adds the given history to the corresponding status ring of the agent. // if the status ring doesn't exist then it creates a new one. Add(ctx context.Context, agentID string, history models.JobHistory) }
StatusRingManager manages status rings for agent jobs.
func NewStatusRingStore ¶ added in v1.0.608
func NewStatusRingStore(evicted chan uuid.UUID) StatusRingManager
type UpstreamClient ¶ added in v1.0.192
func NewUpstreamClient ¶ added in v1.0.192
func NewUpstreamClient(config UpstreamConfig) *UpstreamClient
func (*UpstreamClient) Delete ¶ added in v1.0.283
func (t *UpstreamClient) Delete(ctx context.Context, msg *PushData) error
Delete performs hard delete on the given items from the upstream server.
func (*UpstreamClient) Ping ¶ added in v1.0.337
func (t *UpstreamClient) Ping(ctx context.Context) error
Ping sends a ping message to the upstream
func (*UpstreamClient) Push ¶ added in v1.0.192
func (t *UpstreamClient) Push(ctx context.Context, msg *PushData) error
Push uploads the given push message to the upstream server.
func (*UpstreamClient) PushArtifacts ¶ added in v1.0.316
func (t *UpstreamClient) PushArtifacts(ctx context.Context, artifactID uuid.UUID, reader io.ReadCloser) error
PushArtifacts uploads the given artifact to the upstream server.
type UpstreamConfig ¶
type UpstreamConfig struct { AgentName string Host string InsecureSkipVerify bool Username string Password string Labels []string Debug bool Options []func(c *http.Client) }
func (*UpstreamConfig) IsPartiallyFilled ¶
func (t *UpstreamConfig) IsPartiallyFilled() (bool, error)
func (*UpstreamConfig) LabelsMap ¶
func (t *UpstreamConfig) LabelsMap() map[string]string
func (UpstreamConfig) String ¶ added in v1.0.259
func (t UpstreamConfig) String() string
func (*UpstreamConfig) Valid ¶
func (t *UpstreamConfig) Valid() bool