api

package
v1.17.9 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthSecretSettingName = "auth_secret"
	HashFunc              = crypto.SHA256
	SessionCookieName     = "coroot_session"
	SessionCookieTTL      = 7 * 24 * time.Hour
)
View Source
const (
	MaxIncidentWindow = timeseries.Day
)

Variables

This section is empty.

Functions

func GetApplicationId added in v1.14.0

func GetApplicationId(r *http.Request) (model.ApplicationId, error)

Types

type Api

type Api struct {
	// contains filtered or unexported fields
}

func NewApi

func NewApi(cache *cache.Cache, db *db.DB, collector *collector.Collector, pricing *pricing.Manager, roles rbac.RoleManager, licenseMgr LicenseManager,
	globalClickHouse *db.IntegrationClickhouse, globalPrometheus *db.IntegrationPrometheus,
	deploymentUuid, instanceUuid string, loadWorld LoadWorldF) *Api

func (*Api) AI added in v1.11.0

func (api *Api) AI(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) ApiKeyAuth added in v1.17.7

func (api *Api) ApiKeyAuth(h func(http.ResponseWriter, *http.Request, *db.Project)) http.HandlerFunc

func (*Api) ApiKeys added in v1.7.0

func (api *Api) ApiKeys(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Application added in v1.5.0

func (api *Api) Application(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) ApplicationCategories added in v1.10.0

func (api *Api) ApplicationCategories(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Auth added in v1.5.0

func (api *Api) Auth(h func(http.ResponseWriter, *http.Request, *db.User)) http.HandlerFunc

func (*Api) AuthInit added in v1.5.0

func (api *Api) AuthInit(anonymousRole string, adminPassword string) error

func (*Api) ClickhouseConfig added in v1.17.7

func (api *Api) ClickhouseConfig(w http.ResponseWriter, r *http.Request, project *db.Project)

func (*Api) ClickhouseConnect added in v1.17.7

func (api *Api) ClickhouseConnect(w http.ResponseWriter, r *http.Request)

func (*Api) Cloud added in v1.14.0

func (api *Api) Cloud(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) CustomApplications added in v1.4.0

func (api *Api) CustomApplications(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) CustomCloudPricing added in v1.11.0

func (api *Api) CustomCloudPricing(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Dashboards added in v1.12.0

func (api *Api) Dashboards(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) GetClickhouseClient added in v1.12.5

func (api *Api) GetClickhouseClient(project *db.Project, memberProjectId string) (*clickhouse.Client, error)

func (*Api) GetClickhouseClients added in v1.17.1

func (api *Api) GetClickhouseClients(project *db.Project) (res clickhouse.Clients)

func (*Api) GetUser added in v1.5.6

func (api *Api) GetUser(r *http.Request) *db.User

func (*Api) Incident added in v1.5.0

func (api *Api) Incident(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) IncidentRCA added in v1.14.0

func (api *Api) IncidentRCA(ctx context.Context, project *db.Project, world *model.World, incident *model.ApplicationIncident)

func (*Api) IncidentTimeContext added in v1.14.0

func (api *Api) IncidentTimeContext(projectId db.ProjectId, incident *model.ApplicationIncident, now timeseries.Time) (timeseries.Time, timeseries.Time)

func (*Api) Incidents added in v1.12.5

func (api *Api) Incidents(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Inspection added in v1.5.0

func (api *Api) Inspection(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Inspections added in v1.5.0

func (api *Api) Inspections(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Instrumentation added in v1.3.0

func (api *Api) Instrumentation(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Integration

func (api *Api) Integration(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Integrations

func (api *Api) Integrations(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) IsAllowed added in v1.5.0

func (api *Api) IsAllowed(u *db.User, actions ...rbac.Action) bool

func (*Api) LoadWorld added in v1.5.0

func (api *Api) LoadWorld(ctx context.Context, project *db.Project, from, to timeseries.Time) (*model.World, *cache.Status, error)

func (*Api) LoadWorldByRequest added in v1.5.0

func (api *Api) LoadWorldByRequest(r *http.Request) (*model.World, *db.Project, *cache.Status, error)

func (*Api) Login added in v1.5.0

func (api *Api) Login(w http.ResponseWriter, r *http.Request)

func (*Api) Logout added in v1.5.0

func (api *Api) Logout(w http.ResponseWriter, r *http.Request)

func (*Api) Logs added in v0.20.0

func (api *Api) Logs(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Node

func (api *Api) Node(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Overview

func (api *Api) Overview(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) PanelData added in v1.12.0

func (api *Api) PanelData(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Profiling added in v1.5.0

func (api *Api) Profiling(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Project

func (api *Api) Project(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Prom

func (api *Api) Prom(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) PrometheusLabelValues added in v1.17.7

func (api *Api) PrometheusLabelValues(w http.ResponseWriter, r *http.Request, project *db.Project)

func (*Api) PrometheusMetricMetadata added in v1.17.7

func (api *Api) PrometheusMetricMetadata(w http.ResponseWriter, r *http.Request, project *db.Project)

func (*Api) PrometheusQueryRange added in v1.17.7

func (api *Api) PrometheusQueryRange(w http.ResponseWriter, r *http.Request, project *db.Project)

func (*Api) PrometheusSeries added in v1.17.7

func (api *Api) PrometheusSeries(w http.ResponseWriter, r *http.Request, project *db.Project)

func (*Api) RCA added in v1.5.0

func (api *Api) RCA(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Risks added in v1.8.0

func (api *Api) Risks(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Roles added in v1.5.0

func (api *Api) Roles(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) SSO added in v1.5.6

func (api *Api) SSO(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) SetSessionCookie added in v1.5.6

func (api *Api) SetSessionCookie(w http.ResponseWriter, userId int, ttl time.Duration) error

func (*Api) Status

func (api *Api) Status(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Tracing

func (api *Api) Tracing(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) User added in v1.5.0

func (api *Api) User(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) Users added in v1.5.0

func (api *Api) Users(w http.ResponseWriter, r *http.Request, u *db.User)

func (*Api) WithContext added in v1.6.0

func (api *Api) WithContext(p *db.Project, cacheStatus *cache.Status, w *model.World, data any) DataWithContext

type Application added in v0.22.0

type Application struct {
	Id     model.ApplicationId `json:"id"`
	Status model.Status        `json:"status"`
}

type CloudIntegrationForm added in v1.14.0

type CloudIntegrationForm struct {
	ApiKey                     string `json:"api_key"`
	IncidentsAutoInvestigation bool   `json:"incidents_auto_investigation"`
}

func (*CloudIntegrationForm) Valid added in v1.14.0

func (f *CloudIntegrationForm) Valid() bool

type Context added in v0.22.0

type Context struct {
	Status         Status                            `json:"status"`
	Search         Search                            `json:"search"`
	Incidents      map[model.ApplicationCategory]int `json:"incidents"`
	Fluxcd         bool                              `json:"fluxcd"`
	License        *License                          `json:"license,omitempty"`
	Multicluster   bool                              `json:"multicluster"`
	MemberProjects []string                          `json:"member_projects,omitempty"`
}

type DataWithContext added in v1.5.0

type DataWithContext struct {
	Context Context `json:"context"`
	Data    any     `json:"data"`
}

type KubeStateMetrics added in v0.22.0

type KubeStateMetrics struct {
	Status       model.Status `json:"status"`
	Applications int          `json:"applications"`
}

type License added in v1.14.1

type License struct {
	Invalid bool   `json:"invalid"`
	Message string `json:"message"`
}

type LicenseManager added in v1.14.1

type LicenseManager interface {
	CheckLicense() *License
}

type LoadWorldF added in v1.14.2

type LoadWorldF func(ctx context.Context, project *db.Project, from, to timeseries.Time) (*model.World, error)

type Node added in v0.22.0

type Node struct {
	Name   string       `json:"name"`
	Status model.Status `json:"status"`
}

type NodeAgent added in v0.22.0

type NodeAgent struct {
	Status model.Status `json:"status"`
	Nodes  int          `json:"nodes"`
}

type Prometheus added in v0.22.0

type Prometheus struct {
	Status  model.Status `json:"status"`
	Message string       `json:"message"`
	Error   string       `json:"error"`
	Action  string       `json:"action"`
}
type Search struct {
	Applications []Application `json:"applications"`
	Nodes        []Node        `json:"nodes"`
}

type Session added in v1.5.0

type Session struct {
	Id int `json:"id"`
}

type Status added in v0.22.0

type Status struct {
	Status           model.Status      `json:"status"`
	Error            string            `json:"error"`
	Prometheus       Prometheus        `json:"prometheus"`
	NodeAgent        NodeAgent         `json:"node_agent"`
	KubeStateMetrics *KubeStateMetrics `json:"kube_state_metrics"`
}

Jump to

Keyboard shortcuts

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