Documentation
¶
Index ¶
- type Alert
- type AlertCredential
- type AlertService
- type AlertmanagerService
- type Alerts
- type Channel
- type CodeExchangeService
- type Config
- type CortexConfig
- type DBConfig
- type EncryptedNamespace
- type LogConfig
- type Namespace
- type NamespaceService
- type NewRelicConfig
- type NotifierServices
- type OAuthExchangeResponse
- type OAuthPayload
- type Provider
- type ProviderService
- type Receiver
- type ReceiverMetadata
- type ReceiverService
- type Rule
- type RuleService
- type RuleVariable
- type SirenServiceConfig
- type SlackApp
- type SlackConfig
- type SlackCredential
- type SlackMessage
- type SlackMessageSendResponse
- type SlackNotifierService
- type SlackService
- type SlackWorkspaceService
- type Subscription
- type SubscriptionService
- type Template
- type TemplatesService
- type Variable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
Id uint64 `json:"id"`
ProviderId uint64 `json:"provider_id"`
ResourceName string `json:"resource_name"`
MetricName string `json:"metric_name"`
MetricValue string `json:"metric_value"`
Severity string `json:"severity"`
Rule string `json:"rule"`
TriggeredAt time.Time `json:"triggered_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type AlertCredential ¶
type AlertCredential struct {
Entity string `json:"entity" validate:"required"`
TeamName string `json:"team_name"`
PagerdutyCredentials string `json:"pagerduty_credentials" validate:"required"`
SlackConfig SlackConfig `json:"slack_config" validate:"required,dive,required"`
}
type AlertService ¶ added in v0.3.0
type AlertmanagerService ¶
type AlertmanagerService interface {
Upsert(credential AlertCredential) error
Get(teamName string) (AlertCredential, error)
Migrate() error
}
type CodeExchangeService ¶ added in v0.2.0
type CodeExchangeService interface {
Exchange(payload OAuthPayload) (*OAuthExchangeResponse, error)
GetToken(string) (string, error)
Migrate() error
}
type Config ¶
type Config struct {
Port int `mapstructure:"port" default:"8080"`
DB DBConfig `mapstructure:"db"`
Cortex CortexConfig `mapstructure:"cortex"`
NewRelic NewRelicConfig `mapstructure:"newrelic"`
SirenService SirenServiceConfig `mapstructure:"siren_service"`
Log LogConfig `mapstructure:"log"`
SlackApp SlackApp `mapstructure:"slack_app"`
EncryptionKey string `mapstructure:"encryption_key"`
}
Config contains the application configuration
type CortexConfig ¶
type CortexConfig struct {
Address string `mapstructure:"address" default:"http://localhost:8080"`
}
CortexConfig contains the cortex configuration
type DBConfig ¶
type DBConfig struct {
Host string `mapstructure:"host" default:"localhost"`
User string `mapstructure:"user" default:"postgres"`
Password string `mapstructure:"password" default:""`
Name string `mapstructure:"name" default:"postgres"`
Port string `mapstructure:"port" default:"5432"`
SslMode string `mapstructure:"sslmode" default:"disable"`
LogLevel string `mapstructure:"log_level" default:"info"`
}
DBConfig contains the database configuration
type EncryptedNamespace ¶ added in v0.4.0
type Namespace ¶ added in v0.3.0
type Namespace struct {
Id uint64 `json:"id"`
Urn string `json:"urn"`
Name string `json:"name"`
Provider uint64 `json:"provider"`
Credentials map[string]interface{} `json:"credentials"`
Labels map[string]string `json:"labels"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type NamespaceService ¶ added in v0.3.0
type NewRelicConfig ¶
type NewRelicConfig struct {
Enabled bool `mapstructure:"enabled" default:"false"`
AppName string `mapstructure:"appname" default:"siren"`
License string `mapstructure:"license"`
}
NewRelic contains the New Relic go-agent configuration
type NotifierServices ¶ added in v0.2.0
type NotifierServices struct {
Slack SlackNotifierService
}
type OAuthExchangeResponse ¶ added in v0.2.0
type OAuthExchangeResponse struct {
OK bool `json:"ok"`
}
type OAuthPayload ¶ added in v0.2.0
type Provider ¶ added in v0.3.0
type Provider struct {
Id uint64 `json:"id"`
Urn string `json:"urn"`
Host string `json:"host"`
Name string `json:"name"`
Type string `json:"type"`
Credentials map[string]interface{} `json:"credentials"`
Labels map[string]string `json:"labels"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ProviderService ¶ added in v0.3.0
type Receiver ¶ added in v0.3.0
type Receiver struct {
Id uint64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Labels map[string]string `json:"labels"`
Configurations map[string]interface{} `json:"configurations"`
Data map[string]interface{} `json:"data"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ReceiverMetadata ¶ added in v0.3.0
type ReceiverService ¶ added in v0.3.0
type Rule ¶
type Rule struct {
Id uint64 `json:"id"`
Name string `json:"name"`
Enabled bool `json:"enabled" validate:"required"`
GroupName string `json:"group_name" validate:"required"`
Namespace string `json:"namespace" validate:"required"`
Template string `json:"template" validate:"required"`
Variables []RuleVariable `json:"variables" validate:"required,dive,required"`
ProviderNamespace uint64 `json:"provider_namespace" validate:"required"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type RuleService ¶
type RuleService interface {
Upsert(context.Context, *Rule) error
Get(context.Context, string, string, string, string, uint64) ([]Rule, error)
Migrate() error
}
RuleService interface
type RuleVariable ¶
type SirenServiceConfig ¶
type SirenServiceConfig struct {
Host string `mapstructure:"host" default:"http://localhost:3000"`
}
type SlackConfig ¶
type SlackConfig struct {
Critical SlackCredential `json:"critical" validate:"required,dive,required"`
Warning SlackCredential `json:"warning" validate:"required,dive,required"`
}
type SlackCredential ¶
type SlackCredential struct {
Channel string `json:"channel" validate:"required"`
}
type SlackMessage ¶ added in v0.2.0
type SlackMessage struct {
ReceiverName string `json:"receiver_name" validate:"required"`
ReceiverType string `json:"receiver_type" validate:"required,oneof=user channel"`
Token string `json:"token" validate:"required"`
Message string `json:"message"`
Blocks slack.Blocks `json:"blocks"`
}
func (*SlackMessage) Validate ¶ added in v0.2.0
func (sm *SlackMessage) Validate() error
type SlackMessageSendResponse ¶ added in v0.2.0
type SlackMessageSendResponse struct {
OK bool `json:"ok"`
}
type SlackNotifierService ¶ added in v0.2.0
type SlackNotifierService interface {
Notify(*SlackMessage) (*SlackMessageSendResponse, error)
}
type SlackService ¶ added in v0.2.0
type SlackWorkspaceService ¶ added in v0.3.0
type Subscription ¶ added in v0.3.0
type SubscriptionService ¶ added in v0.3.0
type SubscriptionService interface {
ListSubscriptions(context.Context) ([]*Subscription, error)
CreateSubscription(context.Context, *Subscription) error
GetSubscription(context.Context, uint64) (*Subscription, error)
UpdateSubscription(context.Context, *Subscription) error
DeleteSubscription(context.Context, uint64) error
Migrate() error
}
type Template ¶
type Template struct {
ID uint `json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Name string `json:"name" validate:"required"`
Body string `json:"body" validate:"required"`
Tags []string `json:"tags" validate:"required"`
Variables []Variable `json:"variables" validate:"required,dive,required"`
}
Click to show internal directories.
Click to hide internal directories.