Documentation
¶
Index ¶
- Constants
- Variables
- func GetRequiredModuleForEventType(eventType EventType) string
- type AuthType
- type Category
- type EventCategory
- type EventType
- func AllKnownEventTypes() []EventType
- func DefaultEnabledEventTypes() []EventType
- func GetDefaultEventTypesByModules(enabledModuleIDs []string) []EventType
- func MapLegacyEventType(eventType EventType) EventType
- func ValidateEventTypes(eventTypes []EventType, enabledModuleIDs []string) (valid bool, invalidTypes []EventType)
- type EventTypeInfo
- type Filter
- type ID
- type Integration
- func (i *Integration) AuthType() AuthType
- func (i *Integration) BaseURL() string
- func (i *Integration) Category() Category
- func (i *Integration) Config() map[string]any
- func (i *Integration) CreatedAt() time.Time
- func (i *Integration) CreatedBy() *ID
- func (i *Integration) CredentialsEncrypted() string
- func (i *Integration) Description() string
- func (i *Integration) ID() ID
- func (i *Integration) IsConnected() bool
- func (i *Integration) IsSCM() bool
- func (i *Integration) LastSyncAt() *time.Time
- func (i *Integration) Metadata() map[string]any
- func (i *Integration) Name() string
- func (i *Integration) NextSyncAt() *time.Time
- func (i *Integration) Provider() Provider
- func (i *Integration) SetBaseURL(baseURL string)
- func (i *Integration) SetConfig(config map[string]any)
- func (i *Integration) SetConnected()
- func (i *Integration) SetCredentials(encrypted string)
- func (i *Integration) SetDescription(description string)
- func (i *Integration) SetDisconnected()
- func (i *Integration) SetError(err string)
- func (i *Integration) SetMetadata(metadata map[string]any)
- func (i *Integration) SetName(name string)
- func (i *Integration) SetStats(stats Stats)
- func (i *Integration) SetStatus(status Status)
- func (i *Integration) SetStatusMessage(message string)
- func (i *Integration) SetSyncInterval(minutes int)
- func (i *Integration) Stats() Stats
- func (i *Integration) Status() Status
- func (i *Integration) StatusMessage() string
- func (i *Integration) SyncError() string
- func (i *Integration) SyncIntervalMinutes() int
- func (i *Integration) TenantID() ID
- func (i *Integration) UpdateLastSync()
- func (i *Integration) UpdatedAt() time.Time
- type IntegrationWithNotification
- type IntegrationWithSCM
- type ListResult
- type NotificationExtension
- func NewNotificationExtension(integrationID ID) *NotificationExtension
- func ReconstructNotificationExtension(integrationID ID, _ string, _ string, enabledSeverities []Severity, ...) *NotificationExtension
- func ReconstructNotificationExtensionFromBooleans(integrationID ID, _ string, _ string, notifyOnCritical bool, notifyOnHigh bool, ...) *NotificationExtension
- func (n *NotificationExtension) ChannelID() string
- func (n *NotificationExtension) ChannelName() string
- func (n *NotificationExtension) EnabledEventTypes() []EventType
- func (n *NotificationExtension) EnabledSeverities() []Severity
- func (n *NotificationExtension) IncludeDetails() bool
- func (n *NotificationExtension) IntegrationID() ID
- func (n *NotificationExtension) IsEventTypeEnabled(eventType EventType) bool
- func (n *NotificationExtension) IsSeverityEnabled(severity Severity) bool
- func (n *NotificationExtension) MessageTemplate() string
- func (n *NotificationExtension) MinIntervalMinutes() int
- func (n *NotificationExtension) NotifyOnCritical() bool
- func (n *NotificationExtension) NotifyOnHigh() bool
- func (n *NotificationExtension) NotifyOnLow() bool
- func (n *NotificationExtension) NotifyOnMedium() bool
- func (n *NotificationExtension) SetChannel(_, _ string)
- func (n *NotificationExtension) SetEnabledEventTypes(types []EventType)
- func (n *NotificationExtension) SetEnabledSeverities(severities []Severity)
- func (n *NotificationExtension) SetIncludeDetails(include bool)
- func (n *NotificationExtension) SetMessageTemplate(template string)
- func (n *NotificationExtension) SetMinIntervalMinutes(minutes int)
- func (n *NotificationExtension) SetNotifyOnCritical(notify bool)
- func (n *NotificationExtension) SetNotifyOnHigh(notify bool)
- func (n *NotificationExtension) SetNotifyOnLow(notify bool)
- func (n *NotificationExtension) SetNotifyOnMedium(notify bool)
- func (n *NotificationExtension) ShouldNotify(severity string) bool
- func (n *NotificationExtension) ShouldNotifyEventType(eventType EventType) bool
- type NotificationExtensionRepository
- type Provider
- type Repository
- type SCMExtension
- func (s *SCMExtension) AutoImportRepos() bool
- func (s *SCMExtension) DefaultBranchPattern() string
- func (s *SCMExtension) ExcludePatterns() []string
- func (s *SCMExtension) ImportArchivedRepos() bool
- func (s *SCMExtension) ImportPrivateRepos() bool
- func (s *SCMExtension) IncludePatterns() []string
- func (s *SCMExtension) IntegrationID() ID
- func (s *SCMExtension) LastRepoSyncAt() *time.Time
- func (s *SCMExtension) RepositoryCount() int
- func (s *SCMExtension) SCMOrganization() string
- func (s *SCMExtension) SetAutoImportRepos(auto bool)
- func (s *SCMExtension) SetDefaultBranchPattern(pattern string)
- func (s *SCMExtension) SetExcludePatterns(patterns []string)
- func (s *SCMExtension) SetImportArchivedRepos(archived bool)
- func (s *SCMExtension) SetImportPrivateRepos(private bool)
- func (s *SCMExtension) SetIncludePatterns(patterns []string)
- func (s *SCMExtension) SetRepositoryCount(count int)
- func (s *SCMExtension) SetSCMOrganization(org string)
- func (s *SCMExtension) SetWebhook(id, secret, url string)
- func (s *SCMExtension) UpdateLastRepoSync()
- func (s *SCMExtension) WebhookID() string
- func (s *SCMExtension) WebhookSecret() string
- func (s *SCMExtension) WebhookURL() string
- type SCMExtensionRepository
- type Severity
- type Stats
- type Status
Constants ¶
const ( ModuleAssets = "assets" ModuleScans = "scans" ModuleFindings = "findings" )
Module IDs that map to event types. These must match the module IDs in the modules table.
Variables ¶
var ( // Not found errors ErrIntegrationNotFound = fmt.Errorf("%w: integration not found", shared.ErrNotFound) ErrSCMExtensionNotFound = fmt.Errorf("%w: SCM extension not found", shared.ErrNotFound) ErrNotificationExtensionNotFound = fmt.Errorf("%w: notification extension not found", shared.ErrNotFound) // Conflict errors ErrIntegrationNameExists = fmt.Errorf("%w: integration name already exists", shared.ErrConflict) ErrIntegrationInUse = fmt.Errorf("%w: integration is in use", shared.ErrConflict) // Validation errors ErrInvalidCategory = fmt.Errorf("%w: invalid integration category", shared.ErrValidation) ErrInvalidProvider = fmt.Errorf("%w: invalid integration provider", shared.ErrValidation) ErrInvalidStatus = fmt.Errorf("%w: invalid integration status", shared.ErrValidation) ErrInvalidAuthType = fmt.Errorf("%w: invalid authentication type", shared.ErrValidation) ErrCredentialsRequired = fmt.Errorf("%w: credentials are required", shared.ErrValidation) ErrProviderCategoryMismatch = fmt.Errorf("%w: provider does not match category", shared.ErrValidation) // Connection errors ErrConnectionFailed = fmt.Errorf("%w: connection test failed", shared.ErrValidation) ErrCredentialsInvalid = fmt.Errorf("%w: credentials are invalid", shared.ErrValidation) )
Domain errors for integration.
Functions ¶
func GetRequiredModuleForEventType ¶
GetRequiredModuleForEventType returns the module ID required for an event type. Returns empty string if the event type is always available (system events).
Types ¶
type AuthType ¶
type AuthType string
AuthType represents the authentication type.
type EventCategory ¶
type EventCategory string
EventCategory groups event types for UI organization.
const ( EventCategorySystem EventCategory = "system" EventCategoryAsset EventCategory = "asset" EventCategoryScan EventCategory = "scan" EventCategoryFinding EventCategory = "finding" EventCategoryExposure EventCategory = "exposure" )
Event categories for UI grouping.
type EventType ¶
type EventType string
EventType represents the type of event that triggers notifications.
const ( // System events EventTypeSecurityAlert EventType = "security_alert" EventTypeSystemError EventType = "system_error" // Asset events EventTypeNewAsset EventType = "new_asset" EventTypeAssetChanged EventType = "asset_changed" EventTypeAssetDeleted EventType = "asset_deleted" // Scan events EventTypeScanStarted EventType = "scan_started" EventTypeScanCompleted EventType = "scan_completed" EventTypeScanFailed EventType = "scan_failed" // Finding events EventTypeNewFinding EventType = "new_finding" EventTypeFindingConfirmed EventType = "finding_confirmed" EventTypeFindingTriaged EventType = "finding_triaged" EventTypeFindingFixed EventType = "finding_fixed" EventTypeFindingReopened EventType = "finding_reopened" // Exposure events EventTypeNewExposure EventType = "new_exposure" EventTypeExposureResolved EventType = "exposure_resolved" // Legacy event types (for backward compatibility) EventTypeFindings EventType = "findings" // Maps to new_finding EventTypeExposures EventType = "exposures" // Maps to new_exposure EventTypeScans EventType = "scans" // Maps to scan_completed EventTypeAlerts EventType = "alerts" // Maps to security_alert )
Known event types for notification routing. Add new event types here - no database migration required (JSONB array).
func AllKnownEventTypes ¶
func AllKnownEventTypes() []EventType
AllKnownEventTypes returns all known event types (for backward compatibility API).
func DefaultEnabledEventTypes ¶
func DefaultEnabledEventTypes() []EventType
DefaultEnabledEventTypes returns the default enabled event types for new integrations.
func GetDefaultEventTypesByModules ¶
GetDefaultEventTypesByModules returns default event types filtered by enabled modules.
func MapLegacyEventType ¶
MapLegacyEventType maps old event types to new ones for backward compatibility.
func ValidateEventTypes ¶
func ValidateEventTypes(eventTypes []EventType, enabledModuleIDs []string) (valid bool, invalidTypes []EventType)
ValidateEventTypes checks if all event types are available for the given modules. Returns a list of invalid event types that require modules not in enabledModuleIDs.
type EventTypeInfo ¶
type EventTypeInfo struct {
Type EventType
Category EventCategory
Label string
Description string
RequiredModule string // Module ID required for this event type (empty = always available)
}
EventTypeInfo contains metadata about an event type.
func AllEventTypes ¶
func AllEventTypes() []EventTypeInfo
AllEventTypes returns all event types with metadata for UI. RequiredModule maps to modules.id in the database. Empty RequiredModule means the event type is always available (system events).
func GetEventTypesByModules ¶
func GetEventTypesByModules(enabledModuleIDs []string) []EventTypeInfo
GetEventTypesByModules returns event types filtered by enabled modules. System events (no required module) are always included.
type Filter ¶
type Filter struct {
TenantID *ID
Category *Category
Provider *Provider
Status *Status
Search string
Page int
PerPage int
SortBy string
SortOrder string
}
Filter represents filters for listing integrations.
type Integration ¶
type Integration struct {
// contains filtered or unexported fields
}
Integration represents a connection to an external service.
func NewIntegration ¶
func NewIntegration( id ID, tenantID ID, name string, category Category, provider Provider, authType AuthType, ) *Integration
NewIntegration creates a new integration.
func Reconstruct ¶
func Reconstruct( id ID, tenantID ID, name string, description string, category Category, provider Provider, status Status, statusMessage string, authType AuthType, baseURL string, credentialsEncrypted string, lastSyncAt *time.Time, nextSyncAt *time.Time, syncIntervalMinutes int, syncError string, config map[string]any, metadata map[string]any, stats Stats, createdAt time.Time, updatedAt time.Time, createdBy *ID, ) *Integration
Reconstruct creates an integration from stored data.
func (*Integration) AuthType ¶
func (i *Integration) AuthType() AuthType
func (*Integration) BaseURL ¶
func (i *Integration) BaseURL() string
func (*Integration) Category ¶
func (i *Integration) Category() Category
func (*Integration) Config ¶
func (i *Integration) Config() map[string]any
func (*Integration) CreatedAt ¶
func (i *Integration) CreatedAt() time.Time
func (*Integration) CreatedBy ¶
func (i *Integration) CreatedBy() *ID
func (*Integration) CredentialsEncrypted ¶
func (i *Integration) CredentialsEncrypted() string
func (*Integration) Description ¶
func (i *Integration) Description() string
func (*Integration) ID ¶
func (i *Integration) ID() ID
func (*Integration) IsConnected ¶
func (i *Integration) IsConnected() bool
IsConnected returns true if the integration is connected.
func (*Integration) IsSCM ¶
func (i *Integration) IsSCM() bool
IsSCM returns true if this is an SCM integration.
func (*Integration) LastSyncAt ¶
func (i *Integration) LastSyncAt() *time.Time
func (*Integration) Metadata ¶
func (i *Integration) Metadata() map[string]any
func (*Integration) Name ¶
func (i *Integration) Name() string
func (*Integration) NextSyncAt ¶
func (i *Integration) NextSyncAt() *time.Time
func (*Integration) Provider ¶
func (i *Integration) Provider() Provider
func (*Integration) SetBaseURL ¶
func (i *Integration) SetBaseURL(baseURL string)
func (*Integration) SetConfig ¶
func (i *Integration) SetConfig(config map[string]any)
func (*Integration) SetConnected ¶
func (i *Integration) SetConnected()
func (*Integration) SetCredentials ¶
func (i *Integration) SetCredentials(encrypted string)
func (*Integration) SetDescription ¶
func (i *Integration) SetDescription(description string)
func (*Integration) SetDisconnected ¶
func (i *Integration) SetDisconnected()
func (*Integration) SetError ¶
func (i *Integration) SetError(err string)
func (*Integration) SetMetadata ¶
func (i *Integration) SetMetadata(metadata map[string]any)
func (*Integration) SetName ¶
func (i *Integration) SetName(name string)
func (*Integration) SetStats ¶
func (i *Integration) SetStats(stats Stats)
func (*Integration) SetStatus ¶
func (i *Integration) SetStatus(status Status)
func (*Integration) SetStatusMessage ¶
func (i *Integration) SetStatusMessage(message string)
func (*Integration) SetSyncInterval ¶
func (i *Integration) SetSyncInterval(minutes int)
func (*Integration) Stats ¶
func (i *Integration) Stats() Stats
func (*Integration) Status ¶
func (i *Integration) Status() Status
func (*Integration) StatusMessage ¶
func (i *Integration) StatusMessage() string
func (*Integration) SyncError ¶
func (i *Integration) SyncError() string
func (*Integration) SyncIntervalMinutes ¶
func (i *Integration) SyncIntervalMinutes() int
func (*Integration) TenantID ¶
func (i *Integration) TenantID() ID
func (*Integration) UpdateLastSync ¶
func (i *Integration) UpdateLastSync()
func (*Integration) UpdatedAt ¶
func (i *Integration) UpdatedAt() time.Time
type IntegrationWithNotification ¶
type IntegrationWithNotification struct {
*Integration
Notification *NotificationExtension
}
IntegrationWithNotification combines an Integration with its notification extension.
func NewIntegrationWithNotification ¶
func NewIntegrationWithNotification(integration *Integration, notification *NotificationExtension) *IntegrationWithNotification
NewIntegrationWithNotification creates a new integration with notification extension.
type IntegrationWithSCM ¶
type IntegrationWithSCM struct {
*Integration
SCM *SCMExtension
}
IntegrationWithSCM combines an Integration with its SCM extension.
func NewIntegrationWithSCM ¶
func NewIntegrationWithSCM(integration *Integration, scm *SCMExtension) *IntegrationWithSCM
NewIntegrationWithSCM creates a new integration with SCM extension.
type ListResult ¶
type ListResult struct {
Data []*Integration
Total int64
Page int
PerPage int
TotalPages int
}
ListResult represents a paginated list result.
type NotificationExtension ¶
type NotificationExtension struct {
// contains filtered or unexported fields
}
NotificationExtension represents notification-specific extension data for an integration. This follows the same pattern as SCM extension. Note: channel_id (for Telegram) and channel_name (for Slack/Teams) are now stored in integrations.metadata instead of this extension table.
func NewNotificationExtension ¶
func NewNotificationExtension(integrationID ID) *NotificationExtension
NewNotificationExtension creates a new notification extension with defaults.
func ReconstructNotificationExtension ¶
func ReconstructNotificationExtension( integrationID ID, _ string, _ string, enabledSeverities []Severity, enabledEventTypes []EventType, messageTemplate string, includeDetails bool, minIntervalMinutes int, ) *NotificationExtension
ReconstructNotificationExtension creates a notification extension from stored data. Note: channelID and channelName parameters are deprecated and ignored. They are now stored in integrations.metadata.
func ReconstructNotificationExtensionFromBooleans ¶
func ReconstructNotificationExtensionFromBooleans( integrationID ID, _ string, _ string, notifyOnCritical bool, notifyOnHigh bool, notifyOnMedium bool, notifyOnLow bool, enabledEventTypes []EventType, messageTemplate string, includeDetails bool, minIntervalMinutes int, ) *NotificationExtension
ReconstructNotificationExtensionFromBooleans creates extension from old boolean fields. Used for backward compatibility during migration. Note: channelID and channelName parameters are deprecated and ignored.
func (*NotificationExtension) ChannelID ¶
func (n *NotificationExtension) ChannelID() string
ChannelID returns empty string - deprecated, now stored in integrations.metadata as chat_id
func (*NotificationExtension) ChannelName ¶
func (n *NotificationExtension) ChannelName() string
ChannelName returns empty string - deprecated, now stored in integrations.metadata as channel_name
func (*NotificationExtension) EnabledEventTypes ¶
func (n *NotificationExtension) EnabledEventTypes() []EventType
func (*NotificationExtension) EnabledSeverities ¶
func (n *NotificationExtension) EnabledSeverities() []Severity
func (*NotificationExtension) IncludeDetails ¶
func (n *NotificationExtension) IncludeDetails() bool
func (*NotificationExtension) IntegrationID ¶
func (n *NotificationExtension) IntegrationID() ID
func (*NotificationExtension) IsEventTypeEnabled ¶
func (n *NotificationExtension) IsEventTypeEnabled(eventType EventType) bool
IsEventTypeEnabled checks if a specific event type is enabled.
func (*NotificationExtension) IsSeverityEnabled ¶
func (n *NotificationExtension) IsSeverityEnabled(severity Severity) bool
IsSeverityEnabled checks if a specific severity is enabled.
func (*NotificationExtension) MessageTemplate ¶
func (n *NotificationExtension) MessageTemplate() string
func (*NotificationExtension) MinIntervalMinutes ¶
func (n *NotificationExtension) MinIntervalMinutes() int
func (*NotificationExtension) NotifyOnCritical ¶
func (n *NotificationExtension) NotifyOnCritical() bool
Backward compatibility getters (derived from enabledSeverities)
func (*NotificationExtension) NotifyOnHigh ¶
func (n *NotificationExtension) NotifyOnHigh() bool
func (*NotificationExtension) NotifyOnLow ¶
func (n *NotificationExtension) NotifyOnLow() bool
func (*NotificationExtension) NotifyOnMedium ¶
func (n *NotificationExtension) NotifyOnMedium() bool
func (*NotificationExtension) SetChannel ¶
func (n *NotificationExtension) SetChannel(_, _ string)
SetChannel is deprecated - channel info is now stored in integrations.metadata This function is kept for backward compatibility but does nothing.
func (*NotificationExtension) SetEnabledEventTypes ¶
func (n *NotificationExtension) SetEnabledEventTypes(types []EventType)
func (*NotificationExtension) SetEnabledSeverities ¶
func (n *NotificationExtension) SetEnabledSeverities(severities []Severity)
func (*NotificationExtension) SetIncludeDetails ¶
func (n *NotificationExtension) SetIncludeDetails(include bool)
func (*NotificationExtension) SetMessageTemplate ¶
func (n *NotificationExtension) SetMessageTemplate(template string)
func (*NotificationExtension) SetMinIntervalMinutes ¶
func (n *NotificationExtension) SetMinIntervalMinutes(minutes int)
func (*NotificationExtension) SetNotifyOnCritical ¶
func (n *NotificationExtension) SetNotifyOnCritical(notify bool)
Backward compatibility setters
func (*NotificationExtension) SetNotifyOnHigh ¶
func (n *NotificationExtension) SetNotifyOnHigh(notify bool)
func (*NotificationExtension) SetNotifyOnLow ¶
func (n *NotificationExtension) SetNotifyOnLow(notify bool)
func (*NotificationExtension) SetNotifyOnMedium ¶
func (n *NotificationExtension) SetNotifyOnMedium(notify bool)
func (*NotificationExtension) ShouldNotify ¶
func (n *NotificationExtension) ShouldNotify(severity string) bool
ShouldNotify checks if a notification should be sent for the given severity string.
func (*NotificationExtension) ShouldNotifyEventType ¶
func (n *NotificationExtension) ShouldNotifyEventType(eventType EventType) bool
ShouldNotifyEventType checks if a notification should be sent for the given event type.
type NotificationExtensionRepository ¶
type NotificationExtensionRepository interface {
// CRUD operations
Create(ctx context.Context, ext *NotificationExtension) error
GetByIntegrationID(ctx context.Context, integrationID ID) (*NotificationExtension, error)
Update(ctx context.Context, ext *NotificationExtension) error
Delete(ctx context.Context, integrationID ID) error
// Combined operations (integration + extension)
GetIntegrationWithNotification(ctx context.Context, id ID) (*IntegrationWithNotification, error)
ListIntegrationsWithNotification(ctx context.Context, tenantID ID) ([]*IntegrationWithNotification, error)
}
NotificationExtensionRepository defines the interface for notification extension persistence.
type Provider ¶
type Provider string
Provider represents the integration provider.
const ( ProviderGitHub Provider = "github" ProviderGitLab Provider = "gitlab" ProviderBitbucket Provider = "bitbucket" ProviderAzureDevOps Provider = "azure_devops" )
SCM Providers
const ( ProviderWiz Provider = "wiz" ProviderSnyk Provider = "snyk" ProviderTenable Provider = "tenable" ProviderCrowdStrike Provider = "crowdstrike" )
Security Providers
const ( ProviderAWS Provider = "aws" ProviderGCP Provider = "gcp" ProviderAzure Provider = "azure" )
Cloud Providers
const ( ProviderJira Provider = "jira" ProviderLinear Provider = "linear" ProviderAsana Provider = "asana" )
Ticketing Providers
const ( ProviderSlack Provider = "slack" ProviderTeams Provider = "teams" ProviderTelegram Provider = "telegram" ProviderEmail Provider = "email" ProviderWebhook Provider = "webhook" )
Notification Providers
type Repository ¶
type Repository interface {
// CRUD operations
Create(ctx context.Context, i *Integration) error
GetByID(ctx context.Context, id ID) (*Integration, error)
GetByTenantAndName(ctx context.Context, tenantID ID, name string) (*Integration, error)
Update(ctx context.Context, i *Integration) error
Delete(ctx context.Context, id ID) error
// List operations
List(ctx context.Context, filter Filter) (ListResult, error)
Count(ctx context.Context, filter Filter) (int64, error)
// Batch operations
ListByTenant(ctx context.Context, tenantID ID) ([]*Integration, error)
ListByCategory(ctx context.Context, tenantID ID, category Category) ([]*Integration, error)
ListByProvider(ctx context.Context, tenantID ID, provider Provider) ([]*Integration, error)
}
Repository defines the interface for integration persistence.
type SCMExtension ¶
type SCMExtension struct {
// contains filtered or unexported fields
}
SCMExtension represents SCM-specific extension data for an integration. This follows the same pattern as asset + asset_repositories extension.
func NewSCMExtension ¶
func NewSCMExtension(integrationID ID) *SCMExtension
NewSCMExtension creates a new SCM extension.
func ReconstructSCMExtension ¶
func ReconstructSCMExtension( integrationID ID, scmOrganization string, repositoryCount int, webhookID string, webhookSecret string, webhookURL string, defaultBranchPattern string, autoImportRepos bool, importPrivateRepos bool, importArchivedRepos bool, includePatterns []string, excludePatterns []string, lastRepoSyncAt *time.Time, ) *SCMExtension
ReconstructSCMExtension creates an SCM extension from stored data.
func (*SCMExtension) AutoImportRepos ¶
func (s *SCMExtension) AutoImportRepos() bool
func (*SCMExtension) DefaultBranchPattern ¶
func (s *SCMExtension) DefaultBranchPattern() string
func (*SCMExtension) ExcludePatterns ¶
func (s *SCMExtension) ExcludePatterns() []string
func (*SCMExtension) ImportArchivedRepos ¶
func (s *SCMExtension) ImportArchivedRepos() bool
func (*SCMExtension) ImportPrivateRepos ¶
func (s *SCMExtension) ImportPrivateRepos() bool
func (*SCMExtension) IncludePatterns ¶
func (s *SCMExtension) IncludePatterns() []string
func (*SCMExtension) IntegrationID ¶
func (s *SCMExtension) IntegrationID() ID
func (*SCMExtension) LastRepoSyncAt ¶
func (s *SCMExtension) LastRepoSyncAt() *time.Time
func (*SCMExtension) RepositoryCount ¶
func (s *SCMExtension) RepositoryCount() int
func (*SCMExtension) SCMOrganization ¶
func (s *SCMExtension) SCMOrganization() string
func (*SCMExtension) SetAutoImportRepos ¶
func (s *SCMExtension) SetAutoImportRepos(auto bool)
func (*SCMExtension) SetDefaultBranchPattern ¶
func (s *SCMExtension) SetDefaultBranchPattern(pattern string)
func (*SCMExtension) SetExcludePatterns ¶
func (s *SCMExtension) SetExcludePatterns(patterns []string)
func (*SCMExtension) SetImportArchivedRepos ¶
func (s *SCMExtension) SetImportArchivedRepos(archived bool)
func (*SCMExtension) SetImportPrivateRepos ¶
func (s *SCMExtension) SetImportPrivateRepos(private bool)
func (*SCMExtension) SetIncludePatterns ¶
func (s *SCMExtension) SetIncludePatterns(patterns []string)
func (*SCMExtension) SetRepositoryCount ¶
func (s *SCMExtension) SetRepositoryCount(count int)
func (*SCMExtension) SetSCMOrganization ¶
func (s *SCMExtension) SetSCMOrganization(org string)
func (*SCMExtension) SetWebhook ¶
func (s *SCMExtension) SetWebhook(id, secret, url string)
func (*SCMExtension) UpdateLastRepoSync ¶
func (s *SCMExtension) UpdateLastRepoSync()
func (*SCMExtension) WebhookID ¶
func (s *SCMExtension) WebhookID() string
func (*SCMExtension) WebhookSecret ¶
func (s *SCMExtension) WebhookSecret() string
func (*SCMExtension) WebhookURL ¶
func (s *SCMExtension) WebhookURL() string
type SCMExtensionRepository ¶
type SCMExtensionRepository interface {
// CRUD operations
Create(ctx context.Context, ext *SCMExtension) error
GetByIntegrationID(ctx context.Context, integrationID ID) (*SCMExtension, error)
Update(ctx context.Context, ext *SCMExtension) error
Delete(ctx context.Context, integrationID ID) error
// Combined operations (integration + extension)
GetIntegrationWithSCM(ctx context.Context, id ID) (*IntegrationWithSCM, error)
ListIntegrationsWithSCM(ctx context.Context, tenantID ID) ([]*IntegrationWithSCM, error)
}
SCMExtensionRepository defines the interface for SCM extension persistence.
type Severity ¶
type Severity string
Severity represents notification severity level. Stored as JSONB array in database for flexibility.
const ( SeverityCritical Severity = "critical" SeverityHigh Severity = "high" SeverityMedium Severity = "medium" SeverityLow Severity = "low" SeverityInfo Severity = "info" SeverityNone Severity = "none" )
Known severity levels. Add new severity here - no database migration required (JSONB array).
func AllKnownSeverities ¶
func AllKnownSeverities() []Severity
AllKnownSeverities returns all known severity levels (for UI display).
func DefaultEnabledSeverities ¶
func DefaultEnabledSeverities() []Severity
DefaultEnabledSeverities returns the default enabled severities for new integrations.
type Stats ¶
type Stats struct {
TotalAssets int `json:"total_assets"`
TotalFindings int `json:"total_findings"`
TotalRepositories int `json:"total_repositories,omitempty"`
}
Stats represents integration statistics.