controllers

package
v0.9.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 26 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Paginate

func Paginate(p *Pagination) func(db *gorm.DB) *gorm.DB

Types

type AlertController

type AlertController struct {
	Path    string
	Api     *huma.API
	Config  *model.Config
	Logger  *zerolog.Logger
	Version string
}

func NewAlertController

func NewAlertController(api *huma.API, config *model.Config) *AlertController

func (*AlertController) V1AddRoutes

func (ac *AlertController) V1AddRoutes()

func (*AlertController) V1AlertLabelNamesGet

func (ac *AlertController) V1AlertLabelNamesGet() (huma.Operation, func(ctx context.Context, input *struct{}) (*AlertLabels, error))

func (*AlertController) V1AlertLabelValuesGet

func (ac *AlertController) V1AlertLabelValuesGet() (huma.Operation, func(ctx context.Context, input *AlertValuesSearchInput) (*AlertValues, error))

func (*AlertController) V1AlertPayloadsGetBySearch

func (ac *AlertController) V1AlertPayloadsGetBySearch() (huma.Operation, func(ctx context.Context, input *AlertPayloadSearchInput) (*AlertPayloads, error))

func (*AlertController) V1AlertPayloadsUpdateExtraLabels

func (ac *AlertController) V1AlertPayloadsUpdateExtraLabels() (huma.Operation, func(ctx context.Context, input *AlertPayloadsUpdateInput) (*AlertPayloads, error))

func (*AlertController) V1AlertsGetBySearch

func (ac *AlertController) V1AlertsGetBySearch() (huma.Operation, func(ctx context.Context, input *AlertSearchInput) (*Alerts, error))

func (*AlertController) V1PrometheusAlertsGetBySearch

func (ac *AlertController) V1PrometheusAlertsGetBySearch() (huma.Operation, func(ctx context.Context, input *AlertSearchInput) (*PrometheusAlerts, error))

type AlertLabels

type AlertLabels struct {
	Body []string `json:"body"`
}

type AlertPayloadSearchInput

type AlertPayloadSearchInput struct {
	Body struct {
		Pagination
		Detail   bool   `query:"detail" default:"true" doc:"If true, returns detailed information about the alert payload"`
		GroupKey string `query:"groupKey" doc:"GroupKey of the to retrieve, can be a glob pattern, exclusive with search"`
		Receiver string `query:"receiver" doc:"Receiver of the alert payload to retrieve, can be a glob pattern, exclusive with search"`
		JSONPath string `query:"jsonPath" doc:"Use RFC9535 jsonPath to filter alert payloads, exclusive with groupKey and receiver"`
	}
}

type AlertPayloads

type AlertPayloads struct {
	Body []model.AlertPayload `json:"body"`
}

type AlertPayloadsUpdateInput

type AlertPayloadsUpdateInput struct {
	Body struct {
		GroupKey    string            `json:"groupKey" query:"groupKey" doc:"GroupKey of the to retrieve, can be a glob pattern, exclusive with search"`
		Receiver    string            `` /* 126-byte string literal not displayed */
		ExtraLabels map[string]string `json:"extraLabels" doc:"Extra labels to add to the alert payload"`
	}
}

type AlertSearchInput

type AlertSearchInput struct {
	Pagination
	Detail bool `query:"detail" default:"true" doc:"If true, returns detailed information about the alert"`
}

type AlertValues

type AlertValues struct {
	Body []string `json:"body"`
}

type AlertValuesSearchInput

type AlertValuesSearchInput struct {
	LabelName string `query:"labelName"`
}

type Alerts

type Alerts struct {
	Body []model.Alert `json:"body"`
}

type CommonController

type CommonController struct {
	Logger *zerolog.Logger
}

func NewCommonController

func NewCommonController() *CommonController

func (*CommonController) RedirectToV1

func (cc *CommonController) RedirectToV1(next http.Handler) http.Handler

type CommonResponse

type CommonResponse struct {
	Body string `json:"body"`
}

type Config

type Config struct {
	Body model.Config `json:"body"`
}

type ConfigController

type ConfigController struct {
	Path    string
	Api     *huma.API
	Version string
	Config  *model.Config
	Logger  *zerolog.Logger
}

func NewConfigController

func NewConfigController(api *huma.API, config *model.Config) *ConfigController

func (*ConfigController) V1AddRoutes

func (cc *ConfigController) V1AddRoutes()

func (*ConfigController) V1GetConfig

func (cc *ConfigController) V1GetConfig() (huma.Operation, func(ctx context.Context, input *struct{}) (*Config, error))

type ContextEntries

type ContextEntries struct {
	Body []model.ContextEntry `json:"body"`
}

type Enricher

type Enricher struct {
	Body model.Enricher `json:"body"`
}

type EnricherController

type EnricherController struct {
	Path    string
	Api     *huma.API
	Config  *model.Config
	Logger  *zerolog.Logger
	Version string
}

func NewEnricherController

func NewEnricherController(api *huma.API, config *model.Config) *EnricherController

func (*EnricherController) V1AddRoutes

func (ec *EnricherController) V1AddRoutes()

func (*EnricherController) V1DeleteEnricher

func (ec *EnricherController) V1DeleteEnricher() (huma.Operation, func(ctx context.Context, input *EnricherIdInput) (*EnricherDeleteResponse, error))

func (*EnricherController) V1Get

func (ec *EnricherController) V1Get() (huma.Operation, func(ctx context.Context, input *EnricherIdInput) (*Enricher, error))

func (*EnricherController) V1GetBySearch

func (ec *EnricherController) V1GetBySearch() (huma.Operation, func(ctx context.Context, input *EnricherSearchInput) (*Enrichers, error))

func (*EnricherController) V1UpsertEnricher

func (ec *EnricherController) V1UpsertEnricher() (huma.Operation, func(ctx context.Context, input *UpsertEnricherInput) (*Enricher, error))

type EnricherDeleteResponse

type EnricherDeleteResponse struct {
	Message string `json:"message"`
}

type EnricherIdInput

type EnricherIdInput struct {
	EnricherId uint `path:"enricherid" doc:"ID of the Enricher to retrieve"`
}

type EnricherSearchInput

type EnricherSearchInput struct {
	Pagination
	Id     string             `query:"id" doc:"ID of the Enricher to retrieve, can be a glob pattern, exclusive with search"`
	Type   model.EnricherType `query:"type" doc:"Type of the Enricher to retrieve"`
	Name   string             `query:"name" doc:"Name of the Enricher to retrieve, can be a glob pattern, exclusive with search"`
	Search string             `query:"search" doc:"Any field of the Enricher to retrieve, can be a glob pattern, exclusive with id and name"`
	Detail bool               `query:"detail" default:"false" doc:"If true, returns detailed information about the enricher"`
}

type Enrichers

type Enrichers struct {
	Body []model.Enricher `json:"body"`
}

type ImageDigestInput

type ImageDigestInput struct {
	ImageId string `path:"imageid" doc:"Imageid of the Docker image to retrieve"`
}

type MetricsController

type MetricsController struct {
	Path              string
	Api               *huma.API
	AsyncPublisher    *redis.RedisGtrsClient[model.PharosScanTask, model.PharosScanResult]
	PriorityPublisher *redis.RedisGtrsClient[model.PharosScanTask, model.PharosScanResult]
	Config            *model.Config
	Logger            *zerolog.Logger

	HttpRequests *prometheus.CounterVec // Metric to track HTTP requests
	TaskChannel  chan any               // Channel for scan tasks
	Version      string
	// contains filtered or unexported fields
}

func NewMetricsController

func NewMetricsController(api *huma.API, config *model.Config, taskChannel chan any) *MetricsController

func (*MetricsController) MetricsMiddleware

func (mc *MetricsController) MetricsMiddleware() func(ctx huma.Context, next func(huma.Context))

func (*MetricsController) NewContextRegistry

func (mc *MetricsController) NewContextRegistry() (*prometheus.Registry, *prometheus.GaugeVec, error)

returns a registry for serving context metrics, may return nil if no context labels are set yet.

func (*MetricsController) NewGaugeRegistry

func (mc *MetricsController) NewGaugeRegistry() (*prometheus.Registry, *prometheus.GaugeVec, error)

func (*MetricsController) V1AddRoutes

func (mc *MetricsController) V1AddRoutes()

func (*MetricsController) V1GetContextMetrics

func (mc *MetricsController) V1GetContextMetrics() (huma.Operation, func(ctx context.Context, input *struct{}) (*struct{ Body string }, error))

func (*MetricsController) V1GetDefaultMetrics

func (mc *MetricsController) V1GetDefaultMetrics() (huma.Operation, func(ctx context.Context, input *struct{}) (*struct{ Body string }, error))

func (*MetricsController) V1GetImageGaugeMetrics

func (mc *MetricsController) V1GetImageGaugeMetrics() (huma.Operation, func(ctx context.Context, input *struct{}) (*struct{ Body string }, error))

func (*MetricsController) V1GetLiveness

func (mc *MetricsController) V1GetLiveness() (huma.Operation, func(ctx context.Context, input *struct{}) (*ProbeResult, error))

func (*MetricsController) V1GetReadiness

func (mc *MetricsController) V1GetReadiness() (huma.Operation, func(ctx context.Context, input *struct{}) (*ProbeResult, error))

type Pagination

type Pagination struct {
	PageSize int `query:"page_size" default:"10" doc:"Maximum number of items"`
	Page     int `query:"page" default:"1" doc:"Page number"`
}

type PharosImageMeta

type PharosImageMeta struct {
	Body model.PharosImageMeta `json:"body"`
}

type PharosImageMetaController

type PharosImageMetaController struct {
	Path    string
	Api     *huma.API
	Config  *model.Config
	Logger  *zerolog.Logger
	Version string
}

func NewImageController added in v0.9.11

func NewImageController(api *huma.API, config *model.Config) *PharosImageMetaController

func (*PharosImageMetaController) V1AddRoutes

func (pc *PharosImageMetaController) V1AddRoutes()

func (*PharosImageMetaController) V1Get

func (*PharosImageMetaController) V1GetBySearch

func (*PharosImageMetaController) V1GetContexts

func (pc *PharosImageMetaController) V1GetContexts() (huma.Operation, func(ctx context.Context, input *ImageDigestInput) (*ContextEntries, error))

type PharosImageMetaSearchInput

type PharosImageMetaSearchInput struct {
	Pagination
	ImageId        string `query:"image_id" doc:"ImageId of the Docker image to retrieve, can be a glob pattern, exclusive with search"`
	IndexDigest    string `query:"index_digest" doc:"Index digest of the Docker image to retrieve, can be a glob pattern, exclusive with search"`
	ManifestDigest string `query:"manifest_digest" doc:"Manifest digest of the Docker image to retrieve, can be a glob pattern, exclusive with search"`
	ImageSpec      string `query:"image_spec" doc:"ImageSpec of the Docker image to retrieve, can be a glob pattern, exclusive with search"`
	Search         string `` /* 180-byte string literal not displayed */
	Detail         bool   `` /* 140-byte string literal not displayed */
}

type PharosImageMetas

type PharosImageMetas struct {
	Body []model.PharosImageMeta `json:"body"`
}

type PharosScanResult

type PharosScanResult struct {
	Body model.PharosScanResult `json:"body"`
}

type PharosScanTask2

type PharosScanTask2 struct {
	Body model.PharosScanTask `json:"body"`
}

TODO: Rename as PharosScanTask2 is know from model, leads to confusion

type PharosScanTaskController

type PharosScanTaskController struct {
	Path          string
	Api           *huma.API
	Config        *model.Config
	Logger        *zerolog.Logger
	TaskChannel   chan any
	ResultChannel chan any
	Version       string
}

func NewPharosScanTaskController

func NewPharosScanTaskController(api *huma.API, config *model.Config, sourceChannel chan any, resultChannel chan any) *PharosScanTaskController

func (*PharosScanTaskController) V1AddRoutes

func (pc *PharosScanTaskController) V1AddRoutes()

func (*PharosScanTaskController) V1PostAsyncScan

func (pc *PharosScanTaskController) V1PostAsyncScan() (huma.Operation, func(ctx context.Context, input *PharosScanTask2) (*PharosScanTask2, error))

func (*PharosScanTaskController) V1PostSyncScan

func (pc *PharosScanTaskController) V1PostSyncScan() (huma.Operation, func(ctx context.Context, input *PharosScanTask2) (*PharosScanResult, error))

type ProbeResult

type ProbeResult struct {
	Body string `json:"body"`
}

type PrometheusAlerts

type PrometheusAlerts struct {
	Body []model.PrometheusAlert `json:"body"`
}

type UpsertEnricherInput

type UpsertEnricherInput struct {
	Body model.Enricher `json:"body"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL