model

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 18 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         `db:"id"`
	NamespaceID   sql.NullInt64  `db:"namespace_id"`
	ProviderID    uint64         `db:"provider_id"`
	ResourceName  string         `db:"resource_name"`
	MetricName    string         `db:"metric_name"`
	MetricValue   string         `db:"metric_value"`
	Severity      string         `db:"severity"`
	Rule          string         `db:"rule"`
	TriggeredAt   time.Time      `db:"triggered_at"`
	CreatedAt     time.Time      `db:"created_at"`
	UpdatedAt     time.Time      `db:"updated_at"`
	SilenceStatus sql.NullString `db:"silence_status"`
}

func (*Alert) FromDomain

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

func (*Alert) ToDomain

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

type Idempotency

type Idempotency struct {
	ID             uint64    `db:"id"`
	Scope          string    `db:"scope"`
	Key            string    `db:"key"`
	NotificationID string    `db:"notification_id"`
	CreatedAt      time.Time `db:"created_at"`
	UpdatedAt      time.Time `db:"updated_at"`
}

func (*Idempotency) ToDomain

func (i *Idempotency) ToDomain() *notification.Idempotency

type Namespace

type Namespace struct {
	ID               uint64              `db:"id"`
	ProviderID       uint64              `db:"provider_id"`
	URN              string              `db:"urn"`
	Name             string              `db:"name"`
	CredentialString string              `db:"credentials"`
	Labels           pgc.StringStringMap `db:"labels"`
	CreatedAt        time.Time           `db:"created_at"`
	UpdatedAt        time.Time           `db:"updated_at"`
}

func (*Namespace) FromDomain

func (ns *Namespace) FromDomain(n namespace.EncryptedNamespace)

func (*Namespace) ToDomain

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

type NamespaceDetail

type NamespaceDetail struct {
	ID               uint64              `db:"id"`
	Provider         Provider            `db:"provider"`
	URN              string              `db:"urn"`
	Name             string              `db:"name"`
	CredentialString string              `db:"credentials"`
	Labels           pgc.StringStringMap `db:"labels"`
	CreatedAt        time.Time           `db:"created_at"`
	UpdatedAt        time.Time           `db:"updated_at"`
}

func (*NamespaceDetail) FromDomain

func (ns *NamespaceDetail) FromDomain(n namespace.EncryptedNamespace)

func (*NamespaceDetail) ToDomain

type Notification

type Notification struct {
	ID                string                  `db:"id"`
	NamespaceID       sql.NullInt64           `db:"namespace_id"`
	Type              string                  `db:"type"`
	Data              pgc.StringAnyMap        `db:"data"`
	Labels            pgc.StringStringMap     `db:"labels"`
	ValidDuration     pgc.TimeDuration        `db:"valid_duration"`
	UniqueKey         sql.NullString          `db:"unique_key"`
	Template          sql.NullString          `db:"template"`
	CreatedAt         time.Time               `db:"created_at"`
	ReceiverSelectors pgc.ListStringStringMap `db:"receiver_selectors"`
}

func (*Notification) FromDomain

func (n *Notification) FromDomain(d notification.Notification)

func (*Notification) ToDomain

func (n *Notification) ToDomain() *notification.Notification

type NotificationLog

type NotificationLog struct {
	ID             string         `db:"id"`
	NamespaceID    sql.NullInt64  `db:"namespace_id"`
	NotificationID string         `db:"notification_id"`
	SubscriptionID uint64         `db:"subscription_id"`
	ReceiverID     sql.NullInt64  `db:"receiver_id"`
	AlertIDs       pq.Int64Array  `db:"alert_ids"`
	SilenceIDs     pq.StringArray `db:"silence_ids"`
	CreatedAt      time.Time      `db:"created_at"`
}

func (*NotificationLog) FromDomain

func (ns *NotificationLog) FromDomain(d log.Notification)

func (*NotificationLog) ToDomain

func (ns *NotificationLog) ToDomain() log.Notification

type Provider

type Provider struct {
	ID          uint64              `db:"id"`
	Host        string              `db:"host"`
	URN         string              `db:"urn"`
	Name        string              `db:"name"`
	Type        string              `db:"type"`
	Credentials pgc.StringAnyMap    `db:"credentials"`
	Labels      pgc.StringStringMap `db:"labels"`
	CreatedAt   time.Time           `db:"created_at"`
	UpdatedAt   time.Time           `db:"updated_at"`
}

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              `db:"id"`
	Name           string              `db:"name"`
	Type           string              `db:"type"`
	Labels         pgc.StringStringMap `db:"labels"`
	Configurations pgc.StringAnyMap    `db:"configurations"`
	Data           pgc.StringAnyMap    `db:"-"` //TODO do we need this?
	ParentID       sql.NullInt64       `db:"parent_id"`
	CreatedAt      time.Time           `db:"created_at"`
	UpdatedAt      time.Time           `db:"updated_at"`
}

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    `db:"id"`
	Name              string    `db:"name"`
	Namespace         string    `db:"namespace"`
	GroupName         string    `db:"group_name"`
	Template          string    `db:"template"`
	Enabled           bool      `db:"enabled"`
	Variables         string    `db:"variables"`
	ProviderNamespace uint64    `db:"provider_namespace"`
	CreatedAt         time.Time `db:"created_at"`
	UpdatedAt         time.Time `db:"updated_at"`
}

func (*Rule) FromDomain

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

func (*Rule) ToDomain

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

type Silence

type Silence struct {
	ID               string           `db:"id"`
	NamespaceID      uint64           `db:"namespace_id"`
	Type             string           `db:"type"`
	TargetID         sql.NullInt64    `db:"target_id"`
	TargetExpression pgc.StringAnyMap `db:"target_expression"`
	Creator          sql.NullString   `db:"creator"`
	Comment          sql.NullString   `db:"comment"`
	CreatedAt        time.Time        `db:"created_at"`
	DeletedAt        sql.NullTime     `db:"deleted_at"`
}

func (*Silence) FromDomain

func (s *Silence) FromDomain(sil silence.Silence)

func (*Silence) ToDomain

func (s *Silence) ToDomain() *silence.Silence

type Subscription

type Subscription struct {
	ID          uint64                `db:"id"`
	NamespaceID uint64                `db:"namespace_id"`
	URN         string                `db:"urn"`
	Receiver    SubscriptionReceivers `db:"receiver"`
	Match       pgc.StringStringMap   `db:"match"`
	Metadata    pgc.StringAnyMap      `db:"metadata"`
	CreatedBy   sql.NullString        `db:"created_by"`
	UpdatedBy   sql.NullString        `db:"updated_by"`
	CreatedAt   time.Time             `db:"created_at"`
	UpdatedAt   time.Time             `db:"updated_at"`
}

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]any `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         `db:"id"`
	Name      string         `db:"name"`
	Body      string         `db:"body"`
	Tags      pq.StringArray `db:"tags"`
	Variables string         `db:"variables"`
	CreatedAt time.Time      `db:"created_at"`
	UpdatedAt time.Time      `db:"updated_at"`
}

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