Documentation
¶
Index ¶
- Variables
- func ParseDigest(input string) string
- type Alert
- type AlertAnnotation
- type AlertLabel
- type AlertPayload
- type AlertingAuthorizationConfig
- type AlertingBasicAuthConfig
- type AlertingConfig
- type AlertingHttpConfig
- type Config
- type Context
- type ContextEntry
- type ContextRoot
- type Database
- type DatabaseContext
- type DatabaseDriver
- type DefaultGormModel
- type Delete_PharosScanEngine
- type DockerImage
- type Enricher
- type EnricherCommonConfig
- type EnricherConfig
- type EnricherSource
- type EnricherType
- type EnrichersConfig
- type MapperConfig
- type PharosFindingSummary
- type PharosImageMeta
- type PharosImageSpec
- type PharosPackage
- type PharosRepoAuth
- type PharosScanFinding
- type PharosScanResult
- func (p *PharosScanResult) FromMap(values map[string]any) error
- func (rx *PharosScanResult) GetContextRoot(owner string, ttl time.Duration) ContextRoot
- func (rx *PharosScanResult) LoadGrypeImageScan(sbom syfttype.SyftSbomType, scan grypetype.GrypeScanType) error
- func (rx *PharosScanResult) LoadTrivyImageScan(sbom trivytype.TrivySbomType, scan trivytype.TrivyScanType) error
- func (rx *PharosScanResult) MaskAuth() PharosScanResult
- func (rx *PharosScanResult) ToBytes() []byte
- func (p PharosScanResult) ToMap() (map[string]any, error)
- type PharosScanTask
- func (p *PharosScanTask) FromMap(values map[string]any) error
- func (pt *PharosScanTask) GetReceiver() *chan PharosScanResult
- func (rx *PharosScanTask) SetError(err error) *PharosScanTask
- func (pt *PharosScanTask) SetReceiver(ch *chan PharosScanResult)
- func (p PharosScanTask) ToMap() (map[string]any, error)
- type PharosVulnerability
- type PrometheusAlert
- type PrometheusReporterConfig
- type PublisherConfig
- type ReceiverConfig
- type Redis
- type ResultCollectorConfig
- type RouteConfig
- type ScannerConfig
- type StringSlice
- type WebHookPayload
- type WebhookConfig
Constants ¶
This section is empty.
Variables ¶
var Models = []interface{}{ PharosImageMeta{}, PharosVulnerability{}, PharosScanFinding{}, PharosPackage{}, ContextRoot{}, Context{}, Alert{}, AlertLabel{}, AlertAnnotation{}, AlertPayload{}, Enricher{}, }
Functions ¶
func ParseDigest ¶
return digest from "bom-ref": "pkg:oci/alpine@sha256%3A0db9d004361b106932f8c7632ae54d56e92c18281e2dd203127d77405020abf6?arch=amd64&repository_url=index.docker.io%2Flibrary%2Falpine",
Types ¶
type Alert ¶
type Alert struct {
Status string `json:"status"`
Labels []AlertLabel `json:"labels" gorm:"foreignKey:AlertFingerprint;references:Fingerprint;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
Annotations []AlertAnnotation `json:"annotations" gorm:"foreignKey:AlertFingerprint;references:Fingerprint;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
StartsAt time.Time `json:"startsAt"`
EndsAt time.Time `json:"endsAt"`
GeneratorURL string `json:"generatorURL"`
Fingerprint string `json:"fingerprint" gorm:"primaryKey"` // see how this is defined: https://stackoverflow.com/questions/59066569/is-the-fingerprint-field-in-alertmanager-unique
}
type AlertAnnotation ¶
type AlertLabel ¶
type AlertPayload ¶
type AlertPayload struct {
Receiver string `json:"receiver" gorm:"primary_key"`
GroupKey string `json:"groupKey" gorm:"primary_key"`
GroupedBy StringSlice `json:"groupedBy" gorm:"type:VARCHAR"`
Status string `json:"status"` // "firing" or "resolved"
Alerts []*Alert `json:"alerts" gorm:"many2many:join_alert_payload_with_alert;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
ExtraLabels map[string]string `json:"extraLabels" yaml:"extraLabels" gorm:"serializer:json"` // Context data
}
AlertPayload is something we store in the database. An Alert Payload is identified by its GroupKey and Receiver. It is exposed by the API and we can manually silence it or add more commonlabels/annotations to it.
type AlertingBasicAuthConfig ¶
type AlertingConfig ¶
type AlertingConfig struct {
Route RouteConfig `mapstructure:"route" yaml:"route" json:"route" doc:"Root Route for alerts"`
Receivers []ReceiverConfig `mapstructure:"receivers" yaml:"receivers" json:"receivers" doc:"List of receivers for alerts"`
}
type AlertingHttpConfig ¶
type AlertingHttpConfig struct {
BasicAuth *AlertingBasicAuthConfig `mapstructure:"basic_auth" yaml:"basic_auth" json:"basic_auth,omitempty"`
Authorization *AlertingAuthorizationConfig `mapstructure:"authorization" yaml:"authorization" json:"authorization,omitempty"`
}
type Config ¶
type Config struct {
Redis Redis `mapstructure:"redis"`
Scanner ScannerConfig `mapstructure:"scanner"`
Publisher PublisherConfig `mapstructure:"publisher"`
Database Database `mapstructure:"database"`
Prometheus PrometheusReporterConfig `mapstructure:"prometheus"`
ResultCollector ResultCollectorConfig `mapstructure:"collector"`
Command string `mapstructure:"command"`
BasePath string
EnricherCommon EnricherCommonConfig `mapstructure:"enricherCommon" yaml:"enricherCommon" json:"enricherCommon"`
Alerting AlertingConfig `mapstructure:"alerting" yaml:"alerting" json:"alerting"`
Init bool `mapstructure:"init" yaml:"init" json:"init"` // If true, used as an init container to wait for dependencies to be ready
}
Config holds the application configuration.
func (*Config) ObfuscateSensitiveData ¶
ObfuscateSensitiveData replaces passwords and tokens in the config with "***".
type Context ¶
type Context struct {
ID uint `json:"ID" yaml:"ID" gorm:"primaryKey"` // Auto-incrementing primary key
ContextRootKey string `json:"ContextRootKey" yaml:"ContextRootKey"` // Composite Foreign Key to the ContextRoot Table
ImageId string `json:"ImageId" yaml:"ImageId"` // Composite Foreign Key to the ContextRoot Table
Owner string `json:"Owner" yaml:"Owner"` // The owner of the Context, this is the plugin that has created / changed it. Will be a Foreign Key to the Plugins Table
UpdatedAt time.Time `json:"UpdatedAt" yaml:"UpdatedAt"`
Data map[string]any `json:"Data" yaml:"Data" gorm:"serializer:json"` // Context data
}
type ContextEntry ¶
type ContextEntry struct {
ContextRootKey string `json:"ContextRootKey" yaml:"ContextRootKey"` // Composite Foreign Key to the ContextRoot Table
Owner string `json:"Owner" yaml:"Owner"`
Key string `json:"Key" yaml:"Key"` // Composite Key to the ContextRoot Table
Value any `json:"Value" yaml:"Value"` // Value of the context entry
UpdatedAt time.Time `json:"UpdatedAt" yaml:"UpdatedAt"` // Last update timestamp
}
type ContextRoot ¶
type ContextRoot struct {
Key string `json:"Key" yaml:"Key" gorm:"primaryKey"`
ImageId string `json:"ImageId" yaml:"ImageId" gorm:"primaryKey"`
UpdatedAt time.Time `json:"UpdatedAt" yaml:"UpdatedAt"`
TTL time.Duration `json:"TTL" yaml:"TTL"`
Contexts []Context `` /* 140-byte string literal not displayed */
}
func (*ContextRoot) IsExpired ¶
func (cr *ContextRoot) IsExpired() bool
type Database ¶
type Database struct {
Driver DatabaseDriver `mapstructure:"driver"` // "postgres"
Dsn string `mapstructure:"dsn"`
}
type DatabaseContext ¶
func NewDatabaseContext ¶
func NewDatabaseContext(config *Database, init bool) *DatabaseContext
func (*DatabaseContext) DatabaseMiddleware ¶
func (databaseContext *DatabaseContext) DatabaseMiddleware() func(ctx huma.Context, next func(huma.Context))
func (*DatabaseContext) Migrate ¶
func (dc *DatabaseContext) Migrate() error
type DatabaseDriver ¶
type DatabaseDriver string
const (
DatabaseDriverPostgres DatabaseDriver = "postgres"
)
type DefaultGormModel ¶
type DefaultGormModel struct {
ID uint `gorm:"primarykey"`
CreatedAt time.Time
UpdatedAt time.Time
}
DefaultGormModel provides a base model with common fields for GORM models, removing the DeletedAt field.
type Delete_PharosScanEngine ¶
type Delete_PharosScanEngine struct {
Name string `json:"Name" yaml:"Name"`
Version string `json:"Version" yaml:"Version"`
ScanTime time.Time `json:"ScanTime" yaml:"ScanTime"`
}
scan metadata to identify scanner tool and versions (this is importan once we have a variety of scanners)
type DockerImage ¶
type DockerImage struct {
Name string `json:"name" gorm:"not null"` // Name is the name of the Docker image, e.g., "ubuntu:latest"
Digest string `json:"digest" gorm:"primaryKey"` // SHA is the unique identifier for the image
}
DockerImage represents the structure for a Docker image submission.
func (DockerImage) GetId ¶
func (d DockerImage) GetId() string
GetId returns the unique identifier for the DockerImage, which is its SHA.
type EnricherCommonConfig ¶
type EnricherConfig ¶
type EnricherConfig struct {
BasePath string `yaml:"basePath"`
Configs []MapperConfig `yaml:"configs"`
Enricher *Enricher `yaml:"enricher"` // Enricher configuration if loaded from database
}
Enrichers could be loaded from different sources: filesysem, git. They are not part of Config structure.
type EnricherSource ¶
type EnricherSource struct {
Name string `mapstructure:"name" yaml:"name" json:"name"`
Path string `mapstructure:"path" yaml:"path" json:"path"`
// Git is a pointer to string to allow it to be nil
Git *string `mapstructure:"git" yaml:"git,omitempty" json:"git,omitempty"`
// ID is the ID of the enricher in the database, optional, can be null if not stored in database
ID *string `mapstructure:"id" yaml:"id,omitempty" json:"id,omitempty"`
}
type EnricherType ¶
type EnricherType string
const ( EnricherTypeVisual EnricherType = "visual" EnricherTypeYaegi EnricherType = "yaegi" EnricherTypeStarlark EnricherType = "starlark" EnricherTypeHbs EnricherType = "hbs" )
type EnrichersConfig ¶
type EnrichersConfig struct {
Order []string `mapstructure:"order" yaml:"order" json:"order"`
Sources []EnricherSource `mapstructure:"sources" yaml:"sources" json:"sources"`
}
type MapperConfig ¶
type PharosFindingSummary ¶
type PharosImageMeta ¶
type PharosImageMeta struct {
ImageSpec string `json:"ImageSpec" yaml:"ImageSpec" required:"true" doc:"image url, e.g. docker.io/nginx:latest"` // scan input / image uri
ImageId string `json:"ImageId" yaml:"ImageId" gorm:"primaryKey" hidden:"false" doc:"internal image ID, e.g. sha256:1234.."`
IndexDigest string `json:"IndexDigest" yaml:"IndexDigest" required:"true" gorm:"index"` // internal ID for cache
ManifestDigest string `json:"ManifestDigest" yaml:"ManifestDigest" required:"false" gorm:"index"`
RepoDigests StringSlice `json:"RepoDigests" yaml:"RepoDigests" required:"false" gorm:"type:VARCHAR"`
ArchName string `json:"ArchName" yaml:"ArchName" required:"false" doc:"image platform architecture default: amd64" gorm:"index"` // image platform architecture amd64/..
ArchOS string `json:"ArchOS" yaml:"ArchOS" required:"false" doc:"image platform OS default: linux" gorm:"index"` // image platform OS
DistroName string `json:"DistroName" yaml:"DistroName" required:"false"`
DistroVersion string `json:"DistroVersion" yaml:"DistroVersion" required:"false"`
Size uint64 `json:"Size" yaml:"Size" required:"false"`
Tags StringSlice `json:"Tags" yaml:"Tags" gorm:"type:VARCHAR" required:"false"`
Layers StringSlice `json:"Layers" yaml:"Layers" gorm:"type:VARCHAR" required:"false"`
Vulnerabilities []PharosVulnerability `` /* 173-byte string literal not displayed */
Findings []PharosScanFinding `` /* 158-byte string literal not displayed */
Packages []PharosPackage `` /* 153-byte string literal not displayed */
ContextRoots []ContextRoot `` /* 146-byte string literal not displayed */
TTL time.Duration `json:"TTL" yaml:"TTL" required:"false" gorm:"default:43200000000"`
LastSuccessfulScan time.Time `json:"LastSuccessfulScan" yaml:"LastSuccessfulScan"` // last update time
}
metadata about the asset (image, code, vm, ..)
type PharosImageSpec ¶
type PharosPackage ¶
type PharosPackage struct {
Key string `json:"Key" yaml:"Key" gorm:"primaryKey"` // unique key to deduplicate packages
Name string `json:"Name" yaml:"Name"`
Version string `json:"Version" yaml:"Version"`
Type string `json:"Type" yaml:"Type"`
Purl string `json:"Purl" yaml:"Purl"`
Cpes StringSlice `json:"Cpes" yaml:"Cpes" gorm:"type:VARCHAR"`
}
sbom packages
type PharosRepoAuth ¶
type PharosRepoAuth struct {
Authority string `json:"authority" required:"false"`
Username string `json:"username" required:"false"`
Password string `json:"password" required:"false"`
Token string `json:"token" required:"false"`
//
TlsCheck bool `json:"tlscheck" required:"false"` // disable TLS cert check for authority
}
authentication for image repos TODO: here, json tags have lowercase names, but other models use PascalCase names.
func GetMatchingAuth ¶
func GetMatchingAuth(imageSpec string, auths []PharosRepoAuth) PharosRepoAuth
func NewPharosRepoAuth ¶
func NewPharosRepoAuth(authDsn string) (PharosRepoAuth, error)
func (*PharosRepoAuth) FromDsn ¶
func (rx *PharosRepoAuth) FromDsn(input string) error
parse DSN registry://user:password@docker.io/type=password registry://user:token@docker.io/type=token
func (PharosRepoAuth) HasAuth ¶
func (rx PharosRepoAuth) HasAuth(imageRef string) bool
return true if auth is not empty and matchies imageRef repo
func (PharosRepoAuth) ToDsn ¶
func (rx PharosRepoAuth) ToDsn() string
func (PharosRepoAuth) ToMaskedDsn ¶
func (rx PharosRepoAuth) ToMaskedDsn(mask string) string
return DSN without password
type PharosScanFinding ¶
type PharosScanFinding struct {
AdvId string `json:"AdvId" yaml:"AdvId" gorm:"primaryKey"` // finding CVE, GHSA, ..
AdvSource string `json:"AdvSource" yaml:"AdvSource" gorm:"primaryKey"` // advisory source, like NVD, GItHub, Uuntu
ScanDate time.Time `json:"ScanDate" yaml:"ScanDate"` // finding first found
UpdateDate time.Time `json:"UpdateDate" yaml:"UpdateDate"` // finding updated/last scan
Severity string `json:"Severity" yaml:"Severity"`
DueDate time.Time `json:"DueDate" yaml:"DueDate"` // needs to be fixed by
FixState string `json:"FixState" yaml:"FixState"`
FixVersions StringSlice `json:"FixVersions" yaml:"FixVersions" gorm:"type:VARCHAR"`
FoundIn StringSlice `json:"FoundIn" yaml:"FoundIn" gorm:"type:VARCHAR"` // Paths of vulnerable artifact
FirstSeen time.Time `json:"FirstSeen" yaml:"FirstSeen"`
}
a finding is an instantiation of a vulnerability in an asset/package (scan result)
type PharosScanResult ¶
type PharosScanResult struct {
Version string `json:"Version" yaml:"Version"`
ScanTask PharosScanTask `json:"ScanTask" yaml:"ScanTask"`
Image PharosImageMeta `json:"Image" yaml:"Image"`
Findings []PharosScanFinding `json:"Findings" yaml:"Findings"` // instatiation of vulnerabilities in packages
Vulnerabilities []PharosVulnerability `json:"Vulnerabilities" yaml:"Vulnerabilities"` // vulnerabilities found with vuln metadata (description, CVSS, ..)
Packages []PharosPackage `json:"Packages" yaml:"Packages"`
}
hold results if images scans returned from a variety of scanner engines Update: Stefan 2025-06-29 Context and scanner info is in ScanTask
func LoadResultFromFile ¶
func LoadResultFromFile(path string) (*PharosScanResult, error)
func NewTestScanResult ¶
func NewTestScanResult(task PharosScanTask, engineName string) PharosScanResult
newTestScanResult is a test helper that creates a PharosScanResult for a given task and engine name.
func (*PharosScanResult) FromMap ¶
func (p *PharosScanResult) FromMap(values map[string]any) error
FromMap implements ConvertibleFrom interface for PharosScanResult
func (*PharosScanResult) GetContextRoot ¶
func (rx *PharosScanResult) GetContextRoot(owner string, ttl time.Duration) ContextRoot
func (*PharosScanResult) LoadGrypeImageScan ¶
func (rx *PharosScanResult) LoadGrypeImageScan(sbom syfttype.SyftSbomType, scan grypetype.GrypeScanType) error
populate model from grype scan
func (*PharosScanResult) LoadTrivyImageScan ¶
func (rx *PharosScanResult) LoadTrivyImageScan(sbom trivytype.TrivySbomType, scan trivytype.TrivyScanType) error
populate model from trivy scan
func (*PharosScanResult) MaskAuth ¶
func (rx *PharosScanResult) MaskAuth() PharosScanResult
mask auth info in scantask (e.g. before submitting results)
func (*PharosScanResult) ToBytes ¶
func (rx *PharosScanResult) ToBytes() []byte
return model as []byte
type PharosScanTask ¶ added in v0.9.11
type PharosScanTask struct {
// task status
JobId string `json:"jobId" required:"false" default:"" doc:"you can give a job id here to track the job."` // jobid for batch jobs tracking
Status string `json:"status" required:"false" readOnly:"true"`
Engine string `json:"engine" required:"false" default:"grype" doc:"scanner engine used for the scan, e.g. trivy, grype, .."` // scanner engine used for the scan
Error string `json:"error" required:"false" readOnly:"true"`
// image
AuthDsn string `json:"authdsn" required:"false" default:"registry:///?tlscheck=false"` // TODO: has to be documented.
ImageSpec string `json:"imagespec" required:"true"`
Platform string `json:"platform" required:"false" default:"linux/amd64"`
Context map[string]any `json:"context" required:"false" doc:"context data for the scan, e.g. namespace, labels, .." default:"{}"`
ContextRootKey string `json:"contextRootKey" required:"false" default:""` // key to the context root, if any
RxDigest string `json:"rxdigest" required:"false" readOnly:"true"` // manifest digest retrieved from repo
RxPlatform string `json:"rxplatform" required:"false" readOnly:"true"` // platform retrieved from repo
// scanner
CacheTTL time.Duration `` // cache expiry in sec
/* 127-byte string literal not displayed */
ScanTTL time.Duration `` // cache expiry in sec
/* 128-byte string literal not displayed */
Created time.Time `json:"created" yaml:"created" required:"false"`
Updated time.Time `json:"updated" yaml:"updated" required:"false"`
Sbom *string `json:"sbom" yaml:"sbom" required:"false"`
// contains filtered or unexported fields
}
func NewTestScanTask ¶
func NewTestScanTask(t *testing.T, taskID, image string) PharosScanTask
func (*PharosScanTask) FromMap ¶ added in v0.9.11
func (p *PharosScanTask) FromMap(values map[string]any) error
FromMap implements ConvertibleFrom interface for PharosScanResult
func (*PharosScanTask) GetReceiver ¶ added in v0.9.11
func (pt *PharosScanTask) GetReceiver() *chan PharosScanResult
func (*PharosScanTask) SetError ¶ added in v0.9.11
func (rx *PharosScanTask) SetError(err error) *PharosScanTask
set error and status
func (*PharosScanTask) SetReceiver ¶ added in v0.9.11
func (pt *PharosScanTask) SetReceiver(ch *chan PharosScanResult)
type PharosVulnerability ¶
type PharosVulnerability struct {
AdvId string `json:"AdvId" yaml:"AdvId" gorm:"primaryKey"` // finding CVE, GHSA, ..
AdvSource string `json:"AdvSource" yaml:"AdvSource" gorm:"primaryKey"` // advisory source, like NVD, GItHub, Ubuntu
AdvAliases string `json:"Aliases" yaml:"Aliases"`
CreateDate time.Time `json:"CreateDate" yaml:"CreateDate"` // finding first found
PubDate time.Time `json:"PubDate" yaml:"PubDate"` // vuln publication
ModDate time.Time `json:"ModDate" yaml:"ModDate"` // last modified
KevDate time.Time `json:"KevDate" yaml:"KevDate"` // known exploited in wild pubdate)
Severity string `json:"Severity" yaml:"Severity"`
CvssVectors StringSlice `json:"CvssVectors" yaml:"CvssVectors" gorm:"type:VARCHAR"`
CvssBase float64 `json:"CvssBase" yaml:"CvssBase"` // max cvss score
RiskScoce float64 `json:"RiskScore" yaml:"RiskScore"` // from grype
Cpes StringSlice `json:"Cpes" yaml:"Cpes" gorm:"type:VARCHAR"` // Mitre CPEs
Cwes StringSlice `json:"Cwes" yaml:"Cwes" gorm:"type:VARCHAR"` // Mitre CWEs
References StringSlice `json:"References" yaml:"References" gorm:"type:VARCHAR"` // external references
RansomwareUsed string `json:"RansomwareUsed" yaml:"RansomwareUsed"` // Exploit used in ransomware
Description string `json:"Description" yaml:"Description"`
FirstSeen time.Time `json:"FirstSeen" yaml:"FirstSeen"` // can be used for FirstSeen
}
a vulnerability is generic description of a weakness, a scan finds vulns in packages
type PrometheusAlert ¶
type PrometheusAlert struct {
Status string `json:"status"`
Labels map[string]string `json:"labels"`
Annotations map[string]string `json:"annotations"`
StartsAt time.Time `json:"startsAt"`
EndsAt time.Time `json:"endsAt"`
GeneratorURL string `json:"generatorURL"`
Fingerprint string `json:"fingerprint"` // see how this is defined: https://stackoverflow.com/questions/59066569/is-the-fingerprint-field-in-alertmanager-unique
}
type PrometheusReporterConfig ¶
type PrometheusReporterConfig struct {
URL string `mapstructure:"url"` // URL of the Prometheus server
Interval string `mapstructure:"interval"` // Interval for scraping Prometheus metrics
Platform string `mapstructure:"platform"` // Platform for which the metrics are collected, defaults to "linux/amd64"
Namespace string `mapstructure:"namespace"` // Namespace for the Prometheus metrics
PharosURL string `mapstructure:"pharosUrl"` // Root URL of the Pharos server for Prometheus metrics
ContextLabels []string `mapstructure:"contextLabels"` // Labels to add to the Prometheus context
TTL string `mapstructure:"ttl"` // Time to live for the scan results
Query string `mapstructure:"query"` // Query to use for fetching metrics
Auth hwmodel.PrometheusAuth `mapstructure:"auth"` // Authentication details for Prometheus
Wait string `mapstructure:"wait"` // How long to wait between each post of data
}
type PublisherConfig ¶
type PublisherConfig struct {
RequestQueue string `mapstructure:"requestQueue"`
PriorityRequestQueue string `mapstructure:"priorityRequestQueue"`
ResponseQueue string `mapstructure:"responseQueue"`
PriorityResponseQueue string `mapstructure:"priorityResponseQueue"`
Timeout string `mapstructure:"timeout"`
QueueSize int `mapstructure:"queueSize"`
}
PublisherConfig holds publisher-specific configuration.
type ReceiverConfig ¶
type ReceiverConfig struct {
Name string `mapstructure:"name" yaml:"name" json:"name"`
WebhookConfigs []WebhookConfig `mapstructure:"webhook_configs" yaml:"webhook_configs" json:"webhook_configs"`
}
type Redis ¶
type Redis struct {
DSN string `mapstructure:"dsn"`
}
Redis holds Redis-specific configuration.
type ResultCollectorConfig ¶
type RouteConfig ¶
type RouteConfig struct {
Receiver string `mapstructure:"receiver" yaml:"receiver" json:"receiver"`
GroupBy []string `mapstructure:"group_by" yaml:"group_by" json:"group_by"`
Continue bool `mapstructure:"continue" yaml:"continue,omitempty" json:"continue,omitempty"`
Matchers []string `mapstructure:"matchers,omitempty" yaml:"matchers,omitempty" json:"matchers,omitempty"`
GroupWait string `mapstructure:"group_wait,omitempty" yaml:"group_wait,omitempty" json:"group_wait,omitempty"`
GroupInterval string `mapstructure:"group_interval,omitempty" yaml:"group_interval,omitempty" json:"group_interval,omitempty" default:"5m"`
RepeatInterval string `mapstructure:"repeat_interval,omitempty" yaml:"repeat_interval,omitempty" json:"repeat_interval,omitempty" default:"4h"`
ChildRoutes []RouteConfig `mapstructure:"child_routes,omitempty" yaml:"child_routes,omitempty" json:"child_routes,omitempty"`
}
type ScannerConfig ¶
type ScannerConfig struct {
RequestQueue string `mapstructure:"requestQueue"`
PriorityRequestQueue string `mapstructure:"priorityRequestQueue"`
ResponseQueue string `mapstructure:"responseQueue"`
PriorityResponseQueue string `mapstructure:"priorityResponseQueue"`
Timeout string `mapstructure:"timeout"`
CacheExpiry string `mapstructure:"cacheExpiry"`
CacheEndpoint string `mapstructure:"cacheEndpoint"`
Engine string `mapstructure:"engine"`
}
ScannerConfig holds scanner-specific configuration.
type StringSlice ¶
type StringSlice []string
func (*StringSlice) Scan ¶
func (ss *StringSlice) Scan(src any) error
type WebHookPayload ¶
type WebHookPayload struct {
Version string `json:"version"`
GroupKey string `json:"groupKey"`
TruncatedAlerts int `json:"truncatedAlerts"`
Status string `json:"status"`
Receiver string `json:"receiver"`
GroupLabels map[string]string `json:"groupLabels"`
CommonLabels map[string]string `json:"commonLabels"`
CommonAnnotations map[string]string `json:"commonAnnotations"`
ExternalURL string `json:"externalURL"`
Alerts []*PrometheusAlert `json:"alerts"`
}
type WebhookConfig ¶
type WebhookConfig struct {
// Whether to notify about resolved alerts.
SendResolved bool `mapstructure:"send_resolved" yaml:"send_resolved" json:"send_resolved"`
// The endpoint to send HTTP POST requests to.
// url and url_file are mutually exclusive.
URL string `mapstructure:"url" yaml:"url" json:"url"`
URLFile string `mapstructure:"url_file" yaml:"url_file" json:"url_file"`
// The maximum number of alerts to include in a single webhook message.
MaxAlerts int `mapstructure:"max_alerts" yaml:"max_alerts" json:"max_alerts"`
// The maximum time to wait for a webhook request to complete.
Timeout string `mapstructure:"timeout" yaml:"timeout" json:"timeout"`
// The HTTP client's configuration.
HTTPConfig *AlertingHttpConfig `mapstructure:"http_config" yaml:"http_config" json:"http_config,omitempty"`
}