Documentation
¶
Index ¶
- Constants
- Variables
- func Aggregate(ctx context.Context, table string, query types.AggregatedResourceSelector) ([]types.AggregateRow, error)
- func ArtifactsByCheck(ctx context.Context, checkID uuid.UUID, checkTime time.Time) ([]models.Artifact, error)
- func ArtifactsByPlaybookRun(ctx context.Context, runID uuid.UUID) ([]models.Artifact, error)
- func BuildJSONFieldSelector(field string) (selector, alias string)
- func BuildSelectClause(groupBy []string, aggregates []types.AggregationField) string
- func CheckSummary(ctx context.Context, opts ...CheckSummaryOptions) ([]models.CheckSummary, error)
- func CheckSummaryByID(ctx context.Context, checkID string) (*models.CheckSummary, error)
- func ComponentFromCache(ctx context.Context, id string, queryDeleted bool) (models.Component, error)
- func ConfigIDsByTypeFromCache(ctx context.Context, id, typ string) ([]string, error)
- func ConfigItemFromCache(ctx context.Context, id string) (models.ConfigItem, error)
- func ConfigItemSummaryFromCache(ctx context.Context, id string) (models.ConfigItemSummary, error)
- func ConfigRelationsFromCache(ctx context.Context, id string) ([]string, error)
- func ConfigSummary(ctx context.Context, req ConfigSummaryRequest) (types.JSON, error)
- func FindAgent(ctx context.Context, name string) (*models.Agent, error)
- func FindCachedAgent(ctx context.Context, identifier string) (*models.Agent, error)
- func FindCachedCanary(ctx context.Context, id string) (*models.Canary, error)
- func FindCachedCheck(ctx context.Context, id string) (*models.Check, error)
- func FindCheckIDs(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]uuid.UUID, error)
- func FindChecks(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]models.Check, error)
- func FindComponentIDs(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]uuid.UUID, error)
- func FindComponents(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]models.Component, error)
- func FindConfig(ctx context.Context, query types.ConfigQuery) (*models.ConfigItem, error)
- func FindConfigAccessByConfigIDs(ctx context.Context, configIDs []uuid.UUID) ([]models.ConfigAccessSummary, error)
- func FindConfigChangeIDsByResourceSelector(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]uuid.UUID, error)
- func FindConfigChangesByResourceSelector(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]models.CatalogChange, error)
- func FindConfigChildrenIDsByLocation(ctx context.Context, configID uuid.UUID, prefix string) ([]uuid.UUID, error)
- func FindConfigForComponent(ctx context.Context, componentID, configType string) ([]models.ConfigItem, error)
- func FindConfigIDs(ctx context.Context, limit int, config types.ConfigQuery) ([]uuid.UUID, error)
- func FindConfigIDsByResourceSelector(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]uuid.UUID, error)
- func FindConfigItemSummaryByResourceSelector(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]models.ConfigItemSummary, error)
- func FindConfigItemSummaryIDsByResourceSelector(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]uuid.UUID, error)
- func FindConfigParentIDsByLocation(ctx context.Context, configID uuid.UUID, prefix string) ([]uuid.UUID, error)
- func FindConfigs(ctx context.Context, limit int, config types.ConfigQuery) ([]models.ConfigItem, error)
- func FindConfigsByResourceSelector(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]models.ConfigItem, error)
- func FindPerson(ctx context.Context, identifier string, opts ...GetterOption) (*models.Person, error)
- func FindPlaybook(ctx context.Context, identifier string, opts ...GetterOption) (*models.Playbook, error)
- func FindPlaybookIDsByResourceSelector(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]uuid.UUID, error)
- func FindPlaybooksByResourceSelector(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]models.Playbook, error)
- func FindTeam(ctx context.Context, identifier string, opts ...GetterOption) (*models.Team, error)
- func FlushComponentCache(ctx context.Context) error
- func FlushConfigCache(ctx context.Context) error
- func FlushGettersCache()
- func FlushTopologyCache()
- func GetAllResourceIDsOfAgent(ctx context.Context, table, from string, size int, agentID uuid.UUID) ([]string, error)
- func GetCachedComponent(ctx context.Context, id string) (*models.Component, error)
- func GetCachedConfig(ctx context.Context, id string) (*models.ConfigItem, error)
- func GetCachedIncident(ctx context.Context, id string) (*models.Incident, error)
- func GetCatalogChangesByIDs(ctx context.Context, ids []uuid.UUID) ([]models.CatalogChange, error)
- func GetChecksByIDs(ctx context.Context, ids []uuid.UUID) ([]models.Check, error)
- func GetComponent(ctx context.Context, id string) (*models.Component, error)
- func GetComponentsByIDs(ctx context.Context, ids []uuid.UUID) ([]models.Component, error)
- func GetConfigItemSummaryByIDs(ctx context.Context, ids []uuid.UUID) ([]models.ConfigItemSummary, error)
- func GetConfigsByIDs(ctx context.Context, ids []uuid.UUID) ([]models.ConfigItem, error)
- func GetDistinctTags(ctx context.Context) ([]string, error)
- func GetNotificationStats(ctx context.Context, notificationIDs ...string) ([]models.NotificationSummary, error)
- func InvalidateCacheByID[T any](id string)
- func MatchQueryCelFunc(ctx context.Context) cel.EnvOption
- func MatchQueryGotemplateFunc(ctx context.Context) any
- func OrQueries(db *gorm.DB, queries ...*gorm.DB) *gorm.DB
- func ParseFilteringQuery(query string, decodeURL bool) (grammar.FilteringQuery, error)
- func QueryTableColumnsWithResourceSelectors[T any](ctx context.Context, table string, selectColumns []string, limit int, ...) ([]T, error)
- func SetResourceSelectorClause(ctx context.Context, resourceSelector types.ResourceSelector, query *gorm.DB, ...) (*gorm.DB, error)
- func SortComponentsByField(c models.Components, sortBy TopologyQuerySortBy, asc bool)
- func SyncComponentCache(ctx context.Context) error
- func SyncConfigCache(ctx context.Context) error
- func TraverseConfig(ctx context.Context, configID, relationType, direction string) []models.ConfigItem
- type CatalogChangesSearchRequest
- type CatalogChangesSearchResponse
- type ChangeRelationDirection
- type CheckQueryParams
- func (q CheckQueryParams) ExecuteDetails(ctx context.Context) ([]Timeseries, types.Uptime, types.Latency, error)
- func (q CheckQueryParams) GetEndTime() *time.Time
- func (q CheckQueryParams) GetStartTime() *time.Time
- func (q CheckQueryParams) GetWhereClause() (string, map[string]interface{}, error)
- func (q *CheckQueryParams) Init(queryParams url.Values) error
- func (q CheckQueryParams) String() string
- func (q *CheckQueryParams) Validate() error
- type CheckSummaryOptions
- type CheckSummarySortBy
- type ConfigChangeRow
- type ConfigMinimal
- type ConfigSummaryRequest
- type ConfigSummaryRequestAnalysis
- type ConfigSummaryRequestChanges
- type GetterOption
- type GetterOptions
- type Git
- type GitOpsSource
- type Kustomize
- type NotificationSendHistorySummaryRequest
- type NotificationSendHistorySummaryResponse
- type QueryModel
- type RelatedConfig
- type RelationDirection
- type RelationQuery
- type RelationType
- type SearchResourcesRequest
- type SearchResourcesResponse
- type SelectedResource
- type Tags
- type Timeseries
- type TopologyOptions
- type TopologyQuerySortBy
- type TopologyResponse
Constants ¶
const ( AggFunctionCount = "COUNT" AggFunctionSum = "SUM" AggFunctionAvg = "AVG" AggFunctionMax = "MAX" AggFunctionMin = "MIN" )
Aggregation function constants
const DefaultDepth = 5
Variables ¶
var AgentMapper = func(ctx context.Context, id string) (any, error) { if strings.ToLower(id) == "all" { return nil, nil } if id, err := uuid.Parse(id); err == nil { return id.String(), nil } if agent, _ := FindCachedAgent(ctx, id); agent != nil && agent.ID != uuid.Nil { return &agent.ID, nil } return nil, fmt.Errorf("invalid agent: %s", id) }
var AllowedAggregationFunctions = []string{ AggFunctionCount, AggFunctionSum, AggFunctionAvg, AggFunctionMax, AggFunctionMin, }
AllowedAggregationFunctions lists all permitted aggregation functions
var CheckQueryModel = QueryModel{ Table: models.Check{}.TableName(), Columns: []string{ "id", "name", "namespace", "canary_id", "type", "status", "agent_id", "created_at", "updated_at", "deleted_at", }, JSONMapColumns: []string{"spec", "labels"}, Aliases: map[string]string{ "created": "created_at", "updated": "updated_at", "deleted": "deleted_at", "agent": "agent_id", "health": "status", "check_type": "type", }, HasAgents: true, HasLabels: true, FieldMapper: map[string]func(ctx context.Context, id string) (any, error){ "agent_id": AgentMapper, "created_at": DateMapper, "updated_at": DateMapper, "deleted_at": DateMapper, }, }
var CommonFields = map[string]func(ctx context.Context, tx *gorm.DB, val string) (*gorm.DB, error){ "limit": func(ctx context.Context, tx *gorm.DB, val string) (*gorm.DB, error) { if i, err := strconv.Atoi(val); err == nil { return tx.Limit(i), nil } else { return nil, err } }, "sort": func(ctx context.Context, tx *gorm.DB, sort string) (*gorm.DB, error) { return tx.Order(clause.OrderByColumn{Column: clause.Column{Name: sort}}), nil }, "offset": func(ctx context.Context, tx *gorm.DB, val string) (*gorm.DB, error) { if i, err := strconv.Atoi(val); err == nil { return tx.Offset(i), nil } else { return nil, err } }, }
var ComponentQueryModel = QueryModel{ Table: models.Component{}.TableName(), Custom: map[string]func(ctx context.Context, tx *gorm.DB, val string) (*gorm.DB, error){ "component_config_traverse": func(ctx context.Context, tx *gorm.DB, val string) (*gorm.DB, error) { args := strings.Split(val, ",") componentID := args[0] direction := "outgoing" if len(args) > 1 { direction = args[1] } _ = direction tx = tx.Where("id IN (SELECT id from lookup_component_config_id_related_components(?))", componentID) return tx, nil }, }, Columns: []string{ "id", "name", "namespace", "topology_id", "type", "status", "health", "agent_id", "created_at", "updated_at", "deleted_at", }, JSONMapColumns: []string{"labels", "summary"}, Aliases: map[string]string{ "created": "created_at", "updated": "updated_at", "deleted": "deleted_at", "agent": "agent_id", "component_type": "type", }, HasProperties: true, HasAgents: true, HasLabels: true, FieldMapper: map[string]func(ctx context.Context, id string) (any, error){ "agent_id": AgentMapper, "created_at": DateMapper, "updated_at": DateMapper, "deleted_at": DateMapper, "last_scraped_time": DateMapper, }, }
var ConfigChangeQueryModel = QueryModel{ Table: "catalog_changes", Columns: []string{ "id", "config_id", "name", "type", "created_at", "severity", "change_type", "summary", "count", "first_observed", "agent_id", }, JSONMapColumns: []string{"tags", "details"}, HasAgents: true, HasTags: true, Aliases: map[string]string{ "created": "created_at", "first_observed": "first_observed", "external_id": "external_created_by", "changeType": "change_type", }, FieldMapper: map[string]func(ctx context.Context, id string) (any, error){ "created_at": DateMapper, "first_observed": DateMapper, "agent_id": AgentMapper, }, }
var ConfigItemQueryModel = QueryModel{ Table: models.ConfigItem{}.TableName(), Columns: []string{ "id", "name", "source", "type", "status", "agent_id", "health", "external_id", "config_class", "cost_total_1d", "cost_total_7d", "cost_total_30d", "cost_per_minute", "created_at", "updated_at", "deleted_at", "last_scraped_time", }, JSONMapColumns: []string{"labels", "tags", "config"}, HasProperties: true, HasTags: true, HasAgents: true, HasLabels: true, Aliases: map[string]string{ "created": "created_at", "updated": "updated_at", "deleted": "deleted_at", "scraped": "last_scraped_time", "agent": "agent_id", "config_type": "type", "namespace": "tags.namespace", }, FieldMapper: map[string]func(ctx context.Context, id string) (any, error){ "agent_id": AgentMapper, "created_at": DateMapper, "updated_at": DateMapper, "deleted_at": DateMapper, "last_scraped_time": DateMapper, }, }
var ConfigItemSummaryQueryModel = QueryModel{ Table: models.ConfigItemSummary{}.TableName(), Columns: []string{ "id", "scraper_id", "config_class", "external_id", "type", "name", "namespace", "source", "created_by", "created_at", "updated_at", "deleted_at", "cost_per_minute", "cost_total_1d", "cost_total_7d", "cost_total_30d", "agent_id", "status", "health", "ready", "path", "changes", "analysis", }, JSONMapColumns: []string{"labels", "tags"}, HasTags: true, HasAgents: true, HasLabels: true, HasProperties: true, Aliases: map[string]string{ "created": "created_at", "updated": "updated_at", "deleted": "deleted_at", "agent": "agent_id", "config_type": "type", "changes_count": "changes", "analysis_count": "analysis", }, FieldMapper: map[string]func(ctx context.Context, id string) (any, error){ "agent_id": AgentMapper, "created_at": DateMapper, "updated_at": DateMapper, "deleted_at": DateMapper, }, }
var DateMapper = func(ctx context.Context, val string) (any, error) { if expr, err := datemath.Parse(val); err != nil { return nil, fmt.Errorf("invalid date '%s': %s", val, err) } else { return expr.Time(), nil } }
var DefaultCheckQueryWindow = "1h"
Default search window
var DefaultQueryTimeout = 30 * time.Second
var JSONPathMapper = func(ctx context.Context, tx *gorm.DB, column string, op grammar.QueryOperator, path string, val string) *gorm.DB { if !slices.Contains([]grammar.QueryOperator{grammar.Eq, grammar.Neq}, op) { op = grammar.Eq } values := strings.Split(val, ",") for _, v := range values { tx = tx.Where(fmt.Sprintf(`TRIM(BOTH '"' from jsonb_path_query_first(%s, '$.%s')::TEXT) %s ?`, column, path, op), v) } return tx }
var Jobs = []*job.Job{
syncConfigCacheJob,
updateTypesCache,
}
var LocalFilter = "deleted_at is NULL AND agent_id = '00000000-0000-0000-0000-000000000000' OR agent_id IS NULL"
var NumericAggregationFunctions = []string{ AggFunctionSum, AggFunctionAvg, AggFunctionMax, AggFunctionMin, }
NumericAggregationFunctions lists functions that require numeric values
var PlaybookQueryModel = QueryModel{ Table: models.Playbook{}.TableName(), HasTags: true, Columns: []string{"id", "name", "namespace", "created_at", "updated_at", "deleted_at"}, Aliases: map[string]string{ "created": "created_at", "updated": "updated_at", "deleted": "deleted_at", }, FieldMapper: map[string]func(ctx context.Context, id string) (any, error){ "created_at": DateMapper, "updated_at": DateMapper, "deleted_at": DateMapper, }, }
var SyncComponentCacheJob = &job.Job{ Name: "SyncComponentCache", Schedule: "@every 5m", JobHistory: true, Retention: job.RetentionFew, Fn: func(ctx job.JobRuntime) error { return SyncComponentCache(ctx.Context) }, }
Functions ¶
func Aggregate ¶ added in v1.0.963
func Aggregate(ctx context.Context, table string, query types.AggregatedResourceSelector) ([]types.AggregateRow, error)
Aggregate performs aggregation queries on resources with GROUP BY and aggregation functions The select clauses, limits are defined in the query struct. The table parameter specifies which table to query (e.g., "config_items", "components", "checks")
func ArtifactsByCheck ¶ added in v1.0.225
func ArtifactsByPlaybookRun ¶ added in v1.0.225
func BuildJSONFieldSelector ¶ added in v1.0.963
BuildJSONFieldSelector creates SQL for accessing JSON fields and returns both the selector and alias This assumes the field has already been validated by isValidFieldForQuery
func BuildSelectClause ¶ added in v1.0.964
func BuildSelectClause(groupBy []string, aggregates []types.AggregationField) string
BuildSelectClause constructs the SELECT clause with GROUP BY fields and aggregations
func CheckSummary ¶
func CheckSummary(ctx context.Context, opts ...CheckSummaryOptions) ([]models.CheckSummary, error)
func CheckSummaryByID ¶
func ComponentFromCache ¶ added in v1.0.324
func ConfigIDsByTypeFromCache ¶ added in v1.0.318
func ConfigItemFromCache ¶ added in v1.0.318
func ConfigItemSummaryFromCache ¶ added in v1.0.1004
func ConfigRelationsFromCache ¶ added in v1.0.318
func ConfigSummary ¶ added in v1.0.421
func FindCachedAgent ¶ added in v1.0.324
func FindCachedCanary ¶ added in v1.0.324
func FindCachedCheck ¶ added in v1.0.324
func FindCheckIDs ¶ added in v1.0.324
func FindChecks ¶ added in v1.0.324
func FindComponentIDs ¶ added in v1.0.324
func FindComponents ¶ added in v1.0.324
func FindConfig ¶ added in v1.0.253
func FindConfig(ctx context.Context, query types.ConfigQuery) (*models.ConfigItem, error)
func FindConfigAccessByConfigIDs ¶ added in v1.0.941
func FindConfigChangeIDsByResourceSelector ¶ added in v1.0.963
func FindConfigChangesByResourceSelector ¶ added in v1.0.963
func FindConfigChangesByResourceSelector(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]models.CatalogChange, error)
func FindConfigChildrenIDsByLocation ¶ added in v1.0.1021
func FindConfigForComponent ¶ added in v1.0.253
func FindConfigIDs ¶ added in v1.0.294
func FindConfigIDsByResourceSelector ¶ added in v1.0.324
func FindConfigItemSummaryByResourceSelector ¶ added in v1.0.1004
func FindConfigItemSummaryByResourceSelector(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]models.ConfigItemSummary, error)
func FindConfigItemSummaryIDsByResourceSelector ¶ added in v1.0.1004
func FindConfigParentIDsByLocation ¶ added in v1.0.1021
func FindConfigs ¶ added in v1.0.254
func FindConfigs(ctx context.Context, limit int, config types.ConfigQuery) ([]models.ConfigItem, error)
func FindConfigsByResourceSelector ¶ added in v1.0.324
func FindConfigsByResourceSelector(ctx context.Context, limit int, resourceSelectors ...types.ResourceSelector) ([]models.ConfigItem, error)
func FindPerson ¶ added in v1.0.324
func FindPerson(ctx context.Context, identifier string, opts ...GetterOption) (*models.Person, error)
FindPerson looks up a person by the given identifier which can either be
- UUID
func FindPlaybook ¶ added in v1.0.674
func FindPlaybookIDsByResourceSelector ¶ added in v1.0.798
func FindPlaybooksByResourceSelector ¶ added in v1.0.798
func FindTeam ¶ added in v1.0.324
FindTeam looks up a team by the given identifier which can either be
- UUID
- team name
func FlushComponentCache ¶ added in v1.0.330
func FlushConfigCache ¶ added in v1.0.330
func FlushGettersCache ¶ added in v1.0.327
func FlushGettersCache()
func FlushTopologyCache ¶ added in v1.0.414
func FlushTopologyCache()
func GetAllResourceIDsOfAgent ¶ added in v1.0.274
func GetCachedComponent ¶ added in v1.0.324
func GetCachedConfig ¶ added in v1.0.324
func GetCachedIncident ¶ added in v1.0.324
func GetCatalogChangesByIDs ¶ added in v1.0.963
func GetChecksByIDs ¶ added in v1.0.324
func GetComponentsByIDs ¶ added in v1.0.324
func GetConfigItemSummaryByIDs ¶ added in v1.0.1004
func GetConfigsByIDs ¶ added in v1.0.324
func GetDistinctTags ¶ added in v1.0.829
func GetNotificationStats ¶ added in v1.0.917
func GetNotificationStats(ctx context.Context, notificationIDs ...string) ([]models.NotificationSummary, error)
GetNotificationStats retrieves statistics for a notification
func InvalidateCacheByID ¶ added in v1.0.743
InvalidateCacheByID deletes a single item from the getters cache
func MatchQueryCelFunc ¶ added in v1.0.843
func MatchQueryGotemplateFunc ¶ added in v1.0.843
func ParseFilteringQuery ¶ added in v1.0.376
func ParseFilteringQuery(query string, decodeURL bool) (grammar.FilteringQuery, error)
ParseFilteringQuery parses a filtering query string
func QueryTableColumnsWithResourceSelectors ¶ added in v1.0.948
func SetResourceSelectorClause ¶ added in v1.0.514
func SortComponentsByField ¶ added in v1.0.427
func SortComponentsByField(c models.Components, sortBy TopologyQuerySortBy, asc bool)
func SyncComponentCache ¶ added in v1.0.324
func SyncConfigCache ¶ added in v1.0.318
func TraverseConfig ¶ added in v1.0.318
func TraverseConfig(ctx context.Context, configID, relationType, direction string) []models.ConfigItem
Types ¶
type CatalogChangesSearchRequest ¶ added in v1.0.373
type CatalogChangesSearchRequest struct { CatalogID string `query:"id" json:"id"` ConfigType string `query:"config_type" json:"config_type"` ChangeType string `query:"type" json:"type"` Severity string `query:"severity" json:"severity"` IncludeDeletedConfigs bool `query:"include_deleted_configs" json:"include_deleted_configs"` Depth int `query:"depth" json:"depth"` CreatedByRaw string `query:"created_by" json:"created_by"` Summary string `query:"summary" json:"summary"` Source string `query:"source" json:"source"` Tags string `query:"tags" json:"tags"` // To Fetch from a particular agent, provide the agent id. // Use `local` keyword to filter by the local agent. AgentID string `query:"agent_id" json:"agent_id"` // From date in datemath format From string `query:"from" json:"from"` // To date in datemath format To string `query:"to" json:"to"` PageSize int `query:"page_size" json:"page_size"` Page int `query:"page" json:"page"` SortBy string `query:"sort_by" json:"sort_by"` // upstream | downstream | both Recursive ChangeRelationDirection `query:"recursive" json:"recursive"` // FIXME: Soft toggle does not work with Recursive=both // In that case, soft relations are always returned // It also returns ALL soft relations throughout the tree // not just soft related to the main config item Soft bool `query:"soft" json:"soft"` // contains filtered or unexported fields }
func (*CatalogChangesSearchRequest) SetDefaults ¶ added in v1.0.379
func (t *CatalogChangesSearchRequest) SetDefaults()
func (CatalogChangesSearchRequest) String ¶ added in v1.0.385
func (t CatalogChangesSearchRequest) String() string
func (*CatalogChangesSearchRequest) Validate ¶ added in v1.0.373
func (t *CatalogChangesSearchRequest) Validate() error
type CatalogChangesSearchResponse ¶ added in v1.0.373
type CatalogChangesSearchResponse struct { Summary map[string]int `json:"summary,omitempty"` Total int64 `json:"total,omitempty"` Changes []ConfigChangeRow `json:"changes,omitempty"` }
func FindCatalogChanges ¶ added in v1.0.373
func FindCatalogChanges(ctx context.Context, req CatalogChangesSearchRequest) (*CatalogChangesSearchResponse, error)
func (*CatalogChangesSearchResponse) Summarize ¶ added in v1.0.373
func (t *CatalogChangesSearchResponse) Summarize()
type ChangeRelationDirection ¶ added in v1.0.782
type ChangeRelationDirection string
const ( CatalogChangeRecursiveUpstream ChangeRelationDirection = "upstream" CatalogChangeRecursiveDownstream ChangeRelationDirection = "downstream" CatalogChangeRecursiveNone ChangeRelationDirection = "none" CatalogChangeRecursiveAll ChangeRelationDirection = "all" )
type CheckQueryParams ¶ added in v1.0.260
type CheckQueryParams struct { Check string CanaryID string Start, End string IncludeMessages bool IncludeDetails bool StatusCount int Labels map[string]string Trace bool WindowDuration time.Duration // contains filtered or unexported fields }
func (CheckQueryParams) ExecuteDetails ¶ added in v1.0.260
func (q CheckQueryParams) ExecuteDetails(ctx context.Context) ([]Timeseries, types.Uptime, types.Latency, error)
func (CheckQueryParams) GetEndTime ¶ added in v1.0.260
func (q CheckQueryParams) GetEndTime() *time.Time
func (CheckQueryParams) GetStartTime ¶ added in v1.0.260
func (q CheckQueryParams) GetStartTime() *time.Time
func (CheckQueryParams) GetWhereClause ¶ added in v1.0.260
func (q CheckQueryParams) GetWhereClause() (string, map[string]interface{}, error)
func (*CheckQueryParams) Init ¶ added in v1.0.260
func (q *CheckQueryParams) Init(queryParams url.Values) error
func (CheckQueryParams) String ¶ added in v1.0.260
func (q CheckQueryParams) String() string
func (*CheckQueryParams) Validate ¶ added in v1.0.260
func (q *CheckQueryParams) Validate() error
type CheckSummaryOptions ¶
type CheckSummaryOptions struct { Timeout time.Duration CheckID *uuid.UUID SortBy CheckSummarySortBy DeleteFrom *time.Time // Labels apply to both the canary and check labels Labels map[string]string }
func OrderByName ¶
func OrderByName() CheckSummaryOptions
type CheckSummarySortBy ¶
type CheckSummarySortBy string
var CheckSummarySortByName CheckSummarySortBy = "name"
type ConfigChangeRow ¶ added in v1.0.379
type ConfigChangeRow struct { AgentID string `gorm:"column:agent_id" json:"agent_id"` ExternalChangeId string `gorm:"column:external_change_id" json:"external_change_id"` ID string `gorm:"primaryKey;unique_index;not null;column:id" json:"id"` ConfigID string `gorm:"column:config_id;default:''" json:"config_id"` DeletedAt *time.Time `gorm:"column:deleted_at" json:"deleted_at,omitempty"` ChangeType string `gorm:"column:change_type" json:"change_type" faker:"oneof: RunInstances, diff"` Severity string `gorm:"column:severity" json:"severity" faker:"oneof: critical, high, medium, low, info"` Source string `gorm:"column:source" json:"source"` Summary string `gorm:"column:summary;default:null" json:"summary,omitempty"` CreatedAt *time.Time `gorm:"column:created_at" json:"created_at"` Count int `gorm:"column:count" json:"count"` FirstObserved *time.Time `gorm:"column:first_observed" json:"first_observed,omitempty"` ConfigName string `gorm:"column:name" json:"name,omitempty"` ConfigType string `gorm:"column:type" json:"type,omitempty"` Tags types.JSONStringMap `gorm:"column:tags" json:"tags,omitempty"` CreatedBy *uuid.UUID `gorm:"column:created_by" json:"created_by,omitempty"` ExternalCreatedBy string `gorm:"column:external_created_by" json:"external_created_by,omitempty"` }
type ConfigMinimal ¶ added in v1.0.1021
type ConfigMinimal struct { ID uuid.UUID `json:"id"` Name string `json:"name"` Type string `json:"type"` }
func FindConfigChildrenByLocation ¶ added in v1.0.1021
func FindConfigParentsByLocation ¶ added in v1.0.1021
type ConfigSummaryRequest ¶ added in v1.0.421
type ConfigSummaryRequest struct { Changes ConfigSummaryRequestChanges `json:"changes"` Analysis ConfigSummaryRequestAnalysis `json:"analysis"` Cost string `json:"cost"` Deleted bool `json:"deleted"` Filter map[string]string `json:"filter"` // Filter by labels GroupBy []string `json:"groupBy"` Tags []string `json:"tags"` Status string `json:"status"` Health string `json:"health"` }
func (*ConfigSummaryRequest) OrderBy ¶ added in v1.0.421
func (t *ConfigSummaryRequest) OrderBy() string
func (*ConfigSummaryRequest) Parse ¶ added in v1.0.421
func (t *ConfigSummaryRequest) Parse() error
func (*ConfigSummaryRequest) SetDefaults ¶ added in v1.0.421
func (t *ConfigSummaryRequest) SetDefaults()
type ConfigSummaryRequestAnalysis ¶ added in v1.0.421
type ConfigSummaryRequestAnalysis struct{}
type ConfigSummaryRequestChanges ¶ added in v1.0.421
type ConfigSummaryRequestChanges struct { Since string `json:"since"` // contains filtered or unexported fields }
type GetterOption ¶ added in v1.0.324
type GetterOption uint8
const (
GetterOptionNoCache GetterOption = iota + 1
)
type GetterOptions ¶ added in v1.0.324
type GetterOptions []GetterOption
func (GetterOptions) IsSet ¶ added in v1.0.324
func (t GetterOptions) IsSet(option GetterOption) bool
type Git ¶ added in v1.0.660
type GitOpsSource ¶ added in v1.0.660
func GetGitOpsSource ¶ added in v1.0.660
func (*GitOpsSource) AsMap ¶ added in v1.0.660
func (t *GitOpsSource) AsMap() map[string]any
type NotificationSendHistorySummaryRequest ¶ added in v1.0.930
type NotificationSendHistorySummaryRequest struct { GroupBy []string `json:"groupBy"` Status types.MatchExpression `json:"status"` // matchItem ResourceType string `json:"resourceType"` Search string `json:"search"` // search on resource name From string `json:"from"` To string `json:"to"` IncludeDeletedResources bool `json:"includeDeletedResources"` PageIndex int `json:"pageIndex"` PageSize int `json:"pageSize"` // contains filtered or unexported fields }
func (*NotificationSendHistorySummaryRequest) SetDefaults ¶ added in v1.0.930
func (r *NotificationSendHistorySummaryRequest) SetDefaults()
func (*NotificationSendHistorySummaryRequest) Validate ¶ added in v1.0.930
func (r *NotificationSendHistorySummaryRequest) Validate() error
type NotificationSendHistorySummaryResponse ¶ added in v1.0.934
type NotificationSendHistorySummaryResponse struct { Total int64 `json:"total"` Results types.JSON `json:"results"` }
func NotificationSendHistorySummary ¶ added in v1.0.930
func NotificationSendHistorySummary(ctx context.Context, req NotificationSendHistorySummaryRequest) (*NotificationSendHistorySummaryResponse, error)
type QueryModel ¶ added in v1.0.788
type QueryModel struct { // Table name Table string // Custom functions to map fields to clauses Custom map[string]func(ctx context.Context, tx *gorm.DB, val string) (*gorm.DB, error) // List of jsonb columns that store a map. // These columns can be addressed using dot notation to access the JSON fields directly // Example: tags.cluster or tags.namespace. JSONMapColumns []string // List of columns that can be addressed on the search query. // Any other fields will be treated as a property lookup. Columns []string // Alias maps fields from the search query to the table columns Aliases map[string]string // True when the table has a "tags" column HasTags bool // True when the table has a "labels" column HasLabels bool // True when the table has an "agent_id" column HasAgents bool // True when the table has properties column HasProperties bool // FieldMapper maps the value of these fields FieldMapper map[string]func(ctx context.Context, id string) (any, error) }
func GetModelFromTable ¶ added in v1.0.788
func GetModelFromTable(table string) (QueryModel, error)
func (QueryModel) Apply ¶ added in v1.0.788
func (qm QueryModel) Apply(ctx context.Context, q grammar.QueryField, tx *gorm.DB) (*gorm.DB, []clause.Expression, error)
type RelatedConfig ¶ added in v1.0.561
type RelatedConfig struct { Relation string `json:"relation"` RelatedIDs pq.StringArray `json:"related_ids" gorm:"type:[]text"` ID uuid.UUID `json:"id"` Name string `json:"name"` Type string `json:"type"` Tags types.JSONStringMap `json:"tags"` Changes int `json:"changes,omitempty"` Analysis types.JSON `json:"analysis,omitempty"` CostPerMinute *float64 `json:"cost_per_minute,omitempty"` CostTotal1d *float64 `json:"cost_total_1d,omitempty"` CostTotal7d *float64 `json:"cost_total_7d,omitempty"` CostTotal30d *float64 `json:"cost_total_30d,omitempty"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt *time.Time `json:"deleted_at"` AgentID uuid.UUID `json:"agent_id"` Status *string `json:"status" gorm:"default:null"` Ready bool `json:"ready"` Health *models.Health `json:"health"` Path string `json:"path"` }
func GetRelatedConfigs ¶ added in v1.0.561
func GetRelatedConfigs(ctx context.Context, query RelationQuery) ([]RelatedConfig, error)
type RelationDirection ¶ added in v1.0.561
type RelationDirection string
const ( All RelationDirection = "all" Incoming RelationDirection = "incoming" Outgoing RelationDirection = "outgoing" )
func (RelationDirection) ToChangeDirection ¶ added in v1.0.782
func (t RelationDirection) ToChangeDirection() ChangeRelationDirection
type RelationQuery ¶ added in v1.0.561
type RelationQuery struct { ID uuid.UUID Relation RelationDirection Incoming RelationType Outgoing RelationType IncludeDeleted bool MaxDepth *int }
type RelationType ¶ added in v1.0.561
type RelationType string
const ( Both RelationType = "both" Hard RelationType = "hard" Soft RelationType = "soft" )
type SearchResourcesRequest ¶ added in v1.0.392
type SearchResourcesRequest struct { // Limit the number of results returned per resource type Limit int `json:"limit"` Checks []types.ResourceSelector `json:"checks"` Components []types.ResourceSelector `json:"components"` Configs []types.ResourceSelector `json:"configs"` ConfigChanges []types.ResourceSelector `json:"config_changes"` }
type SearchResourcesResponse ¶ added in v1.0.402
type SearchResourcesResponse struct { Checks []SelectedResource `json:"checks,omitempty"` Components []SelectedResource `json:"components,omitempty"` Configs []SelectedResource `json:"configs,omitempty"` ConfigChanges []SelectedResource `json:"config_changes,omitempty"` }
func SearchResources ¶ added in v1.0.392
func SearchResources(ctx context.Context, req SearchResourcesRequest) (*SearchResourcesResponse, error)
func (*SearchResourcesResponse) GetIDs ¶ added in v1.0.561
func (r *SearchResourcesResponse) GetIDs() []string
type SelectedResource ¶ added in v1.0.401
type Timeseries ¶ added in v1.0.260
type Timeseries struct { Key string `json:"key,omitempty"` Time string `json:"time,omitempty"` Status bool `json:"status,omitempty"` Message string `json:"message,omitempty"` Error string `json:"error,omitempty"` Duration int `json:"duration"` // Count is the number of times the check has been run in the specified time window Count int `json:"count,omitempty"` Passed int `json:"passed,omitempty"` Failed int `json:"failed,omitempty"` }
type TopologyOptions ¶
type TopologyOptions struct { ID string Owner string Labels map[string]string AgentID string Flatten bool Depth int // TODO: Filter status and types in DB Query Types []string Status []string SortBy TopologyQuerySortBy SortOrder string NoCache bool // contains filtered or unexported fields }
func (TopologyOptions) CacheKey ¶ added in v1.0.317
func (opt TopologyOptions) CacheKey() string
func (TopologyOptions) String ¶
func (opt TopologyOptions) String() string
type TopologyQuerySortBy ¶ added in v1.0.298
type TopologyQuerySortBy string
const ( TopologyQuerySortByName TopologyQuerySortBy = "name" TopologyQuerySortByField TopologyQuerySortBy = "field:" )
type TopologyResponse ¶
type TopologyResponse struct { Components models.Components `json:"components"` HealthStatuses []string `json:"healthStatuses"` Teams []string `json:"teams"` Tags Tags `json:"tags"` Types []string `json:"types"` }
func Topology ¶
func Topology(ctx context.Context, params TopologyOptions) (*TopologyResponse, error)
Source Files
¶
- agent.go
- aggregation.go
- artifacts.go
- check_details.go
- check_summary.go
- checks.go
- commons.go
- components.go
- components_cache.go
- config.go
- config_access.go
- config_cache.go
- config_changes.go
- config_relations.go
- config_traversal.go
- getters.go
- gitops.go
- jobs.go
- models.go
- notification_types.go
- notifications.go
- playbooks.go
- resource_selector.go
- template.go
- topology.go
- topology_options.go