domain

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

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 AlertService interface {
	Create(*Alerts) ([]Alert, error)
	Get(string, uint64, uint64, uint64) ([]Alert, error)
	Migrate() error
}

type AlertmanagerService

type AlertmanagerService interface {
	Upsert(credential AlertCredential) error
	Get(teamName string) (AlertCredential, error)
	Migrate() error
}

type Alerts

type Alerts struct {
	Alerts []Alert `json:"alerts"`
}

type Channel added in v0.2.0

type Channel struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

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 LogConfig

type LogConfig struct {
	Level string `mapstructure:"level" default:"info"`
}

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 NamespaceService interface {
	ListNamespaces() ([]*Namespace, error)
	CreateNamespace(*Namespace) (*Namespace, error)
	GetNamespace(uint64) (*Namespace, error)
	UpdateNamespace(*Namespace) (*Namespace, error)
	DeleteNamespace(uint64) error
	Migrate() error
}

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 OAuthPayload struct {
	Code      string `json:"code"`
	Workspace string `json:"workspace"`
}

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 ProviderService interface {
	ListProviders(map[string]interface{}) ([]*Provider, error)
	CreateProvider(*Provider) (*Provider, error)
	GetProvider(uint64) (*Provider, error)
	UpdateProvider(*Provider) (*Provider, error)
	DeleteProvider(uint64) error
	Migrate() error
}

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 ReceiverMetadata struct {
	Id            uint64            `json:"id"`
	Configuration map[string]string `json:"configuration"`
}

type ReceiverService added in v0.3.0

type ReceiverService interface {
	ListReceivers() ([]*Receiver, error)
	CreateReceiver(*Receiver) (*Receiver, error)
	GetReceiver(uint64) (*Receiver, error)
	UpdateReceiver(*Receiver) (*Receiver, error)
	DeleteReceiver(uint64) error
	Migrate() error
}

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(*Rule) (*Rule, error)
	Get(string, string, string, string, uint64) ([]Rule, error)
	Migrate() error
}

RuleService interface

type RuleVariable

type RuleVariable struct {
	Name        string `json:"name" validate:"required"`
	Type        string `json:"type"`
	Value       string `json:"value" validate:"required"`
	Description string `json:"description"`
}

type SirenServiceConfig

type SirenServiceConfig struct {
	Host string `mapstructure:"host" default:"http://localhost:3000"`
}

type SlackApp added in v0.2.0

type SlackApp struct {
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"`
}

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 SlackService interface {
	SendMessage(string, ...slack.MsgOption) (string, string, string, error)
	GetUserByEmail(string) (*slack.User, error)
	GetJoinedChannelsList() ([]slack.Channel, error)
}

type SlackWorkspaceService added in v0.3.0

type SlackWorkspaceService interface {
	GetChannels(string) ([]Channel, error)
}

type Subscription added in v0.3.0

type Subscription struct {
	Id        uint64             `json:"id"`
	Urn       string             `json:"urn"`
	Namespace uint64             `json:"namespace"`
	Receivers []ReceiverMetadata `json:"receivers"`
	Match     map[string]string  `json:"match"`
	CreatedAt time.Time          `json:"created_at"`
	UpdatedAt time.Time          `json:"updated_at"`
}

type SubscriptionService added in v0.3.0

type SubscriptionService interface {
	ListSubscriptions() ([]*Subscription, error)
	CreateSubscription(*Subscription) (*Subscription, error)
	GetSubscription(uint64) (*Subscription, error)
	UpdateSubscription(*Subscription) (*Subscription, error)
	DeleteSubscription(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"`
}

type TemplatesService

type TemplatesService interface {
	Upsert(*Template) (*Template, error)
	Index(string) ([]Template, error)
	GetByName(string) (*Template, error)
	Delete(string) error
	Render(string, map[string]string) (string, error)
	Migrate() error
}

TemplatesService interface

type Variable

type Variable struct {
	Name        string `json:"name" validate:"required"`
	Type        string `json:"type" validate:"required"`
	Default     string `json:"default"`
	Description string `json:"description"`
}

Jump to

Keyboard shortcuts

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