config

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

Documentation

Index

Constants

View Source
const (
	ConfigKeyName        = "global_config"
	UserInterfaceKeyName = "user_interface"
	VersionKeyName       = "canopsis_version"
	RemediationKeyName   = "remediation"
	HealthCheckName      = "health_check"
	AlarmTagColorKeyName = "alarm_tag_color"
	MaintenanceKeyName   = "maintenance"
)

Some default values related to configuration

View Source
const (
	AlarmCancelAutosolveDelay = 60 * 60 * time.Second
	AlarmDisplayNameScheme    = "{{ rand_string 2 }}-{{ rand_string 2 }}-{{ rand_string 2 }}"

	ApiTokenSigningMethod       = "HS256"
	ApiBulkMaxSize              = 10000
	ApiExportMongoClientTimeout = time.Minute
	ApiMetricsCacheExpiration   = 24 * time.Hour

	RemediationHttpTimeout                    = 5 * time.Second
	RemediationPauseManualInstructionInterval = 15 * time.Second
	RemediationJobRetryInterval               = 10 * time.Second
	RemediationJobWaitInterval                = 60 * time.Second

	MetricsFlushInterval          = 10 * time.Second
	MetricsSliInterval            = time.Hour
	MetricsMaxSliInterval         = time.Hour
	MetricsUserSessionGapInterval = time.Hour

	TechMetricsDumpKeepInterval = time.Hour

	UserInterfaceMaxMatchedItems          = 10000
	UserInterfaceCheckCountRequestTimeout = 30

	DataStorageMaxUpdates = 100000

	DefaultEventsCountThreshold = 10
)

Default config values

View Source
const (
	AuthTypeHeaderToken = "header-token"
	AuthTypeBearerToken = "bearer-token"
	AuthTypeBasicAuth   = "basic-auth"
)
View Source
const SystemEnvVariablesKey = "System"

Variables

View Source
var ApiAuthorScheme = []string{"$username"}

Functions

func CreateDisplayNameTpl

func CreateDisplayNameTpl(text string) (*template.Template, error)

func SetDbClientRetry

func SetDbClientRetry(dbClient mongo.DbClient, cfg CanopsisConf)

Types

type Adapter

type Adapter interface {
	// GetConfig return the whole config document
	GetConfig(ctx context.Context) (CanopsisConf, error)
	// UpsertConfig upsert a config in mongo.
	UpsertConfig(ctx context.Context, conf CanopsisConf) error
}

Adapter to the concrete database

func NewAdapter

func NewAdapter(client mongo.DbClient) Adapter

type AlarmConfig

type AlarmConfig struct {
	StealthyInterval     time.Duration
	CancelAutosolveDelay time.Duration
	DisplayNameScheme    *template.Template

	OutputLength     int
	LongOutputLength int
	// DisableActionSnoozeDelayOnPbh ignores Pbh state to resolve snoozed with Action alarm while is True
	DisableActionSnoozeDelayOnPbh     bool
	TimeToKeepResolvedAlarms          time.Duration
	AllowDoubleAck                    bool
	ActivateAlarmAfterAutoRemediation bool
	EnableArraySortingInEntityInfos   bool
	// contains filtered or unexported fields
}

type AlarmConfigProvider

type AlarmConfigProvider interface {
	Get() AlarmConfig
}

type ApiConfig

type ApiConfig struct {
	TokenSigningMethod       jwt.SigningMethod
	BulkMaxSize              int
	ExportMongoClientTimeout time.Duration
	AuthorScheme             []string
	MetricsCacheExpiration   time.Duration
}

type ApiConfigProvider

type ApiConfigProvider interface {
	Get() ApiConfig
}

type Auth

type Auth struct {
	Type string `toml:"type" bson:"type"`
	// Header is only AuthTypeHeaderToken
	Header string `toml:"header" bson:"header,omitempty"`
}

Auth represents configuration for API auth of external service API.

type BaseAlarmConfigProvider

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

func NewAlarmConfigProvider

func NewAlarmConfigProvider(cfg CanopsisConf, logger zerolog.Logger) *BaseAlarmConfigProvider

func (*BaseAlarmConfigProvider) Get

func (*BaseAlarmConfigProvider) Update

func (p *BaseAlarmConfigProvider) Update(cfg CanopsisConf)

type BaseApiConfigProvider

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

func NewApiConfigProvider

func NewApiConfigProvider(cfg CanopsisConf, logger zerolog.Logger) *BaseApiConfigProvider

func (*BaseApiConfigProvider) Get

func (*BaseApiConfigProvider) Update

func (p *BaseApiConfigProvider) Update(cfg CanopsisConf)

type BaseDataStorageConfigProvider

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

func NewDataStorageConfigProvider

func NewDataStorageConfigProvider(cfg CanopsisConf, logger zerolog.Logger) *BaseDataStorageConfigProvider

func (*BaseDataStorageConfigProvider) Get

func (*BaseDataStorageConfigProvider) Update

type BaseHealthCheckConfigProvider

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

func NewBaseHealthCheckConfigProvider

func NewBaseHealthCheckConfigProvider(cfg HealthCheckConf, logger zerolog.Logger) *BaseHealthCheckConfigProvider

func (*BaseHealthCheckConfigProvider) Get

func (*BaseHealthCheckConfigProvider) Update

type BaseMetricsSettingsConfigProvider

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

func NewMetricsConfigProvider

func NewMetricsConfigProvider(cfg CanopsisConf, logger zerolog.Logger) *BaseMetricsSettingsConfigProvider

func (*BaseMetricsSettingsConfigProvider) Get

func (*BaseMetricsSettingsConfigProvider) Update

type BaseRemediationConfigProvider

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

func NewRemediationConfigProvider

func NewRemediationConfigProvider(cfg RemediationConf, logger zerolog.Logger) *BaseRemediationConfigProvider

func (*BaseRemediationConfigProvider) Get

func (*BaseRemediationConfigProvider) Update

type BaseTechMetricsConfigProvider

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

func NewTechMetricsConfigProvider

func NewTechMetricsConfigProvider(cfg CanopsisConf, logger zerolog.Logger) *BaseTechMetricsConfigProvider

func (*BaseTechMetricsConfigProvider) Get

func (*BaseTechMetricsConfigProvider) Update

type BaseTemplateConfigProvider

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

func NewTemplateConfigProvider

func NewTemplateConfigProvider(cfg CanopsisConf, logger zerolog.Logger) *BaseTemplateConfigProvider

func (*BaseTemplateConfigProvider) Get

func (*BaseTemplateConfigProvider) Update

type BaseTimezoneConfigProvider

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

func NewTimezoneConfigProvider

func NewTimezoneConfigProvider(cfg CanopsisConf, logger zerolog.Logger) *BaseTimezoneConfigProvider

func (*BaseTimezoneConfigProvider) Get

func (*BaseTimezoneConfigProvider) Update

type BaseUserInterfaceConfigProvider

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

func NewUserInterfaceConfigProvider

func NewUserInterfaceConfigProvider(cfg UserInterfaceConf, logger zerolog.Logger) *BaseUserInterfaceConfigProvider

func (*BaseUserInterfaceConfigProvider) Get

func (*BaseUserInterfaceConfigProvider) Update

type CanopsisConf

type CanopsisConf struct {
	ID          string             `bson:"_id,omitempty" toml:"omitempty"`
	Global      SectionGlobal      `bson:"global" toml:"global"`
	Alarm       SectionAlarm       `bson:"alarm" toml:"alarm"`
	Timezone    SectionTimezone    `bson:"timezone" toml:"timezone"`
	ImportCtx   SectionImportCtx   `bson:"import_ctx" toml:"import_ctx"`
	File        SectionFile        `bson:"file" toml:"file"`
	DataStorage SectionDataStorage `bson:"data_storage" toml:"data_storage"`
	Logger      SectionLogger      `bson:"logger" toml:"logger"`
	API         SectionApi         `bson:"api" toml:"api"`
	Metrics     SectionMetrics     `bson:"metrics" toml:"metrics"`
	TechMetrics SectionTechMetrics `bson:"tech_metrics" toml:"tech_metrics"`
	Template    SectionTemplate    `bson:"template" toml:"template"`
}

CanopsisConf represents a generic configuration object.

type ConsoleWriter

type ConsoleWriter struct {
	Enabled    bool     `toml:"Enabled"`
	NoColor    bool     `toml:"NoColor"`
	TimeFormat string   `toml:"TimeFormat"`
	PartsOrder []string `toml:"PartsOrder"`
}

type DataStorageConfig

type DataStorageConfig struct {
	TimeToExecute      *ScheduledTime
	MaxUpdates         int
	MongoClientTimeout time.Duration
}

type DataStorageConfigProvider

type DataStorageConfigProvider interface {
	Get() DataStorageConfig
}

type EngineOrder

type EngineOrder struct {
	From string `toml:"from" bson:"from" json:"from"`
	To   string `toml:"to" bson:"to" json:"to"`
}

type EngineParameters

type EngineParameters struct {
	Minimal int  `bson:"minimal" json:"minimal"`
	Optimal int  `bson:"optimal" json:"optimal" binding:"gtefield=Minimal"`
	Enabled bool `bson:"enabled" json:"enabled"`
}

type Exchange

type Exchange struct {
	Name       string                 `toml:"name"`
	Kind       string                 `toml:"kind"`
	Durable    bool                   `toml:"durable"`
	AutoDelete bool                   `toml:"autodelete"`
	Internal   bool                   `toml:"internal"`
	NoWait     bool                   `toml:"noWait"`
	Args       map[string]interface{} `toml:"args"`
}

type ExternalApiConfig

type ExternalApiConfig struct {
	Auth              Auth           `toml:"auth" bson:"auth"`
	ResetEndpoint     ResetEndpoint  `toml:"reset_endpoint" bson:"reset_endpoint"`
	LaunchEndpoint    LaunchEndpoint `toml:"launch_endpoint" bson:"launch_endpoint"`
	StatusEndpoint    StatusEndpoint `toml:"status_endpoint" bson:"status_endpoint"`
	QueueEndpoint     QueueEndpoint  `toml:"queue_endpoint" bson:"queue_endpoint"`
	OutputEndpoint    OutputEndpoint `toml:"output_endpoint" bson:"output_endpoint"`
	ErrOutputEndpoint OutputEndpoint `toml:"err_output_endpoint" bson:"err_output_endpoint"`
	ResponseErrMsgKey string         `toml:"response_err_msg_key" bson:"response_err_msg_key,omitempty"`
}

ExternalApiConfig represents configuration of external service API.

type HealthCheckAdapter

type HealthCheckAdapter interface {
	GetConfig(ctx context.Context) (HealthCheckConf, error)
	UpsertConfig(ctx context.Context, conf HealthCheckConf) error
}

func NewHealthCheckAdapter

func NewHealthCheckAdapter(client mongo.DbClient) HealthCheckAdapter

type HealthCheckConf

type HealthCheckConf struct {
	EngineOrder []EngineOrder         `toml:"engine_order" bson:"engine_order" json:"engine_order"`
	Parameters  HealthCheckParameters `toml:"-" bson:"parameters" json:"parameters"`
	// UpdateInterval controls timer to load healthcheck info by API
	UpdateInterval string `toml:"update_interval" bson:"update_interval" json:"update_interval"`
}

func (HealthCheckConf) ParseUpdateInterval

func (c HealthCheckConf) ParseUpdateInterval(logger zerolog.Logger) time.Duration

type HealthCheckConfigProvider

type HealthCheckConfigProvider interface {
	Get() HealthCheckConf
}

type HealthCheckParameters

type HealthCheckParameters struct {
	Queue        LimitParameters  `bson:"queue" json:"queue"`
	Messages     LimitParameters  `bson:"messages" json:"messages"`
	Fifo         EngineParameters `bson:"engine-fifo" json:"engine-fifo"`
	Che          EngineParameters `bson:"engine-che" json:"engine-che"`
	PBehavior    EngineParameters `bson:"engine-pbehavior" json:"engine-pbehavior"`
	Axe          EngineParameters `bson:"engine-axe" json:"engine-axe"`
	Correlation  EngineParameters `bson:"engine-correlation" json:"engine-correlation"`
	Remediation  EngineParameters `bson:"engine-remediation" json:"engine-remediation"`
	DynamicInfos EngineParameters `bson:"engine-dynamic-infos" json:"engine-dynamic-infos"`
	Action       EngineParameters `bson:"engine-action" json:"engine-action"`
	Webhook      EngineParameters `bson:"engine-webhook" json:"engine-webhook"`
}

func (HealthCheckParameters) GetEngineParameters

func (h HealthCheckParameters) GetEngineParameters(name string) EngineParameters

type LaunchEndpoint

type LaunchEndpoint struct {
	UrlTpl                     string            `toml:"url_tpl" bson:"url_tpl"`
	UrlTplWithParams           string            `toml:"url_tpl_with_params" bson:"url_tpl_with_params"`
	Method                     string            `toml:"method" bson:"method"`
	Headers                    map[string]string `toml:"headers" bson:"headers,omitempty"`
	ResponseStatusUrlKey       string            `toml:"response_status_url_key" bson:"response_status_url_key,omitempty"`
	ResponseStatusHeaderUrlKey string            `toml:"response_status_header_url_key" bson:"response_status_header_url_key,omitempty"`
	ResponseExternalUrlKey     string            `toml:"response_external_url_key" bson:"response_external_url_key,omitempty"`
	Body                       string            `toml:"body" bson:"body"`
	WithBody                   bool              `toml:"with_body" bson:"with_body"`
	WithUrlQuery               bool              `toml:"with_url_query" bson:"with_url_query"`
}

LaunchEndpoint represents API endpoint to launch external job.

type LimitParameters

type LimitParameters struct {
	Limit   int  `bson:"limit" json:"limit"`
	Enabled bool `bson:"enabled" json:"enabled"`
}

type MaintenanceAdapter

type MaintenanceAdapter interface {
	GetConfig(ctx context.Context) (MaintenanceConf, error)
}

func NewMaintenanceAdapter

func NewMaintenanceAdapter(client mongo.DbClient) MaintenanceAdapter

type MaintenanceConf

type MaintenanceConf struct {
	Enabled     bool   `bson:"enabled"`
	BroadcastID string `bson:"broadcast_id"`
}

type MetricsConfig

type MetricsConfig struct {
	Enabled                bool
	FlushInterval          time.Duration
	SliInterval            time.Duration
	UserSessionGapInterval time.Duration
	EnabledInstructions    bool
	EnabledNotAckedMetrics bool
}

func GetMetricsConfig

func GetMetricsConfig(cfg CanopsisConf, logger zerolog.Logger) MetricsConfig

type MetricsConfigProvider

type MetricsConfigProvider interface {
	Get() MetricsConfig
}

type OutputEndpoint

type OutputEndpoint struct {
	UrlTpl  string            `toml:"url_tpl" bson:"url_tpl"`
	Method  string            `toml:"method" bson:"method"`
	Headers map[string]string `toml:"headers" bson:"headers,omitempty"`
}

OutputEndpoint represents API endpoint to fetch execution output of external job.

type Queue

type Queue struct {
	Name       string                 `toml:"name"`
	Durable    bool                   `toml:"durable"`
	AutoDelete bool                   `toml:"autoDelete"`
	Exclusive  bool                   `toml:"exclusive"`
	NoWait     bool                   `toml:"noWait"`
	Bind       *QueueBinding          `toml:"bind"`
	Args       map[string]interface{} `toml:"args"`
}

type QueueBinding

type QueueBinding struct {
	Key      string `toml:"key"`
	Exchange string `toml:"exchange"`
	NoWait   bool   `toml:"noWait"`
	Args     map[string]interface{}
}

type QueueEndpoint

type QueueEndpoint struct {
	UrlTpl                 string            `toml:"url_tpl" bson:"url_tpl"`
	Method                 string            `toml:"method" bson:"method"`
	Headers                map[string]string `toml:"headers" bson:"headers,omitempty"`
	ResponseStatusUrlKey   string            `toml:"response_status_url_key" bson:"response_status_url_key,omitempty"`
	ResponseExternalUrlKey string            `toml:"response_external_url_key" bson:"response_external_url_key,omitempty"`
}

QueueEndpoint represents API endpoint to fetch external job execution.

type RabbitMQConf

type RabbitMQConf struct {
	Exchanges []Exchange `toml:"exchanges"`
	Queues    []Queue    `toml:"queues"`
}

type RemediationAdapter

type RemediationAdapter interface {
	GetConfig(ctx context.Context) (RemediationConf, error)
	UpsertConfig(ctx context.Context, conf RemediationConf) error
}

func NewRemediationAdapter

func NewRemediationAdapter(client mongo.DbClient) RemediationAdapter

type RemediationConf

type RemediationConf struct {
	HttpTimeout                    string                       `toml:"http_timeout" bson:"http_timeout"`
	PauseManualInstructionInterval string                       `toml:"pause_manual_instruction_interval" bson:"pause_manual_instruction_interval"`
	ExternalAPI                    map[string]ExternalApiConfig `toml:"external_api" bson:"external_api"`
	JobWaitInterval                string                       `toml:"job_wait_interval" bson:"job_wait_interval"`
	JobRetryInterval               string                       `toml:"job_retry_interval" bson:"job_retry_interval"`
}

type RemediationConfig

type RemediationConfig struct {
	ExternalAPI                    map[string]ExternalApiConfig
	HttpTimeout                    time.Duration
	PauseManualInstructionInterval time.Duration
	JobWaitInterval                time.Duration
	JobRetryInterval               time.Duration
}

type RemediationConfigProvider

type RemediationConfigProvider interface {
	Get() RemediationConfig
}

type ResetEndpoint

type ResetEndpoint struct {
	UrlTpl  string            `toml:"url_tpl" bson:"url_tpl"`
	Method  string            `toml:"method" bson:"method"`
	Headers map[string]string `toml:"headers" bson:"headers,omitempty"`
	Body    string            `toml:"body" bson:"body"`
}

ResetEndpoint represents API endpoint to reset external job.

type ScheduledTime

type ScheduledTime struct {
	Weekday time.Weekday
	Hour    int
}

func (ScheduledTime) String

func (t ScheduledTime) String() string

type SectionAlarm

type SectionAlarm struct {
	StealthyInterval     int    `toml:"StealthyInterval"`
	CancelAutosolveDelay string `toml:"CancelAutosolveDelay"`
	DisplayNameScheme    string `toml:"DisplayNameScheme"`
	OutputLength         int    `toml:"OutputLength"`
	LongOutputLength     int    `toml:"LongOutputLength"`
	// DisableActionSnoozeDelayOnPbh ignores Pbh state to resolve snoozed with Action alarm while is True
	DisableActionSnoozeDelayOnPbh bool `toml:"DisableActionSnoozeDelayOnPbh"`
	// TimeToKeepResolvedAlarms defines how long resolved alarms will be kept in main alarm collection
	TimeToKeepResolvedAlarms string `toml:"TimeToKeepResolvedAlarms"`
	AllowDoubleAck           bool   `toml:"AllowDoubleAck"`
	// ActivateAlarmAfterAutoRemediation if is set then alarm will be activated only after auto remediation execution
	ActivateAlarmAfterAutoRemediation bool `toml:"ActivateAlarmAfterAutoRemediation"`
	EnableArraySortingInEntityInfos   bool `toml:"EnableArraySortingInEntityInfos"`
}

SectionAlarm ...

type SectionApi

type SectionApi struct {
	TokenSigningMethod       string   `toml:"TokenSigningMethod"`
	BulkMaxSize              int      `toml:"BulkMaxSize"`
	ExportMongoClientTimeout string   `toml:"ExportMongoClientTimeout"`
	AuthorScheme             []string `toml:"AuthorScheme"`
	MetricsCacheExpiration   string   `toml:"MetricsCacheExpiration"`
}

type SectionDataStorage

type SectionDataStorage struct {
	TimeToExecute      string `toml:"TimeToExecute"`
	MaxUpdates         int    `toml:"MaxUpdates"`
	MongoClientTimeout string `toml:"MongoClientTimeout"`
}

type SectionFile

type SectionFile struct {
	Upload        string   `toml:"Upload"`
	UploadMaxSize int64    `toml:"UploadMaxSize"`
	Junit         string   `toml:"Junit"`
	JunitApi      string   `toml:"JunitApi"`
	SnmpMib       []string `toml:"SnmpMib"`
	Icon          string   `toml:"Icon"`
	IconMaxSize   int64    `toml:"IconMaxSize"`
}

type SectionGlobal

type SectionGlobal struct {
	PrefetchCount                int   `toml:"PrefetchCount"`
	PrefetchSize                 int   `toml:"PrefetchSize"`
	ReconnectTimeoutMilliseconds int   `toml:"ReconnectTimeoutMilliseconds"`
	ReconnectRetries             int   `toml:"ReconnectRetries"`
	MaxExternalResponseSize      int64 `toml:"MaxExternalResponseSize"`

	BuildEntityInfosDictionary  bool `toml:"BuildEntityInfosDictionary"`
	BuildDynamicInfosDictionary bool `toml:"BuildDynamicInfosDictionary"`

	EventsCountTriggerDefaultThreshold int `toml:"EventsCountTriggerDefaultThreshold"`
}

SectionGlobal ...

func (*SectionGlobal) GetReconnectTimeout

func (s *SectionGlobal) GetReconnectTimeout() time.Duration

type SectionImportCtx

type SectionImportCtx struct {
	ThdWarnMinPerImport string `toml:"ThdWarnMinPerImport"`
	ThdCritMinPerImport string `toml:"ThdCritMinPerImport"`
	FilePattern         string `toml:"FilePattern"`
}

type SectionLogger

type SectionLogger struct {
	Writer        string        `toml:"Writer"`
	ConsoleWriter ConsoleWriter `toml:"console_writer"`
}

type SectionMetrics

type SectionMetrics struct {
	Enabled                bool   `toml:"Enabled"`
	FlushInterval          string `toml:"FlushInterval"`
	SliInterval            string `toml:"SliInterval"`
	UserSessionGapInterval string `toml:"UserSessionGapInterval"`
	EnabledInstructions    bool   `toml:"EnabledInstructions"`
	EnabledNotAckedMetrics bool   `toml:"EnabledNotAckedMetrics"`
}

type SectionTechMetrics

type SectionTechMetrics struct {
	Enabled          bool   `toml:"Enabled"`
	DumpKeepInterval string `toml:"DumpKeepInterval"`
}

type SectionTemplate

type SectionTemplate struct {
	SystemEnvVarPrefixes []string       `bson:"system_env_var_prefixes" toml:"system_env_var_prefixes"`
	Vars                 map[string]any `bson:"vars" toml:"vars"`
}

type SectionTimezone

type SectionTimezone struct {
	Timezone string `toml:"Timezone"`
}

type StatusEndpoint

type StatusEndpoint struct {
	UrlTpl            string            `toml:"url_tpl" bson:"url_tpl"`
	Method            string            `toml:"method" bson:"method"`
	Headers           map[string]string `toml:"headers" bson:"headers,omitempty"`
	ResponseIdKey     string            `toml:"response_id_key" bson:"response_id_key,omitempty"`
	ResponseStatusKey string            `toml:"response_status_key" bson:"response_status_key,omitempty"`
	Statuses          map[string]string `toml:"statuses" bson:"statuses"`
}

StatusEndpoint represents API endpoint to fetch execution status of external job.

type TechMetricsConfig

type TechMetricsConfig struct {
	Enabled          bool
	DumpKeepInterval time.Duration
}

type TechMetricsConfigProvider

type TechMetricsConfigProvider interface {
	Get() TechMetricsConfig
}

type TemplateConfigProvider

type TemplateConfigProvider interface {
	Get() SectionTemplate
}

type TimezoneConfig

type TimezoneConfig struct {
	Location *time.Location
}

type TimezoneConfigProvider

type TimezoneConfigProvider interface {
	Get() TimezoneConfig
}

type Updater

type Updater interface {
	Update(CanopsisConf)
}

type UserInterfaceAdapter

type UserInterfaceAdapter interface {
	GetConfig(ctx context.Context) (UserInterfaceConf, error)
}

func NewUserInterfaceAdapter

func NewUserInterfaceAdapter(client mongo.DbClient) UserInterfaceAdapter

type UserInterfaceConf

type UserInterfaceConf struct {
	IsAllowChangeSeverityToInfo bool `bson:"allow_change_severity_to_info"`
	// MaxMatchedItems need to warn user when number of items that match patterns is above this value
	MaxMatchedItems            int  `bson:"max_matched_items"`
	CheckCountRequestTimeout   int  `bson:"check_count_request_timeout"`
	RequiredInstructionApprove bool `bson:"required_instruction_approve"`
}

UserInterfaceConf represents a user interface configuration object.

type UserInterfaceConfigProvider

type UserInterfaceConfigProvider interface {
	Get() UserInterfaceConf
}

type VersionAdapter

type VersionAdapter interface {
	GetConfig(ctx context.Context) (VersionConf, error)
	UpsertConfig(ctx context.Context, conf VersionConf) error
}

func NewVersionAdapter

func NewVersionAdapter(client mongo.DbClient) VersionAdapter

type VersionConf

type VersionConf struct {
	Edition string `bson:"edition"`
	Stack   string `bson:"stack"`

	Version        string            `bson:"version"`
	VersionUpdated *datetime.CpsTime `bson:"version_updated,omitempty"`
}

Jump to

Keyboard shortcuts

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