config

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RBACDefaultGroup describes default rbac group name.
	RBACDefaultGroup = "botkube-plugins-default"
	// RBACDefaultUser describes default rbac user name.
	RBACDefaultUser = "botkube-internal-static-user"
)

Variables

View Source
var ErrUnsupportedPlatform = errors.New("unsupported platform to persist data")

ErrUnsupportedPlatform is an error returned when a platform is not supported.

Functions

func DecomposePluginKey added in v0.17.0

func DecomposePluginKey(key string) (string, string, string, error)

DecomposePluginKey extract details from plugin key.

func ExecutorNameForKey added in v0.18.0

func ExecutorNameForKey(key string) string

ExecutorNameForKey returns executor name for a given executor configuration key. It might be a plugin or a built-in executor.

func LoadWithDefaults added in v0.13.0

func LoadWithDefaults(configs [][]byte) (*Config, LoadWithDefaultsDetails, error)

LoadWithDefaults loads new configuration from files and environment variables.

Types

type AWSSigning added in v0.13.0

type AWSSigning struct {
	Enabled   bool   `yaml:"enabled"`
	AWSRegion string `yaml:"awsRegion"`
	RoleArn   string `yaml:"roleArn"`
}

AWSSigning contains AWS configurations

type Action added in v0.16.0

type Action struct {
	Enabled     bool           `yaml:"enabled"`
	DisplayName string         `yaml:"displayName"`
	Command     string         `yaml:"command" validate:"required_if=Enabled true"`
	Bindings    ActionBindings `yaml:"bindings"`
}

Action contains configuration for Botkube app event automations.

type ActionBindings added in v0.16.0

type ActionBindings struct {
	Sources   []string `yaml:"sources"`
	Executors []string `yaml:"executors"`
}

ActionBindings contains configuration for action bindings.

type ActionRuntimeState added in v0.16.0

type ActionRuntimeState struct {
	Enabled bool `yaml:"enabled"`
}

ActionRuntimeState is the action persisted in runtime state

type Actions added in v0.16.0

type Actions map[string]Action

Actions contains configuration for Botkube app event automations.

type ActionsRuntimeState added in v0.16.0

type ActionsRuntimeState map[string]ActionRuntimeState

ActionsRuntimeState are the actions persisted in runtime state

func (*ActionsRuntimeState) SetEnabled added in v0.16.0

func (a *ActionsRuntimeState) SetEnabled(name string, enabled bool) error

SetEnabled sets ActionRuntimeState "name" to "enabled" if action is found otherwise returns error

type Alias added in v0.18.0

type Alias struct {
	Command     string `yaml:"command" validate:"required"`
	DisplayName string `yaml:"displayName"`
}

Alias defines alias configuration for a given command.

type Aliases added in v0.18.0

type Aliases map[string]Alias

Aliases contains aliases configuration.

type Analytics added in v0.13.0

type Analytics struct {
	Disable bool `yaml:"disable"`
}

Analytics contains configuration parameters for analytics collection.

type BotBindings added in v0.13.0

type BotBindings struct {
	Sources   []string `yaml:"sources"`
	Executors []string `yaml:"executors"`
}

BotBindings contains configuration for possible Bot bindings.

type BotRuntimeState added in v0.14.0

type BotRuntimeState struct {
	Channels map[string]ChannelRuntimeState `yaml:"channels,omitempty"`

	// Teams integration only, ignored for other communication platforms.
	MSTeamsOnlyRuntimeState *ChannelRuntimeState `yaml:",inline,omitempty"`
}

BotRuntimeState represents the runtime state for a bot.

type BotStartupState added in v0.14.0

type BotStartupState struct {
	Channels map[string]ChannelStartupState `yaml:"channels"`
}

BotStartupState represents the startup state for a bot.

type CfgWatcher added in v0.14.0

type CfgWatcher struct {
	Enabled   bool                `yaml:"enabled"`
	Remote    RemoteCfgWatcher    `yaml:"remote"`
	InCluster InClusterCfgWatcher `yaml:"inCluster"`

	Deployment K8sResourceRef `yaml:"deployment"`
}

CfgWatcher describes configuration for watching the configuration.

type ChannelBindingsByID added in v0.13.0

type ChannelBindingsByID struct {
	ID           string              `yaml:"id"`
	Notification ChannelNotification `yaml:"notification"` // TODO: rename to `notifications` later
	Bindings     BotBindings         `yaml:"bindings"`
}

ChannelBindingsByID contains configuration bindings per channel.

func (ChannelBindingsByID) GetBotBindings added in v1.6.0

func (c ChannelBindingsByID) GetBotBindings() BotBindings

GetBotBindings returns associated bindings.

func (ChannelBindingsByID) Identifier added in v0.13.0

func (c ChannelBindingsByID) Identifier() string

Identifier returns ChannelBindingsByID identifier.

type ChannelBindingsByName added in v0.13.0

type ChannelBindingsByName struct {
	Name            string                `yaml:"name"`
	Notification    ChannelNotification   `yaml:"notification"` // TODO: rename to `notifications` later
	Bindings        BotBindings           `yaml:"bindings"`
	MessageTriggers []TextMessageTriggers `yaml:"messageTriggers"`
}

ChannelBindingsByName contains configuration bindings per channel.

func (ChannelBindingsByName) GetBotBindings added in v1.6.0

func (c ChannelBindingsByName) GetBotBindings() BotBindings

GetBotBindings returns associated bindings.

func (ChannelBindingsByName) Identifier added in v0.13.0

func (c ChannelBindingsByName) Identifier() string

Identifier returns ChannelBindingsByName identifier.

type ChannelNotification added in v0.14.0

type ChannelNotification struct {
	Disabled bool `yaml:"disabled"`
}

ChannelNotification contains notification configuration for a given platform.

type ChannelRuntimeBindings added in v0.14.0

type ChannelRuntimeBindings struct {
	Sources []string `yaml:"sources"`
}

ChannelRuntimeBindings represents the bindings for a channel.

type ChannelRuntimeState added in v0.14.0

type ChannelRuntimeState struct {
	Bindings ChannelRuntimeBindings `yaml:"bindings"`
}

ChannelRuntimeState represents the runtime state for a channel.

type ChannelStartupState added in v0.14.0

type ChannelStartupState struct {
	Notification NotificationStartupState `yaml:"notification"`
}

ChannelStartupState represents the startup state for a channel.

type CloudSlack added in v1.1.0

type CloudSlack struct {
	Enabled                         bool                                   `yaml:"enabled"`
	Channels                        IdentifiableMap[ChannelBindingsByName] `yaml:"channels"  validate:"required_if=Enabled true,dive,omitempty,min=1"`
	Token                           string                                 `yaml:"token"`
	BotID                           string                                 `yaml:"botID,omitempty"`
	Server                          GRPCServer                             `yaml:"server"`
	ExecutionEventStreamingDisabled bool                                   `yaml:"executionEventStreamingDisabled"`
}

CloudSlack configuration for multi-slack support

type CloudTeams added in v1.6.0

type CloudTeams struct {
	Enabled bool            `yaml:"enabled"`
	BotName string          `yaml:"botName"`
	Server  GRPCServer      `yaml:"server"`
	Teams   []TeamsBindings `yaml:"teams" validate:"required_if=Enabled true,dive,omitempty,min=1"`
}

CloudTeams configuration for cloud MS Teams.

type CommPlatformIntegration added in v0.13.0

type CommPlatformIntegration string

CommPlatformIntegration defines integrations with communication platforms.

const (
	// SocketSlackCommPlatformIntegration defines Slack integration.
	SocketSlackCommPlatformIntegration CommPlatformIntegration = "socketSlack"

	// CloudSlackCommPlatformIntegration defines Slack integration.
	CloudSlackCommPlatformIntegration CommPlatformIntegration = "cloudSlack"

	// MattermostCommPlatformIntegration defines Mattermost integration.
	MattermostCommPlatformIntegration CommPlatformIntegration = "mattermost"

	// TeamsCommPlatformIntegration defines Teams integration.
	TeamsCommPlatformIntegration CommPlatformIntegration = "teams"

	// CloudTeamsCommPlatformIntegration defines Teams integration.
	CloudTeamsCommPlatformIntegration CommPlatformIntegration = "cloudTeams"

	// DiscordCommPlatformIntegration defines Discord integration.
	DiscordCommPlatformIntegration CommPlatformIntegration = "discord"

	//ElasticsearchCommPlatformIntegration defines Elasticsearch integration.
	ElasticsearchCommPlatformIntegration CommPlatformIntegration = "elasticsearch"

	// WebhookCommPlatformIntegration defines an outgoing webhook integration.
	WebhookCommPlatformIntegration CommPlatformIntegration = "webhook"
)

func (CommPlatformIntegration) DisplayName added in v1.10.0

func (c CommPlatformIntegration) DisplayName() string

func (CommPlatformIntegration) IsInteractive added in v1.0.0

func (c CommPlatformIntegration) IsInteractive() bool

func (CommPlatformIntegration) String added in v0.18.0

func (c CommPlatformIntegration) String() string

String returns string platform name.

type Communications

type Communications struct {
	SocketSlack   SocketSlack   `yaml:"socketSlack,omitempty"`
	CloudSlack    CloudSlack    `yaml:"cloudSlack,omitempty"`
	Mattermost    Mattermost    `yaml:"mattermost,omitempty"`
	Discord       Discord       `yaml:"discord,omitempty"`
	CloudTeams    CloudTeams    `yaml:"cloudTeams,omitempty"`
	Webhook       Webhook       `yaml:"webhook,omitempty"`
	Elasticsearch Elasticsearch `yaml:"elasticsearch,omitempty"`
}

Communications contains communication platforms that are supported.

type CommunicationsRuntimeState added in v0.14.0

type CommunicationsRuntimeState map[CommPlatformIntegration]BotRuntimeState

CommunicationsRuntimeState represents the runtime state for communication groups.

type CommunicationsStartupState added in v0.14.0

type CommunicationsStartupState map[CommPlatformIntegration]BotStartupState

CommunicationsStartupState represents the startup state for communication groups.

type Config

type Config struct {
	Actions        Actions                   `yaml:"actions" validate:"dive"`
	Sources        map[string]Sources        `yaml:"sources" validate:"dive"`
	Executors      map[string]Executors      `yaml:"executors" validate:"dive"`
	Aliases        Aliases                   `yaml:"aliases" validate:"dive"`
	Communications map[string]Communications `yaml:"communications"  validate:"required,min=1,dive"`

	Analytics     Analytics        `yaml:"analytics"`
	Settings      Settings         `yaml:"settings"`
	ConfigWatcher CfgWatcher       `yaml:"configWatcher"`
	Plugins       PluginManagement `yaml:"plugins"`
}

Config structure of configuration yaml file

type Discord added in v0.13.0

type Discord struct {
	Enabled  bool                                 `yaml:"enabled"`
	Token    string                               `yaml:"token"`
	BotID    string                               `yaml:"botID"`
	Channels IdentifiableMap[ChannelBindingsByID] `yaml:"channels"  validate:"required_if=Enabled true,dive,omitempty,min=1"`
}

Discord configuration for authentication and send notifications

type ELSIndex added in v0.13.0

type ELSIndex struct {
	Name     string `yaml:"name"`
	Type     string `yaml:"type"`
	Shards   int    `yaml:"shards"`
	Replicas int    `yaml:"replicas"`

	Bindings SinkBindings `yaml:"bindings"`
}

ELSIndex settings for ELS

type Elasticsearch added in v0.13.0

type Elasticsearch struct {
	Enabled       bool                `yaml:"enabled"`
	Username      string              `yaml:"username"`
	Password      string              `yaml:"password"`
	Server        string              `yaml:"server"`
	SkipTLSVerify bool                `yaml:"skipTLSVerify"`
	AWSSigning    AWSSigning          `yaml:"awsSigning"`
	Indices       map[string]ELSIndex `yaml:"indices"  validate:"required_if=Enabled true,dive,omitempty,min=1"`
	LogLevel      string              `yaml:"logLevel"`
}

Elasticsearch config auth settings

type EventType added in v0.8.0

type EventType string

EventType to watch

const (
	// CreateEvent when resource is created
	CreateEvent EventType = "create"
	// UpdateEvent when resource is updated
	UpdateEvent EventType = "update"
	// DeleteEvent when resource deleted
	DeleteEvent EventType = "delete"
	// ErrorEvent on errors in resources
	ErrorEvent EventType = "error"
	// WarningEvent for warning events
	WarningEvent EventType = "warning"
	// NormalEvent for Normal events
	NormalEvent EventType = "normal"
	// InfoEvent for insignificant Info events
	InfoEvent EventType = "info"
	// AllEvent to watch all events
	AllEvent EventType = "all"
)

func (EventType) String added in v0.8.0

func (eventType EventType) String() string

type Executors added in v0.13.0

type Executors struct {
	DisplayName string  `yaml:"displayName"`
	Plugins     Plugins `yaml:",inline" koanf:",remain"`
}

Executors contains executors configuration parameters.

func (Executors) CollectCommandPrefixes added in v0.18.0

func (e Executors) CollectCommandPrefixes() []string

CollectCommandPrefixes returns list of command prefixes for all executors, even disabled ones.

func (Executors) GetPlugins added in v1.0.0

func (e Executors) GetPlugins() Plugins

GetPlugins returns Executors.Plugins

type Formatter added in v1.2.0

type Formatter string

Formatter log formatter

const (
	// FormatterText text formatter for logging
	FormatterText Formatter = "text"

	// FormatterJSON json formatter for logging
	FormatterJSON Formatter = "json"
)

type GRPCServer added in v1.1.0

type GRPCServer struct {
	URL                      string              `yaml:"url"`
	DisableTransportSecurity bool                `yaml:"disableTransportSecurity"`
	TLS                      GRPCServerTLSConfig `yaml:"tls"`
}

GRPCServer config for gRPC server

type GRPCServerTLSConfig added in v1.7.0

type GRPCServerTLSConfig struct {
	CACertificate      []byte `yaml:"caCertificate,omitempty"`
	UseSystemCertPool  bool   `yaml:"useSystemCertPool"`
	InsecureSkipVerify bool   `yaml:"insecureSkipVerify"`
}

GRPCServerTLSConfig describes gRPC server TLS configuration.m

type GraphQLClient added in v1.0.0

type GraphQLClient interface {
	Client() *graphql.Client
	DeploymentID() string
}

GraphQLClient defines GraphQL client.

type GroupPolicySubject added in v1.0.0

type GroupPolicySubject struct {
	// Type is the type of policy subject.
	Type PolicySubjectType `yaml:"type"`
	// Static is static reference of subject for given static policy rule.
	Static GroupStaticSubject `yaml:"static"`
	// Prefix is optional string prefixed to subjects.
	Prefix string `yaml:"prefix"`
}

GroupPolicySubject is the RBAC subject.

type GroupStaticSubject added in v1.0.0

type GroupStaticSubject struct {
	// Values is the name of the subject.
	Values []string `yaml:"values"`
}

GroupStaticSubject references static subjects for given static policy rule.

type Identifiable added in v0.13.0

type Identifiable interface {
	Identifier() string
}

Identifiable exports an Identifier method.

type IdentifiableMap added in v0.13.0

type IdentifiableMap[T Identifiable] map[string]T

IdentifiableMap provides an option to construct an indexable map for identifiable items.

func (IdentifiableMap[T]) GetByIdentifier added in v0.13.0

func (t IdentifiableMap[T]) GetByIdentifier(val string) (T, bool)

GetByIdentifier gets an item from a map by identifier.

type InClusterCfgWatcher added in v1.5.0

type InClusterCfgWatcher struct {
	InformerResyncPeriod time.Duration `yaml:"informerResyncPeriod"`
}

InClusterCfgWatcher describes configuration for watching the configuration using in-cluster config provider.

type IncomingWebhook added in v1.4.0

type IncomingWebhook struct {
	Enabled bool `yaml:"enabled"`
	Port    int  `yaml:"port"`

	// InClusterBaseURL is the in-cluster URL of the incoming webhook. Passed for plugins in context.
	InClusterBaseURL string `yaml:"inClusterBaseURL"`
}

IncomingWebhook contains configuration for incoming source webhook.

type IntegrationType added in v0.13.0

type IntegrationType string

IntegrationType describes the type of integration with a communication platform.

const (
	// BotIntegrationType describes two-way integration.
	BotIntegrationType IntegrationType = "bot"

	// SinkIntegrationType describes one-way integration.
	SinkIntegrationType IntegrationType = "sink"
)

type K8sConfigPersistenceManager added in v1.0.0

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

K8sConfigPersistenceManager manages persistence of the configuration.

func (*K8sConfigPersistenceManager) PersistActionEnabled added in v1.0.0

func (m *K8sConfigPersistenceManager) PersistActionEnabled(ctx context.Context, name string, enabled bool) error

PersistActionEnabled updates runtime config map with desired action.enabled parameter

func (*K8sConfigPersistenceManager) PersistNotificationsEnabled added in v1.0.0

func (m *K8sConfigPersistenceManager) PersistNotificationsEnabled(ctx context.Context, commGroupName string, platform CommPlatformIntegration, channelAlias string, enabled bool) error

PersistNotificationsEnabled persists notifications state for a given channel. While this method updates the Botkube ConfigMap, it doesn't reload Botkube itself.

func (*K8sConfigPersistenceManager) PersistSourceBindings added in v1.0.0

func (m *K8sConfigPersistenceManager) PersistSourceBindings(ctx context.Context, commGroupName string, platform CommPlatformIntegration, channelAlias string, sourceBindings []string) error

PersistSourceBindings persists source bindings configuration for a given channel in a given platform.

func (*K8sConfigPersistenceManager) SetResourceVersion added in v1.0.0

func (m *K8sConfigPersistenceManager) SetResourceVersion(resourceVersion int)

type K8sResourceRef added in v0.14.0

type K8sResourceRef struct {
	Name      string `yaml:"name,omitempty"`
	Namespace string `yaml:"namespace,omitempty"`
}

K8sResourceRef holds the configuration for a Kubernetes resource.

type Level added in v0.13.0

type Level string

Level type to store event levels

const (
	// Info level
	Info Level = "info"
	// Warn level
	Warn Level = "warn"
	// Debug level
	Debug Level = "debug"
	// Error level
	Error Level = "error"
	// Critical level
	Critical Level = "critical"
)

type LoadWithDefaultsDetails added in v0.13.0

type LoadWithDefaultsDetails struct {
	ValidateWarnings error
}

LoadWithDefaultsDetails holds the LoadWithDefaults function details.

type Logger added in v1.0.0

type Logger struct {
	Level         string    `yaml:"level"`
	DisableColors bool      `yaml:"disableColors"`
	Formatter     Formatter `yaml:"formatter"`
}

Logger holds logger configuration parameters.

type Mattermost added in v0.7.0

type Mattermost struct {
	Enabled  bool                                   `yaml:"enabled"`
	BotName  string                                 `yaml:"botName"`
	URL      string                                 `yaml:"url"`
	Token    string                                 `yaml:"token"`
	Team     string                                 `yaml:"team"`
	Channels IdentifiableMap[ChannelBindingsByName] `yaml:"channels"  validate:"required_if=Enabled true,dive,omitempty,min=1"`
}

Mattermost configuration to authentication and send notifications

type NotificationStartupState added in v0.14.0

type NotificationStartupState struct {
	Disabled bool `yaml:"disabled"`
}

NotificationStartupState represents the startup state for a notification.

type PartialPersistentConfig added in v0.14.0

type PartialPersistentConfig struct {
	FileName  string         `yaml:"fileName"`
	ConfigMap K8sResourceRef `yaml:"configMap"`
}

PartialPersistentConfig contains configuration for persistent storage of a given type.

type PersistenceManager added in v0.14.0

type PersistenceManager interface {
	PersistSourceBindings(ctx context.Context, commGroupName string, platform CommPlatformIntegration, channelAlias string, sourceBindings []string) error
	PersistNotificationsEnabled(ctx context.Context, commGroupName string, platform CommPlatformIntegration, channelAlias string, enabled bool) error
	PersistActionEnabled(ctx context.Context, name string, enabled bool) error
	SetResourceVersion(resourceVersion int)
}

PersistenceManager manages persistence of the configuration.

func NewManager added in v0.14.0

func NewManager(remoteCfgEnabled bool, log logrus.FieldLogger, cfg PersistentConfig, cfgVersion int, k8sCli kubernetes.Interface, client GraphQLClient, resVerClient ResVerClient) PersistenceManager

NewManager creates a new PersistenceManager instance.

type PersistentConfig added in v0.14.0

type PersistentConfig struct {
	Startup PartialPersistentConfig `yaml:"startup"`
	Runtime PartialPersistentConfig `yaml:"runtime"`
}

PersistentConfig contains configuration for persistent storage.

type Plugin added in v0.18.0

type Plugin struct {
	Enabled bool
	Config  any
	Context PluginContext
}

Plugin contains plugin specific configuration.

type PluginContext added in v1.0.0

type PluginContext struct {
	// RBAC defines the RBAC rules for given plugin.
	RBAC *PolicyRule `yaml:"rbac,omitempty"`
}

PluginContext defines the context for given plugin.

type PluginManagement added in v0.18.0

type PluginManagement struct {
	CacheDir            string                       `yaml:"cacheDir"`
	Repositories        map[string]PluginsRepository `yaml:"repositories"`
	IncomingWebhook     IncomingWebhook              `yaml:"incomingWebhook"`
	RestartPolicy       PluginRestartPolicy          `yaml:"restartPolicy"`
	HealthCheckInterval time.Duration                `yaml:"healthCheckInterval"`
}

PluginManagement holds Botkube plugin management related configuration.

type PluginRestartPolicy added in v1.4.0

type PluginRestartPolicy struct {
	Type      PluginRestartPolicyType `yaml:"type"`
	Threshold int                     `yaml:"threshold"`
}

type PluginRestartPolicyType added in v1.4.0

type PluginRestartPolicyType string
const (
	KeepAgentRunningWhenThresholdReached PluginRestartPolicyType = "DeactivatePlugin"
	RestartAgentWhenThresholdReached     PluginRestartPolicyType = "RestartAgent"
)

func (PluginRestartPolicyType) ToLower added in v1.4.0

func (p PluginRestartPolicyType) ToLower() string

type Plugins added in v0.17.0

type Plugins map[string]Plugin

Plugins contains plugins configuration parameters defined in groups.

type PluginsRepository added in v1.9.0

type PluginsRepository struct {
	URL     string `yaml:"url"`
	Headers map[string]string
}

PluginsRepository holds the Plugin repository information.

type PolicyRule added in v1.0.0

type PolicyRule struct {
	// User is the policy subject for user.
	User UserPolicySubject `yaml:"user"`
	// Group is the policy subject for group.
	Group GroupPolicySubject `yaml:"group"`
}

PolicyRule is the RBAC rule.

type PolicySubjectType added in v1.0.0

type PolicySubjectType string

PolicySubjectType defines the types for policy subjects.

const (
	// EmptyPolicySubjectType is the empty policy type.
	EmptyPolicySubjectType PolicySubjectType = ""
	// StaticPolicySubjectType is the static policy type.
	StaticPolicySubjectType PolicySubjectType = "Static"
	// ChannelNamePolicySubjectType is the channel name policy type.
	ChannelNamePolicySubjectType PolicySubjectType = "ChannelName"
)

type Provider added in v1.0.0

type Provider interface {
	Configs(ctx context.Context) (YAMLFiles, int, error)
}

Provider for configuration sources

type RegexConstraints added in v1.0.0

type RegexConstraints struct {
	// Include contains a list of allowed values.
	// It can also contain a regex expressions:
	//  - ".*" - to specify all values.
	Include []string `yaml:"include"`

	// Exclude contains a list of values to be ignored even if allowed by Include.
	// It can also contain a regex expressions:
	//  - "test-.*" - to specify all values with `test-` prefix.
	Exclude []string `yaml:"exclude,omitempty"`
}

RegexConstraints contains a list of allowed and excluded values.

func (*RegexConstraints) AreConstraintsDefined added in v1.0.0

func (r *RegexConstraints) AreConstraintsDefined() bool

AreConstraintsDefined checks whether the RegexConstraints has any Include/Exclude configuration.

func (*RegexConstraints) IsAllowed added in v1.0.0

func (r *RegexConstraints) IsAllowed(value string) (bool, error)

IsAllowed checks if a given value is allowed based on the config. Firstly, it checks if the value is excluded. If not, then it checks if the value is included.

type RemoteCfgWatcher added in v1.0.0

type RemoteCfgWatcher struct {
	PollInterval time.Duration `yaml:"pollInterval"`
}

RemoteCfgWatcher describes configuration for watching the configuration using remote config provider.

type RemotePersistenceManager added in v1.0.0

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

RemotePersistenceManager manages persistence of the configuration.

func (*RemotePersistenceManager) PersistActionEnabled added in v1.0.0

func (m *RemotePersistenceManager) PersistActionEnabled(ctx context.Context, name string, enabled bool) error

func (*RemotePersistenceManager) PersistNotificationsEnabled added in v1.0.0

func (m *RemotePersistenceManager) PersistNotificationsEnabled(ctx context.Context, commGroupName string, platform CommPlatformIntegration, channelAlias string, enabled bool) error

func (*RemotePersistenceManager) PersistSourceBindings added in v1.0.0

func (m *RemotePersistenceManager) PersistSourceBindings(ctx context.Context, commGroupName string, platform CommPlatformIntegration, channelAlias string, sourceBindings []string) error

func (*RemotePersistenceManager) SetResourceVersion added in v1.0.0

func (m *RemotePersistenceManager) SetResourceVersion(resourceVersion int)

type ResVerClient added in v1.0.0

type ResVerClient interface {
	GetResourceVersion(ctx context.Context) (int, error)
}

ResVerClient defines client for getting resource version.

type RuntimeState added in v0.14.0

type RuntimeState struct {
	Communications map[string]CommunicationsRuntimeState `yaml:"communications,omitempty"`
	Actions        ActionsRuntimeState                   `yaml:"actions,omitempty"`
}

RuntimeState represents the runtime state.

func (RuntimeState) MarshalToMap added in v0.14.0

func (s RuntimeState) MarshalToMap(cfg PartialPersistentConfig) (map[string]string, error)

MarshalToMap marshals the runtime state to a string map.

type Settings added in v0.2.0

type Settings struct {
	ClusterName             string           `yaml:"clusterName"`
	UpgradeNotifier         bool             `yaml:"upgradeNotifier"`
	SystemConfigMap         K8sResourceRef   `yaml:"systemConfigMap"`
	PersistentConfig        PersistentConfig `yaml:"persistentConfig"`
	MetricsPort             string           `yaml:"metricsPort"`
	HealthPort              string           `yaml:"healthPort"`
	Log                     Logger           `yaml:"log"`
	InformersResyncPeriod   time.Duration    `yaml:"informersResyncPeriod"`
	Kubeconfig              string           `yaml:"kubeconfig"`
	SACredentialsPathPrefix string           `yaml:"saCredentialsPathPrefix"`
}

Settings contains Botkube's related configuration.

type SinkBindings added in v0.13.0

type SinkBindings struct {
	Sources []string `yaml:"sources"`
}

SinkBindings contains configuration for possible Sink bindings.

type SocketSlack added in v0.14.0

type SocketSlack struct {
	Enabled  bool                                   `yaml:"enabled"`
	Channels IdentifiableMap[ChannelBindingsByName] `yaml:"channels"  validate:"required_if=Enabled true,dive,omitempty,min=1"`
	BotToken string                                 `yaml:"botToken,omitempty"`
	AppToken string                                 `yaml:"appToken,omitempty"`
}

SocketSlack configuration to authentication and send notifications

type Sources added in v0.13.0

type Sources struct {
	DisplayName string  `yaml:"displayName"`
	Plugins     Plugins `yaml:",inline" koanf:",remain"`
}

Sources contains configuration for Botkube app sources.

func (Sources) GetPlugins added in v1.0.0

func (s Sources) GetPlugins() Plugins

GetPlugins returns Sources.Plugins.

type StartupState added in v0.14.0

type StartupState struct {
	Communications map[string]CommunicationsStartupState `yaml:"communications,omitempty"`
}

StartupState represents the startup state.

func (StartupState) MarshalToMap added in v0.14.0

func (s StartupState) MarshalToMap(cfg PartialPersistentConfig) (map[string]string, error)

MarshalToMap marshals the startup state to a string map.

type Teams added in v0.13.0

type Teams struct {
	Enabled     bool        `yaml:"enabled"`
	BotName     string      `yaml:"botName,omitempty"`
	AppID       string      `yaml:"appID,omitempty"`
	AppPassword string      `yaml:"appPassword,omitempty"`
	Port        string      `yaml:"port"`
	MessagePath string      `yaml:"messagePath,omitempty"`
	Bindings    BotBindings `yaml:"bindings" validate:"required_if=Enabled true"`
}

Teams creds for authentication with MS Teams

type TeamsBindings added in v1.6.0

type TeamsBindings struct {
	ID       string                               `yaml:"id"`
	Channels IdentifiableMap[ChannelBindingsByID] `yaml:"channels" validate:"dive,omitempty,min=1"`
}

type TextMessageTriggerEvent added in v1.6.0

type TextMessageTriggerEvent string
const (
	MessageTriggerChannelEvent TextMessageTriggerEvent = "ChannelMessage"
)

type TextMessageTriggers added in v1.6.0

type TextMessageTriggers struct {
	Event                   TextMessageTriggerEvent `yaml:"event"`
	Text                    RegexConstraints        `yaml:"text"`
	Users                   UsersMessageConstraints `yaml:"users"`
	Command                 string                  `yaml:"command"`
	Executors               []string                `yaml:"executors"`
	ProcessedEmojiIndicator *string                 `yaml:"processedEmojiIndicator,omitempty"`
}

TextMessageTriggers contains information about matching messages and their associated commands.

func (*TextMessageTriggers) IsUserExcluded added in v1.6.0

func (m *TextMessageTriggers) IsUserExcluded(userID string) bool

type UserPolicySubject added in v1.0.0

type UserPolicySubject struct {
	// Type is the type of policy subject.
	Type PolicySubjectType `yaml:"type"`
	// Static is static reference of subject for given static policy rule.
	Static UserStaticSubject `yaml:"static"`
	// Prefix is optional string prefixed to subjects.
	Prefix string `yaml:"prefix"`
}

UserPolicySubject is the RBAC subject.

type UserStaticSubject added in v1.0.0

type UserStaticSubject struct {
	// Value is the name of the subject.
	Value string `yaml:"value"`
}

UserStaticSubject references static subjects for given static policy rule.

type UsersMessageConstraints added in v1.6.0

type UsersMessageConstraints struct {
	Exclude []string `yaml:"exclude"`
}

type ValidateResult added in v0.13.0

type ValidateResult struct {
	Criticals *multierror.Error
	Warnings  *multierror.Error
}

ValidateResult holds the validation results.

func ValidateStruct added in v0.13.0

func ValidateStruct(in any) (ValidateResult, error)

ValidateStruct validates a given struct based on the `validate` field tag.

type Webhook added in v0.13.0

type Webhook struct {
	Enabled  bool         `yaml:"enabled"`
	URL      string       `yaml:"url"`
	Bindings SinkBindings `yaml:"bindings" validate:"required_if=Enabled true"`
}

Webhook configuration to send notifications

type YAMLFiles added in v1.0.0

type YAMLFiles [][]byte

YAMLFiles denotes list of configurations in bytes

func (YAMLFiles) Merge added in v1.0.0

func (y YAMLFiles) Merge() []byte

Merge flattens 2d config bytes

Jump to

Keyboard shortcuts

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