importcontextgraph

package
v0.0.0-...-9b5cd94 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionDelete  = "delete"
	ActionSet     = "set"
	ActionDisable = "disable"
	ActionEnable  = "enable"
)

Variables

View Source
var ErrNotImplemented = errors.New("import action not implemented")

Functions

This section is empty.

Types

type EntityConfiguration

type EntityConfiguration struct {
	ID             string                `json:"-" bson:"_id"`
	Name           string                `json:"name" bson:"name" binding:"required"`
	Component      string                `json:"component" bson:"component,omitempty"`
	Services       []string              `json:"-" bson:"services,omitempty"`
	EnableHistory  []int64               `json:"-" bson:"enable_history"`
	EntityPattern  pattern.Entity        `json:"entity_pattern" bson:"entity_pattern,omitempty"`
	OutputTemplate string                `json:"output_template" bson:"output_template,omitempty"`
	Infos          map[string]types.Info `json:"infos" bson:"infos"`
	Type           string                `json:"type" bson:"type" binding:"required"`
	CategoryName   string                `json:"category" bson:"-"`
	CategoryID     string                `json:"-" bson:"category,omitempty"`
	ImpactLevel    int64                 `json:"impact_level" bson:"impact_level,omitempty"`
	Enabled        bool                  `json:"enabled" bson:"enabled,omitempty"`
	Action         string                `json:"action" bson:"-"`
	ImportSource   string                `json:"-" bson:"import_source"`
	Imported       datetime.CpsTime      `json:"-" bson:"imported"`
}

type EventPublisher

type EventPublisher interface {
	SendEvent(ctx context.Context, event types.Event) error
}

func NewEventPublisher

func NewEventPublisher(
	exchange, queue string,
	encoder encoding.Encoder,
	contentType string,
	amqpPublisher libamqp.Publisher,
) EventPublisher

type Stats

type Stats struct {
	ExecTime time.Duration `bson:"-" json:"-"`
	Deleted  int64         `bson:"deleted" json:"deleted"`
	Updated  int64         `bson:"updated" json:"updated"`
}

type Worker

type Worker interface {
	Work(ctx context.Context, filename, source string) (Stats, error)
	WorkPartial(ctx context.Context, filename, source string) (Stats, error)
}

func NewWorker

func NewWorker(
	dbClient libmongo.DbClient,
	publisher EventPublisher,
	metricMetaUpdater metrics.MetaUpdater,
	logger zerolog.Logger,
) Worker

Jump to

Keyboard shortcuts

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