aibrain

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginName = "ai-brain"
)

Variables

View Source
var (

	//go:embed config_schema.json
	ConfigJSONSchema string

	//go:embed webhook_schema.json
	IncomingWebhookJSONSchema string
)

Functions

This section is empty.

Types

type BotkubeRunner

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

BotkubeRunner is a runner that executes Botkube related commands.

func NewBotkubeRunner

func NewBotkubeRunner(tracer trace.Tracer) (*BotkubeRunner, error)

NewBotkubeRunner creates new runner instance.

func (*BotkubeRunner) GetAgentStatus

func (r *BotkubeRunner) GetAgentStatus(ctx context.Context, _ []byte, _ *Payload) (string, error)

GetAgentStatus returns Botkube Agent health status.

func (*BotkubeRunner) GetStartupAgentConfiguration

func (r *BotkubeRunner) GetStartupAgentConfiguration(ctx context.Context, _ []byte, p *Payload) (string, error)

GetStartupAgentConfiguration returns Botkube startup configuration.

type Config

type Config struct {
	Log                    config.Logger `yaml:"log"`
	OpenAIBaseURL          string        `yaml:"openAIBaseURL"`
	OpenAIAssistantID      string        `yaml:"openAIAssistantId"`
	HoneycombAPIKey        string        `yaml:"honeycombAPIKey"`
	HoneycombSampleRate    int           `yaml:"honeycombSampleRate"`
	VectorStoreIDForThread string        `yaml:"vectorStoreIDForThread"`
	Version                string
}

Config holds source configuration.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration.

type ConfigWithDetails

type ConfigWithDetails struct {
	*config.Config           `yaml:",inline"`
	LoaderValidationWarnings string `yaml:"loaderValidationWarnings"`
	IncomingRequestPrompt    string `yaml:"incomingRequestPrompt,omitempty"`
}

ConfigWithDetails represents Botkube configuration with additional details.

type KubectlRunner

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

KubectlRunner is a runner that executes kubectl commands using a specific kubeconfig file.

func NewKubectlRunner

func NewKubectlRunner(kubeconfigPath string, tracer trace.Tracer) *KubectlRunner

NewKubectlRunner creates new runner instance.

func (*KubectlRunner) DescribeResource

func (k *KubectlRunner) DescribeResource(ctx context.Context, rawArgs []byte, _ *Payload) (string, error)

DescribeResource executes kubectl describe resource command.

func (*KubectlRunner) GetEvents

func (k *KubectlRunner) GetEvents(ctx context.Context, rawArgs []byte, _ *Payload) (string, error)

GetEvents executes kubectl get events command.

func (*KubectlRunner) GetResource

func (k *KubectlRunner) GetResource(ctx context.Context, rawArgs []byte, _ *Payload) (string, error)

GetResource executes kubectl get resource command.

func (*KubectlRunner) Logs

func (k *KubectlRunner) Logs(ctx context.Context, rawArgs []byte, _ *Payload) (string, error)

Logs executes kubectl logs command.

func (*KubectlRunner) TopNodes

func (k *KubectlRunner) TopNodes(ctx context.Context, rawArgs []byte, _ *Payload) (string, error)

TopNodes executes kubectl top nodes command.

func (*KubectlRunner) TopPods

func (k *KubectlRunner) TopPods(ctx context.Context, rawArgs []byte, _ *Payload) (string, error)

TopPods executes kubectl top pods command.

type KubescapeRunner

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

func NewKubescapeRunner

func NewKubescapeRunner(kubeconfigPath string, tracer trace.Tracer) *KubescapeRunner

func (*KubescapeRunner) ScanCluster

func (k *KubescapeRunner) ScanCluster(ctx context.Context, _ []byte, _ *Payload) (string, error)

func (*KubescapeRunner) ScanControl

func (k *KubescapeRunner) ScanControl(ctx context.Context, rawArgs []byte, _ *Payload) (string, error)

func (*KubescapeRunner) ScanImage

func (k *KubescapeRunner) ScanImage(ctx context.Context, rawArgs []byte, _ *Payload) (string, error)

func (*KubescapeRunner) ScanWorkload

func (k *KubescapeRunner) ScanWorkload(ctx context.Context, rawArgs []byte, _ *Payload) (string, error)

type Payload

type Payload struct {
	Prompt    string `json:"prompt"`
	MessageID string `json:"messageId"`
}

Payload represents incoming webhook payload.

type Source

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

Source implements AI source plugin.

func NewSource

func NewSource(version string) *Source

NewSource creates new source plugin instance.

func (*Source) HandleExternalRequest

func (s *Source) HandleExternalRequest(ctx context.Context, in source.ExternalRequestInput) (source.ExternalRequestOutput, error)

HandleExternalRequest handles incoming payload and returns an event based on it.

func (*Source) Metadata

func (s *Source) Metadata(context.Context) (api.MetadataOutput, error)

Metadata returns details about plugin.

func (*Source) Stream

Stream implements Botkube source plugin.

Jump to

Keyboard shortcuts

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