Documentation ¶
Index ¶
- Constants
- func AgentAuthMiddleware(agentCache *cache.Cache) func(echo.HandlerFunc) echo.HandlerFunc
- func DeleteFromUpstream(ctx context.Context, config UpstreamConfig, events []postq.Event) []postq.Event
- 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 NewDeleteFromUpstreamConsumer(config UpstreamConfig) func(ctx context.Context, events postq.Events) postq.Events
- func PingHandler(c echo.Context) error
- func PushHandler(c echo.Context) error
- func ReconcileAll(ctx context.Context, config UpstreamConfig, batchSize int) (int, error)
- func ReconcileSome(ctx context.Context, config UpstreamConfig, batchSize int, runOnly ...string) (int, error)
- func UpdateAgentLastReceived(ctx context.Context, id uuid.UUID) error
- func UpdateAgentLastSeen(ctx context.Context, id uuid.UUID) error
- type GroupedPushEvents
- 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 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.
const ( // EventPushQueueDelete is fired when a record, on one of the the tables we're tracking, // is hard deleted. EventPushQueueDelete = "push_queue.delete" )
Variables ¶
This section is empty.
Functions ¶
func AgentAuthMiddleware ¶ added in v1.0.356
func AgentAuthMiddleware(agentCache *cache.Cache) func(echo.HandlerFunc) echo.HandlerFunc
func DeleteFromUpstream ¶ added in v1.0.283
func DeleteFromUpstream(ctx context.Context, config UpstreamConfig, events []postq.Event) []postq.Event
DeleteFromUpstream sends a delete request to the upstream server for the given events.
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 NewDeleteFromUpstreamConsumer ¶ added in v1.0.283
func NewDeleteFromUpstreamConsumer(config UpstreamConfig) func(ctx context.Context, events postq.Events) postq.Events
NewDeleteFromUpstreamConsumer acts as an adapter to supply DeleteFromUpstream event consumer.
func PingHandler ¶ added in v1.0.337
func PingHandler(c echo.Context) error
func PushHandler ¶ added in v1.0.274
func PushHandler(c echo.Context) error
PushHandler returns an echo handler that saves the push data from agents.
func ReconcileAll ¶ added in v1.0.362
func ReconcileSome ¶ added in v1.0.362
func UpdateAgentLastReceived ¶ added in v1.0.337
Types ¶
type GroupedPushEvents ¶ added in v1.0.188
func GroupChangelogsByTables ¶ added in v1.0.188
func GroupChangelogsByTables(events []postq.Event) []GroupedPushEvents
GroupChangelogsByTables groups the given events by the table they belong to.
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"` }
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"`
}
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