alert

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRelation = errors.New("provider id does not exist")
)

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 Filter

type Filter struct {
	ResourceName string
	ProviderID   uint64
	StartTime    uint64
	EndTime      uint64
}

type Repository

type Repository interface {
	Create(context.Context, *Alert) (*Alert, error)
	List(context.Context, Filter) ([]Alert, error)
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service handles business logic

func NewService

func NewService(repository Repository) *Service

NewService returns repository struct

func (*Service) Create

func (s *Service) Create(ctx context.Context, alerts []*Alert) ([]Alert, error)

func (*Service) List

func (s *Service) List(ctx context.Context, flt Filter) ([]Alert, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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