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 ListViewsHandler(c echo.Context) error
- func NewPushHandler(ringManager StatusRingManager) echo.HandlerFunc
- func PingHandler(c echo.Context) error
- func ResetIsPushed(ctx context.Context) error
- func UpdateAgentLastReceived(ctx context.Context, id uuid.UUID) error
- func UpdateAgentLastSeen(ctx context.Context, id uuid.UUID) error
- type ForeignKeyErrorSummary
- type PushData
- func (t *PushData) AddAgentConfig(agent models.Agent)
- 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 int, foreignKeyFailures ForeignKeyErrorSummary, ...)
- 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) ListViews(ctx context.Context, views []ViewIdentifier) ([]ViewWithColumns, 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
- type ViewIdentifier
- type ViewWithColumns
Constants ¶
const ( StatusAgentError = "agent-error" StatusError = "error" StatusOK = "ok" StatusLabel = "status" AgentLabel = "agent" ForeignKeyError = "foreign key error" )
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 FKErrorIDCount = 10
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
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 ListViewsHandler ¶ added in v1.0.983
ListViewsHandler receives a list of namespace,name pairs and returns the view column definitions
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 ResetIsPushed ¶ added in v1.0.975
func UpdateAgentLastReceived ¶ added in v1.0.337
Types ¶
type ForeignKeyErrorSummary ¶ added in v1.0.740
type ForeignKeyErrorSummary struct {
// contains filtered or unexported fields
}
func (*ForeignKeyErrorSummary) Add ¶ added in v1.0.742
func (fks *ForeignKeyErrorSummary) Add(id string)
func (ForeignKeyErrorSummary) Count ¶ added in v1.0.740
func (fks ForeignKeyErrorSummary) Count() int
func (ForeignKeyErrorSummary) MarshalJSON ¶ added in v1.0.740
func (fks ForeignKeyErrorSummary) MarshalJSON() ([]byte, error)
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"`
ViewPanels []models.ViewPanel `json:"view_panels,omitempty"`
GeneratedViews map[string][]models.GeneratedViewTable `json:"generated_views,omitempty"`
}
PushData consists of data about changes to components, configs, analysis.
func NewPushData ¶ added in v1.0.362
func (*PushData) AddAgentConfig ¶ added in v1.0.1001
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, client *UpstreamClient, batchSize int) ReconcileSummary
func ReconcileSome ¶ added in v1.0.362
func ReconcileSome(ctx context.Context, client *UpstreamClient, 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 int, foreignKeyFailures ForeignKeyErrorSummary, 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 ReconcileTableSummary struct {
Success int `json:"success,omitempty"`
FKeyError ForeignKeyErrorSummary `json:"foreign_error,omitempty"`
Skipped bool `json:"skipped,omitempty"`
Error *oops.OopsError `json:"error,omitempty"`
}
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
type UpstreamClient struct {
*http.Client
AgentName string
// contains filtered or unexported fields
}
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) ListViews ¶ added in v1.0.983
func (t *UpstreamClient) ListViews(ctx context.Context, views []ViewIdentifier) ([]ViewWithColumns, error)
ListViews returns all views from upstream with namespace,name pairs
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
type ViewIdentifier ¶ added in v1.0.983
ViewIdentifier represents a view namespace and name pair