model

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: Apache-2.0 Imports: 13 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(alrt *alert.Alert)

func (*Alert) ToDomain

func (a *Alert) ToDomain() *alert.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 (ns *Namespace) FromDomain(n *namespace.EncryptedNamespace)

func (*Namespace) ToDomain

func (ns *Namespace) ToDomain() *namespace.EncryptedNamespace

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 (p *Provider) FromDomain(t *provider.Provider)

func (*Provider) ToDomain

func (p *Provider) ToDomain() *provider.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 (rcv *Receiver) FromDomain(t *receiver.Receiver)

func (*Receiver) ToDomain

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

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 (rl *Rule) FromDomain(r *rule.Rule) error

func (*Rule) ToDomain

func (rl *Rule) ToDomain() (*rule.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    SubscriptionReceivers `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 *subscription.Subscription)

func (*Subscription) ToDomain

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

type SubscriptionReceiver

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

type SubscriptionReceivers

type SubscriptionReceivers []SubscriptionReceiver

func (*SubscriptionReceivers) Scan

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

func (SubscriptionReceivers) Value

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

type Template

type Template struct {
	ID        uint64 `gorm:"primarykey"`
	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" `
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (*Template) FromDomain

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

func (*Template) ToDomain

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

Jump to

Keyboard shortcuts

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