Documentation ¶
Index ¶
- Constants
- Variables
- func EmptyResourceNameDropdown() *interactive.Select
- func FilterSection(botName string) interactive.LabelInput
- func InternalErrorSection() interactive.Section
- func IsExecutionCommandError(err error) bool
- func KubectlCmdBuilderMessage(dropdownsBlockID string, verbs interactive.Select, ...) interactive.Message
- func PreviewSection(botName, cmd string, input interactive.LabelInput) []interactive.Section
- func ResourceNamesSelect(botName string, names []string, initialItem string) *interactive.Select
- func ResourceNamespaceSelect(botName string, names []dropdownItem, initialNamespace dropdownItem) *interactive.Select
- func ResourceTypeSelect(botName string, resources []string, initialItem string) *interactive.Select
- func VerbSelect(botName string, verbs []string, initialItem string) *interactive.Select
- type ActionExecutor
- func (e *ActionExecutor) ActionsTabularOutput() string
- func (e *ActionExecutor) Commands() map[CommandVerb]CommandFn
- func (e *ActionExecutor) Disable(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
- func (e *ActionExecutor) Enable(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
- func (e *ActionExecutor) FeatureName() FeatureName
- func (e *ActionExecutor) List(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
- type AnalyticsReporter
- type BindingsStorage
- type CommandCombinedOutputRunner
- type CommandContext
- type CommandExecutor
- type CommandFlags
- type CommandFn
- type CommandGuard
- type CommandMapping
- type CommandRunner
- type CommandSeparateOutputRunner
- type CommandVerb
- type ConfigExecutor
- type ConfigPersistenceManager
- type Conversation
- type DefaultExecutor
- type DefaultExecutorFactory
- type DefaultExecutorFactoryParams
- type ExecExecutor
- type ExecutionCommandError
- type Executor
- type FeatureName
- type FeedbackExecutor
- type FilterExecutor
- func (e *FilterExecutor) Commands() map[CommandVerb]CommandFn
- func (e *FilterExecutor) Disable(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
- func (e *FilterExecutor) Enable(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
- func (e *FilterExecutor) FeatureName() FeatureName
- func (e *FilterExecutor) List(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
- func (e *FilterExecutor) TabularOutput() string
- type Flags
- type HelpExecutor
- type Kubectl
- type KubectlCmdBuilder
- type KubectlCmdBuilderOption
- type KubectlCmdBuilderOptions
- type NamespaceLister
- type NewDefaultInput
- type NotifierExecutor
- func (e *NotifierExecutor) Commands() map[CommandVerb]CommandFn
- func (e *NotifierExecutor) Disable(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
- func (e *NotifierExecutor) Enable(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
- func (e *NotifierExecutor) FeatureName() FeatureName
- func (e *NotifierExecutor) Status(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
- type NotifierHandler
- type OSCommand
- type PingExecutor
- type PluginExecutor
- type SourceBindingExecutor
- func (e *SourceBindingExecutor) Commands() map[CommandVerb]CommandFn
- func (e *SourceBindingExecutor) Edit(_ context.Context, cmdCtx CommandContext) (interactive.Message, error)
- func (e *SourceBindingExecutor) FeatureName() FeatureName
- func (e *SourceBindingExecutor) Status(_ context.Context, cmdCtx CommandContext) (interactive.Message, error)
- type SourceExecutor
- type VersionExecutor
Constants ¶
const (
// KubectlBinary is absolute path of kubectl binary
KubectlBinary = "/usr/local/bin/kubectl"
)
Variables ¶
var ( // ErrNotificationsNotConfigured describes an error when user wants to toggle on/off the notifications for not configured channel. ErrNotificationsNotConfigured = errors.New("notifications not configured for this channel") )
Functions ¶
func EmptyResourceNameDropdown ¶ added in v0.15.0
func EmptyResourceNameDropdown() *interactive.Select
EmptyResourceNameDropdown returns a select that simulates an empty one. Normally, Slack doesn't allow to return a static select with no options. This is a workaround to send a dropdown that it's rendered even if empty. We use that to preserve a proper order in displayed dropdowns.
How it works under the hood:
- This select is converted to external data source (https://api.slack.com/reference/block-kit/block-elements#external_select)
- We change the `min_query_length` to 0 to remove th "Type minimum of 3 characters to see options" message.
- Our backend doesn't return any options, so you see "No result".
- We don't set the command, so the ID of this select is always randomized by Slack server. As a result, the dropdown value is not cached, and we avoid problem with showing the outdated value.
func FilterSection ¶ added in v0.15.0
func FilterSection(botName string) interactive.LabelInput
FilterSection returns filter input block.
func InternalErrorSection ¶ added in v0.15.0
func InternalErrorSection() interactive.Section
InternalErrorSection returns preview command section with Run button.
func IsExecutionCommandError ¶ added in v0.15.0
IsExecutionCommandError returns true if a given error is ExecutionCommandError.
func KubectlCmdBuilderMessage ¶ added in v0.15.0
func KubectlCmdBuilderMessage(dropdownsBlockID string, verbs interactive.Select, opts ...KubectlCmdBuilderOption) interactive.Message
KubectlCmdBuilderMessage returns message for constructing kubectl command.
func PreviewSection ¶ added in v0.15.0
func PreviewSection(botName, cmd string, input interactive.LabelInput) []interactive.Section
PreviewSection returns preview command section with Run button.
func ResourceNamesSelect ¶ added in v0.15.0
func ResourceNamesSelect(botName string, names []string, initialItem string) *interactive.Select
ResourceNamesSelect return drop-down select for kubectl resources names.
func ResourceNamespaceSelect ¶ added in v0.15.0
func ResourceNamespaceSelect(botName string, names []dropdownItem, initialNamespace dropdownItem) *interactive.Select
ResourceNamespaceSelect return drop-down select for kubectl allowed namespaces.
func ResourceTypeSelect ¶ added in v0.15.0
func ResourceTypeSelect(botName string, resources []string, initialItem string) *interactive.Select
ResourceTypeSelect return drop-down select for kubectl resources types.
func VerbSelect ¶ added in v0.15.0
func VerbSelect(botName string, verbs []string, initialItem string) *interactive.Select
VerbSelect return drop-down select for kubectl verbs.
Types ¶
type ActionExecutor ¶ added in v0.16.0
type ActionExecutor struct {
// contains filtered or unexported fields
}
ActionExecutor executes all commands that are related to actions.
func NewActionExecutor ¶ added in v0.16.0
func NewActionExecutor(log logrus.FieldLogger, analyticsReporter AnalyticsReporter, cfgManager ConfigPersistenceManager, cfg config.Config) *ActionExecutor
NewActionExecutor returns a new ActionExecutor instance.
func (*ActionExecutor) ActionsTabularOutput ¶ added in v0.16.0
func (e *ActionExecutor) ActionsTabularOutput() string
ActionsTabularOutput sorts actions by key and returns a printable table
func (*ActionExecutor) Commands ¶ added in v0.17.0
func (e *ActionExecutor) Commands() map[CommandVerb]CommandFn
Commands returns slice of commands the executor supports
func (*ActionExecutor) Disable ¶ added in v0.17.0
func (e *ActionExecutor) Disable(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
Disable disables given action in the runtime config map
func (*ActionExecutor) Enable ¶ added in v0.17.0
func (e *ActionExecutor) Enable(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
Enable enables given action in the runtime config map
func (*ActionExecutor) FeatureName ¶ added in v0.17.0
func (e *ActionExecutor) FeatureName() FeatureName
FeatureName returns the name and aliases of the feature provided by this executor
func (*ActionExecutor) List ¶ added in v0.17.0
func (e *ActionExecutor) List(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
List returns a tabular representation of Actions
type AnalyticsReporter ¶ added in v0.13.0
type AnalyticsReporter interface { // ReportCommand reports a new executed command. The command should be anonymized before using this method. ReportCommand(platform config.CommPlatformIntegration, command string, origin command.Origin, withFilter bool) error }
AnalyticsReporter defines a reporter that collects analytics data.
type BindingsStorage ¶ added in v0.14.0
type BindingsStorage interface {
PersistSourceBindings(ctx context.Context, commGroupName string, platform config.CommPlatformIntegration, channelAlias string, sourceBindings []string) error
}
BindingsStorage provides functionality to persist source binding for a given channel.
type CommandCombinedOutputRunner ¶ added in v0.13.0
type CommandCombinedOutputRunner interface {
RunCombinedOutput(command string, args []string) (string, error)
}
CommandCombinedOutputRunner provides functionality to run arbitrary commands.
type CommandContext ¶ added in v0.17.0
type CommandContext struct { Args []string ClusterName string CommGroupName string BotName string RawCmd string CleanCmd string ProvidedClusterName string User string Conversation Conversation Platform config.CommPlatformIntegration ExecutorFilter executorFilter NotifierHandler NotifierHandler Mapping *CommandMapping }
CommandContext contains the context for CommandFn
func (CommandContext) ProvidedClusterNameEqual ¶ added in v0.17.0
func (cmdCtx CommandContext) ProvidedClusterNameEqual() bool
ProvidedClusterNameEqual returns true when provided cluster name is equal to cluster name
func (CommandContext) ProvidedClusterNameEqualOrEmpty ¶ added in v0.17.0
func (cmdCtx CommandContext) ProvidedClusterNameEqualOrEmpty() bool
ProvidedClusterNameEqualOrEmpty returns true when provided cluster name is empty or when provided cluster name is equal to cluster name
type CommandExecutor ¶ added in v0.17.0
type CommandExecutor interface { Commands() map[CommandVerb]CommandFn FeatureName() FeatureName }
CommandExecutor defines command structure for executors
type CommandFlags ¶ added in v0.5.0
type CommandFlags string
CommandFlags creates custom type for flags in botkube
const ( FollowFlag CommandFlags = "--follow" AbbrFollowFlag CommandFlags = "-f" WatchFlag CommandFlags = "--watch" AbbrWatchFlag CommandFlags = "-w" )
Defines botkube flags
func (CommandFlags) String ¶ added in v0.5.0
func (flag CommandFlags) String() string
type CommandFn ¶ added in v0.17.0
type CommandFn func(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
CommandFn is a single command (eg. List())
type CommandGuard ¶ added in v0.15.0
type CommandGuard interface { GetAllowedResourcesForVerb(verb string, allConfiguredResources []string) ([]kubectl.Resource, error) GetResourceDetails(verb, resourceType string) (kubectl.Resource, error) FilterSupportedVerbs(allVerbs []string) []string }
CommandGuard is an interface that allows to check if a given command is allowed to be executed.
type CommandMapping ¶ added in v0.17.0
type CommandMapping struct {
// contains filtered or unexported fields
}
CommandMapping allows to register and lookup commands and dynamically build help messages
func NewCmdsMapping ¶ added in v0.17.0
func NewCmdsMapping(executors []CommandExecutor) (*CommandMapping, error)
NewCmdsMapping registers command and help mappings
func (*CommandMapping) FindFn ¶ added in v0.17.0
func (m *CommandMapping) FindFn(verb CommandVerb, feature string) (CommandFn, bool, bool)
FindFn looks up CommandFn by verb and feature
func (*CommandMapping) HelpMessageForVerb ¶ added in v0.17.0
func (m *CommandMapping) HelpMessageForVerb(verb CommandVerb, botName string) string
HelpMessageForVerb dynamically builds help message for given CommandVerb, or empty string
type CommandRunner ¶ added in v0.13.0
type CommandRunner interface { CommandCombinedOutputRunner CommandSeparateOutputRunner }
CommandRunner provides functionality to run arbitrary commands.
type CommandSeparateOutputRunner ¶ added in v0.13.0
type CommandSeparateOutputRunner interface {
RunSeparateOutput(command string, args []string) (string, string, error)
}
CommandSeparateOutputRunner provides functionality to run arbitrary commands.
type CommandVerb ¶ added in v0.16.0
type CommandVerb string
CommandVerb are commands supported by the bot
const ( CommandPing CommandVerb = "ping" CommandHelp CommandVerb = "help" CommandVersion CommandVerb = "version" CommandFeedback CommandVerb = "feedback" CommandList CommandVerb = "list" CommandEnable CommandVerb = "enable" CommandDisable CommandVerb = "disable" CommandEdit CommandVerb = "edit" CommandStatus CommandVerb = "status" CommandShow CommandVerb = "show" )
CommandVerb command options
type ConfigExecutor ¶ added in v0.17.0
type ConfigExecutor struct {
// contains filtered or unexported fields
}
ConfigExecutor executes all commands that are related to config
func NewConfigExecutor ¶ added in v0.17.0
func NewConfigExecutor(log logrus.FieldLogger, analyticsReporter AnalyticsReporter, config config.Config) *ConfigExecutor
NewConfigExecutor returns a new ConfigExecutor instance
func (*ConfigExecutor) Commands ¶ added in v0.17.0
func (e *ConfigExecutor) Commands() map[CommandVerb]CommandFn
Commands returns slice of commands the executor supports
func (*ConfigExecutor) FeatureName ¶ added in v0.17.0
func (e *ConfigExecutor) FeatureName() FeatureName
FeatureName returns the name and aliases of the feature provided by this executor
func (*ConfigExecutor) Show ¶ added in v0.17.0
func (e *ConfigExecutor) Show(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
Show returns Config in yaml format
type ConfigPersistenceManager ¶ added in v0.14.0
type ConfigPersistenceManager interface { PersistSourceBindings(ctx context.Context, commGroupName string, platform config.CommPlatformIntegration, channelAlias string, sourceBindings []string) error PersistNotificationsEnabled(ctx context.Context, commGroupName string, platform config.CommPlatformIntegration, channelAlias string, enabled bool) error PersistFilterEnabled(ctx context.Context, name string, enabled bool) error PersistActionEnabled(ctx context.Context, name string, enabled bool) error }
ConfigPersistenceManager manages persistence of the configuration.
type Conversation ¶ added in v0.14.0
type Conversation struct { Alias string ID string ExecutorBindings []string SourceBindings []string IsAuthenticated bool CommandOrigin command.Origin State *slack.BlockActionStates }
Conversation contains details about the conversation.
type DefaultExecutor ¶
type DefaultExecutor struct {
// contains filtered or unexported fields
}
DefaultExecutor is a default implementations of Executor
func (*DefaultExecutor) Execute ¶
func (e *DefaultExecutor) Execute(ctx context.Context) interactive.Message
Execute executes commands and returns output
type DefaultExecutorFactory ¶ added in v0.13.0
type DefaultExecutorFactory struct {
// contains filtered or unexported fields
}
DefaultExecutorFactory facilitates creation of the Executor instances.
func NewExecutorFactory ¶ added in v0.13.0
func NewExecutorFactory(params DefaultExecutorFactoryParams) (*DefaultExecutorFactory, error)
NewExecutorFactory creates new DefaultExecutorFactory.
func (*DefaultExecutorFactory) NewDefault ¶ added in v0.13.0
func (f *DefaultExecutorFactory) NewDefault(cfg NewDefaultInput) Executor
NewDefault creates new Default Executor.
type DefaultExecutorFactoryParams ¶ added in v0.14.0
type DefaultExecutorFactoryParams struct { Log logrus.FieldLogger CmdRunner CommandRunner Cfg config.Config FilterEngine filterengine.FilterEngine KcChecker *kubectl.Checker Merger *kubectl.Merger CfgManager ConfigPersistenceManager AnalyticsReporter AnalyticsReporter NamespaceLister NamespaceLister CommandGuard CommandGuard PluginManager *plugin.Manager BotKubeVersion string }
DefaultExecutorFactoryParams contains input parameters for DefaultExecutorFactory.
type ExecExecutor ¶ added in v0.17.0
type ExecExecutor struct {
// contains filtered or unexported fields
}
ExecExecutor executes all commands that are related to executors.
func NewExecExecutor ¶ added in v0.17.0
func NewExecExecutor(log logrus.FieldLogger, analyticsReporter AnalyticsReporter, cfg config.Config) *ExecExecutor
NewExecExecutor returns a new ExecExecutor instance.
func (*ExecExecutor) Commands ¶ added in v0.17.0
func (e *ExecExecutor) Commands() map[CommandVerb]CommandFn
Commands returns slice of commands the executor supports
func (*ExecExecutor) FeatureName ¶ added in v0.17.0
func (e *ExecExecutor) FeatureName() FeatureName
FeatureName returns the name and aliases of the feature provided by this executor
func (*ExecExecutor) List ¶ added in v0.17.0
func (e *ExecExecutor) List(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
List returns a tabular representation of Executors
func (*ExecExecutor) TabularOutput ¶ added in v0.17.0
func (e *ExecExecutor) TabularOutput(bindings []string) string
TabularOutput sorts executor groups by key and returns a printable table
type ExecutionCommandError ¶ added in v0.15.0
type ExecutionCommandError struct {
// contains filtered or unexported fields
}
ExecutionCommandError defines error occurred during command execution. Use it only if you want to print the error message details to end-users.
func NewExecutionCommandError ¶ added in v0.15.0
func NewExecutionCommandError(format string, args ...any) *ExecutionCommandError
NewExecutionCommandError creates a new ExecutionCommandError instance. Messages should be suitable to be printed to the end user.
func (*ExecutionCommandError) Error ¶ added in v0.15.0
func (e *ExecutionCommandError) Error() string
Error returns error message
type Executor ¶
type Executor interface {
Execute(context.Context) interactive.Message
}
Executor is an interface for processes to execute commands
type FeatureName ¶ added in v0.17.0
FeatureName defines the name and aliases for a feature
type FeedbackExecutor ¶ added in v0.17.0
type FeedbackExecutor struct {
// contains filtered or unexported fields
}
FeedbackExecutor executes all commands that are related to feedback.
func NewFeedbackExecutor ¶ added in v0.17.0
func NewFeedbackExecutor(log logrus.FieldLogger, analyticsReporter AnalyticsReporter) *FeedbackExecutor
NewFeedbackExecutor returns a new FeedbackExecutor instance
func (*FeedbackExecutor) Commands ¶ added in v0.17.0
func (e *FeedbackExecutor) Commands() map[CommandVerb]CommandFn
Commands returns slice of commands the executor supports
func (*FeedbackExecutor) FeatureName ¶ added in v0.17.0
func (e *FeedbackExecutor) FeatureName() FeatureName
FeatureName returns the name and aliases of the feature provided by this executor
func (*FeedbackExecutor) Feedback ¶ added in v0.17.0
func (e *FeedbackExecutor) Feedback(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
Feedback responds with a feedback form URL
type FilterExecutor ¶ added in v0.17.0
type FilterExecutor struct {
// contains filtered or unexported fields
}
FilterExecutor executes all commands that are related to filters.
func NewFilterExecutor ¶ added in v0.17.0
func NewFilterExecutor(log logrus.FieldLogger, analyticsReporter AnalyticsReporter, cfgManager ConfigPersistenceManager, filterEngine filterengine.FilterEngine) *FilterExecutor
NewFilterExecutor returns a new FilterExecutor instance.
func (*FilterExecutor) Commands ¶ added in v0.17.0
func (e *FilterExecutor) Commands() map[CommandVerb]CommandFn
Commands returns slice of commands the executor supports
func (*FilterExecutor) Disable ¶ added in v0.17.0
func (e *FilterExecutor) Disable(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
Disable disables given filter in the startup config map
func (*FilterExecutor) Enable ¶ added in v0.17.0
func (e *FilterExecutor) Enable(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
Enable enables given filter in the startup config map
func (*FilterExecutor) FeatureName ¶ added in v0.17.0
func (e *FilterExecutor) FeatureName() FeatureName
FeatureName returns the name and aliases of the feature provided by this executor
func (*FilterExecutor) List ¶ added in v0.17.0
func (e *FilterExecutor) List(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
List returns a tabular representation of Filters
func (*FilterExecutor) TabularOutput ¶ added in v0.17.0
func (e *FilterExecutor) TabularOutput() string
TabularOutput formats filter strings in tabular form https://golang.org/pkg/text/tabwriter
type Flags ¶ added in v0.17.0
Flags contains cmd line arguments for executors.
func ParseFlags ¶ added in v0.17.0
ParseFlags parses raw cmd and removes optional params with flags.
type HelpExecutor ¶ added in v0.17.0
type HelpExecutor struct {
// contains filtered or unexported fields
}
HelpExecutor executes all commands that are related to help
func NewHelpExecutor ¶ added in v0.17.0
func NewHelpExecutor(log logrus.FieldLogger, analyticsReporter AnalyticsReporter, cfg config.Config) *HelpExecutor
NewHelpExecutor returns a new HelpExecutor instance
func (*HelpExecutor) Commands ¶ added in v0.17.0
func (e *HelpExecutor) Commands() map[CommandVerb]CommandFn
Commands returns slice of commands the executor supports
func (*HelpExecutor) FeatureName ¶ added in v0.17.0
func (e *HelpExecutor) FeatureName() FeatureName
FeatureName returns the name and aliases of the feature provided by this executor
func (*HelpExecutor) Help ¶ added in v0.17.0
func (e *HelpExecutor) Help(_ context.Context, cmdCtx CommandContext) (interactive.Message, error)
Help returns new help message
type Kubectl ¶ added in v0.13.0
type Kubectl struct {
// contains filtered or unexported fields
}
Kubectl executes kubectl commands using local binary.
func NewKubectl ¶ added in v0.13.0
func NewKubectl(log logrus.FieldLogger, cfg config.Config, merger *kubectl.Merger, kcChecker *kubectl.Checker, fn CommandCombinedOutputRunner) *Kubectl
NewKubectl creates a new instance of Kubectl.
func (*Kubectl) CanHandle ¶ added in v0.13.0
CanHandle returns true if it's allowed kubectl command that can be handled by this executor.
func (*Kubectl) Execute ¶ added in v0.13.0
func (e *Kubectl) Execute(bindings []string, command string, isAuthChannel bool, cmdCtx CommandContext) (string, error)
Execute executes kubectl command based on a given args.
This method should be called ONLY if: - we are a target cluster, - and Kubectl.CanHandle returned true.
func (*Kubectl) GetCommandPrefix ¶ added in v0.14.0
GetCommandPrefix gets verb command with k8s alias prefix.
type KubectlCmdBuilder ¶ added in v0.15.0
type KubectlCmdBuilder struct {
// contains filtered or unexported fields
}
KubectlCmdBuilder provides functionality to handle interactive kubectl command selection.
func NewKubectlCmdBuilder ¶ added in v0.15.0
func NewKubectlCmdBuilder(log logrus.FieldLogger, merger kcMerger, executor kcExecutor, namespaceLister NamespaceLister, guard CommandGuard) *KubectlCmdBuilder
NewKubectlCmdBuilder returns a new KubectlCmdBuilder instance.
func (*KubectlCmdBuilder) CanHandle ¶ added in v0.15.0
func (e *KubectlCmdBuilder) CanHandle(args []string) bool
CanHandle returns true if it's allowed kubectl command that can be handled by this executor.
func (*KubectlCmdBuilder) Do ¶ added in v0.15.0
func (e *KubectlCmdBuilder) Do(ctx context.Context, args []string, platform config.CommPlatformIntegration, bindings []string, state *slack.BlockActionStates, botName string, header string, cmdCtx CommandContext) (interactive.Message, error)
Do executes a given kc-cmd-builder command based on args.
TODO: once we will have a real use-case, we should abstract the Slack state and introduce our own model.
func (*KubectlCmdBuilder) GetCommandPrefix ¶ added in v0.15.0
func (e *KubectlCmdBuilder) GetCommandPrefix(args []string) string
GetCommandPrefix returns the command prefix only if it's known.
type KubectlCmdBuilderOption ¶ added in v0.15.0
type KubectlCmdBuilderOption func(options *KubectlCmdBuilderOptions)
KubectlCmdBuilderOption defines option mutator signature.
func WithAdditionalSections ¶ added in v0.15.0
func WithAdditionalSections(in ...interactive.Section) KubectlCmdBuilderOption
WithAdditionalSections adds additional sections to a given kubectl KubectlCmdBuilderMessage message.
func WithAdditionalSelects ¶ added in v0.15.0
func WithAdditionalSelects(in ...*interactive.Select) KubectlCmdBuilderOption
WithAdditionalSelects adds additional selects to a given kubectl KubectlCmdBuilderMessage message.
type KubectlCmdBuilderOptions ¶ added in v0.15.0
type KubectlCmdBuilderOptions struct {
// contains filtered or unexported fields
}
KubectlCmdBuilderOptions holds builder message options.
type NamespaceLister ¶ added in v0.15.0
type NamespaceLister interface {
List(ctx context.Context, opts metav1.ListOptions) (*corev1.NamespaceList, error)
}
NamespaceLister provides an option to list all namespaces in a given cluster.
type NewDefaultInput ¶ added in v0.14.0
type NewDefaultInput struct { CommGroupName string Platform config.CommPlatformIntegration NotifierHandler NotifierHandler Conversation Conversation Message string User string }
NewDefaultInput an input for NewDefault
type NotifierExecutor ¶ added in v0.13.0
type NotifierExecutor struct {
// contains filtered or unexported fields
}
NotifierExecutor executes all commands that are related to notifications.
func NewNotifierExecutor ¶ added in v0.13.0
func NewNotifierExecutor(log logrus.FieldLogger, analyticsReporter AnalyticsReporter, cfgManager ConfigPersistenceManager, cfg config.Config) *NotifierExecutor
NewNotifierExecutor creates a new instance of NotifierExecutor
func (*NotifierExecutor) Commands ¶ added in v0.17.0
func (e *NotifierExecutor) Commands() map[CommandVerb]CommandFn
Commands returns slice of commands the executor supports
func (*NotifierExecutor) Disable ¶ added in v0.17.0
func (e *NotifierExecutor) Disable(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
Disable stops the notifier
func (*NotifierExecutor) Enable ¶ added in v0.17.0
func (e *NotifierExecutor) Enable(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
Enable starts the notifier
func (*NotifierExecutor) FeatureName ¶ added in v0.17.0
func (e *NotifierExecutor) FeatureName() FeatureName
FeatureName returns the name and aliases of the feature provided by this executor
func (*NotifierExecutor) Status ¶ added in v0.17.0
func (e *NotifierExecutor) Status(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
Status returns the status of a notifier (per channel)
type NotifierHandler ¶ added in v0.13.0
type NotifierHandler interface { // NotificationsEnabled returns current notification status for a given conversation ID. NotificationsEnabled(conversationID string) bool // SetNotificationsEnabled sets a new notification status for a given conversation ID. SetNotificationsEnabled(conversationID string, enabled bool) error BotName() string }
NotifierHandler handles disabling and enabling notifications for a given communication platform.
type OSCommand ¶ added in v0.13.0
type OSCommand struct{}
OSCommand provides syntax sugar for working with exec.Command
func (*OSCommand) RunCombinedOutput ¶ added in v0.13.0
RunCombinedOutput runs a given command and returns its combined standard output and standard error.
type PingExecutor ¶ added in v0.17.0
type PingExecutor struct {
// contains filtered or unexported fields
}
PingExecutor executes all commands that are related to ping.
func NewPingExecutor ¶ added in v0.17.0
func NewPingExecutor(log logrus.FieldLogger, analyticsReporter AnalyticsReporter, botkubeVersion string) *PingExecutor
NewPingExecutor returns a new PingExecutor instance.
func (*PingExecutor) Commands ¶ added in v0.17.0
func (e *PingExecutor) Commands() map[CommandVerb]CommandFn
Commands returns slice of commands the executor supports
func (*PingExecutor) FeatureName ¶ added in v0.17.0
func (e *PingExecutor) FeatureName() FeatureName
FeatureName returns the name and aliases of the feature provided by this executor
func (*PingExecutor) Ping ¶ added in v0.17.0
func (e *PingExecutor) Ping(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
Ping responds with "pong" to the ping command
type PluginExecutor ¶ added in v0.17.0
type PluginExecutor struct {
// contains filtered or unexported fields
}
PluginExecutor provides functionality to run registered Botkube plugins.
func NewPluginExecutor ¶ added in v0.17.0
func NewPluginExecutor(log logrus.FieldLogger, cfg config.Config, manager *plugin.Manager) *PluginExecutor
NewPluginExecutor creates a new instance of PluginExecutor.
func (*PluginExecutor) CanHandle ¶ added in v0.17.0
func (e *PluginExecutor) CanHandle(bindings []string, args []string) bool
CanHandle returns true if it's a known plugin executor.
func (*PluginExecutor) Execute ¶ added in v0.17.0
func (e *PluginExecutor) Execute(ctx context.Context, bindings []string, args []string, command string) (string, error)
Execute executes plugin executor based on a given command.
func (*PluginExecutor) GetCommandPrefix ¶ added in v0.17.0
func (e *PluginExecutor) GetCommandPrefix(args []string) string
GetCommandPrefix gets verb command with k8s alias prefix.
type SourceBindingExecutor ¶ added in v0.17.0
type SourceBindingExecutor struct {
// contains filtered or unexported fields
}
SourceBindingExecutor provides functionality to run all Botkube SourceBinding related commands.
func NewSourceBindingExecutor ¶ added in v0.17.0
func NewSourceBindingExecutor(log logrus.FieldLogger, analyticsReporter AnalyticsReporter, cfgManager BindingsStorage, cfg config.Config) *SourceBindingExecutor
NewSourceBindingExecutor returns a new SourceBindingExecutor instance.
func (*SourceBindingExecutor) Commands ¶ added in v0.17.0
func (e *SourceBindingExecutor) Commands() map[CommandVerb]CommandFn
Commands returns slice of commands the executor supports
func (*SourceBindingExecutor) Edit ¶ added in v0.17.0
func (e *SourceBindingExecutor) Edit(_ context.Context, cmdCtx CommandContext) (interactive.Message, error)
Edit executes the edit command based on args.
func (*SourceBindingExecutor) FeatureName ¶ added in v0.17.0
func (e *SourceBindingExecutor) FeatureName() FeatureName
FeatureName returns the name and aliases of the feature provided by this executor
func (*SourceBindingExecutor) Status ¶ added in v0.17.0
func (e *SourceBindingExecutor) Status(_ context.Context, cmdCtx CommandContext) (interactive.Message, error)
Status returns all sources per given channel
type SourceExecutor ¶ added in v0.17.0
type SourceExecutor struct {
// contains filtered or unexported fields
}
SourceExecutor executes all commands that are related to sources.
func NewSourceExecutor ¶ added in v0.17.0
func NewSourceExecutor(log logrus.FieldLogger, analyticsReporter AnalyticsReporter, cfg config.Config) *SourceExecutor
NewSourceExecutor returns a new SourceExecutor instance.
func (*SourceExecutor) Commands ¶ added in v0.17.0
func (e *SourceExecutor) Commands() map[CommandVerb]CommandFn
Commands returns slice of commands the executor supports
func (*SourceExecutor) FeatureName ¶ added in v0.17.0
func (e *SourceExecutor) FeatureName() FeatureName
FeatureName returns the name and aliases of the feature provided by this executor
func (*SourceExecutor) List ¶ added in v0.17.0
func (e *SourceExecutor) List(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
List returns a tabular representation of Executors
func (*SourceExecutor) TabularOutput ¶ added in v0.17.0
func (e *SourceExecutor) TabularOutput(bindings []string) string
TabularOutput sorts source groups by key and returns a printable table
type VersionExecutor ¶ added in v0.17.0
type VersionExecutor struct {
// contains filtered or unexported fields
}
VersionExecutor executes all commands that are related to version.
func NewVersionExecutor ¶ added in v0.17.0
func NewVersionExecutor(log logrus.FieldLogger, analyticsReporter AnalyticsReporter, botkubeVersion string) *VersionExecutor
NewVersionExecutor returns a new VersionExecutor instance
func (*VersionExecutor) Commands ¶ added in v0.17.0
func (e *VersionExecutor) Commands() map[CommandVerb]CommandFn
Commands returns slice of commands the executor supports
func (*VersionExecutor) FeatureName ¶ added in v0.17.0
func (e *VersionExecutor) FeatureName() FeatureName
FeatureName returns the name and aliases of the feature provided by this executor
func (*VersionExecutor) Version ¶ added in v0.17.0
func (e *VersionExecutor) Version(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error)
Version responds with k8s and botkube version string