model

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 Imports: 6 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 `gorm:"primarykey"`
	Provider     *Provider
	ProviderId   uint64
	ResourceName string
	MetricName   string
	MetricValue  string
	Severity     string
	Rule         string
	TriggeredAt  time.Time
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

func (*Alert) FromDomain

func (a *Alert) FromDomain(alert *domain.Alert)

func (*Alert) ToDomain

func (a *Alert) ToDomain() domain.Alert

type Namespace

type Namespace struct {
	Id          uint64 `gorm:"primarykey"`
	Provider    *Provider
	ProviderId  uint64 `gorm:"uniqueIndex:urn_provider_id_unique"`
	Urn         string `gorm:"uniqueIndex:urn_provider_id_unique"`
	Name        string
	Credentials string
	Labels      StringStringMap `gorm:"type:jsonb" sql:"type:jsonb" `
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (*Namespace) FromDomain

func (namespace *Namespace) FromDomain(n *domain.EncryptedNamespace) error

func (*Namespace) ToDomain

func (namespace *Namespace) ToDomain() (*domain.EncryptedNamespace, error)

type Provider

type Provider struct {
	Id          uint64 `gorm:"primarykey"`
	Host        string
	Urn         string `gorm:"unique:urn"`
	Name        string
	Type        string
	Credentials StringInterfaceMap `gorm:"type:jsonb" sql:"type:jsonb" `
	Labels      StringStringMap    `gorm:"type:jsonb" sql:"type:jsonb" `
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (*Provider) FromDomain

func (provider *Provider) FromDomain(t *domain.Provider) *Provider

func (*Provider) ToDomain

func (provider *Provider) ToDomain() *domain.Provider

type Receiver

type Receiver struct {
	Id             uint64 `gorm:"primarykey"`
	Name           string
	Type           string
	Labels         StringStringMap    `gorm:"type:jsonb" sql:"type:jsonb" `
	Configurations StringInterfaceMap `gorm:"type:jsonb" sql:"type:jsonb" `
	Data           StringInterfaceMap `gorm:"-"`
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

func (*Receiver) FromDomain

func (receiver *Receiver) FromDomain(t *domain.Receiver)

func (*Receiver) ToDomain

func (receiver *Receiver) ToDomain() *domain.Receiver

type ReceiverMetadata

type ReceiverMetadata struct {
	Id            uint64            `json:"id"`
	Configuration map[string]string `json:"configuration"`
}

type ReceiverMetadataList

type ReceiverMetadataList []ReceiverMetadata

func (*ReceiverMetadataList) Scan

func (list *ReceiverMetadataList) Scan(src interface{}) error

func (ReceiverMetadataList) Value

func (list ReceiverMetadataList) Value() (driver.Value, error)

type Rule

type Rule struct {
	Id                    uint64 `gorm:"primarykey"`
	CreatedAt             time.Time
	UpdatedAt             time.Time
	Name                  string `gorm:"index:idx_rule_name,unique"`
	Namespace             string `gorm:"uniqueIndex:unique_name"`
	GroupName             string `gorm:"uniqueIndex:unique_name"`
	Template              string `gorm:"uniqueIndex:unique_name"`
	Enabled               *bool
	Variables             string     `gorm:"type:jsonb" sql:"type:jsonb"`
	ProviderNamespace     uint64     `gorm:"uniqueIndex:unique_name"`
	ProviderNamespaceInfo *Namespace `gorm:"foreignKey:ProviderNamespace"`
}

func (*Rule) FromDomain

func (rule *Rule) FromDomain(r *domain.Rule) error

func (*Rule) ToDomain

func (rule *Rule) ToDomain() (*domain.Rule, error)

type StringInterfaceMap

type StringInterfaceMap map[string]interface{}

func (*StringInterfaceMap) Scan

func (m *StringInterfaceMap) Scan(value interface{}) error

func (StringInterfaceMap) Value

func (a StringInterfaceMap) Value() (driver.Value, error)

type StringStringMap

type StringStringMap map[string]string

func (*StringStringMap) Scan

func (m *StringStringMap) Scan(value interface{}) error

func (StringStringMap) Value

func (a StringStringMap) Value() (driver.Value, error)

type Subscription

type Subscription struct {
	Id          uint64 `gorm:"primarykey"`
	Namespace   *Namespace
	NamespaceId uint64
	Urn         string               `gorm:"unique"`
	Receiver    ReceiverMetadataList `gorm:"type:jsonb" sql:"type:jsonb" `
	Match       StringStringMap      `gorm:"type:jsonb" sql:"type:jsonb" `
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (*Subscription) FromDomain

func (s *Subscription) FromDomain(sub *domain.Subscription)

func (*Subscription) ToDomain

func (s *Subscription) ToDomain() *domain.Subscription

type Template

type Template struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	Name      string `gorm:"index:idx_template_name,unique"`
	Body      string
	Tags      pq.StringArray `gorm:"type:text[];index:idx_tags,type:gin"`
	Variables string         `gorm:"type:jsonb" sql:"type:jsonb" `
}

func (*Template) FromDomain

func (template *Template) FromDomain(t *domain.Template) error

func (*Template) ToDomain

func (template *Template) ToDomain() (*domain.Template, error)

Jump to

Keyboard shortcuts

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