Documentation ¶
Index ¶
- Constants
- Variables
- func CheckSummary(ctx DBContext, checkID string) (*models.CheckSummary, error)
- func DefaultGormConfig() *gorm.Config
- func FindCachedAgent(ctx DBContext, id string) (*models.Agent, error)
- func FindCachedCanary(ctx DBContext, id string) (*models.Canary, error)
- func FindCachedCheck(ctx DBContext, id string) (*models.Check, error)
- func FindCachedComponent(ctx DBContext, id string) (*models.Component, error)
- func FindCachedConfig(ctx DBContext, id string) (*models.ConfigItem, error)
- func FindCachedIncident(ctx DBContext, id string) (*models.Incident, error)
- func FindConnection(ctx context.Context, db *gorm.DB, connectionType, name string) (*models.Connection, error)
- func FindConnectionByURL(ctx context.Context, db *gorm.DB, connectionString string) (*models.Connection, error)
- func FindPerson(ctx DBContext, identifier string, opts ...GetterOption) (*models.Person, error)
- func FindTeam(ctx DBContext, identifier string, opts ...GetterOption) (*models.Team, error)
- func GetComponent(ctx context.Context, db *gorm.DB, id string) (*models.Component, error)
- func GetConfigMapFromCache(c kubernetes.Interface, namespace, name, key string) (string, error)
- func GetConnection(ctx context.Context, client kubernetes.Interface, db *gorm.DB, ...) (*models.Connection, error)
- func GetEnvStringFromCache(c kubernetes.Interface, env string, namespace string) (string, error)
- func GetEnvValueFromCache(c kubernetes.Interface, input types.EnvVar, namespace string) (string, error)
- func GetSecretFromCache(c kubernetes.Interface, namespace, name, key string) (string, error)
- func HydrateConnection(ctx context.Context, client kubernetes.Interface, db *gorm.DB, ...) (*models.Connection, error)
- func HydratedConnectionByURL(ctx context.Context, db *gorm.DB, k8sClient kubernetes.Interface, ...) (*models.Connection, error)
- func IsValidConnectionURL(connectionString string) bool
- func Migrate(connection string, opts *migrate.MigrateOptions) error
- func NewDB(connection string) (*sql.DB, error)
- func NewGorm(connection string, config *gorm.Config) (*gorm.DB, error)
- func NewPgxPool(connection string) (*pgxpool.Pool, error)
- func QueryCheckSummary(ctx context.Context, dbpool *pgxpool.Pool) (models.Checks, error)
- func RefreshCheckStatusSummary(dbpool *pgxpool.Pool) error
- func SetupDB(connection string, migrateOpts *migrate.MigrateOptions) (gormDB *gorm.DB, pgxpool *pgxpool.Pool, err error)
- type DBContext
- type GetterOption
- type GetterOptions
- type Tags
- type TopologyOptions
- type TopologyResponse
Constants ¶
const DefaultDepth = 5
Variables ¶
var DefaultQueryTimeout = 30 * time.Second
var (
ErrNotFound = errors.New("NOT_FOUND")
)
Functions ¶
func CheckSummary ¶ added in v1.0.164
func CheckSummary(ctx DBContext, checkID string) (*models.CheckSummary, error)
func DefaultGormConfig ¶ added in v1.0.6
func FindCachedAgent ¶ added in v1.0.172
func FindCachedCanary ¶ added in v1.0.172
func FindCachedCheck ¶ added in v1.0.172
func FindCachedComponent ¶ added in v1.0.172
func FindCachedConfig ¶ added in v1.0.172
func FindCachedConfig(ctx DBContext, id string) (*models.ConfigItem, error)
func FindCachedIncident ¶ added in v1.0.172
func FindConnection ¶ added in v1.0.45
func FindConnection(ctx context.Context, db *gorm.DB, connectionType, name string) (*models.Connection, error)
FindConnection returns the connection with the given type and name
func FindConnectionByURL ¶ added in v1.0.75
func FindConnectionByURL(ctx context.Context, db *gorm.DB, connectionString string) (*models.Connection, error)
FindConnectionByURL retrieves a connection from the given connection string. The connection string is expected to be of the form: connection://<type>/<name>
func FindPerson ¶ added in v1.0.178
FindPerson looks up a person by the given identifier which can either be
- UUID
func FindTeam ¶ added in v1.0.178
FindTeam looks up a team by the given identifier which can either be
- UUID
- team name
func GetComponent ¶ added in v1.0.45
func GetConfigMapFromCache ¶ added in v1.0.45
func GetConfigMapFromCache(c kubernetes.Interface, namespace, name, key string) (string, error)
func GetConnection ¶ added in v1.0.45
func GetEnvStringFromCache ¶ added in v1.0.45
func GetEnvValueFromCache ¶ added in v1.0.45
func GetSecretFromCache ¶ added in v1.0.45
func GetSecretFromCache(c kubernetes.Interface, namespace, name, key string) (string, error)
func HydrateConnection ¶ added in v1.0.48
func HydrateConnection(ctx context.Context, client kubernetes.Interface, db *gorm.DB, connection *models.Connection, namespace string) (*models.Connection, error)
Create a cache with a default expiration time of 5 minutes, and which purges expired items every 10 minutes var connectionCache = cache.New(5*time.Minute, 10*time.Minute)
func HydratedConnectionByURL ¶ added in v1.0.75
func HydratedConnectionByURL(ctx context.Context, db *gorm.DB, k8sClient kubernetes.Interface, namespace, connectionString string) (*models.Connection, error)
HydratedConnectionByURL retrieves a connection from the given connection string. The connection string is expected to be in one of the following forms:
- connection://<type>/<name> or
- the UUID of the connection.
func IsValidConnectionURL ¶ added in v1.0.140
func NewGorm ¶
creates a new Gorm DB connection using the global pgx connection pool, must be called after NewPgxPool
func QueryCheckSummary ¶ added in v1.0.34
func RefreshCheckStatusSummary ¶ added in v1.0.34
Types ¶
type GetterOption ¶ added in v1.0.178
type GetterOption uint8
const (
GetterOptionNoCache GetterOption = iota + 1
)
type GetterOptions ¶ added in v1.0.178
type GetterOptions []GetterOption
func (GetterOptions) IsSet ¶ added in v1.0.178
func (t GetterOptions) IsSet(option GetterOption) bool
type TopologyOptions ¶ added in v1.0.11
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 }
func (TopologyOptions) String ¶ added in v1.0.11
func (opt TopologyOptions) String() string
type TopologyResponse ¶ added in v1.0.71
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 QueryTopology ¶ added in v1.0.24
func QueryTopology(ctx context.Context, dbpool *pgxpool.Pool, params TopologyOptions) (*TopologyResponse, error)