discovery

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdvancedQuery

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

AdvancedQuery provides advanced querying capabilities for discovered resources

func NewAdvancedQuery

func NewAdvancedQuery() *AdvancedQuery

NewAdvancedQuery creates a new advanced query engine

func (*AdvancedQuery) AddResource

func (aq *AdvancedQuery) AddResource(resource models.Resource)

AddResource adds a resource and updates indexes

func (*AdvancedQuery) Aggregate

func (aq *AdvancedQuery) Aggregate(field, operation string) interface{}

Aggregate performs aggregation operations

func (*AdvancedQuery) ClearCache

func (aq *AdvancedQuery) ClearCache()

ClearCache clears the query cache

func (*AdvancedQuery) FindByRegex

func (aq *AdvancedQuery) FindByRegex(field, pattern string) []models.Resource

FindByRegex finds resources matching a regex pattern

func (*AdvancedQuery) FindByTags

func (aq *AdvancedQuery) FindByTags(tags map[string]string) []models.Resource

FindByTags finds resources with specific tags

func (*AdvancedQuery) GetStatistics

func (aq *AdvancedQuery) GetStatistics() map[string]interface{}

GetStatistics returns query statistics

func (*AdvancedQuery) GroupBy

func (aq *AdvancedQuery) GroupBy(field string) map[string][]models.Resource

GroupBy groups resources by a specific field

func (*AdvancedQuery) Query

func (aq *AdvancedQuery) Query(options QueryOptions) *QueryResult

Query performs a query with the given options

func (*AdvancedQuery) QueryByJMESPath

func (aq *AdvancedQuery) QueryByJMESPath(expression string) *QueryResult

QueryByJMESPath performs a JMESPath-like query

func (*AdvancedQuery) QueryBySQL

func (aq *AdvancedQuery) QueryBySQL(sql string) *QueryResult

QueryBySQL performs a SQL-like query

type Alert

type Alert struct {
	ID           string
	Type         AlertType
	Severity     AlertSeverity
	Message      string
	Details      map[string]interface{}
	Timestamp    time.Time
	Acknowledged bool
}

Alert represents a monitoring alert

type AlertSeverity

type AlertSeverity string

AlertSeverity defines the severity of an alert

const (
	AlertSeverityCritical AlertSeverity = "critical"
	AlertSeverityHigh     AlertSeverity = "high"
	AlertSeverityMedium   AlertSeverity = "medium"
	AlertSeverityLow      AlertSeverity = "low"
)

type AlertType

type AlertType string

AlertType defines the type of alert

const (
	AlertTypeError         AlertType = "error"
	AlertTypeWarning       AlertType = "warning"
	AlertTypeInfo          AlertType = "info"
	AlertTypeRateLimit     AlertType = "rate_limit"
	AlertTypeQuotaExceeded AlertType = "quota_exceeded"
	AlertTypeSlowDiscovery AlertType = "slow_discovery"
)

type Backend

type Backend interface {
	Connect(ctx context.Context) error
	GetState(ctx context.Context, key string) ([]byte, error)
	PutState(ctx context.Context, key string, data []byte) error
	DeleteState(ctx context.Context, key string) error
	ListStates(ctx context.Context) ([]string, error)
	LockState(ctx context.Context, key string) (string, error)
	UnlockState(ctx context.Context, key string, lockID string) error
}

Backend interface for state storage operations

type BackendConfig

type BackendConfig struct {
	ID           string                 `json:"id"`
	Type         string                 `json:"type"`
	Attributes   map[string]interface{} `json:"attributes"`
	FilePath     string                 `json:"file_path"`
	Module       string                 `json:"module,omitempty"`
	Workspace    string                 `json:"workspace,omitempty"`
	ConfigPath   string                 `json:"config_path"`
	Config       map[string]interface{} `json:"config"`
	WorkspaceDir string                 `json:"workspace_dir,omitempty"`
}

BackendConfig represents a discovered Terraform backend configuration

type BackendFactory

type BackendFactory struct{}

BackendFactory creates backends based on configuration

func NewBackendFactory

func NewBackendFactory() *BackendFactory

NewBackendFactory creates a new backend factory

func (*BackendFactory) CreateBackend

func (f *BackendFactory) CreateBackend(backendType BackendType, config map[string]interface{}) (Backend, error)

CreateBackend creates a backend based on type and config

type BackendScanner

type BackendScanner interface {
	Scan(ctx interface{}, opts ScanOptions) ([]*BackendConfig, error)
}

BackendScanner interface for backend scanning

func NewBackendScanner

func NewBackendScanner() BackendScanner

NewBackendScanner creates a new backend scanner

type BackendType

type BackendType string

BackendType represents the type of backend

const (
	BackendLocal     BackendType = "local"
	BackendS3        BackendType = "s3"
	BackendAzureBlob BackendType = "azurerm"
	BackendGCS       BackendType = "gcs"
	BackendRemote    BackendType = "remote"
)

type CachedResource

type CachedResource struct {
	ID           string                 `json:"id"`
	Type         string                 `json:"type"`
	Provider     string                 `json:"provider"`
	Region       string                 `json:"region"`
	Attributes   map[string]interface{} `json:"attributes"`
	Version      string                 `json:"version"`
	ETag         string                 `json:"etag,omitempty"`
	LastModified time.Time              `json:"last_modified"`
	LastChecked  time.Time              `json:"last_checked"`
	Checksum     string                 `json:"checksum"`
	TTL          time.Duration          `json:"-"`
}

CachedResource represents a cached resource

type ChangeLogReader

type ChangeLogReader interface {
	GetChanges(ctx context.Context, since time.Time) ([]ResourceChange, error)
}

ChangeLogReader reads cloud provider change logs

type ChangeTracker

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

ChangeTracker tracks resource changes using various methods

func NewChangeTracker

func NewChangeTracker() *ChangeTracker

NewChangeTracker creates a new change tracker

func (*ChangeTracker) GetETag

func (t *ChangeTracker) GetETag(resourceID string) string

GetETag gets a resource's ETag

func (*ChangeTracker) SetChangeLogReader

func (t *ChangeTracker) SetChangeLogReader(reader ChangeLogReader)

SetChangeLogReader sets the change log reader

func (*ChangeTracker) UpdateETag

func (t *ChangeTracker) UpdateETag(resourceID, etag string)

UpdateETag updates a resource's ETag

func (*ChangeTracker) UpdateLastDiscovery

func (t *ChangeTracker) UpdateLastDiscovery(provider string)

UpdateLastDiscovery updates the last discovery time

type CloudSDK

type CloudSDK interface {
	Name() string
	Initialize(credentials Credentials) error
	ListResources(ctx context.Context, resourceType string, params map[string]interface{}) ([]models.Resource, error)
	GetResource(ctx context.Context, resourceID string) (*models.Resource, error)
	TagResource(ctx context.Context, resourceID string, tags map[string]string) error
	GetAPICallCount() int64
	GetLastError() error
}

CloudSDK interface for cloud provider SDKs

type Credentials

type Credentials struct {
	Provider       string
	AccessKey      string
	SecretKey      string
	Token          string
	Region         string
	ProjectID      string
	SubscriptionID string
	TenantID       string
	ClientID       string
	ClientSecret   string
	ServiceAccount string
	KeyFile        string
	Extra          map[string]string
}

Credentials represents cloud provider credentials

type DiscoveryCache

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

DiscoveryCache caches resource states with TTL

func NewDiscoveryCache

func NewDiscoveryCache() *DiscoveryCache

NewDiscoveryCache creates a new discovery cache

func (*DiscoveryCache) Clear

func (c *DiscoveryCache) Clear()

Clear clears the entire cache

func (*DiscoveryCache) Delete

func (c *DiscoveryCache) Delete(id string)

Delete removes a resource from cache

func (*DiscoveryCache) Get

func (c *DiscoveryCache) Get(id string) *CachedResource

Get retrieves a resource from cache

func (*DiscoveryCache) Put

func (c *DiscoveryCache) Put(resource interface{})

Put adds or updates a resource in cache

type DiscoveryConfig

type DiscoveryConfig struct {
	CacheDuration     time.Duration
	BloomFilterSize   uint
	BloomFilterHashes uint
	ParallelWorkers   int
	BatchSize         int
	UseCloudTrails    bool
	UseResourceTags   bool
	DifferentialSync  bool
}

DiscoveryConfig configures incremental discovery

type DiscoveryFilter

type DiscoveryFilter struct {
	IncludeTags   map[string]string `yaml:"include_tags"`
	ExcludeTags   map[string]string `yaml:"exclude_tags"`
	ResourceTypes []string          `yaml:"resource_types"`
	AgeThreshold  time.Duration     `yaml:"age_threshold"`
	UsagePatterns []string          `yaml:"usage_patterns"`
	CostThreshold float64           `yaml:"cost_threshold"`
	SecurityScore int               `yaml:"security_score"`
	Environment   string            `yaml:"environment"`
}

DiscoveryFilter provides intelligent resource filtering

type DiscoveryMetrics

type DiscoveryMetrics struct {
	TotalDiscoveries int
	AverageDuration  time.Duration
	SuccessRate      float64
	ErrorCount       int
}

DiscoveryMetrics contains metrics about discovery operations

type DiscoveryOptions

type DiscoveryOptions struct {
	Regions       []string
	ResourceTypes []string
	Tags          map[string]string
	MaxResults    int
}

DiscoveryOptions represents options for resource discovery

type DiscoveryPlugin

type DiscoveryPlugin struct {
	Name         string            `yaml:"name"`
	Enabled      bool              `yaml:"enabled"`
	Priority     int               `yaml:"priority"`
	Dependencies []string          `yaml:"dependencies"`
	Config       map[string]string `yaml:"config"`
	DiscoveryFn  func(context.Context, string, string) ([]models.Resource, error)
}

DiscoveryPlugin represents a configurable discovery plugin

type DiscoveryQuality

type DiscoveryQuality struct {
	Completeness float64            `json:"completeness"`
	Accuracy     float64            `json:"accuracy"`
	Freshness    time.Duration      `json:"freshness"`
	Coverage     map[string]float64 `json:"coverage"`
	Errors       []string           `json:"errors"`
}

DiscoveryQuality represents discovery quality metrics

type DiscoveryResult

type DiscoveryResult struct {
	NewResources     []interface{}
	UpdatedResources []interface{}
	DeletedResources []string
	UnchangedCount   int
	DiscoveryTime    time.Duration
	CacheHits        int
	CacheMisses      int
}

DiscoveryResult represents the result of incremental discovery

type DiscoveryStats

type DiscoveryStats struct {
	TotalResources       int
	ResourcesByType      map[string]int
	ResourcesByRegion    map[string]int
	ResourcesByProvider  map[string]int
	DiscoveryDuration    time.Duration
	ErrorCount           int
	WarningCount         int
	AverageDiscoveryTime time.Duration
}

DiscoveryStats holds statistics about the discovery

type DiscoveryVisualizer

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

DiscoveryVisualizer provides visualization capabilities for discovery results

func NewDiscoveryVisualizer

func NewDiscoveryVisualizer() *DiscoveryVisualizer

NewDiscoveryVisualizer creates a new discovery visualizer

func (*DiscoveryVisualizer) AddRelationship

func (dv *DiscoveryVisualizer) AddRelationship(fromResourceID, toResourceID string)

AddRelationship adds a relationship between resources

func (*DiscoveryVisualizer) AddResource

func (dv *DiscoveryVisualizer) AddResource(resource models.Resource)

AddResource adds a resource to the visualizer

func (*DiscoveryVisualizer) GenerateASCIIDiagram

func (dv *DiscoveryVisualizer) GenerateASCIIDiagram() string

GenerateASCIIDiagram generates an ASCII diagram of resources

func (*DiscoveryVisualizer) GenerateCSV

func (dv *DiscoveryVisualizer) GenerateCSV() string

GenerateCSV generates a CSV export of resources

func (*DiscoveryVisualizer) GenerateGraphviz

func (dv *DiscoveryVisualizer) GenerateGraphviz() string

GenerateGraphviz generates a Graphviz DOT representation

func (*DiscoveryVisualizer) GenerateHTMLReport

func (dv *DiscoveryVisualizer) GenerateHTMLReport() string

GenerateHTMLReport generates an HTML report of the discovery

func (*DiscoveryVisualizer) GenerateJSON

func (dv *DiscoveryVisualizer) GenerateJSON() map[string]interface{}

GenerateJSON generates a JSON representation of the discovery

func (*DiscoveryVisualizer) GenerateMarkdownReport

func (dv *DiscoveryVisualizer) GenerateMarkdownReport() string

GenerateMarkdownReport generates a Markdown report

func (*DiscoveryVisualizer) GetStats

func (dv *DiscoveryVisualizer) GetStats() *DiscoveryStats

GetStats returns discovery statistics

func (*DiscoveryVisualizer) GetTimeline

func (dv *DiscoveryVisualizer) GetTimeline() []TimelineEvent

GetTimeline returns the discovery timeline

func (*DiscoveryVisualizer) Reset

func (dv *DiscoveryVisualizer) Reset()

Reset clears all visualization data

func (*DiscoveryVisualizer) WriteReport

func (dv *DiscoveryVisualizer) WriteReport(w io.Writer, format string) error

WriteReport writes a report to an io.Writer

type EnhancedDiscoverer

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

EnhancedDiscoverer provides advanced cloud discovery capabilities

func NewEnhancedDiscoverer

func NewEnhancedDiscoverer(cfg *config.Config) *EnhancedDiscoverer

NewEnhancedDiscoverer creates a new enhanced discoverer

func (*EnhancedDiscoverer) DiscoverAllResourcesEnhanced

func (ed *EnhancedDiscoverer) DiscoverAllResourcesEnhanced(ctx context.Context, providers []string, regions []string) ([]models.Resource, error)

DiscoverAllResourcesEnhanced performs comprehensive resource discovery

func (*EnhancedDiscoverer) DiscoverResources

func (ed *EnhancedDiscoverer) DiscoverResources(ctx context.Context) ([]models.Resource, error)

DiscoverResources performs resource discovery across all configured providers

func (*EnhancedDiscoverer) GetDiscoveryQuality

func (ed *EnhancedDiscoverer) GetDiscoveryQuality() DiscoveryQuality

GetDiscoveryQuality returns quality metrics for the discovery process

func (*EnhancedDiscoverer) RegisterPlugin

func (ed *EnhancedDiscoverer) RegisterPlugin(plugin *DiscoveryPlugin)

RegisterPlugin registers a discovery plugin

func (*EnhancedDiscoverer) SetFilter

func (ed *EnhancedDiscoverer) SetFilter(filter *DiscoveryFilter)

SetFilter sets the discovery filter

type Event

type Event struct {
	Type      string                 `json:"type"`
	Timestamp time.Time              `json:"timestamp"`
	Provider  string                 `json:"provider"`
	Region    string                 `json:"region"`
	Data      map[string]interface{} `json:"data"`
}

Event represents a monitoring event

type IncrementalDiscovery

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

IncrementalDiscovery provides efficient incremental resource discovery

func NewIncrementalDiscovery

func NewIncrementalDiscovery(config DiscoveryConfig) *IncrementalDiscovery

NewIncrementalDiscovery creates a new incremental discovery engine

func (*IncrementalDiscovery) DiscoverIncremental

func (d *IncrementalDiscovery) DiscoverIncremental(ctx context.Context) (*DiscoveryResult, error)

DiscoverIncremental performs incremental discovery

func (*IncrementalDiscovery) RegisterProvider

func (d *IncrementalDiscovery) RegisterProvider(name string, provider providers.CloudProvider)

RegisterProvider registers a cloud provider

type LocalBackend

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

LocalBackend implements local file system backend

func NewLocalBackend

func NewLocalBackend(path string) *LocalBackend

NewLocalBackend creates a new local backend

func (*LocalBackend) Connect

func (b *LocalBackend) Connect(ctx context.Context) error

Connect initializes the local backend

func (*LocalBackend) DeleteState

func (b *LocalBackend) DeleteState(ctx context.Context, key string) error

DeleteState removes state file

func (*LocalBackend) GetState

func (b *LocalBackend) GetState(ctx context.Context, key string) ([]byte, error)

GetState retrieves state from local file

func (*LocalBackend) ListStates

func (b *LocalBackend) ListStates(ctx context.Context) ([]string, error)

ListStates lists all state files

func (*LocalBackend) LockState

func (b *LocalBackend) LockState(ctx context.Context, key string) (string, error)

LockState creates a lock file

func (*LocalBackend) PutState

func (b *LocalBackend) PutState(ctx context.Context, key string, data []byte) error

PutState writes state to local file

func (*LocalBackend) UnlockState

func (b *LocalBackend) UnlockState(ctx context.Context, key string, lockID string) error

UnlockState removes the lock file

type MonitoringMetrics

type MonitoringMetrics struct {
	ResourcesDiscovered  int64
	ResourcesPerSecond   float64
	ErrorCount           int64
	WarningCount         int64
	LastUpdateTime       time.Time
	AverageDiscoveryTime time.Duration
	ActiveProviders      map[string]bool
	ActiveRegions        map[string]bool
	DiscoveryRate        map[string]float64 // provider -> rate
	ErrorRate            float64
	SuccessRate          float64
}

MonitoringMetrics tracks real-time metrics

type ParallelDiscoverer

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

ParallelDiscoverer provides parallel resource discovery capabilities

func NewParallelDiscoverer

func NewParallelDiscoverer(config ParallelDiscoveryConfig) *ParallelDiscoverer

NewParallelDiscoverer creates a new parallel discoverer

func (*ParallelDiscoverer) DiscoverAllResources

func (pd *ParallelDiscoverer) DiscoverAllResources(ctx context.Context, providers []string, regions []string) ([]models.Resource, error)

DiscoverAllResources discovers resources across multiple providers and regions in parallel

func (*ParallelDiscoverer) GetMetrics

func (pd *ParallelDiscoverer) GetMetrics() DiscoveryMetrics

GetMetrics returns discovery metrics

func (*ParallelDiscoverer) Shutdown

func (pd *ParallelDiscoverer) Shutdown(timeout time.Duration) error

Shutdown gracefully shuts down the parallel discoverer

type ParallelDiscoveryConfig

type ParallelDiscoveryConfig struct {
	MaxWorkers     int
	MaxConcurrency int
	Timeout        time.Duration
	RetryAttempts  int
	RetryDelay     time.Duration
	BatchSize      int
	EnableMetrics  bool
}

ParallelDiscoveryConfig contains configuration for parallel discovery

type ProgressTracker

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

ProgressTracker tracks discovery progress across providers, regions, and services

func NewProgressTracker

func NewProgressTracker(providers, regions, services []string) *ProgressTracker

NewProgressTracker creates a new progress tracker

func (*ProgressTracker) AddError

func (pt *ProgressTracker) AddError(err error)

AddError adds an error to the tracker

func (*ProgressTracker) GetErrors

func (pt *ProgressTracker) GetErrors() []error

GetErrors returns all tracked errors

func (*ProgressTracker) GetProgress

func (pt *ProgressTracker) GetProgress() map[string]interface{}

GetProgress returns current progress statistics

func (*ProgressTracker) GetProviderProgress

func (pt *ProgressTracker) GetProviderProgress(provider string) *ProviderProgress

GetProviderProgress returns progress for a specific provider

func (*ProgressTracker) GetRegionProgress

func (pt *ProgressTracker) GetRegionProgress(provider, region string) *RegionProgress

GetRegionProgress returns progress for a specific region

func (*ProgressTracker) GetServiceProgress

func (pt *ProgressTracker) GetServiceProgress(provider, region, service string) *ServiceProgress

GetServiceProgress returns progress for a specific service

func (*ProgressTracker) GetSummary

func (pt *ProgressTracker) GetSummary() string

GetSummary returns a summary of the discovery progress

func (*ProgressTracker) IncrementResources

func (pt *ProgressTracker) IncrementResources(count int64)

IncrementResources increments the resource counters

func (*ProgressTracker) IsCompleted

func (pt *ProgressTracker) IsCompleted() bool

IsCompleted returns whether discovery is completed

func (*ProgressTracker) MarkCompleted

func (pt *ProgressTracker) MarkCompleted()

MarkCompleted marks the discovery as completed

func (*ProgressTracker) Reset

func (pt *ProgressTracker) Reset()

Reset resets the progress tracker

func (*ProgressTracker) UpdateProviderProgress

func (pt *ProgressTracker) UpdateProviderProgress(provider string, completedRegions int, resources int64)

UpdateProviderProgress updates progress for a provider

func (*ProgressTracker) UpdateRegionProgress

func (pt *ProgressTracker) UpdateRegionProgress(provider, region string, completedServices int, resources int64)

UpdateRegionProgress updates progress for a region

func (*ProgressTracker) UpdateServiceProgress

func (pt *ProgressTracker) UpdateServiceProgress(provider, region, service string, resources int64)

UpdateServiceProgress updates progress for a service

type ProviderProgress

type ProviderProgress struct {
	Name                string
	TotalRegions        int
	CompletedRegions    int
	TotalResources      int64
	DiscoveredResources int64
	StartTime           time.Time
	EndTime             *time.Time
	Errors              []error
}

ProviderProgress tracks progress for a specific provider

type QueryFilter

type QueryFilter struct {
	Field    string
	Operator string
	Value    interface{}
}

QueryFilter defines filter criteria

type QueryOptions

type QueryOptions struct {
	Filters   []QueryFilter
	SortBy    string
	SortOrder string // "asc" or "desc"
	Limit     int
	Offset    int
	GroupBy   string
	Aggregate string // "count", "sum", "avg", "min", "max"
}

QueryOptions defines query options

type QueryResult

type QueryResult struct {
	Query         string
	Resources     []models.Resource
	Count         int
	ExecutionTime time.Duration
	Timestamp     time.Time
	Cached        bool
}

QueryResult represents the result of a query

type RateLimiter

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

RateLimiter implements rate limiting for API calls

type RealTimeMonitor

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

RealTimeMonitor provides real-time monitoring of discovery operations

func NewRealTimeMonitor

func NewRealTimeMonitor() *RealTimeMonitor

NewRealTimeMonitor creates a new real-time monitor

func (*RealTimeMonitor) AcknowledgeAlert

func (rtm *RealTimeMonitor) AcknowledgeAlert(alertID string) error

AcknowledgeAlert acknowledges an alert

func (*RealTimeMonitor) AddWebhook

func (rtm *RealTimeMonitor) AddWebhook(config WebhookConfig)

AddWebhook adds a webhook configuration

func (*RealTimeMonitor) CreateAlert

func (rtm *RealTimeMonitor) CreateAlert(alertType AlertType, severity AlertSeverity, message string, details map[string]interface{})

CreateAlert creates a new alert

func (*RealTimeMonitor) GetAlerts

func (rtm *RealTimeMonitor) GetAlerts(unacknowledgedOnly bool) []Alert

GetAlerts returns current alerts

func (*RealTimeMonitor) GetDashboardData

func (rtm *RealTimeMonitor) GetDashboardData() map[string]interface{}

GetDashboardData returns data for dashboard display

func (*RealTimeMonitor) GetMetrics

func (rtm *RealTimeMonitor) GetMetrics() *MonitoringMetrics

GetMetrics returns current monitoring metrics

func (*RealTimeMonitor) ProcessResource

func (rtm *RealTimeMonitor) ProcessResource(resource models.Resource)

ProcessResource processes a discovered resource

func (*RealTimeMonitor) RemoveWebhook

func (rtm *RealTimeMonitor) RemoveWebhook(url string)

RemoveWebhook removes a webhook configuration

func (*RealTimeMonitor) Start

func (rtm *RealTimeMonitor) Start(ctx context.Context) error

Start begins real-time monitoring

func (*RealTimeMonitor) Stop

func (rtm *RealTimeMonitor) Stop()

Stop stops the real-time monitor

func (*RealTimeMonitor) SubscribeToStream

func (rtm *RealTimeMonitor) SubscribeToStream(clientID string) <-chan Event

SubscribeToStream subscribes to the event stream

func (*RealTimeMonitor) UnsubscribeFromStream

func (rtm *RealTimeMonitor) UnsubscribeFromStream(clientID string)

UnsubscribeFromStream unsubscribes from the event stream

type RegionProgress

type RegionProgress struct {
	Provider            string
	Region              string
	TotalServices       int
	CompletedServices   int
	TotalResources      int64
	DiscoveredResources int64
	StartTime           time.Time
	EndTime             *time.Time
	Errors              []error
}

RegionProgress tracks progress for a specific region

type ResourceCache

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

ResourceCache provides simple caching for discovered resources

func (*ResourceCache) Get

func (c *ResourceCache) Get(key string) (interface{}, bool)

Get retrieves a value from cache

func (*ResourceCache) GetSize

func (c *ResourceCache) GetSize() int

GetSize returns the number of items in cache

func (*ResourceCache) Set

func (c *ResourceCache) Set(key string, value interface{})

Set stores a value in cache

type ResourceChange

type ResourceChange struct {
	ResourceID string
	ChangeType string
	Timestamp  time.Time
	Details    map[string]interface{}
}

ResourceChange represents a change to a resource

type ResourceHierarchy

type ResourceHierarchy struct {
	Parent       *models.Resource
	Children     []*ResourceHierarchy
	Dependencies []string
	Level        int
}

ResourceHierarchy represents hierarchical resource relationships

type RetryPolicy

type RetryPolicy struct {
	MaxRetries      int
	InitialDelay    time.Duration
	MaxDelay        time.Duration
	BackoffFactor   float64
	RetryableErrors []string
}

RetryPolicy defines retry behavior

type S3Backend

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

S3Backend implements AWS S3 backend

func NewS3Backend

func NewS3Backend(bucket, key, region, dynamoDBTable string) *S3Backend

NewS3Backend creates a new S3 backend

func (*S3Backend) Connect

func (b *S3Backend) Connect(ctx context.Context) error

Connect initializes AWS clients

func (*S3Backend) DeleteState

func (b *S3Backend) DeleteState(ctx context.Context, key string) error

DeleteState removes state from S3

func (*S3Backend) GetState

func (b *S3Backend) GetState(ctx context.Context, key string) ([]byte, error)

GetState retrieves state from S3

func (*S3Backend) ListStates

func (b *S3Backend) ListStates(ctx context.Context) ([]string, error)

ListStates lists all state files in S3

func (*S3Backend) LockState

func (b *S3Backend) LockState(ctx context.Context, key string) (string, error)

LockState creates a DynamoDB lock

func (*S3Backend) PutState

func (b *S3Backend) PutState(ctx context.Context, key string, data []byte) error

PutState uploads state to S3

func (*S3Backend) UnlockState

func (b *S3Backend) UnlockState(ctx context.Context, key string, lockID string) error

UnlockState removes the DynamoDB lock

type SDKIntegration

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

SDKIntegration provides SDK integration capabilities for various cloud providers

func NewSDKIntegration

func NewSDKIntegration() *SDKIntegration

NewSDKIntegration creates a new SDK integration manager

func (*SDKIntegration) CallAPI

func (si *SDKIntegration) CallAPI(ctx context.Context, provider string, operation func() (interface{}, error)) (interface{}, error)

CallAPI makes an API call with rate limiting and retry logic

func (*SDKIntegration) Cleanup

func (si *SDKIntegration) Cleanup()

Cleanup cleans up resources

func (*SDKIntegration) ClearCache

func (si *SDKIntegration) ClearCache()

ClearCache clears the client cache

func (*SDKIntegration) GetMetrics

func (si *SDKIntegration) GetMetrics() *SDKMetrics

GetMetrics returns SDK usage metrics

func (*SDKIntegration) GetProviderStatus

func (si *SDKIntegration) GetProviderStatus(provider string) map[string]interface{}

GetProviderStatus returns the status of a provider

func (*SDKIntegration) GetResource

func (si *SDKIntegration) GetResource(ctx context.Context, provider, resourceID string) (*models.Resource, error)

GetResource gets a single resource using the SDK

func (*SDKIntegration) ListResources

func (si *SDKIntegration) ListResources(ctx context.Context, provider, resourceType string, params map[string]interface{}) ([]models.Resource, error)

ListResources lists resources using the appropriate SDK

func (*SDKIntegration) RegisterProvider

func (si *SDKIntegration) RegisterProvider(provider string, sdk CloudSDK)

RegisterProvider registers a cloud provider SDK

func (*SDKIntegration) SetCredentials

func (si *SDKIntegration) SetCredentials(provider string, creds Credentials) error

SetCredentials sets credentials for a provider

func (*SDKIntegration) SetRateLimiter

func (si *SDKIntegration) SetRateLimiter(provider string, maxTokens, refillRate int)

SetRateLimiter sets a custom rate limiter for a provider

func (*SDKIntegration) SetRetryPolicy

func (si *SDKIntegration) SetRetryPolicy(provider string, policy *RetryPolicy)

SetRetryPolicy sets a custom retry policy for a provider

func (*SDKIntegration) TagResource

func (si *SDKIntegration) TagResource(ctx context.Context, provider, resourceID string, tags map[string]string) error

TagResource tags a resource using the SDK

type SDKMetrics

type SDKMetrics struct {
	APICallsTotal     map[string]int64
	APICallsPerSecond map[string]float64
	ErrorCount        map[string]int64
	RetryCount        map[string]int64
	RateLimitHits     map[string]int64
	AverageLatency    map[string]time.Duration
	LastAPICall       map[string]time.Time
}

SDKMetrics tracks SDK usage metrics

type ScanOptions

type ScanOptions struct {
	Path        string
	Recursive   bool
	Pattern     string
	MaxDepth    int
	Workers     int
	FilterTypes []string
}

ScanOptions represents scan options

type Scanner

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

Scanner discovers Terraform backend configurations

func NewScanner

func NewScanner(rootDir string, workers int) *Scanner

NewScanner creates a new backend scanner

func (*Scanner) GetBackendsByType

func (s *Scanner) GetBackendsByType(backendType string) []BackendConfig

GetBackendsByType returns all backends of a specific type

func (*Scanner) GetUniqueBackends

func (s *Scanner) GetUniqueBackends() []BackendConfig

GetUniqueBackends returns unique backend configurations

func (*Scanner) Scan

func (s *Scanner) Scan(ctx context.Context) ([]BackendConfig, error)

Scan discovers all backend configurations in the directory tree

type ServiceProgress

type ServiceProgress struct {
	Provider            string
	Region              string
	Service             string
	TotalResources      int64
	DiscoveredResources int64
	StartTime           time.Time
	EndTime             *time.Time
	Errors              []error
	LastActivity        time.Time
}

ServiceProgress tracks progress for a specific service

type TimelineEvent

type TimelineEvent struct {
	Timestamp   time.Time
	EventType   string
	Provider    string
	Region      string
	Service     string
	ResourceID  string
	Description string
}

TimelineEvent represents an event in the discovery timeline

type ValidationResult

type ValidationResult struct {
	Region            string   `json:"region"`
	DriftmgrCount     int      `json:"driftmgr_count"`
	CLICount          int      `json:"cli_count"`
	Match             bool     `json:"match"`
	MissingInCLI      []string `json:"missing_in_cli,omitempty"`
	MissingInDriftmgr []string `json:"missing_in_driftmgr,omitempty"`
}

ValidationResult represents validation results

type WebhookConfig

type WebhookConfig struct {
	URL        string
	Events     []string
	Headers    map[string]string
	RetryCount int
	Timeout    time.Duration
}

WebhookConfig defines webhook configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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