integrations

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector interface {
	// Connect establishes connection to the external system
	Connect(ctx context.Context) error

	// Send sends a security event to the external system
	Send(ctx context.Context, event *events.SecurityEvent) error

	// Health returns the current health status of the connector
	Health() HealthStatus

	// Close closes the connection and cleans up resources
	Close() error

	// GetName returns the connector's name
	GetName() string

	// GetType returns the connector's type
	GetType() string
}

Connector defines the interface for security tool integrations

type ConnectorConfig

type ConnectorConfig struct {
	Type     string                 `mapstructure:"type" json:"type"`
	Enabled  bool                   `mapstructure:"enabled" json:"enabled"`
	Settings map[string]interface{} `mapstructure:"settings" json:"settings"`
	Filters  *events.EventFilter    `mapstructure:"filters" json:"filters,omitempty"`
	Retry    *RetryConfig           `mapstructure:"retry" json:"retry,omitempty"`
}

ConnectorConfig represents the configuration for a connector

type ConnectorError

type ConnectorError struct {
	ConnectorName string `json:"connector_name"`
	Operation     string `json:"operation"`
	Message       string `json:"message"`
	Retryable     bool   `json:"retryable"`
}

ConnectorError represents an error from a connector operation

func NewConnectorError

func NewConnectorError(connectorName, operation, message string, retryable bool) *ConnectorError

NewConnectorError creates a new connector error

func (ConnectorError) Error

func (e ConnectorError) Error() string

type ConnectorFactory

type ConnectorFactory interface {
	CreateConnector(connectorType, name string, settings map[string]interface{}) (Connector, error)
	GetSupportedTypes() []string
}

ConnectorFactory creates connectors based on type and configuration

type ConnectorMetrics

type ConnectorMetrics struct {
	EventsSent       int64         `json:"events_sent"`
	EventsSucceeded  int64         `json:"events_succeeded"`
	EventsFailed     int64         `json:"events_failed"`
	AverageLatency   time.Duration `json:"average_latency"`
	LastEventTime    time.Time     `json:"last_event_time"`
	ConnectionUptime time.Duration `json:"connection_uptime"`
}

ConnectorMetrics tracks performance metrics for a connector

type HealthStatus

type HealthStatus struct {
	Healthy     bool          `json:"healthy"`
	LastCheck   time.Time     `json:"last_check"`
	Latency     time.Duration `json:"latency"`
	EventsSent  int64         `json:"events_sent"`
	ErrorCount  int64         `json:"error_count"`
	LastError   string        `json:"last_error,omitempty"`
	ConnectedAt time.Time     `json:"connected_at,omitempty"`
}

HealthStatus represents the health status of a connector

type RetryConfig

type RetryConfig struct {
	MaxAttempts   int           `mapstructure:"max_attempts" json:"max_attempts"`
	InitialDelay  time.Duration `mapstructure:"initial_delay" json:"initial_delay"`
	MaxDelay      time.Duration `mapstructure:"max_delay" json:"max_delay"`
	BackoffFactor float64       `mapstructure:"backoff_factor" json:"backoff_factor"`
}

RetryConfig defines retry behavior for failed deliveries

func DefaultRetryConfig

func DefaultRetryConfig() *RetryConfig

DefaultRetryConfig returns a default retry configuration

type ValidationError

type ValidationError struct {
	Field   string `json:"field"`
	Message string `json:"message"`
}

ValidationError represents a configuration validation error

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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