plugintypes

package
v0.0.0-...-5ba556e Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PluginReviewName                     = "review"
	PluginAuditName                      = "audit"
	PluginEditorName                     = "editor"
	PluginRunbooksName                   = "runbooks"
	PluginSlackName                      = "slack"
	PluginAccessControlName              = "access_control"
	PluginIndexName                      = "indexer"
	PluginDLPName                        = "dlp"
	PluginDatabaseCredentialsManagerName = "database-credentials-manager"
	PluginWebhookName                    = "webhooks"
)

Variables

View Source
var (
	// AuditPath is the filesystem path where wal logs are stored.
	// The env PLUGIN_AUDIT_PATH should be used to set a new path
	AuditPath = os.Getenv("PLUGIN_AUDIT_PATH")
	// IndexPath is the filesytem path where index wal logs are stored
	IndexPath = os.Getenv("PLUGIN_INDEX_PATH")
	// registered at gateway/main.go
	RegisteredPlugins []Plugin
)

Functions

This section is empty.

Types

type ConnectResponse

type ConnectResponse struct {
	// The new context to propagate to the client transport layer
	Context context.Context
	// When this attribute is set, the packet will be sent to the client.
	// The transport layer must stop processing any further logic and
	// just wait for new client packets to arrive.
	//
	// This is useful when a plugin needs to intercept the current flow and
	// send a packet back to client.
	ClientPacket *pb.Packet
}

type Context

type Context struct {
	Context context.Context
	// Session ID
	SID string

	// Use Attributes
	OrgID          string
	OrgName        string
	OrgLicenseType string
	UserID         string
	UserName       string
	UserEmail      string
	UserSlackID    string
	UserGroups     []string

	// Connection attributes
	ConnectionID      string
	ConnectionName    string
	ConnectionType    string
	ConnectionSubType string
	ConnectionCommand []string
	ConnectionSecret  map[string]any

	// Agent attributes
	AgentID   string
	AgentName string
	AgentMode string

	// Plugin attributes
	PluginConnectionConfig []string

	// Gateway client attributes
	ClientVerb   string
	ClientOrigin string

	Script   string
	Labels   map[string]string
	Metadata map[string]any

	ParamsData GenericMap
}

func (Context) GetOrgID

func (c Context) GetOrgID() string

func (Context) GetUserGroups

func (c Context) GetUserGroups() []string

func (Context) GetUserID

func (c Context) GetUserID() string

func (Context) IsAdmin

func (c Context) IsAdmin() bool

func (*Context) Validate

func (c *Context) Validate() error

type GenericMap

type GenericMap map[string]any

func (GenericMap) Get

func (m GenericMap) Get(key string) any

func (GenericMap) GetString

func (m GenericMap) GetString(key string) string

func (GenericMap) GetTime

func (m GenericMap) GetTime(key string) *time.Time

func (GenericMap) Int64

func (m GenericMap) Int64(key string) int64

type InternalError

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

func InternalErr

func InternalErr(msg string, internalErr error) *InternalError

func (*InternalError) Error

func (e *InternalError) Error() string

func (*InternalError) FullErr

func (e *InternalError) FullErr() string

func (*InternalError) HasInternalErr

func (e *InternalError) HasInternalErr() bool

type InvalidArgErr

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

func InvalidArgument

func InvalidArgument(format string, a ...any) *InvalidArgErr

func (*InvalidArgErr) Error

func (e *InvalidArgErr) Error() string

type Plugin

type Plugin interface {
	Name() string
	OnStartup(pctx Context) error
	OnUpdate(oldState, newState *types.Plugin) error
	OnConnect(pctx Context) error
	OnReceive(pctx Context, pkt *pb.Packet) (*ConnectResponse, error)
	OnDisconnect(pctx Context, errMsg error) error
}

Jump to

Keyboard shortcuts

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