Documentation
¶
Index ¶
- Constants
- Variables
- func AddPaginationToQuery(query *gorm.DB, limit int, cont *Continue, listParams ListParams) *gorm.DB
- func BuildContinueString(names []string, count int64) *string
- func CallEventCallback(resourceKind domain.ResourceKind, log logrus.FieldLogger) ...
- func CountRemainingItems(query *gorm.DB, nextValues []string, listParams ListParams) int64
- func ErrorFromGormError(err error) error
- func GetNonNilFieldsFromResource(resource model.Resource) []string
- func InitDB(cfg *config.Config, log *logrus.Logger) (*gorm.DB, error)
- func InitMigrationDB(cfg *config.Config, log *logrus.Logger) (*gorm.DB, error)
- func ListQuery(dest any, opts ...ListQueryOption) *listQuery
- func NewTraceContextEnforcer() gorm.Plugin
- func SafeEventCallback(log logrus.FieldLogger, callback func())
- func SeverityToRank(severity model.VulnerabilitySeverity) int
- func WithBypassSpanCheck(ctx context.Context) context.Context
- type AuthProvider
- type AuthProviderStore
- func (s *AuthProviderStore) Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
- func (s *AuthProviderStore) CountByOrg(ctx context.Context, orgId *uuid.UUID) ([]CountByOrgResult, error)
- func (s *AuthProviderStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.AuthProvider, ...) (*domain.AuthProvider, error)
- func (s *AuthProviderStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *domain.AuthProvider, ...) (*domain.AuthProvider, bool, error)
- func (s *AuthProviderStore) CreateWithFromAPI(ctx context.Context, orgId uuid.UUID, resource *domain.AuthProvider, ...) (*domain.AuthProvider, error)
- func (s *AuthProviderStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
- func (s *AuthProviderStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.AuthProvider, error)
- func (s *AuthProviderStore) GetAuthProviderByAuthorizationUrl(ctx context.Context, orgId uuid.UUID, authorizationUrl string) (*domain.AuthProvider, error)
- func (s *AuthProviderStore) GetAuthProviderByIssuerAndClientId(ctx context.Context, orgId uuid.UUID, issuer string, clientId string) (*domain.AuthProvider, error)
- func (s *AuthProviderStore) InitialMigration(ctx context.Context) error
- func (s *AuthProviderStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.AuthProviderList, error)
- func (s *AuthProviderStore) ListAll(ctx context.Context, listParams ListParams) (*domain.AuthProviderList, error)
- func (s *AuthProviderStore) Update(ctx context.Context, orgId uuid.UUID, resource *domain.AuthProvider, ...) (*domain.AuthProvider, error)
- func (s *AuthProviderStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.AuthProvider, ...) (*domain.AuthProvider, error)
- type CVEEventCandidate
- type CVEEventResolutionCandidate
- type Catalog
- type CatalogStore
- func (s *CatalogStore) Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
- func (s *CatalogStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.Catalog, ...) (*domain.Catalog, error)
- func (s *CatalogStore) CreateItem(ctx context.Context, orgId uuid.UUID, catalogName string, ...) (*domain.CatalogItem, error)
- func (s *CatalogStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *domain.Catalog, fromAPI bool, ...) (*domain.Catalog, bool, error)
- func (s *CatalogStore) CreateOrUpdateItem(ctx context.Context, orgId uuid.UUID, catalogName string, ...) (*domain.CatalogItem, bool, error)
- func (s *CatalogStore) Delete(ctx context.Context, orgId uuid.UUID, name string, ...) error
- func (s *CatalogStore) DeleteItem(ctx context.Context, orgId uuid.UUID, catalogName string, itemName string) error
- func (s *CatalogStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.Catalog, error)
- func (s *CatalogStore) GetItem(ctx context.Context, orgId uuid.UUID, catalogName string, itemName string) (*domain.CatalogItem, error)
- func (s *CatalogStore) InitialMigration(ctx context.Context) error
- func (s *CatalogStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.CatalogList, error)
- func (s *CatalogStore) ListAllItems(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.CatalogItemList, error)
- func (s *CatalogStore) ListItems(ctx context.Context, orgId uuid.UUID, catalogName string, ...) (*domain.CatalogItemList, error)
- func (s *CatalogStore) UnsetItemOwner(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, owner string) error
- func (s *CatalogStore) UnsetOwner(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, owner string) error
- func (s *CatalogStore) Update(ctx context.Context, orgId uuid.UUID, resource *domain.Catalog, ...) (*domain.Catalog, error)
- func (s *CatalogStore) UpdateItem(ctx context.Context, orgId uuid.UUID, catalogName string, ...) (*domain.CatalogItem, error)
- func (s *CatalogStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.Catalog, ...) (*domain.Catalog, error)
- type CertificateSigningRequest
- type CertificateSigningRequestStore
- func (s *CertificateSigningRequestStore) Create(ctx context.Context, orgId uuid.UUID, ...) (*domain.CertificateSigningRequest, error)
- func (s *CertificateSigningRequestStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, ...) (*domain.CertificateSigningRequest, bool, error)
- func (s *CertificateSigningRequestStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
- func (s *CertificateSigningRequestStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.CertificateSigningRequest, error)
- func (s *CertificateSigningRequestStore) InitialMigration(ctx context.Context) error
- func (s *CertificateSigningRequestStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.CertificateSigningRequestList, error)
- func (s *CertificateSigningRequestStore) Update(ctx context.Context, orgId uuid.UUID, ...) (*domain.CertificateSigningRequest, error)
- func (s *CertificateSigningRequestStore) UpdateConditions(ctx context.Context, orgId uuid.UUID, name string, ...) error
- func (s *CertificateSigningRequestStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, ...) (*domain.CertificateSigningRequest, error)
- type Checkpoint
- type CheckpointStore
- func (s *CheckpointStore) Get(ctx context.Context, consumer string, key string) ([]byte, error)
- func (s *CheckpointStore) GetDatabaseTime(ctx context.Context) (time.Time, error)
- func (s *CheckpointStore) InitialMigration(ctx context.Context) error
- func (s *CheckpointStore) Set(ctx context.Context, consumer string, key string, value []byte) error
- type Continue
- type CountByOrgAndStatusResult
- type CountByOrgResult
- type CountByResourceSyncOrgAndStatusResult
- type CountByRolloutStatusResult
- type CreateOrUpdateMode
- type DataStore
- func (s *DataStore) AuthProvider() AuthProvider
- func (s *DataStore) Catalog() Catalog
- func (s *DataStore) CertificateSigningRequest() CertificateSigningRequest
- func (s *DataStore) CheckHealth(ctx context.Context) error
- func (s *DataStore) Checkpoint() Checkpoint
- func (s *DataStore) Close() error
- func (s *DataStore) DependencyRef() DependencyRef
- func (s *DataStore) Device() Device
- func (s *DataStore) EnrollmentRequest() EnrollmentRequest
- func (s *DataStore) Event() Event
- func (s *DataStore) Fleet() Fleet
- func (s *DataStore) Organization() Organization
- func (s *DataStore) Repository() Repository
- func (s *DataStore) ResourceSync() ResourceSync
- func (s *DataStore) RunMigrationWithMigrationUser(ctx context.Context, cfg *config.Config, log *logrus.Logger) error
- func (s *DataStore) RunMigrations(ctx context.Context) error
- func (s *DataStore) SyncState() SyncState
- func (s *DataStore) TemplateVersion() TemplateVersion
- func (s *DataStore) VulnerabilityFinding() VulnerabilityFinding
- type DependencyRef
- type DependencyRefStore
- func (s *DependencyRefStore) BulkUpsertDeviceRefs(ctx context.Context, orgID uuid.UUID, refs []model.DependencyRef) error
- func (s *DependencyRefStore) DeleteByDevice(ctx context.Context, orgID uuid.UUID, deviceName string) error
- func (s *DependencyRefStore) DeleteByFleet(ctx context.Context, orgID uuid.UUID, fleetName string) error
- func (s *DependencyRefStore) InitialMigration(ctx context.Context) error
- func (s *DependencyRefStore) ListByRefType(ctx context.Context, orgID uuid.UUID, refType string) ([]model.DependencyRef, error)
- func (s *DependencyRefStore) ListDueGitDependencies(ctx context.Context, orgID uuid.UUID, pollInterval time.Duration) ([]model.GitDependencyProbe, error)
- func (s *DependencyRefStore) ListDueHttpDependencies(ctx context.Context, orgID uuid.UUID, pollInterval time.Duration) ([]model.HttpDependencyProbe, error)
- func (s *DependencyRefStore) ListSecretDependencyTargets(ctx context.Context, secretNamespace, secretName, newFingerprint string) ([]model.SecretDependencyRef, error)
- func (s *DependencyRefStore) ReplaceByFleet(ctx context.Context, orgID uuid.UUID, fleetName string, ...) error
- func (s *DependencyRefStore) ReplaceByFleetDevice(ctx context.Context, orgID uuid.UUID, fleetName, deviceName string, ...) error
- func (s *DependencyRefStore) ReplaceByStandaloneDevice(ctx context.Context, orgID uuid.UUID, deviceName string, ...) error
- func (s *DependencyRefStore) ReplaceDeviceRefsByFleet(ctx context.Context, orgID uuid.UUID, fleetName string, ...) error
- func (s *DependencyRefStore) ReplaceFleetScopedDeviceRefs(ctx context.Context, orgID uuid.UUID, deviceName string, ...) error
- func (s *DependencyRefStore) Upsert(ctx context.Context, orgID uuid.UUID, ref *model.DependencyRef) error
- type Device
- type DeviceImageDigest
- type DeviceListParams
- type DeviceStatusType
- type DeviceStore
- func (s *DeviceStore) CompletionCounts(ctx context.Context, orgId uuid.UUID, owner string, templateVersion string, ...) ([]domain.DeviceCompletionCount, error)
- func (s *DeviceStore) Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
- func (s *DeviceStore) CountByLabels(ctx context.Context, orgId uuid.UUID, listParams ListParams, groupBy []string) ([]map[string]any, error)
- func (s *DeviceStore) CountByOrgAndStatus(ctx context.Context, orgId *uuid.UUID, statusType DeviceStatusType, ...) ([]CountByOrgAndStatusResult, error)
- func (s *DeviceStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.Device, ...) (*domain.Device, error)
- func (s *DeviceStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *domain.Device, ...) (*domain.Device, bool, error)
- func (s *DeviceStore) DecommissionDevice(ctx context.Context, orgId uuid.UUID, name string, ...) (*domain.Device, error)
- func (s *DeviceStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) (bool, error)
- func (s *DeviceStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.Device, error)
- func (s *DeviceStore) GetLastSeen(ctx context.Context, orgId uuid.UUID, name string) (*time.Time, error)
- func (s *DeviceStore) GetRendered(ctx context.Context, orgId uuid.UUID, name string, ...) (*domain.Device, error)
- func (s *DeviceStore) GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.RepositoryList, error)
- func (s *DeviceStore) GetWithTimestamp(ctx context.Context, orgId uuid.UUID, name string) (*domain.Device, error)
- func (s *DeviceStore) Healthcheck(ctx context.Context, orgId uuid.UUID, names []string) error
- func (s *DeviceStore) InitialMigration(ctx context.Context) error
- func (s *DeviceStore) Labels(ctx context.Context, orgId uuid.UUID, listParams ListParams) (domain.LabelList, error)
- func (s *DeviceStore) List(ctx context.Context, orgId uuid.UUID, listParams DeviceListParams) (*domain.DeviceList, error)
- func (s *DeviceStore) ListConnectivityChanged(ctx context.Context, orgId uuid.UUID, listParams ListParams, ...) (*domain.DeviceList, error)
- func (s *DeviceStore) ListDevicesByServiceCondition(ctx context.Context, orgId uuid.UUID, conditionType string, ...) (*domain.DeviceList, error)
- func (s *DeviceStore) MarkRolloutSelection(ctx context.Context, orgId uuid.UUID, listParams ListParams, limit *int) error
- func (s *DeviceStore) OverwriteRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string, repositoryNames ...string) error
- func (s *DeviceStore) ProcessAwaitingReconnectAnnotation(ctx context.Context, orgId uuid.UUID, deviceName string, ...) (bool, error)
- func (s *DeviceStore) RemoveConflictPausedAnnotation(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, []string, error)
- func (s *DeviceStore) SetIntegrationTestCreateOrUpdateCallback(c IntegrationTestCallback)
- func (s *DeviceStore) SetOutOfDate(ctx context.Context, orgId uuid.UUID, owner string) error
- func (s *DeviceStore) SetServiceConditions(ctx context.Context, orgId uuid.UUID, name string, ...) error
- func (s *DeviceStore) Summary(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.DevicesSummary, error)
- func (s *DeviceStore) UnmarkRolloutSelection(ctx context.Context, orgId uuid.UUID, fleetName string) error
- func (s *DeviceStore) Update(ctx context.Context, orgId uuid.UUID, resource *domain.Device, ...) (*domain.Device, error)
- func (s *DeviceStore) UpdateAnnotations(ctx context.Context, orgId uuid.UUID, name string, ...) error
- func (s *DeviceStore) UpdateRendered(ctx context.Context, orgId uuid.UUID, ...) (string, error)
- func (s *DeviceStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.Device, ...) (*domain.Device, error)
- type DeviceStoreValidationCallback
- type EnrollmentRequest
- type EnrollmentRequestStore
- func (s *EnrollmentRequestStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.EnrollmentRequest, ...) (*domain.EnrollmentRequest, error)
- func (s *EnrollmentRequestStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *domain.EnrollmentRequest, ...) (*domain.EnrollmentRequest, bool, error)
- func (s *EnrollmentRequestStore) CreateWithFromAPI(ctx context.Context, orgId uuid.UUID, resource *domain.EnrollmentRequest, ...) (*domain.EnrollmentRequest, error)
- func (s *EnrollmentRequestStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
- func (s *EnrollmentRequestStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.EnrollmentRequest, error)
- func (s *EnrollmentRequestStore) InitialMigration(ctx context.Context) error
- func (s *EnrollmentRequestStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.EnrollmentRequestList, error)
- func (s *EnrollmentRequestStore) Update(ctx context.Context, orgId uuid.UUID, resource *domain.EnrollmentRequest, ...) (*domain.EnrollmentRequest, error)
- func (s *EnrollmentRequestStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.EnrollmentRequest, ...) (*domain.EnrollmentRequest, error)
- type Event
- type EventCallback
- type EventCallbackCaller
- type EventStore
- func (s *EventStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.Event) error
- func (s *EventStore) DeleteOlderThan(ctx context.Context, cutoffTime time.Time) (int64, error)
- func (s *EventStore) InitialMigration(ctx context.Context) error
- func (s *EventStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.EventList, error)
- type Fleet
- type FleetSeverityCounts
- type FleetStore
- func (s *FleetStore) CountByRolloutStatus(ctx context.Context, orgId *uuid.UUID, _ *string) ([]CountByRolloutStatusResult, error)
- func (s *FleetStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.Fleet, ...) (*domain.Fleet, error)
- func (s *FleetStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *domain.Fleet, ...) (*domain.Fleet, bool, error)
- func (s *FleetStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
- func (s *FleetStore) Get(ctx context.Context, orgId uuid.UUID, name string, opts ...GetOption) (*domain.Fleet, error)
- func (s *FleetStore) GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.RepositoryList, error)
- func (s *FleetStore) InitialMigration(ctx context.Context) error
- func (s *FleetStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams, ...) (*domain.FleetList, error)
- func (s *FleetStore) ListDisruptionBudgetFleets(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)
- func (s *FleetStore) ListIgnoreOrg(ctx context.Context) ([]model.Fleet, error)
- func (s *FleetStore) ListRolloutDeviceSelection(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)
- func (s *FleetStore) OverwriteRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string, repositoryNames ...string) error
- func (s *FleetStore) UnsetOwner(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, owner string) error
- func (s *FleetStore) UnsetOwnerByKind(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, resourceKind string) error
- func (s *FleetStore) Update(ctx context.Context, orgId uuid.UUID, resource *domain.Fleet, ...) (*domain.Fleet, error)
- func (s *FleetStore) UpdateAnnotations(ctx context.Context, orgId uuid.UUID, name string, ...) error
- func (s *FleetStore) UpdateConditions(ctx context.Context, orgId uuid.UUID, name string, ...) error
- func (s *FleetStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.Fleet) (*domain.Fleet, error)
- type GenericStore
- func (s *GenericStore[P, M, A, AL]) Create(ctx context.Context, orgId uuid.UUID, resource *A) (*A, error)
- func (s *GenericStore[P, M, A, AL]) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *A, fieldsToUnset []string, ...) (*A, *A, bool, error)
- func (s *GenericStore[P, M, A, AL]) Delete(ctx context.Context, resource M, associatedResources ...Resource) (bool, error)
- func (s *GenericStore[P, M, A, AL]) Get(ctx context.Context, orgId uuid.UUID, name string) (*A, error)
- func (s *GenericStore[P, M, A, AL]) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*AL, error)
- func (s *GenericStore[P, M, A, AL]) Update(ctx context.Context, orgId uuid.UUID, resource *A, fieldsToUnset []string, ...) (*A, *A, error)
- func (s *GenericStore[P, M, A, AL]) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *A) (*A, error)
- type GetOption
- type GroupedVulnPageRow
- type ImpactDigestDetail
- type ImpactPageResult
- type ImpactPageRow
- type IntegrationTestCallback
- type ListOption
- type ListParams
- type ListQueryOption
- type Model
- type OrgVulnerabilitySummary
- type Organization
- type OrganizationStore
- func (s *OrganizationStore) Create(ctx context.Context, org *model.Organization) (*model.Organization, error)
- func (s *OrganizationStore) GetByID(ctx context.Context, id uuid.UUID) (*model.Organization, error)
- func (s *OrganizationStore) InitialMigration(ctx context.Context) error
- func (s *OrganizationStore) List(ctx context.Context, listParams ListParams) ([]*model.Organization, error)
- func (s *OrganizationStore) ListByExternalIDs(ctx context.Context, externalIDs []string) ([]*model.Organization, error)
- func (s *OrganizationStore) ListByIDs(ctx context.Context, ids []string) ([]*model.Organization, error)
- func (s *OrganizationStore) UpsertMany(ctx context.Context, orgs []*model.Organization) ([]*model.Organization, error)
- type RemoveOwnerCallback
- type Repository
- type RepositoryStore
- func (s *RepositoryStore) Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
- func (s *RepositoryStore) CountByOrg(ctx context.Context, orgId *uuid.UUID) ([]CountByOrgResult, error)
- func (s *RepositoryStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.Repository, ...) (*domain.Repository, error)
- func (s *RepositoryStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *domain.Repository, ...) (*domain.Repository, bool, error)
- func (s *RepositoryStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
- func (s *RepositoryStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.Repository, error)
- func (s *RepositoryStore) GetDeviceRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.DeviceList, error)
- func (s *RepositoryStore) GetFleetRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.FleetList, error)
- func (s *RepositoryStore) GetInternal(ctx context.Context, orgId uuid.UUID, name string) (*model.Repository, error)
- func (s *RepositoryStore) InitialMigration(ctx context.Context) error
- func (s *RepositoryStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.RepositoryList, error)
- func (s *RepositoryStore) ListIgnoreOrg(ctx context.Context) ([]model.Repository, error)
- func (s *RepositoryStore) Update(ctx context.Context, orgId uuid.UUID, resource *domain.Repository, ...) (*domain.Repository, error)
- func (s *RepositoryStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.Repository, ...) (*domain.Repository, error)
- type Resource
- type ResourceSync
- type ResourceSyncStore
- func (s *ResourceSyncStore) Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
- func (s *ResourceSyncStore) CountByOrgAndStatus(ctx context.Context, orgId *uuid.UUID, status *string) ([]CountByResourceSyncOrgAndStatusResult, error)
- func (s *ResourceSyncStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.ResourceSync, ...) (*domain.ResourceSync, error)
- func (s *ResourceSyncStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *domain.ResourceSync, ...) (*domain.ResourceSync, bool, error)
- func (s *ResourceSyncStore) Delete(ctx context.Context, orgId uuid.UUID, name string, ...) error
- func (s *ResourceSyncStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.ResourceSync, error)
- func (s *ResourceSyncStore) InitialMigration(ctx context.Context) error
- func (s *ResourceSyncStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.ResourceSyncList, error)
- func (s *ResourceSyncStore) Update(ctx context.Context, orgId uuid.UUID, resource *domain.ResourceSync, ...) (*domain.ResourceSync, error)
- func (s *ResourceSyncStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.ResourceSync, ...) (*domain.ResourceSync, error)
- type ServiceConditionsCallback
- type SeverityCounts
- type SortColumn
- type SortOrder
- type StatusCount
- type StatusCountList
- type Store
- type SyncState
- type SyncStateStore
- func (s *SyncStateStore) BulkUpdateLastCheckedAt(ctx context.Context, orgID uuid.UUID, resourceKeys []string, t time.Time) error
- func (s *SyncStateStore) BulkUpsert(ctx context.Context, orgID uuid.UUID, states []model.SyncState) error
- func (s *SyncStateStore) Get(ctx context.Context, orgID uuid.UUID, resourceKey string) (*model.SyncState, error)
- func (s *SyncStateStore) InitialMigration(ctx context.Context) error
- func (s *SyncStateStore) Set(ctx context.Context, orgID uuid.UUID, state *model.SyncState) error
- func (s *SyncStateStore) SetLastCheckedAt(ctx context.Context, orgID uuid.UUID, resourceKey string, t time.Time) error
- type TemplateVersion
- type TemplateVersionStore
- func (s *TemplateVersionStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.TemplateVersion, ...) (*domain.TemplateVersion, error)
- func (s *TemplateVersionStore) Delete(ctx context.Context, orgId uuid.UUID, fleet string, name string, ...) (bool, error)
- func (s *TemplateVersionStore) Get(ctx context.Context, orgId uuid.UUID, fleet string, name string) (*domain.TemplateVersion, error)
- func (s *TemplateVersionStore) GetLatest(ctx context.Context, orgId uuid.UUID, fleet string) (*domain.TemplateVersion, error)
- func (s *TemplateVersionStore) InitialMigration(ctx context.Context) error
- func (s *TemplateVersionStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.TemplateVersionList, error)
- func (s *TemplateVersionStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.TemplateVersion, ...) error
- type VulnerabilityFinding
- type VulnerabilityFindingStore
- func (s *VulnerabilityFindingStore) BatchUpdateOpenEvents(ctx context.Context, actions []model.CVEEventAction) ([]model.CVEEventAction, error)
- func (s *VulnerabilityFindingStore) ComputeAllCVEActions(ctx context.Context, changedFindings []model.ChangedFinding, ...) ([]model.CVEEventAction, error)
- func (s *VulnerabilityFindingStore) FindAnyFindingForCVE(ctx context.Context, cveID string) (*model.VulnerabilityFinding, error)
- func (s *VulnerabilityFindingStore) FindingsForCVEAndImageDigests(ctx context.Context, cveID string, imageDigests []string) ([]model.VulnerabilityFinding, error)
- func (s *VulnerabilityFindingStore) GetFleetVulnerabilitySummary(ctx context.Context, digests []DeviceImageDigest, fs *selector.FieldSelector) (FleetSeverityCounts, error)
- func (s *VulnerabilityFindingStore) GetImpactDigestDetails(ctx context.Context, orgID uuid.UUID, cveID string, owners []string, ...) ([]ImpactDigestDetail, error)
- func (s *VulnerabilityFindingStore) GetOrgVulnerabilitySummary(ctx context.Context, orgID uuid.UUID) (OrgVulnerabilitySummary, error)
- func (s *VulnerabilityFindingStore) GetVulnerabilities(ctx context.Context, digest string, listParams ListParams) (*VulnerabilityListResult, error)
- func (s *VulnerabilityFindingStore) GetVulnerabilityGroups(ctx context.Context, digests []DeviceImageDigest, listParams ListParams) (*VulnerabilityGroupResult, error)
- func (s *VulnerabilityFindingStore) GetVulnerabilityImpactPage(ctx context.Context, orgID uuid.UUID, cveID string, listParams ListParams) (*ImpactPageResult, error)
- func (s *VulnerabilityFindingStore) GetVulnerabilitySummary(ctx context.Context, digest string, fs *selector.FieldSelector) (SeverityCounts, error)
- func (s *VulnerabilityFindingStore) InitialMigration(ctx context.Context) error
- func (s *VulnerabilityFindingStore) ListCVEEventResolutionCandidates(ctx context.Context) ([]CVEEventResolutionCandidate, error)
- func (s *VulnerabilityFindingStore) ListCriticalCVEEventCandidates(ctx context.Context) ([]CVEEventCandidate, error)
- func (s *VulnerabilityFindingStore) ListDeployedImageDigests(ctx context.Context) ([]string, error)
- func (s *VulnerabilityFindingStore) ListFleetDeviceImageDigests(ctx context.Context, orgId uuid.UUID, fleetName string) ([]DeviceImageDigest, error)
- func (s *VulnerabilityFindingStore) ListOpenWarningSupersedeCVEEventCandidates(ctx context.Context) ([]CVEEventCandidate, error)
- func (s *VulnerabilityFindingStore) ListOrgDeviceImageDigests(ctx context.Context, orgId uuid.UUID) ([]DeviceImageDigest, error)
- func (s *VulnerabilityFindingStore) ListWarningCVEEventCandidates(ctx context.Context) ([]CVEEventCandidate, error)
- func (s *VulnerabilityFindingStore) UpsertFindings(ctx context.Context, findings []model.VulnerabilityFinding) ([]model.ChangedFinding, error)
- type VulnerabilityGroup
- type VulnerabilityGroupResult
- type VulnerabilityListResult
Constants ¶
const ( ConstraintAuthProviderOIDCUnique = "idx_authproviders_oidc_unique" ConstraintAuthProviderOAuth2Unique = "idx_authproviders_oauth2_unique" )
AuthProvider database constraint names
const ( SortByName SortColumn = "name" SortByCreatedAt SortColumn = "created_at" SortAsc SortOrder = "asc" SortDesc SortOrder = "desc" )
Variables ¶
var ( NullOrgId = org.DefaultID CurrentContinueVersion = 1 )
Functions ¶
func AddPaginationToQuery ¶
func BuildContinueString ¶ added in v0.8.1
func CallEventCallback ¶ added in v0.9.0
func CallEventCallback(resourceKind domain.ResourceKind, log logrus.FieldLogger) func(ctx context.Context, callbackEvent EventCallback, orgId uuid.UUID, name string, oldResource, newResource interface{}, created bool, err error)
func CountRemainingItems ¶
func CountRemainingItems(query *gorm.DB, nextValues []string, listParams ListParams) int64
func ErrorFromGormError ¶ added in v0.3.0
ErrorFromGormError translates well-known gorm errors into domain-specific errors. Delegated to storeutil so that packages outside internal/store can reuse the logic.
func InitMigrationDB ¶ added in v0.9.0
func ListQuery ¶ added in v0.3.0
func ListQuery(dest any, opts ...ListQueryOption) *listQuery
func NewTraceContextEnforcer ¶ added in v0.8.1
func SafeEventCallback ¶ added in v0.9.0
func SafeEventCallback(log logrus.FieldLogger, callback func())
Call callback if provided (but don't fail the operation if callback fails) with panic recovery to prevent callback failures from affecting the main operation
func SeverityToRank ¶ added in v1.2.0
func SeverityToRank(severity model.VulnerabilitySeverity) int
SeverityToRank converts a model severity enum to its integer rank used in SQL ordering.
Types ¶
type AuthProvider ¶ added in v1.0.0
type AuthProvider interface {
InitialMigration(ctx context.Context) error
Create(ctx context.Context, orgId uuid.UUID, authProvider *domain.AuthProvider, eventCallback EventCallback) (*domain.AuthProvider, error)
CreateWithFromAPI(ctx context.Context, orgId uuid.UUID, authProvider *domain.AuthProvider, fromAPI bool, eventCallback EventCallback) (*domain.AuthProvider, error)
Update(ctx context.Context, orgId uuid.UUID, authProvider *domain.AuthProvider, eventCallback EventCallback) (*domain.AuthProvider, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, authProvider *domain.AuthProvider, eventCallback EventCallback) (*domain.AuthProvider, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.AuthProvider, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.AuthProviderList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.AuthProvider, eventCallback EventCallback) (*domain.AuthProvider, error)
GetAuthProviderByIssuerAndClientId(ctx context.Context, orgId uuid.UUID, issuer string, clientId string) (*domain.AuthProvider, error)
GetAuthProviderByAuthorizationUrl(ctx context.Context, orgId uuid.UUID, authorizationUrl string) (*domain.AuthProvider, error)
// Used by domain metrics
Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
CountByOrg(ctx context.Context, orgId *uuid.UUID) ([]CountByOrgResult, error)
// ListAll lists all auth providers without org filtering
ListAll(ctx context.Context, listParams ListParams) (*domain.AuthProviderList, error)
}
func NewAuthProvider ¶ added in v1.0.0
func NewAuthProvider(db *gorm.DB, log logrus.FieldLogger) AuthProvider
type AuthProviderStore ¶ added in v1.0.0
type AuthProviderStore struct {
// contains filtered or unexported fields
}
func (*AuthProviderStore) Count ¶ added in v1.0.0
func (s *AuthProviderStore) Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
func (*AuthProviderStore) CountByOrg ¶ added in v1.0.0
func (s *AuthProviderStore) CountByOrg(ctx context.Context, orgId *uuid.UUID) ([]CountByOrgResult, error)
func (*AuthProviderStore) Create ¶ added in v1.0.0
func (s *AuthProviderStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.AuthProvider, eventCallback EventCallback) (*domain.AuthProvider, error)
func (*AuthProviderStore) CreateOrUpdate ¶ added in v1.0.0
func (s *AuthProviderStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *domain.AuthProvider, eventCallback EventCallback) (*domain.AuthProvider, bool, error)
func (*AuthProviderStore) CreateWithFromAPI ¶ added in v1.0.0
func (s *AuthProviderStore) CreateWithFromAPI(ctx context.Context, orgId uuid.UUID, resource *domain.AuthProvider, fromAPI bool, eventCallback EventCallback) (*domain.AuthProvider, error)
func (*AuthProviderStore) Delete ¶ added in v1.0.0
func (s *AuthProviderStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
func (*AuthProviderStore) Get ¶ added in v1.0.0
func (s *AuthProviderStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.AuthProvider, error)
func (*AuthProviderStore) GetAuthProviderByAuthorizationUrl ¶ added in v1.0.0
func (s *AuthProviderStore) GetAuthProviderByAuthorizationUrl(ctx context.Context, orgId uuid.UUID, authorizationUrl string) (*domain.AuthProvider, error)
func (*AuthProviderStore) GetAuthProviderByIssuerAndClientId ¶ added in v1.0.0
func (s *AuthProviderStore) GetAuthProviderByIssuerAndClientId(ctx context.Context, orgId uuid.UUID, issuer string, clientId string) (*domain.AuthProvider, error)
func (*AuthProviderStore) InitialMigration ¶ added in v1.0.0
func (s *AuthProviderStore) InitialMigration(ctx context.Context) error
func (*AuthProviderStore) List ¶ added in v1.0.0
func (s *AuthProviderStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.AuthProviderList, error)
func (*AuthProviderStore) ListAll ¶ added in v1.0.0
func (s *AuthProviderStore) ListAll(ctx context.Context, listParams ListParams) (*domain.AuthProviderList, error)
func (*AuthProviderStore) Update ¶ added in v1.0.0
func (s *AuthProviderStore) Update(ctx context.Context, orgId uuid.UUID, resource *domain.AuthProvider, eventCallback EventCallback) (*domain.AuthProvider, error)
func (*AuthProviderStore) UpdateStatus ¶ added in v1.0.0
func (s *AuthProviderStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.AuthProvider, eventCallback EventCallback) (*domain.AuthProvider, error)
type CVEEventCandidate ¶ added in v1.2.0
type CVEEventCandidate struct {
OrgID uuid.UUID `gorm:"column:org_id"`
DeviceName string `gorm:"column:device_name"`
CveID string `gorm:"column:cve_id"`
ImageDigest string `gorm:"column:image_digest"`
ImageRef string `gorm:"column:image_ref"`
CvssScore float64 `gorm:"column:cvss_score"`
Severity string `gorm:"column:severity"`
}
CVEEventCandidate is one device+CVE row eligible for a new vulnerability event emission.
type CVEEventResolutionCandidate ¶ added in v1.2.0
type CVEEventResolutionCandidate struct {
OrgID uuid.UUID `gorm:"column:org_id"`
DeviceName string `gorm:"column:device_name"`
CveID string `gorm:"column:cve_id"`
ImageDigest string `gorm:"column:image_digest"`
ImageRef string `gorm:"column:image_ref"`
PriorReason string `gorm:"column:prior_reason"`
CvssScore float64 `gorm:"column:cvss_score"`
Severity string `gorm:"column:severity"`
}
CVEEventResolutionCandidate is an open Warning or Critical CVE event that should receive a Resolved event.
type Catalog ¶ added in v1.1.0
type Catalog interface {
InitialMigration(ctx context.Context) error
Create(ctx context.Context, orgId uuid.UUID, catalog *domain.Catalog, callbackEvent EventCallback) (*domain.Catalog, error)
Update(ctx context.Context, orgId uuid.UUID, catalog *domain.Catalog, callbackEvent EventCallback) (*domain.Catalog, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, catalog *domain.Catalog, fromAPI bool, callbackEvent EventCallback) (*domain.Catalog, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.Catalog, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.CatalogList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, callback RemoveOwnerCallback, callbackEvent EventCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.Catalog, eventCallback EventCallback) (*domain.Catalog, error)
Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
UnsetOwner(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, owner string) error
UnsetItemOwner(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, owner string) error
// CatalogItem operations
ListAllItems(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.CatalogItemList, error)
ListItems(ctx context.Context, orgId uuid.UUID, catalogName string, listParams ListParams) (*domain.CatalogItemList, error)
GetItem(ctx context.Context, orgId uuid.UUID, catalogName string, itemName string) (*domain.CatalogItem, error)
CreateItem(ctx context.Context, orgId uuid.UUID, catalogName string, item *domain.CatalogItem) (*domain.CatalogItem, error)
UpdateItem(ctx context.Context, orgId uuid.UUID, catalogName string, item *domain.CatalogItem) (*domain.CatalogItem, error)
CreateOrUpdateItem(ctx context.Context, orgId uuid.UUID, catalogName string, item *domain.CatalogItem) (*domain.CatalogItem, bool, error)
DeleteItem(ctx context.Context, orgId uuid.UUID, catalogName string, itemName string) error
}
func NewCatalog ¶ added in v1.1.0
func NewCatalog(db *gorm.DB, log logrus.FieldLogger) Catalog
type CatalogStore ¶ added in v1.1.0
type CatalogStore struct {
// contains filtered or unexported fields
}
func (*CatalogStore) Count ¶ added in v1.1.0
func (s *CatalogStore) Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
func (*CatalogStore) CreateItem ¶ added in v1.1.0
func (s *CatalogStore) CreateItem(ctx context.Context, orgId uuid.UUID, catalogName string, item *domain.CatalogItem) (*domain.CatalogItem, error)
func (*CatalogStore) CreateOrUpdate ¶ added in v1.1.0
func (*CatalogStore) CreateOrUpdateItem ¶ added in v1.1.0
func (s *CatalogStore) CreateOrUpdateItem(ctx context.Context, orgId uuid.UUID, catalogName string, item *domain.CatalogItem) (*domain.CatalogItem, bool, error)
func (*CatalogStore) Delete ¶ added in v1.1.0
func (s *CatalogStore) Delete(ctx context.Context, orgId uuid.UUID, name string, callback RemoveOwnerCallback, callbackEvent EventCallback) error
func (*CatalogStore) DeleteItem ¶ added in v1.1.0
func (*CatalogStore) GetItem ¶ added in v1.1.0
func (s *CatalogStore) GetItem(ctx context.Context, orgId uuid.UUID, catalogName string, itemName string) (*domain.CatalogItem, error)
func (*CatalogStore) InitialMigration ¶ added in v1.1.0
func (s *CatalogStore) InitialMigration(ctx context.Context) error
func (*CatalogStore) List ¶ added in v1.1.0
func (s *CatalogStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.CatalogList, error)
func (*CatalogStore) ListAllItems ¶ added in v1.1.0
func (s *CatalogStore) ListAllItems(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.CatalogItemList, error)
func (*CatalogStore) ListItems ¶ added in v1.1.0
func (s *CatalogStore) ListItems(ctx context.Context, orgId uuid.UUID, catalogName string, listParams ListParams) (*domain.CatalogItemList, error)
func (*CatalogStore) UnsetItemOwner ¶ added in v1.1.0
func (*CatalogStore) UnsetOwner ¶ added in v1.1.0
func (*CatalogStore) UpdateItem ¶ added in v1.1.0
func (s *CatalogStore) UpdateItem(ctx context.Context, orgId uuid.UUID, catalogName string, item *domain.CatalogItem) (*domain.CatalogItem, error)
func (*CatalogStore) UpdateStatus ¶ added in v1.1.0
type CertificateSigningRequest ¶
type CertificateSigningRequest interface {
InitialMigration(ctx context.Context) error
Create(ctx context.Context, orgId uuid.UUID, req *domain.CertificateSigningRequest, eventCallback EventCallback) (*domain.CertificateSigningRequest, error)
Update(ctx context.Context, orgId uuid.UUID, req *domain.CertificateSigningRequest, eventCallback EventCallback) (*domain.CertificateSigningRequest, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, certificatesigningrequest *domain.CertificateSigningRequest, eventCallback EventCallback) (*domain.CertificateSigningRequest, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.CertificateSigningRequest, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.CertificateSigningRequestList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, certificatesigningrequest *domain.CertificateSigningRequest) (*domain.CertificateSigningRequest, error)
UpdateConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []domain.Condition) error
}
func NewCertificateSigningRequest ¶
func NewCertificateSigningRequest(db *gorm.DB, log logrus.FieldLogger) CertificateSigningRequest
type CertificateSigningRequestStore ¶
type CertificateSigningRequestStore struct {
// contains filtered or unexported fields
}
func (*CertificateSigningRequestStore) Create ¶
func (s *CertificateSigningRequestStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.CertificateSigningRequest, eventCallback EventCallback) (*domain.CertificateSigningRequest, error)
Warning: this is a user-facing function and will set the Status to nil
func (*CertificateSigningRequestStore) CreateOrUpdate ¶
func (s *CertificateSigningRequestStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *domain.CertificateSigningRequest, eventCallback EventCallback) (*domain.CertificateSigningRequest, bool, error)
func (*CertificateSigningRequestStore) Delete ¶
func (s *CertificateSigningRequestStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
func (*CertificateSigningRequestStore) Get ¶
func (s *CertificateSigningRequestStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.CertificateSigningRequest, error)
func (*CertificateSigningRequestStore) InitialMigration ¶
func (s *CertificateSigningRequestStore) InitialMigration(ctx context.Context) error
func (*CertificateSigningRequestStore) List ¶
func (s *CertificateSigningRequestStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.CertificateSigningRequestList, error)
func (*CertificateSigningRequestStore) Update ¶ added in v0.2.0
func (s *CertificateSigningRequestStore) Update(ctx context.Context, orgId uuid.UUID, resource *domain.CertificateSigningRequest, eventCallback EventCallback) (*domain.CertificateSigningRequest, error)
Warning: this is a user-facing function and will set the Status to nil
func (*CertificateSigningRequestStore) UpdateConditions ¶
func (*CertificateSigningRequestStore) UpdateStatus ¶
func (s *CertificateSigningRequestStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.CertificateSigningRequest) (*domain.CertificateSigningRequest, error)
type Checkpoint ¶ added in v0.9.0
type Checkpoint interface {
InitialMigration(ctx context.Context) error
Set(ctx context.Context, consumer string, key string, value []byte) error
Get(ctx context.Context, consumer string, key string) ([]byte, error)
GetDatabaseTime(ctx context.Context) (time.Time, error)
}
func NewCheckpoint ¶ added in v0.9.0
func NewCheckpoint(db *gorm.DB, log logrus.FieldLogger) Checkpoint
type CheckpointStore ¶ added in v0.9.0
type CheckpointStore struct {
// contains filtered or unexported fields
}
func (*CheckpointStore) GetDatabaseTime ¶ added in v0.9.0
func (*CheckpointStore) InitialMigration ¶ added in v0.9.0
func (s *CheckpointStore) InitialMigration(ctx context.Context) error
type Continue ¶
func ParseContinueString ¶
type CountByOrgAndStatusResult ¶ added in v0.10.0
CountByOrgAndStatusResult holds the result of the group by query for organization and status.
type CountByOrgResult ¶ added in v0.10.0
CountByOrgResult holds the result of the group by query for organization.
type CountByResourceSyncOrgAndStatusResult ¶ added in v0.10.0
CountByResourceSyncOrgAndStatusResult holds the result of the group by query for organization and status.
type CountByRolloutStatusResult ¶ added in v0.10.0
CountByRolloutStatusResult holds the result of the group by query for fleet rollout status.
type CreateOrUpdateMode ¶ added in v0.2.0
type CreateOrUpdateMode string
const ( ModeCreateOnly CreateOrUpdateMode = "create-only" ModeUpdateOnly CreateOrUpdateMode = "update-only" ModeCreateOrUpdate CreateOrUpdateMode = "create-or-update" )
type DataStore ¶
type DataStore struct {
// contains filtered or unexported fields
}
func (*DataStore) AuthProvider ¶ added in v1.0.0
func (s *DataStore) AuthProvider() AuthProvider
func (*DataStore) CertificateSigningRequest ¶
func (s *DataStore) CertificateSigningRequest() CertificateSigningRequest
func (*DataStore) CheckHealth ¶ added in v0.10.0
CheckHealth verifies database connectivity and ensures the instance is not in recovery.
func (*DataStore) Checkpoint ¶ added in v0.9.0
func (s *DataStore) Checkpoint() Checkpoint
func (*DataStore) DependencyRef ¶ added in v1.2.0
func (s *DataStore) DependencyRef() DependencyRef
func (*DataStore) EnrollmentRequest ¶
func (s *DataStore) EnrollmentRequest() EnrollmentRequest
func (*DataStore) Organization ¶ added in v0.9.0
func (s *DataStore) Organization() Organization
func (*DataStore) Repository ¶
func (s *DataStore) Repository() Repository
func (*DataStore) ResourceSync ¶
func (s *DataStore) ResourceSync() ResourceSync
func (*DataStore) RunMigrationWithMigrationUser ¶ added in v0.9.0
func (*DataStore) RunMigrations ¶ added in v0.9.0
func (*DataStore) TemplateVersion ¶
func (s *DataStore) TemplateVersion() TemplateVersion
func (*DataStore) VulnerabilityFinding ¶ added in v1.2.0
func (s *DataStore) VulnerabilityFinding() VulnerabilityFinding
type DependencyRef ¶ added in v1.2.0
type DependencyRef interface {
InitialMigration(ctx context.Context) error
Upsert(ctx context.Context, orgID uuid.UUID, ref *model.DependencyRef) error
ListByRefType(ctx context.Context, orgID uuid.UUID, refType string) ([]model.DependencyRef, error)
DeleteByFleet(ctx context.Context, orgID uuid.UUID, fleetName string) error
DeleteByDevice(ctx context.Context, orgID uuid.UUID, deviceName string) error
ReplaceByFleet(ctx context.Context, orgID uuid.UUID, fleetName string, refs []model.DependencyRef) error
ReplaceDeviceRefsByFleet(ctx context.Context, orgID uuid.UUID, fleetName string, refs []model.DependencyRef) error
ReplaceByFleetDevice(ctx context.Context, orgID uuid.UUID, fleetName, deviceName string, refs []model.DependencyRef) error
ReplaceFleetScopedDeviceRefs(ctx context.Context, orgID uuid.UUID, deviceName string, refs []model.DependencyRef) error
ReplaceByStandaloneDevice(ctx context.Context, orgID uuid.UUID, deviceName string, refs []model.DependencyRef) error
BulkUpsertDeviceRefs(ctx context.Context, orgID uuid.UUID, refs []model.DependencyRef) error
ListDueGitDependencies(ctx context.Context, orgID uuid.UUID, pollInterval time.Duration) ([]model.GitDependencyProbe, error)
ListDueHttpDependencies(ctx context.Context, orgID uuid.UUID, pollInterval time.Duration) ([]model.HttpDependencyProbe, error)
ListSecretDependencyTargets(ctx context.Context, secretNamespace, secretName, newFingerprint string) ([]model.SecretDependencyRef, error)
}
func NewDependencyRef ¶ added in v1.2.0
func NewDependencyRef(db *gorm.DB, log logrus.FieldLogger) DependencyRef
type DependencyRefStore ¶ added in v1.2.0
type DependencyRefStore struct {
// contains filtered or unexported fields
}
func (*DependencyRefStore) BulkUpsertDeviceRefs ¶ added in v1.2.0
func (s *DependencyRefStore) BulkUpsertDeviceRefs(ctx context.Context, orgID uuid.UUID, refs []model.DependencyRef) error
BulkUpsertDeviceRefs inserts device-level dependency refs, updating the revision and resource_key on conflict. Used by fleet rollout to populate refs for parameterized git revisions after template resolution.
func (*DependencyRefStore) DeleteByDevice ¶ added in v1.2.0
func (s *DependencyRefStore) DeleteByDevice(ctx context.Context, orgID uuid.UUID, deviceName string) error
DeleteByDevice removes all dependency refs where device_name matches, regardless of fleet_name. This handles both standalone refs and fleet-rollout refs created for parameterized revisions.
func (*DependencyRefStore) DeleteByFleet ¶ added in v1.2.0
func (*DependencyRefStore) InitialMigration ¶ added in v1.2.0
func (s *DependencyRefStore) InitialMigration(ctx context.Context) error
func (*DependencyRefStore) ListByRefType ¶ added in v1.2.0
func (s *DependencyRefStore) ListByRefType(ctx context.Context, orgID uuid.UUID, refType string) ([]model.DependencyRef, error)
func (*DependencyRefStore) ListDueGitDependencies ¶ added in v1.2.0
func (s *DependencyRefStore) ListDueGitDependencies(ctx context.Context, orgID uuid.UUID, pollInterval time.Duration) ([]model.GitDependencyProbe, error)
ListDueGitDependencies returns git dependency probes that are due for polling. It LEFT JOINs dependency_refs with sync_states so that refs without a sync state row (never polled) are included, filters out parameterized revisions, applies the poll-interval time gate, and groups by (repository_name, revision) with array_agg for fan-out targets.
func (*DependencyRefStore) ListDueHttpDependencies ¶ added in v1.2.0
func (s *DependencyRefStore) ListDueHttpDependencies(ctx context.Context, orgID uuid.UUID, pollInterval time.Duration) ([]model.HttpDependencyProbe, error)
ListDueHttpDependencies returns HTTP dependency probes that are due for polling. Mirrors ListDueGitDependencies but filters by ref_type='http' and groups by (repository_name, http_suffix).
func (*DependencyRefStore) ListSecretDependencyTargets ¶ added in v1.2.0
func (s *DependencyRefStore) ListSecretDependencyTargets(ctx context.Context, secretNamespace, secretName, newFingerprint string) ([]model.SecretDependencyRef, error)
ListSecretDependencyTargets returns flat rows of (orgID, fleetName, deviceName) for all dependency_refs matching the given secret where the stored fingerprint differs from newFingerprint (or no fingerprint exists yet).
func (*DependencyRefStore) ReplaceByFleet ¶ added in v1.2.0
func (s *DependencyRefStore) ReplaceByFleet(ctx context.Context, orgID uuid.UUID, fleetName string, refs []model.DependencyRef) error
ReplaceByFleet atomically replaces fleet-level dependency refs (device_name = ”). Device-level refs (populated during fleet rollout) are left untouched.
func (*DependencyRefStore) ReplaceByFleetDevice ¶ added in v1.2.0
func (s *DependencyRefStore) ReplaceByFleetDevice(ctx context.Context, orgID uuid.UUID, fleetName, deviceName string, refs []model.DependencyRef) error
ReplaceByFleetDevice atomically replaces device-level dependency refs for a single device within a fleet. Used by the device-event rollout path so that stale refs are cleaned when a device's resolved revision changes.
func (*DependencyRefStore) ReplaceByStandaloneDevice ¶ added in v1.2.0
func (s *DependencyRefStore) ReplaceByStandaloneDevice(ctx context.Context, orgID uuid.UUID, deviceName string, refs []model.DependencyRef) error
ReplaceByStandaloneDevice atomically replaces all dependency refs for a standalone device (fleet_name = ”, device_name = deviceName).
func (*DependencyRefStore) ReplaceDeviceRefsByFleet ¶ added in v1.2.0
func (s *DependencyRefStore) ReplaceDeviceRefsByFleet(ctx context.Context, orgID uuid.UUID, fleetName string, refs []model.DependencyRef) error
ReplaceDeviceRefsByFleet atomically replaces all device-level dependency refs for a fleet. Fleet-level refs (device_name = ”) are left untouched.
func (*DependencyRefStore) ReplaceFleetScopedDeviceRefs ¶ added in v1.2.0
func (s *DependencyRefStore) ReplaceFleetScopedDeviceRefs(ctx context.Context, orgID uuid.UUID, deviceName string, refs []model.DependencyRef) error
ReplaceFleetScopedDeviceRefs atomically replaces all fleet-scoped refs for a device (any fleet). Used by RolloutDevice to handle fleet-move scenarios where the device's old-fleet refs must be cleaned alongside inserting new-fleet refs. Standalone refs (fleet_name=”) are left untouched.
func (*DependencyRefStore) Upsert ¶ added in v1.2.0
func (s *DependencyRefStore) Upsert(ctx context.Context, orgID uuid.UUID, ref *model.DependencyRef) error
type Device ¶
type Device interface {
InitialMigration(ctx context.Context) error
// Exposed to users
Create(ctx context.Context, orgId uuid.UUID, device *domain.Device, eventCallback EventCallback) (*domain.Device, error)
Update(ctx context.Context, orgId uuid.UUID, device *domain.Device, fieldsToUnset []string, fromAPI bool, validationCallback DeviceStoreValidationCallback, eventCallback EventCallback) (*domain.Device, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, device *domain.Device, fieldsToUnset []string, fromAPI bool, validationCallback DeviceStoreValidationCallback, eventCallback EventCallback) (*domain.Device, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.Device, error)
List(ctx context.Context, orgId uuid.UUID, listParams DeviceListParams) (*domain.DeviceList, error)
Labels(ctx context.Context, orgId uuid.UUID, listParams ListParams) (domain.LabelList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) (bool, error)
UpdateStatus(ctx context.Context, orgId uuid.UUID, device *domain.Device, eventCallback EventCallback) (*domain.Device, error)
GetRendered(ctx context.Context, orgId uuid.UUID, name string, knownRenderedVersion *string, consoleGrpcEndpoint string) (*domain.Device, error)
Healthcheck(ctx context.Context, orgId uuid.UUID, names []string) error
ProcessAwaitingReconnectAnnotation(ctx context.Context, orgId uuid.UUID, deviceName string, deviceReportedVersion *string) (bool, error)
GetLastSeen(ctx context.Context, orgId uuid.UUID, name string) (*time.Time, error)
// Used internally
UpdateAnnotations(ctx context.Context, orgId uuid.UUID, name string, annotations map[string]string, deleteKeys []string) error
UpdateRendered(ctx context.Context, orgId uuid.UUID, name, renderedConfig, renderedApplications, specHash string, configFingerprints []domain.DependencySyncConfigRefStatus) (string, error)
SetServiceConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []domain.Condition, callback ServiceConditionsCallback) error
DecommissionDevice(ctx context.Context, orgId uuid.UUID, name string, decom domain.DeviceDecommission, eventCallback EventCallback) (*domain.Device, error)
OverwriteRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string, repositoryNames ...string) error
GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.RepositoryList, error)
RemoveConflictPausedAnnotation(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, []string, error)
SetOutOfDate(ctx context.Context, orgId uuid.UUID, owner string) error
ListConnectivityChanged(ctx context.Context, orgId uuid.UUID, listParams ListParams, cutoffTime time.Time) (*domain.DeviceList, error)
GetWithTimestamp(ctx context.Context, orgId uuid.UUID, name string) (*domain.Device, error)
// Used only by rollout
Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
UnmarkRolloutSelection(ctx context.Context, orgId uuid.UUID, fleetName string) error
MarkRolloutSelection(ctx context.Context, orgId uuid.UUID, listParams ListParams, limit *int) error
CompletionCounts(ctx context.Context, orgId uuid.UUID, owner string, templateVersion string, updateTimeout *time.Duration) ([]domain.DeviceCompletionCount, error)
CountByLabels(ctx context.Context, orgId uuid.UUID, listParams ListParams, groupBy []string) ([]map[string]any, error)
Summary(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.DevicesSummary, error)
// Used by fleet selector
ListDevicesByServiceCondition(ctx context.Context, orgId uuid.UUID, conditionType string, conditionStatus string, listParams ListParams) (*domain.DeviceList, error)
// Used by tests
SetIntegrationTestCreateOrUpdateCallback(IntegrationTestCallback)
CountByOrgAndStatus(ctx context.Context, orgId *uuid.UUID, statusType DeviceStatusType, groupByFleet bool) ([]CountByOrgAndStatusResult, error)
}
type DeviceImageDigest ¶ added in v1.2.0
DeviceImageDigest aggregates all image refs that resolve to the same digest.
type DeviceListParams ¶ added in v1.2.0
type DeviceListParams struct {
ListParams
CveID *string // Filter devices by CVE ID (join vulnerability_findings; selectors use devices.*)
}
DeviceListParams extends ListParams with device-specific filter options.
type DeviceStatusType ¶ added in v0.10.0
type DeviceStatusType string
DeviceStatusType represents the type of device status to query
const ( DeviceStatusTypeSummary DeviceStatusType = "summary" DeviceStatusTypeApplication DeviceStatusType = "application" DeviceStatusTypeUpdate DeviceStatusType = "update" )
func (DeviceStatusType) String ¶ added in v0.10.0
func (d DeviceStatusType) String() string
String returns the string representation of the status type
func (DeviceStatusType) Validate ¶ added in v0.10.0
func (d DeviceStatusType) Validate() error
Validate ensures the status type is valid
type DeviceStore ¶
type DeviceStore struct {
// contains filtered or unexported fields
}
func (*DeviceStore) CompletionCounts ¶ added in v0.4.0
func (s *DeviceStore) CompletionCounts(ctx context.Context, orgId uuid.UUID, owner string, templateVersion string, updateTimeout *time.Duration) ([]domain.DeviceCompletionCount, error)
CompletionCounts is used for finding if a rollout batch is complete or to set the success percentage of the batch. The result is a count of devices grouped by some fields: - rendered_template_version: taken from the annotation 'device-controller/renderedTemplateVersion' - summary_status: taken from the field 'status.summary.status' - updating_reason: it is the reason field from a condition having type 'Updating' - same_rendered_version: it is the result of comparison for equality between the annotation 'device-controller/renderedVersion' and the field 'status.config.renderedVersion' - update_timed_out: it is a boolean value indicating if the update of the device has been timed out
func (*DeviceStore) Count ¶ added in v0.4.0
func (s *DeviceStore) Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
func (*DeviceStore) CountByLabels ¶ added in v0.4.0
func (s *DeviceStore) CountByLabels(ctx context.Context, orgId uuid.UUID, listParams ListParams, groupBy []string) ([]map[string]any, error)
CountByLabels is used for rollout policy disruption budget to provide device count values grouped by the label values.
func (*DeviceStore) CountByOrgAndStatus ¶ added in v0.10.0
func (s *DeviceStore) CountByOrgAndStatus(ctx context.Context, orgId *uuid.UUID, statusType DeviceStatusType, groupByFleet bool) ([]CountByOrgAndStatusResult, error)
CountByOrgAndStatus returns the count of devices grouped by org_id and status.
func (*DeviceStore) CreateOrUpdate ¶
func (s *DeviceStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *domain.Device, fieldsToUnset []string, fromAPI bool, validationCallback DeviceStoreValidationCallback, eventCallback EventCallback) (*domain.Device, bool, error)
func (*DeviceStore) DecommissionDevice ¶ added in v1.2.0
func (s *DeviceStore) DecommissionDevice(ctx context.Context, orgId uuid.UUID, name string, decom domain.DeviceDecommission, eventCallback EventCallback) (*domain.Device, error)
func (*DeviceStore) Delete ¶
func (s *DeviceStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) (bool, error)
func (*DeviceStore) GetLastSeen ¶ added in v0.10.0
func (*DeviceStore) GetRendered ¶
func (*DeviceStore) GetRepositoryRefs ¶
func (s *DeviceStore) GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.RepositoryList, error)
func (*DeviceStore) GetWithTimestamp ¶ added in v1.2.0
func (*DeviceStore) Healthcheck ¶ added in v0.10.0
func (*DeviceStore) InitialMigration ¶
func (s *DeviceStore) InitialMigration(ctx context.Context) error
func (*DeviceStore) Labels ¶ added in v0.5.0
func (s *DeviceStore) Labels(ctx context.Context, orgId uuid.UUID, listParams ListParams) (domain.LabelList, error)
func (*DeviceStore) List ¶
func (s *DeviceStore) List(ctx context.Context, orgId uuid.UUID, listParams DeviceListParams) (*domain.DeviceList, error)
func (*DeviceStore) ListConnectivityChanged ¶ added in v1.1.0
func (s *DeviceStore) ListConnectivityChanged(ctx context.Context, orgId uuid.UUID, listParams ListParams, cutoffTime time.Time) (*domain.DeviceList, error)
func (*DeviceStore) ListDevicesByServiceCondition ¶ added in v0.9.0
func (s *DeviceStore) ListDevicesByServiceCondition(ctx context.Context, orgId uuid.UUID, conditionType string, conditionStatus string, listParams ListParams) (*domain.DeviceList, error)
func (*DeviceStore) MarkRolloutSelection ¶ added in v0.4.0
func (s *DeviceStore) MarkRolloutSelection(ctx context.Context, orgId uuid.UUID, listParams ListParams, limit *int) error
MarkRolloutSelection marks all devices that can be filtered by the list params. If limit is provided then the number of marked devices will not be greater than the provided limit.
func (*DeviceStore) OverwriteRepositoryRefs ¶
func (*DeviceStore) ProcessAwaitingReconnectAnnotation ¶ added in v0.10.0
func (s *DeviceStore) ProcessAwaitingReconnectAnnotation(ctx context.Context, orgId uuid.UUID, deviceName string, deviceReportedVersion *string) (bool, error)
ProcessAwaitingReconnectAnnotation processes the AwaitingReconnect annotation for a specific device This is called from GetRenderedDevice when a device connects and has the awaiting-reconnect annotation Returns true if the device was moved to conflict paused state, false otherwise
func (*DeviceStore) RemoveConflictPausedAnnotation ¶ added in v0.10.0
func (s *DeviceStore) RemoveConflictPausedAnnotation(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, []string, error)
RemoveConflictPausedAnnotation removes the conflictPaused annotation from all devices matching the selector Returns the count of affected devices and their IDs
func (*DeviceStore) SetIntegrationTestCreateOrUpdateCallback ¶
func (s *DeviceStore) SetIntegrationTestCreateOrUpdateCallback(c IntegrationTestCallback)
func (*DeviceStore) SetOutOfDate ¶ added in v0.10.0
func (*DeviceStore) SetServiceConditions ¶
func (s *DeviceStore) SetServiceConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []domain.Condition, callback ServiceConditionsCallback) error
func (*DeviceStore) Summary ¶ added in v0.3.0
func (s *DeviceStore) Summary(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.DevicesSummary, error)
func (*DeviceStore) UnmarkRolloutSelection ¶ added in v0.4.0
func (s *DeviceStore) UnmarkRolloutSelection(ctx context.Context, orgId uuid.UUID, fleetName string) error
UnmarkRolloutSelection unmarks all previously marked devices for rollout in a fleet
func (*DeviceStore) Update ¶ added in v0.2.0
func (s *DeviceStore) Update(ctx context.Context, orgId uuid.UUID, resource *domain.Device, fieldsToUnset []string, fromAPI bool, validationCallback DeviceStoreValidationCallback, eventCallback EventCallback) (*domain.Device, error)
func (*DeviceStore) UpdateAnnotations ¶
func (*DeviceStore) UpdateRendered ¶
func (s *DeviceStore) UpdateRendered(ctx context.Context, orgId uuid.UUID, name, renderedConfig, renderedApplications, specHash string, configFingerprints []domain.DependencySyncConfigRefStatus) (string, error)
func (*DeviceStore) UpdateStatus ¶
type DeviceStoreValidationCallback ¶ added in v0.4.0
type EnrollmentRequest ¶
type EnrollmentRequest interface {
InitialMigration(ctx context.Context) error
Create(ctx context.Context, orgId uuid.UUID, req *domain.EnrollmentRequest, callbackEvent EventCallback) (*domain.EnrollmentRequest, error)
CreateWithFromAPI(ctx context.Context, orgId uuid.UUID, req *domain.EnrollmentRequest, fromAPI bool, callbackEvent EventCallback) (*domain.EnrollmentRequest, error)
Update(ctx context.Context, orgId uuid.UUID, req *domain.EnrollmentRequest, callbackEvent EventCallback) (*domain.EnrollmentRequest, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, enrollmentrequest *domain.EnrollmentRequest, callbackEvent EventCallback) (*domain.EnrollmentRequest, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.EnrollmentRequest, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.EnrollmentRequestList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, callbackEvent EventCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, enrollmentrequest *domain.EnrollmentRequest, callbackEvent EventCallback) (*domain.EnrollmentRequest, error)
}
func NewEnrollmentRequest ¶
func NewEnrollmentRequest(db *gorm.DB, log logrus.FieldLogger) EnrollmentRequest
type EnrollmentRequestStore ¶
type EnrollmentRequestStore struct {
// contains filtered or unexported fields
}
func (*EnrollmentRequestStore) Create ¶
func (s *EnrollmentRequestStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.EnrollmentRequest, eventCallback EventCallback) (*domain.EnrollmentRequest, error)
func (*EnrollmentRequestStore) CreateOrUpdate ¶
func (s *EnrollmentRequestStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *domain.EnrollmentRequest, eventCallback EventCallback) (*domain.EnrollmentRequest, bool, error)
func (*EnrollmentRequestStore) CreateWithFromAPI ¶ added in v0.10.0
func (s *EnrollmentRequestStore) CreateWithFromAPI(ctx context.Context, orgId uuid.UUID, resource *domain.EnrollmentRequest, fromAPI bool, eventCallback EventCallback) (*domain.EnrollmentRequest, error)
func (*EnrollmentRequestStore) Delete ¶
func (s *EnrollmentRequestStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
func (*EnrollmentRequestStore) Get ¶
func (s *EnrollmentRequestStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.EnrollmentRequest, error)
func (*EnrollmentRequestStore) InitialMigration ¶
func (s *EnrollmentRequestStore) InitialMigration(ctx context.Context) error
func (*EnrollmentRequestStore) List ¶
func (s *EnrollmentRequestStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.EnrollmentRequestList, error)
func (*EnrollmentRequestStore) Update ¶ added in v0.4.0
func (s *EnrollmentRequestStore) Update(ctx context.Context, orgId uuid.UUID, resource *domain.EnrollmentRequest, eventCallback EventCallback) (*domain.EnrollmentRequest, error)
func (*EnrollmentRequestStore) UpdateStatus ¶
func (s *EnrollmentRequestStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.EnrollmentRequest, callbackEvent EventCallback) (*domain.EnrollmentRequest, error)
type Event ¶ added in v0.7.0
type Event interface {
InitialMigration(ctx context.Context) error
Create(ctx context.Context, orgId uuid.UUID, event *domain.Event) error
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.EventList, error)
DeleteOlderThan(ctx context.Context, cutoffTime time.Time) (int64, error)
}
type EventCallback ¶ added in v0.9.0
type EventCallbackCaller ¶ added in v0.9.0
type EventStore ¶ added in v0.7.0
type EventStore struct {
// contains filtered or unexported fields
}
func (*EventStore) DeleteOlderThan ¶ added in v0.7.0
DeleteEventsOlderThan deletes events older than the provided timestamp
func (*EventStore) InitialMigration ¶ added in v0.7.0
func (s *EventStore) InitialMigration(ctx context.Context) error
type Fleet ¶
type Fleet interface {
InitialMigration(ctx context.Context) error
Create(ctx context.Context, orgId uuid.UUID, fleet *domain.Fleet, eventCallback EventCallback) (*domain.Fleet, error)
Update(ctx context.Context, orgId uuid.UUID, fleet *domain.Fleet, fieldsToUnset []string, fromAPI bool, eventCallback EventCallback) (*domain.Fleet, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, fleet *domain.Fleet, fieldsToUnset []string, fromAPI bool, eventCallback EventCallback) (*domain.Fleet, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string, opts ...GetOption) (*domain.Fleet, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams, opts ...ListOption) (*domain.FleetList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, fleet *domain.Fleet) (*domain.Fleet, error)
ListRolloutDeviceSelection(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)
ListDisruptionBudgetFleets(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)
UnsetOwner(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, owner string) error
UnsetOwnerByKind(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, resourceKind string) error
UpdateConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []domain.Condition, eventCallback EventCallback) error
UpdateAnnotations(ctx context.Context, orgId uuid.UUID, name string, annotations map[string]string, deleteKeys []string, eventCallback EventCallback) error
OverwriteRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string, repositoryNames ...string) error
GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.RepositoryList, error)
// Used by domain metrics
CountByRolloutStatus(ctx context.Context, orgId *uuid.UUID, _ *string) ([]CountByRolloutStatusResult, error)
}
type FleetSeverityCounts ¶ added in v1.2.0
type FleetSeverityCounts struct {
SeverityCounts
UniqueDigests int64
}
FleetSeverityCounts extends SeverityCounts with the unique digest count for a fleet.
type FleetStore ¶
type FleetStore struct {
// contains filtered or unexported fields
}
func (*FleetStore) CountByRolloutStatus ¶ added in v0.10.0
func (s *FleetStore) CountByRolloutStatus(ctx context.Context, orgId *uuid.UUID, _ *string) ([]CountByRolloutStatusResult, error)
CountByRolloutStatus returns the count of fleets grouped by org_id and rollout status.
func (*FleetStore) CreateOrUpdate ¶
func (*FleetStore) Delete ¶
func (s *FleetStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
func (*FleetStore) GetRepositoryRefs ¶
func (s *FleetStore) GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.RepositoryList, error)
func (*FleetStore) InitialMigration ¶
func (s *FleetStore) InitialMigration(ctx context.Context) error
func (*FleetStore) List ¶
func (s *FleetStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams, opts ...ListOption) (*domain.FleetList, error)
func (*FleetStore) ListDisruptionBudgetFleets ¶ added in v0.4.0
func (s *FleetStore) ListDisruptionBudgetFleets(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)
ListDisruptionBudgetFleets attempts to get fleets for disruption budget. Since the disruption budget acts like a gate to device rendering, the query searches for fleets that each contains at least 1 device that has different value set between tha annotation 'device-controller/templateVersion' which is set before rollout and 'device-controller/renderedTemplateVersion' which is set after rollout.
func (*FleetStore) ListIgnoreOrg ¶
A method to get all Fleets regardless of ownership. Used internally by the DeviceUpdater. TODO: Add pagination, perhaps via gorm scopes.
func (*FleetStore) ListRolloutDeviceSelection ¶ added in v0.4.0
func (s *FleetStore) ListRolloutDeviceSelection(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)
ListRolloutDeviceSelection attempts to get all relevant fleets for rollout device selection. A relevant fleet contains at least 1 device that at least one of the conditions below is true: - marked as selected for rollout - the template version of the fleet is not the same the template version in the annotation 'device-controller/renderedTemplateVersion' - the field 'status.config.renderedVersion' is not the same as the annotation 'device-controller/renderedVersion'
func (*FleetStore) OverwriteRepositoryRefs ¶
func (*FleetStore) UnsetOwner ¶
func (*FleetStore) UnsetOwnerByKind ¶
func (*FleetStore) UpdateAnnotations ¶
func (*FleetStore) UpdateConditions ¶
func (s *FleetStore) UpdateConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []domain.Condition, eventCallback EventCallback) error
type GenericStore ¶ added in v0.4.0
type GenericStore[P extInt[M], M Model, A any, AL any] struct { // Callback for integration tests to inject logic IntegrationTestCreateOrUpdateCallback IntegrationTestCallback // contains filtered or unexported fields }
func NewGenericStore ¶ added in v0.4.0
func NewGenericStore[P extInt[M], M Model, A any, AL any]( db *gorm.DB, log logrus.FieldLogger, apiToModelPtr func(*A) (P, error), modelPtrToAPI func(P, ...model.APIResourceOption) (*A, error), listModelToAPI func([]M, *string, *int64) (AL, error), ) *GenericStore[P, M, A, AL]
func (*GenericStore[P, M, A, AL]) CreateOrUpdate ¶ added in v0.4.0
func (*GenericStore[P, M, A, AL]) List ¶ added in v0.4.0
func (s *GenericStore[P, M, A, AL]) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*AL, error)
func (*GenericStore[P, M, A, AL]) UpdateStatus ¶ added in v0.4.0
type GroupedVulnPageRow ¶ added in v1.2.0
type GroupedVulnPageRow struct {
CveID string
SeverityRank int
MaxCvssScore *float64
MaxPublishedAt *time.Time
}
GroupedVulnPageRow holds the per-CVE aggregated data for pagination (without full findings).
type ImpactDigestDetail ¶ added in v1.2.0
type ImpactDigestDetail struct {
Owner *string `gorm:"column:owner"`
ImageDigest string `gorm:"column:image_digest"`
ImageRefsJSON []byte `gorm:"column:image_refs_json"`
DeviceCount int64 `gorm:"column:device_count"`
Severity string `gorm:"column:severity"`
CvssScore *float64 `gorm:"column:cvss_score"`
AdvisoryID *string `gorm:"column:advisory_id"`
IssuerName *string `gorm:"column:issuer_name"`
Description *string `gorm:"column:description"`
PublishedAt *time.Time `gorm:"column:published_at"`
FirstSeenAt *time.Time `gorm:"column:first_seen_at"`
}
ImpactDigestDetail holds per-(owner, digest) details: imageRefs, device count, and vulnerability metadata.
type ImpactPageResult ¶ added in v1.2.0
type ImpactPageResult struct {
Rows []ImpactPageRow
TotalFleets int64
WorstSeverity string
MaxCvssScore *float64
MaxPublishedAt *time.Time
Continue *string
}
ImpactPageResult holds the page rows plus top-level aggregates for the entire CVE impact.
type ImpactPageRow ¶ added in v1.2.0
type ImpactPageRow struct {
Owner *string `gorm:"column:owner"`
DeviceAffected int64 `gorm:"column:device_affected"`
}
ImpactPageRow is one row for the page-level query (owner-level aggregates + digest list).
type IntegrationTestCallback ¶
type IntegrationTestCallback func()
type ListOption ¶
type ListOption func(*listOptions)
func ListWithDevicesSummary ¶ added in v0.4.0
func ListWithDevicesSummary(val bool) ListOption
type ListParams ¶
type ListParams struct {
Limit int
Continue *Continue
FieldSelector *selector.FieldSelector
LabelSelector *selector.LabelSelector
AnnotationSelector *selector.AnnotationSelector
SortOrder *SortOrder
SortColumns []SortColumn
}
type ListQueryOption ¶ added in v0.5.0
type ListQueryOption func(*listQuery)
func WithSelectorResolver ¶ added in v0.5.0
func WithSelectorResolver(resolver selector.Resolver) ListQueryOption
type Model ¶ added in v0.4.0
type Model interface {
model.AuthProvider | model.Catalog | model.CertificateSigningRequest | model.Device | model.EnrollmentRequest | model.Fleet | model.Repository | model.ResourceSync | model.TemplateVersion | model.Event
}
GenericStore provides generic CRUD operations for resources P is a pointer to a model, for example: *model.Device M is the model, for example: model.Device A is the API resource, for example: domain.Device AL is the API list, for example: domain.DeviceList
type OrgVulnerabilitySummary ¶ added in v1.2.0
type OrgVulnerabilitySummary struct {
CvesBySeverity SeverityCounts
}
OrgVulnerabilitySummary holds distinct CVE counts and distinct device counts per finding severity for an organization (tenant-scoped via devices ⨝ vulnerability_findings).
type Organization ¶ added in v0.9.0
type Organization interface {
InitialMigration(ctx context.Context) error
Create(ctx context.Context, org *model.Organization) (*model.Organization, error)
UpsertMany(ctx context.Context, orgs []*model.Organization) ([]*model.Organization, error)
List(ctx context.Context, listParams ListParams) ([]*model.Organization, error)
ListByExternalIDs(ctx context.Context, externalIDs []string) ([]*model.Organization, error)
ListByIDs(ctx context.Context, ids []string) ([]*model.Organization, error)
GetByID(ctx context.Context, id uuid.UUID) (*model.Organization, error)
}
func NewOrganization ¶ added in v0.9.0
func NewOrganization(db *gorm.DB) Organization
type OrganizationStore ¶ added in v0.9.0
type OrganizationStore struct {
// contains filtered or unexported fields
}
func (*OrganizationStore) Create ¶ added in v0.9.0
func (s *OrganizationStore) Create(ctx context.Context, org *model.Organization) (*model.Organization, error)
func (*OrganizationStore) GetByID ¶ added in v0.9.0
func (s *OrganizationStore) GetByID(ctx context.Context, id uuid.UUID) (*model.Organization, error)
func (*OrganizationStore) InitialMigration ¶ added in v0.9.0
func (s *OrganizationStore) InitialMigration(ctx context.Context) error
func (*OrganizationStore) List ¶ added in v0.9.0
func (s *OrganizationStore) List(ctx context.Context, listParams ListParams) ([]*model.Organization, error)
func (*OrganizationStore) ListByExternalIDs ¶ added in v0.10.0
func (s *OrganizationStore) ListByExternalIDs(ctx context.Context, externalIDs []string) ([]*model.Organization, error)
func (*OrganizationStore) ListByIDs ¶ added in v1.0.0
func (s *OrganizationStore) ListByIDs(ctx context.Context, ids []string) ([]*model.Organization, error)
func (*OrganizationStore) UpsertMany ¶ added in v0.10.0
func (s *OrganizationStore) UpsertMany(ctx context.Context, orgs []*model.Organization) ([]*model.Organization, error)
type RemoveOwnerCallback ¶ added in v0.10.0
type Repository ¶
type Repository interface {
InitialMigration(ctx context.Context) error
Create(ctx context.Context, orgId uuid.UUID, repository *domain.Repository, eventCallback EventCallback) (*domain.Repository, error)
Update(ctx context.Context, orgId uuid.UUID, repository *domain.Repository, eventCallback EventCallback) (*domain.Repository, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, repository *domain.Repository, eventCallback EventCallback) (*domain.Repository, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.Repository, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.RepositoryList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.Repository, eventCallback EventCallback) (*domain.Repository, error)
GetFleetRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.FleetList, error)
GetDeviceRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.DeviceList, error)
// Used by domain metrics
Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
CountByOrg(ctx context.Context, orgId *uuid.UUID) ([]CountByOrgResult, error)
}
func NewRepository ¶
func NewRepository(db *gorm.DB, log logrus.FieldLogger) Repository
type RepositoryStore ¶
type RepositoryStore struct {
// contains filtered or unexported fields
}
func (*RepositoryStore) Count ¶ added in v0.10.0
func (s *RepositoryStore) Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
func (*RepositoryStore) CountByOrg ¶ added in v0.10.0
func (s *RepositoryStore) CountByOrg(ctx context.Context, orgId *uuid.UUID) ([]CountByOrgResult, error)
CountByOrg returns the count of repositories grouped by org_id.
func (*RepositoryStore) Create ¶
func (s *RepositoryStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.Repository, eventCallback EventCallback) (*domain.Repository, error)
func (*RepositoryStore) CreateOrUpdate ¶
func (s *RepositoryStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *domain.Repository, eventCallback EventCallback) (*domain.Repository, bool, error)
func (*RepositoryStore) Delete ¶
func (s *RepositoryStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
func (*RepositoryStore) Get ¶
func (s *RepositoryStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.Repository, error)
func (*RepositoryStore) GetDeviceRefs ¶
func (s *RepositoryStore) GetDeviceRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.DeviceList, error)
func (*RepositoryStore) GetFleetRefs ¶
func (*RepositoryStore) GetInternal ¶
func (s *RepositoryStore) GetInternal(ctx context.Context, orgId uuid.UUID, name string) (*model.Repository, error)
func (*RepositoryStore) InitialMigration ¶
func (s *RepositoryStore) InitialMigration(ctx context.Context) error
func (*RepositoryStore) List ¶
func (s *RepositoryStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.RepositoryList, error)
func (*RepositoryStore) ListIgnoreOrg ¶
func (s *RepositoryStore) ListIgnoreOrg(ctx context.Context) ([]model.Repository, error)
A method to get all Repositories with secrets, regardless of ownership. Used internally by the RepoTester. TODO: Add pagination, perhaps via gorm scopes.
func (*RepositoryStore) Update ¶ added in v0.2.0
func (s *RepositoryStore) Update(ctx context.Context, orgId uuid.UUID, resource *domain.Repository, eventCallback EventCallback) (*domain.Repository, error)
func (*RepositoryStore) UpdateStatus ¶ added in v0.6.0
func (s *RepositoryStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.Repository, eventCallback EventCallback) (*domain.Repository, error)
type ResourceSync ¶
type ResourceSync interface {
InitialMigration(ctx context.Context) error
Create(ctx context.Context, orgId uuid.UUID, resourceSync *domain.ResourceSync, callbackEvent EventCallback) (*domain.ResourceSync, error)
Update(ctx context.Context, orgId uuid.UUID, resourceSync *domain.ResourceSync, callbackEvent EventCallback) (*domain.ResourceSync, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resourceSync *domain.ResourceSync, callbackEvent EventCallback) (*domain.ResourceSync, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.ResourceSync, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.ResourceSyncList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, callback RemoveOwnerCallback, callbackEvent EventCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.ResourceSync, eventCallback EventCallback) (*domain.ResourceSync, error)
Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
CountByOrgAndStatus(ctx context.Context, orgId *uuid.UUID, status *string) ([]CountByResourceSyncOrgAndStatusResult, error)
}
func NewResourceSync ¶
func NewResourceSync(db *gorm.DB, log logrus.FieldLogger) ResourceSync
type ResourceSyncStore ¶
type ResourceSyncStore struct {
// contains filtered or unexported fields
}
func (*ResourceSyncStore) Count ¶ added in v0.10.0
func (s *ResourceSyncStore) Count(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, error)
func (*ResourceSyncStore) CountByOrgAndStatus ¶ added in v0.10.0
func (s *ResourceSyncStore) CountByOrgAndStatus(ctx context.Context, orgId *uuid.UUID, status *string) ([]CountByResourceSyncOrgAndStatusResult, error)
CountByOrgAndStatus returns the count of resource syncs grouped by org_id and status.
func (*ResourceSyncStore) Create ¶
func (s *ResourceSyncStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.ResourceSync, eventCallback EventCallback) (*domain.ResourceSync, error)
func (*ResourceSyncStore) CreateOrUpdate ¶
func (s *ResourceSyncStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *domain.ResourceSync, eventCallback EventCallback) (*domain.ResourceSync, bool, error)
func (*ResourceSyncStore) Delete ¶
func (s *ResourceSyncStore) Delete(ctx context.Context, orgId uuid.UUID, name string, callback RemoveOwnerCallback, callbackEvent EventCallback) error
func (*ResourceSyncStore) Get ¶
func (s *ResourceSyncStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.ResourceSync, error)
func (*ResourceSyncStore) InitialMigration ¶
func (s *ResourceSyncStore) InitialMigration(ctx context.Context) error
func (*ResourceSyncStore) List ¶
func (s *ResourceSyncStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.ResourceSyncList, error)
func (*ResourceSyncStore) Update ¶ added in v0.2.0
func (s *ResourceSyncStore) Update(ctx context.Context, orgId uuid.UUID, resource *domain.ResourceSync, eventCallback EventCallback) (*domain.ResourceSync, error)
func (*ResourceSyncStore) UpdateStatus ¶ added in v0.6.0
func (s *ResourceSyncStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.ResourceSync, eventCallback EventCallback) (*domain.ResourceSync, error)
type ServiceConditionsCallback ¶ added in v0.9.0
type SeverityCounts ¶ added in v1.2.0
type SeverityCounts struct {
Total int64
Critical int64
High int64
Medium int64
Low int64
None int64
Unknown int64
}
SeverityCounts holds per-severity CVE counts for a result set.
type SortColumn ¶ added in v0.8.1
type SortColumn string
const ( SortByOwner SortColumn = "owner" SortByDeviceAffected SortColumn = "device_affected" SortBySeverity SortColumn = "severity" SortByCvssScore SortColumn = "cvss_score" SortByPublishedAt SortColumn = "published_at" SortByCveId SortColumn = "cve_id" )
Sort columns for vulnerability queries.
type StatusCount ¶
type StatusCountList ¶ added in v0.3.0
type StatusCountList []StatusCount
func CountStatusList ¶ added in v0.3.0
type Store ¶
type Store interface {
Device() Device
EnrollmentRequest() EnrollmentRequest
CertificateSigningRequest() CertificateSigningRequest
Fleet() Fleet
TemplateVersion() TemplateVersion
Repository() Repository
ResourceSync() ResourceSync
Catalog() Catalog
Event() Event
Checkpoint() Checkpoint
Organization() Organization
AuthProvider() AuthProvider
VulnerabilityFinding() VulnerabilityFinding
SyncState() SyncState
DependencyRef() DependencyRef
RunMigrations(context.Context) error
CheckHealth(context.Context) error
Close() error
}
type SyncState ¶ added in v1.2.0
type SyncState interface {
InitialMigration(ctx context.Context) error
Get(ctx context.Context, orgID uuid.UUID, resourceKey string) (*model.SyncState, error)
Set(ctx context.Context, orgID uuid.UUID, state *model.SyncState) error
SetLastCheckedAt(ctx context.Context, orgID uuid.UUID, resourceKey string, t time.Time) error
BulkUpsert(ctx context.Context, orgID uuid.UUID, states []model.SyncState) error
BulkUpdateLastCheckedAt(ctx context.Context, orgID uuid.UUID, resourceKeys []string, t time.Time) error
}
func NewSyncState ¶ added in v1.2.0
func NewSyncState(db *gorm.DB, log logrus.FieldLogger) SyncState
type SyncStateStore ¶ added in v1.2.0
type SyncStateStore struct {
// contains filtered or unexported fields
}
func (*SyncStateStore) BulkUpdateLastCheckedAt ¶ added in v1.2.0
func (s *SyncStateStore) BulkUpdateLastCheckedAt(ctx context.Context, orgID uuid.UUID, resourceKeys []string, t time.Time) error
BulkUpdateLastCheckedAt updates last_checked_at for all given resource keys in a single statement. It also resets probe_status to "Synced" and clears probe_message so that transient probe failures don't persist across successful unchanged polls.
func (*SyncStateStore) BulkUpsert ¶ added in v1.2.0
func (s *SyncStateStore) BulkUpsert(ctx context.Context, orgID uuid.UUID, states []model.SyncState) error
BulkUpsert inserts or updates multiple sync state rows in a single batch.
func (*SyncStateStore) InitialMigration ¶ added in v1.2.0
func (s *SyncStateStore) InitialMigration(ctx context.Context) error
type TemplateVersion ¶
type TemplateVersion interface {
InitialMigration(ctx context.Context) error
Create(ctx context.Context, orgId uuid.UUID, templateVersion *domain.TemplateVersion, eventCallback EventCallback) (*domain.TemplateVersion, error)
Get(ctx context.Context, orgId uuid.UUID, fleet string, name string) (*domain.TemplateVersion, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.TemplateVersionList, error)
Delete(ctx context.Context, orgId uuid.UUID, fleet string, name string, eventCallback EventCallback) (bool, error)
GetLatest(ctx context.Context, orgId uuid.UUID, fleet string) (*domain.TemplateVersion, error)
UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.TemplateVersion, valid *bool) error
}
func NewTemplateVersion ¶
func NewTemplateVersion(db *gorm.DB, log logrus.FieldLogger) TemplateVersion
type TemplateVersionStore ¶
type TemplateVersionStore struct {
// contains filtered or unexported fields
}
func (*TemplateVersionStore) Create ¶
func (s *TemplateVersionStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.TemplateVersion, eventCallback EventCallback) (*domain.TemplateVersion, error)
func (*TemplateVersionStore) Delete ¶
func (s *TemplateVersionStore) Delete(ctx context.Context, orgId uuid.UUID, fleet string, name string, eventCallback EventCallback) (bool, error)
func (*TemplateVersionStore) Get ¶
func (s *TemplateVersionStore) Get(ctx context.Context, orgId uuid.UUID, fleet string, name string) (*domain.TemplateVersion, error)
func (*TemplateVersionStore) GetLatest ¶ added in v0.4.0
func (s *TemplateVersionStore) GetLatest(ctx context.Context, orgId uuid.UUID, fleet string) (*domain.TemplateVersion, error)
func (*TemplateVersionStore) InitialMigration ¶
func (s *TemplateVersionStore) InitialMigration(ctx context.Context) error
func (*TemplateVersionStore) List ¶
func (s *TemplateVersionStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*domain.TemplateVersionList, error)
func (*TemplateVersionStore) UpdateStatus ¶
func (s *TemplateVersionStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.TemplateVersion, valid *bool) error
type VulnerabilityFinding ¶ added in v1.2.0
type VulnerabilityFinding interface {
InitialMigration(ctx context.Context) error
ListDeployedImageDigests(ctx context.Context) ([]string, error)
// UpsertFindings inserts or updates vulnerability findings and returns the findings
// that were actually inserted or had their severity/status changed.
UpsertFindings(ctx context.Context, findings []model.VulnerabilityFinding) ([]model.ChangedFinding, error)
// GetVulnerabilities returns paginated findings for a single image digest.
// Supports cursor-based pagination via ListParams.Continue and sorting via ListParams.SortColumns
// (SortBySeverity, SortByCvssScore, SortByPublishedAt, SortByCveId).
GetVulnerabilities(ctx context.Context, digest string, listParams ListParams) (*VulnerabilityListResult, error)
// GetVulnerabilitySummary returns the severity counts for a single image digest.
GetVulnerabilitySummary(ctx context.Context, digest string, fieldSelector *selector.FieldSelector) (SeverityCounts, error)
// ListFleetDeviceImageDigests returns the (image, imageDigest, deviceCount) rows for all
// non-deleted devices that belong to the given fleet within the given org.
ListFleetDeviceImageDigests(ctx context.Context, orgId uuid.UUID, fleetName string) ([]DeviceImageDigest, error)
// ListOrgDeviceImageDigests returns per-digest device totals and image refs for all
// non-deleted devices in the organization (any fleet or fleetless).
ListOrgDeviceImageDigests(ctx context.Context, orgId uuid.UUID) ([]DeviceImageDigest, error)
// GetVulnerabilityGroups returns findings grouped by CVE across multiple image digests.
// Supports cursor-based pagination via ListParams.Continue and sorting via ListParams.SortColumns
// (SortBySeverity, SortByCvssScore, SortByPublishedAt, SortByCveId).
GetVulnerabilityGroups(ctx context.Context, digests []DeviceImageDigest, listParams ListParams) (*VulnerabilityGroupResult, error)
// GetFleetVulnerabilitySummary returns the severity summary across multiple image digests using SQL aggregation.
GetFleetVulnerabilitySummary(ctx context.Context, digests []DeviceImageDigest, fieldSelector *selector.FieldSelector) (FleetSeverityCounts, error)
// GetOrgVulnerabilitySummary returns per-severity CVE and affected-device counts for an organization.
GetOrgVulnerabilitySummary(ctx context.Context, orgID uuid.UUID) (OrgVulnerabilitySummary, error)
// FindAnyFindingForCVE returns any finding row for the CVE, or nil if none exist.
FindAnyFindingForCVE(ctx context.Context, cveID string) (*model.VulnerabilityFinding, error)
// FindingsForCVEAndImageDigests returns findings for the CVE limited to the given digests (empty digests => empty slice).
FindingsForCVEAndImageDigests(ctx context.Context, cveID string, imageDigests []string) ([]model.VulnerabilityFinding, error)
// GetVulnerabilityImpactPage returns one page of fleets with fleet totals, digest lists, and top-level CVE aggregates.
// Supports cursor-based pagination via ListParams.Continue and sorting via ListParams.SortColumns (SortByOwner or SortByDeviceAffected).
GetVulnerabilityImpactPage(ctx context.Context, orgID uuid.UUID, cveID string, listParams ListParams) (*ImpactPageResult, error)
// GetImpactDigestDetails returns per-(owner, digest) device counts and vulnerability metadata for the given owners.
GetImpactDigestDetails(ctx context.Context, orgID uuid.UUID, cveID string, owners []string, includeNull bool) ([]ImpactDigestDetail, error)
// ListCVEEventResolutionCandidates returns open Warning/Critical CVE events that merit a Resolved event (PostgreSQL only).
ListCVEEventResolutionCandidates(ctx context.Context) ([]CVEEventResolutionCandidate, error)
// ListOpenWarningSupersedeCVEEventCandidates returns device/CVE rows crossing critical severity with an open Warning (PostgreSQL only).
ListOpenWarningSupersedeCVEEventCandidates(ctx context.Context) ([]CVEEventCandidate, error)
// ListCriticalCVEEventCandidates returns device/CVE rows with Critical severity eligible for a Critical event (PostgreSQL only).
ListCriticalCVEEventCandidates(ctx context.Context) ([]CVEEventCandidate, error)
// ListWarningCVEEventCandidates returns device/CVE rows with High severity eligible for a Warning event (PostgreSQL only).
ListWarningCVEEventCandidates(ctx context.Context) ([]CVEEventCandidate, error)
// ComputeAllCVEActions computes all CVE event actions from changed findings and device image changes.
// Returns a list of actions (new, supersede, resolved) to apply to device_open_cve_events.
ComputeAllCVEActions(ctx context.Context, changedFindings []model.ChangedFinding, lastSnapshot time.Time) ([]model.CVEEventAction, error)
// BatchUpdateOpenEvents applies CVE event actions to device_open_cve_events using batch INSERT/UPDATE/DELETE.
// Returns the actions that were actually applied (for event emission).
BatchUpdateOpenEvents(ctx context.Context, actions []model.CVEEventAction) ([]model.CVEEventAction, error)
}
func NewVulnerabilityFinding ¶ added in v1.2.0
func NewVulnerabilityFinding(db *gorm.DB, log logrus.FieldLogger) VulnerabilityFinding
type VulnerabilityFindingStore ¶ added in v1.2.0
type VulnerabilityFindingStore struct {
// contains filtered or unexported fields
}
func (*VulnerabilityFindingStore) BatchUpdateOpenEvents ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) BatchUpdateOpenEvents(ctx context.Context, actions []model.CVEEventAction) ([]model.CVEEventAction, error)
BatchUpdateOpenEvents applies CVE event actions to device_open_cve_events using batch queries. Returns the actions that were actually applied (for event emission).
func (*VulnerabilityFindingStore) ComputeAllCVEActions ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) ComputeAllCVEActions(ctx context.Context, changedFindings []model.ChangedFinding, lastSnapshot time.Time) ([]model.CVEEventAction, error)
ComputeAllCVEActions computes all CVE event actions from changed findings and device image changes. It combines two sources of deltas: 1. Finding actions: Changed findings expanded to device-CVE pairs, compared against open events 2. Device actions: Devices that changed images since lastSnapshot Returns a unified list of actions (new, supersede, resolved) to apply.
func (*VulnerabilityFindingStore) FindAnyFindingForCVE ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) FindAnyFindingForCVE(ctx context.Context, cveID string) (*model.VulnerabilityFinding, error)
func (*VulnerabilityFindingStore) FindingsForCVEAndImageDigests ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) FindingsForCVEAndImageDigests(ctx context.Context, cveID string, imageDigests []string) ([]model.VulnerabilityFinding, error)
func (*VulnerabilityFindingStore) GetFleetVulnerabilitySummary ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) GetFleetVulnerabilitySummary( ctx context.Context, digests []DeviceImageDigest, fs *selector.FieldSelector, ) (FleetSeverityCounts, error)
GetFleetVulnerabilitySummary returns the fleet-level severity summary across multiple image digests using a single SQL aggregation — no in-memory iteration.
func (*VulnerabilityFindingStore) GetImpactDigestDetails ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) GetImpactDigestDetails( ctx context.Context, orgID uuid.UUID, cveID string, owners []string, includeNull bool, ) ([]ImpactDigestDetail, error)
func (*VulnerabilityFindingStore) GetOrgVulnerabilitySummary ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) GetOrgVulnerabilitySummary(ctx context.Context, orgID uuid.UUID) (OrgVulnerabilitySummary, error)
func (*VulnerabilityFindingStore) GetVulnerabilities ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) GetVulnerabilities( ctx context.Context, digest string, listParams ListParams, ) (*VulnerabilityListResult, error)
func (*VulnerabilityFindingStore) GetVulnerabilityGroups ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) GetVulnerabilityGroups( ctx context.Context, digests []DeviceImageDigest, listParams ListParams, ) (*VulnerabilityGroupResult, error)
GetVulnerabilityGroups returns CVE groups for the given image digests using two queries:
Step 1 — lightweight GROUP BY: computes only the three sort fields and COUNT(*) OVER() for the total count, then applies LIMIT/OFFSET to get exactly the page of CVE IDs.
Step 2 — targeted fetch: loads full findings only for those CVEs (at most pageSize × fleetImageCount rows, typically < 200). The Go assembly collects unique image digests per CVE from the fetched findings.
func (*VulnerabilityFindingStore) GetVulnerabilityImpactPage ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) GetVulnerabilityImpactPage( ctx context.Context, orgID uuid.UUID, cveID string, listParams ListParams, ) (*ImpactPageResult, error)
func (*VulnerabilityFindingStore) GetVulnerabilitySummary ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) GetVulnerabilitySummary( ctx context.Context, digest string, fs *selector.FieldSelector, ) (SeverityCounts, error)
GetSummaryByDigest returns the full (unpaginated) severity counts for a single image digest.
func (*VulnerabilityFindingStore) InitialMigration ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) InitialMigration(ctx context.Context) error
func (*VulnerabilityFindingStore) ListCVEEventResolutionCandidates ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) ListCVEEventResolutionCandidates(ctx context.Context) ([]CVEEventResolutionCandidate, error)
ListCVEEventResolutionCandidates returns open Warning or Critical CVE events that should receive a Resolved event.
func (*VulnerabilityFindingStore) ListCriticalCVEEventCandidates ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) ListCriticalCVEEventCandidates(ctx context.Context) ([]CVEEventCandidate, error)
ListCriticalCVEEventCandidates returns device+CVE rows with Critical severity that need a Critical event.
func (*VulnerabilityFindingStore) ListDeployedImageDigests ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) ListDeployedImageDigests(ctx context.Context) ([]string, error)
ListDeployedImageDigests returns the distinct set of OS image digests reported across all devices (all organizations), excluding empty or NULL values.
func (*VulnerabilityFindingStore) ListFleetDeviceImageDigests ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) ListFleetDeviceImageDigests( ctx context.Context, orgId uuid.UUID, fleetName string, ) ([]DeviceImageDigest, error)
ListFleetDeviceImageDigests returns per-digest device totals and all image refs reported for each digest by devices in the given fleet and organization.
func (*VulnerabilityFindingStore) ListOpenWarningSupersedeCVEEventCandidates ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) ListOpenWarningSupersedeCVEEventCandidates(ctx context.Context) ([]CVEEventCandidate, error)
ListOpenWarningSupersedeCVEEventCandidates returns device+CVE rows that qualify for Critical severity and still have an open Warning (emit Resolved before Critical).
func (*VulnerabilityFindingStore) ListOrgDeviceImageDigests ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) ListOrgDeviceImageDigests( ctx context.Context, orgId uuid.UUID, ) ([]DeviceImageDigest, error)
ListOrgDeviceImageDigests returns per-digest device totals and all image refs reported for each digest by non-deleted devices in the given organization.
This is the tenant boundary for org-wide vulnerability APIs: only devices with matching org_id contribute digests (see devices.org_id in the query below).
func (*VulnerabilityFindingStore) ListWarningCVEEventCandidates ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) ListWarningCVEEventCandidates(ctx context.Context) ([]CVEEventCandidate, error)
ListWarningCVEEventCandidates returns device+CVE rows with High severity that need a Warning event.
func (*VulnerabilityFindingStore) UpsertFindings ¶ added in v1.2.0
func (s *VulnerabilityFindingStore) UpsertFindings(ctx context.Context, findings []model.VulnerabilityFinding) ([]model.ChangedFinding, error)
UpsertFindings inserts or updates vulnerability findings and returns the findings that were actually inserted or had their severity/status changed. All metadata fields (advisory_id, cvss_score, description, published_at) are always refreshed on conflict, but only findings with severity/status changes are returned. Returned findings include SeverityChanged and StatusChanged flags for event emission. Uses PostgreSQL CTEs to capture old values and compute change flags efficiently.
type VulnerabilityGroup ¶ added in v1.2.0
type VulnerabilityGroup struct {
CveID string
SeverityRank int
MaxCvssScore *float64
MaxPublishedAt *time.Time
Findings []model.VulnerabilityFinding
}
VulnerabilityGroup is the per-CVE result returned by GetVulnerabilityGroups. SeverityRank is the integer rank (1=Critical … 6=None; 7=unrecognized severity) from the SQL severity expression; use model.VulnerabilitySeverityFromRank to recover the string. Findings contains the raw store rows for all (image_digest, cve_id) pairs in this group — one entry per image for fleet/estate context.
type VulnerabilityGroupResult ¶ added in v1.2.0
type VulnerabilityGroupResult struct {
Groups []VulnerabilityGroup
Continue *string
}
VulnerabilityGroupResult holds paginated vulnerability groups.
type VulnerabilityListResult ¶ added in v1.2.0
type VulnerabilityListResult struct {
Items []model.VulnerabilityFinding
Continue *string
}
VulnerabilityListResult holds paginated vulnerability findings.