Documentation
¶
Index ¶
- Constants
- Variables
- func AuthProviderAPIVersion() string
- func AuthProvidersToApiResource(authProviders []AuthProvider, continueToken *string, resourceVersion *int64) (domain.AuthProviderList, error)
- func CatalogAPIVersion() string
- func CatalogItemAPIVersion() string
- func CatalogItemsToApiResource(items []CatalogItem, cont *string, numRemaining *int64) domain.CatalogItemList
- func CatalogsToApiResource(catalogs []Catalog, cont *string, numRemaining *int64) (domain.CatalogList, error)
- func CertificateSigningRequestAPIVersion() string
- func CertificateSigningRequestsToApiResource(csrs []CertificateSigningRequest, cont *string, numRemaining *int64) (domain.CertificateSigningRequestList, error)
- func DeviceAPIVersion() string
- func DevicesToApiResource[D DeviceType](devices []D, cont *string, numRemaining *int64) (domain.DeviceList, error)
- func EnrollmentRequestAPIVersion() string
- func EnrollmentRequestsToApiResource(ers []EnrollmentRequest, cont *string, numRemaining *int64) (domain.EnrollmentRequestList, error)
- func EventAPIVersion() string
- func EventsToApiResource(events []Event, cont *string, numRemaining *int64) (domain.EventList, error)
- func FleetAPIVersion() string
- func FleetsToApiResource(fleets []Fleet, cont *string, numRemaining *int64) (domain.FleetList, error)
- func RepositoriesToApiResource(repos []Repository, cont *string, numRemaining *int64) (domain.RepositoryList, error)
- func RepositoryAPIVersion() string
- func ResourceSyncAPIVersion() string
- func ResourceSyncsToApiResource(rss []ResourceSync, cont *string, numRemaining *int64) (domain.ResourceSyncList, error)
- func TemplateVersionAPIVersion() string
- func TemplateVersionsToApiResource(tvs []TemplateVersion, cont *string, numRemaining *int64) (domain.TemplateVersionList, error)
- func VulnerabilitySeverityOrderSQL(severityColumn string) string
- func VulnerabilitySeverityPostgresArrayLiteralElements() string
- type APIResourceOption
- type AuthProvider
- func (a *AuthProvider) GetKind() string
- func (a *AuthProvider) GetStatusAsJson() ([]byte, error)
- func (a *AuthProvider) HasNilSpec() bool
- func (a *AuthProvider) HasSameSpecAs(otherResource any) bool
- func (a AuthProvider) String() string
- func (a *AuthProvider) ToApiResource(opts ...APIResourceOption) (*domain.AuthProvider, error)
- type CVEEventAction
- type Catalog
- type CatalogItem
- type CertificateSigningRequest
- func (csr *CertificateSigningRequest) GetKind() string
- func (csr *CertificateSigningRequest) GetSpec() any
- func (csr *CertificateSigningRequest) GetStatusAsJson() ([]byte, error)
- func (csr *CertificateSigningRequest) HasNilSpec() bool
- func (csr *CertificateSigningRequest) HasSameSpecAs(otherResource any) bool
- func (m *CertificateSigningRequest) ListSelectors() selector.SelectorNameSet
- func (m *CertificateSigningRequest) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
- func (csr CertificateSigningRequest) String() string
- func (csr *CertificateSigningRequest) ToApiResource(opts ...APIResourceOption) (*domain.CertificateSigningRequest, error)
- type ChangedFinding
- type Checkpoint
- type DependencyRef
- type Device
- func (d *Device) GetKind() string
- func (d *Device) GetStatusAsJson() ([]byte, error)
- func (d *Device) HasNilSpec() bool
- func (d *Device) HasSameSpecAs(otherResource any) bool
- func (m *Device) ListSelectors() selector.SelectorNameSet
- func (m *Device) MapSelectorName(name selector.SelectorName) []selector.SelectorName
- func (m *Device) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
- func (d Device) String() string
- func (d *Device) ToApiResource(opts ...APIResourceOption) (*domain.Device, error)
- type DeviceLabel
- type DeviceOpenCveEvent
- type DeviceTimestamp
- type DeviceType
- type DeviceTypePtr
- type DeviceWithTimestamp
- type EnrollmentRequest
- func (e *EnrollmentRequest) GetKind() string
- func (e *EnrollmentRequest) GetStatusAsJson() ([]byte, error)
- func (e *EnrollmentRequest) HasNilSpec() bool
- func (e *EnrollmentRequest) HasSameSpecAs(otherResource any) bool
- func (m *EnrollmentRequest) ListSelectors() selector.SelectorNameSet
- func (m *EnrollmentRequest) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
- func (e EnrollmentRequest) String() string
- func (e *EnrollmentRequest) ToApiResource(opts ...APIResourceOption) (*domain.EnrollmentRequest, error)
- type Event
- type Fleet
- func (f *Fleet) GetKind() string
- func (f *Fleet) GetStatusAsJson() ([]byte, error)
- func (f *Fleet) HasNilSpec() bool
- func (f *Fleet) HasSameSpecAs(otherResource any) bool
- func (m *Fleet) ListSelectors() selector.SelectorNameSet
- func (m *Fleet) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
- func (d Fleet) String() string
- func (f *Fleet) ToApiResource(opts ...APIResourceOption) (*domain.Fleet, error)
- type GitDependencyProbe
- type HttpDependencyProbe
- type JSONField
- type JSONMap
- type Organization
- type Repository
- func (r *Repository) GetKind() string
- func (r *Repository) GetStatusAsJson() ([]byte, error)
- func (r *Repository) HasNilSpec() bool
- func (r *Repository) HasSameSpecAs(otherResource any) bool
- func (m *Repository) ListSelectors() selector.SelectorNameSet
- func (m *Repository) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
- func (r Repository) String() string
- func (r *Repository) ToApiResource(opts ...APIResourceOption) (*domain.Repository, error)
- type Resource
- func (r *Resource) BeforeCreate(tx *gorm.DB) error
- func (r *Resource) GetAnnotations() JSONMap[string, string]
- func (r *Resource) GetGeneration() *int64
- func (r *Resource) GetLabels() JSONMap[string, string]
- func (r *Resource) GetName() string
- func (r *Resource) GetNonNilFieldsFromResource() []string
- func (r *Resource) GetOrgID() uuid.UUID
- func (r *Resource) GetOwner() *string
- func (r *Resource) GetResourceVersion() *int64
- func (r *Resource) GetTimestamp() time.Time
- func (r *Resource) SetAnnotations(annotations JSONMap[string, string])
- func (r *Resource) SetGeneration(generation *int64)
- func (r *Resource) SetLabels(labels JSONMap[string, string])
- func (r *Resource) SetOrgID(orgId uuid.UUID)
- func (r *Resource) SetOwner(owner *string)
- func (r *Resource) SetResourceVersion(version *int64)
- type ResourceInterface
- type ResourceSync
- func (rs *ResourceSync) GetKind() string
- func (rs *ResourceSync) GetStatusAsJson() ([]byte, error)
- func (rs *ResourceSync) HasNilSpec() bool
- func (rs *ResourceSync) HasSameSpecAs(otherResource any) bool
- func (m *ResourceSync) ListSelectors() selector.SelectorNameSet
- func (m *ResourceSync) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
- func (rs *ResourceSync) String() string
- func (rs *ResourceSync) ToApiResource(opts ...APIResourceOption) (*domain.ResourceSync, error)
- type SchemaMigration
- type SecretDependencyRef
- type ServiceConditions
- type StringArray
- type SyncState
- type TemplateVersion
- func (tv *TemplateVersion) GetAnnotations() JSONMap[string, string]
- func (tv *TemplateVersion) GetGeneration() *int64
- func (tv *TemplateVersion) GetKind() string
- func (tv *TemplateVersion) GetLabels() JSONMap[string, string]
- func (tv *TemplateVersion) GetName() string
- func (tv *TemplateVersion) GetNonNilFieldsFromResource() []string
- func (tv *TemplateVersion) GetOrgID() uuid.UUID
- func (tv *TemplateVersion) GetOwner() *string
- func (tv *TemplateVersion) GetResourceVersion() *int64
- func (tv *TemplateVersion) GetStatusAsJson() ([]byte, error)
- func (tv *TemplateVersion) GetTimestamp() time.Time
- func (tv *TemplateVersion) HasNilSpec() bool
- func (tv *TemplateVersion) HasSameSpecAs(otherResource any) bool
- func (tv *TemplateVersion) SetAnnotations(annotations JSONMap[string, string])
- func (tv *TemplateVersion) SetGeneration(generation *int64)
- func (tv *TemplateVersion) SetLabels(labels JSONMap[string, string])
- func (tv *TemplateVersion) SetOrgID(orgId uuid.UUID)
- func (tv *TemplateVersion) SetOwner(owner *string)
- func (tv *TemplateVersion) SetResourceVersion(version *int64)
- func (tv TemplateVersion) String() string
- func (tv *TemplateVersion) ToApiResource(opts ...APIResourceOption) (*domain.TemplateVersion, error)
- type VulnerabilityFinding
- type VulnerabilityIssuer
- type VulnerabilitySeverity
- type VulnerabilityStatus
Constants ¶
const ( CVEEventActionNew = "new" CVEEventActionSupersede = "supersede" CVEEventActionResolved = "resolved" )
CVEEventActionType constants for action field.
Variables ¶
var VulnerabilitySeverityRankOrder = [...]VulnerabilitySeverity{ VulnerabilitySeverityCritical, VulnerabilitySeverityHigh, VulnerabilitySeverityMedium, VulnerabilitySeverityLow, VulnerabilitySeverityUnknown, VulnerabilitySeverityNone, }
VulnerabilitySeverityRankOrder is the single definition of severity precedence: rank 1 = most severe (index 0), rank len = least severe known label. SQL CASE expressions, Postgres ARRAY indices, Rank(), and VulnerabilitySeverityFromRank are all derived from this order.
Functions ¶
func AuthProviderAPIVersion ¶ added in v1.0.0
func AuthProviderAPIVersion() string
func AuthProvidersToApiResource ¶ added in v1.0.0
func AuthProvidersToApiResource(authProviders []AuthProvider, continueToken *string, resourceVersion *int64) (domain.AuthProviderList, error)
func CatalogAPIVersion ¶ added in v1.1.0
func CatalogAPIVersion() string
func CatalogItemAPIVersion ¶ added in v1.1.0
func CatalogItemAPIVersion() string
func CatalogItemsToApiResource ¶ added in v1.1.0
func CatalogItemsToApiResource(items []CatalogItem, cont *string, numRemaining *int64) domain.CatalogItemList
func CatalogsToApiResource ¶ added in v1.1.0
func CertificateSigningRequestAPIVersion ¶ added in v0.5.0
func CertificateSigningRequestAPIVersion() string
func CertificateSigningRequestsToApiResource ¶ added in v0.4.0
func CertificateSigningRequestsToApiResource(csrs []CertificateSigningRequest, cont *string, numRemaining *int64) (domain.CertificateSigningRequestList, error)
func DeviceAPIVersion ¶ added in v0.5.0
func DeviceAPIVersion() string
func DevicesToApiResource ¶ added in v0.4.0
func DevicesToApiResource[D DeviceType](devices []D, cont *string, numRemaining *int64) (domain.DeviceList, error)
func EnrollmentRequestAPIVersion ¶ added in v0.5.0
func EnrollmentRequestAPIVersion() string
func EnrollmentRequestsToApiResource ¶ added in v0.4.0
func EnrollmentRequestsToApiResource(ers []EnrollmentRequest, cont *string, numRemaining *int64) (domain.EnrollmentRequestList, error)
func EventAPIVersion ¶ added in v0.7.0
func EventAPIVersion() string
func EventsToApiResource ¶ added in v0.7.0
func FleetAPIVersion ¶ added in v0.5.0
func FleetAPIVersion() string
func FleetsToApiResource ¶ added in v0.4.0
func RepositoriesToApiResource ¶ added in v0.4.0
func RepositoriesToApiResource(repos []Repository, cont *string, numRemaining *int64) (domain.RepositoryList, error)
func RepositoryAPIVersion ¶ added in v0.5.0
func RepositoryAPIVersion() string
func ResourceSyncAPIVersion ¶ added in v0.5.0
func ResourceSyncAPIVersion() string
func ResourceSyncsToApiResource ¶ added in v0.4.0
func ResourceSyncsToApiResource(rss []ResourceSync, cont *string, numRemaining *int64) (domain.ResourceSyncList, error)
func TemplateVersionAPIVersion ¶ added in v0.5.0
func TemplateVersionAPIVersion() string
func TemplateVersionsToApiResource ¶ added in v0.4.0
func TemplateVersionsToApiResource(tvs []TemplateVersion, cont *string, numRemaining *int64) (domain.TemplateVersionList, error)
func VulnerabilitySeverityOrderSQL ¶ added in v1.2.0
VulnerabilitySeverityOrderSQL builds a CASE expression mapping the given column to integer ranks matching VulnerabilitySeverityRankOrder (unknown DB values → len+1).
func VulnerabilitySeverityPostgresArrayLiteralElements ¶ added in v1.2.0
func VulnerabilitySeverityPostgresArrayLiteralElements() string
VulnerabilitySeverityPostgresArrayLiteralElements returns comma-separated quoted labels in rank order, for use in ARRAY[ … ] indexed by ranks from VulnerabilitySeverityOrderSQL.
Types ¶
type APIResourceOption ¶
type APIResourceOption func(*apiResourceOptions)
func WithDevicesSummary ¶ added in v0.4.0
func WithDevicesSummary(devicesSummary *domain.DevicesSummary) APIResourceOption
func WithRendered ¶ added in v0.5.0
func WithRendered(knownRenderedVersion *string) APIResourceOption
type AuthProvider ¶ added in v1.0.0
type AuthProvider struct {
Resource
// The desired state, stored as opaque JSON object.
Spec *JSONField[domain.AuthProviderSpec] `gorm:"type:jsonb"`
}
func NewAuthProviderFromApiResource ¶ added in v1.0.0
func NewAuthProviderFromApiResource(resource *domain.AuthProvider) (*AuthProvider, error)
func (*AuthProvider) GetKind ¶ added in v1.0.0
func (a *AuthProvider) GetKind() string
func (*AuthProvider) GetStatusAsJson ¶ added in v1.0.0
func (a *AuthProvider) GetStatusAsJson() ([]byte, error)
func (*AuthProvider) HasNilSpec ¶ added in v1.0.0
func (a *AuthProvider) HasNilSpec() bool
func (*AuthProvider) HasSameSpecAs ¶ added in v1.0.0
func (a *AuthProvider) HasSameSpecAs(otherResource any) bool
func (AuthProvider) String ¶ added in v1.0.0
func (a AuthProvider) String() string
func (*AuthProvider) ToApiResource ¶ added in v1.0.0
func (a *AuthProvider) ToApiResource(opts ...APIResourceOption) (*domain.AuthProvider, error)
type CVEEventAction ¶ added in v1.2.0
type CVEEventAction struct {
OrgID uuid.UUID
DeviceName string
CveID string
Action string // "new", "supersede", "resolved"
Severity string
FirstImageDigest *string
FirstImageRef *string
}
CVEEventAction represents an action to be performed on device_open_cve_events and the corresponding event to emit.
type Catalog ¶ added in v1.1.0
type Catalog struct {
Resource
// The desired state, stored as opaque JSON object.
Spec *JSONField[domain.CatalogSpec] `gorm:"type:jsonb"`
// The last reported state, stored as opaque JSON object.
Status *JSONField[domain.CatalogStatus] `gorm:"type:jsonb"`
}
Catalog represents a catalog source configuration in the database.
func NewCatalogFromApiResource ¶ added in v1.1.0
func (*Catalog) GetStatusAsJson ¶ added in v1.1.0
func (*Catalog) HasNilSpec ¶ added in v1.1.0
func (*Catalog) HasSameSpecAs ¶ added in v1.1.0
func (*Catalog) ToApiResource ¶ added in v1.1.0
func (c *Catalog) ToApiResource(opts ...APIResourceOption) (*domain.Catalog, error)
type CatalogItem ¶ added in v1.1.0
type CatalogItem struct {
OrgID uuid.UUID `gorm:"type:uuid;primaryKey"`
CatalogName string `gorm:"primaryKey" selector:"metadata.catalog"`
AppName string `gorm:"primaryKey" selector:"metadata.name"`
Owner *string `gorm:"index" selector:"metadata.owner"`
Spec *JSONField[domain.CatalogItemSpec] `gorm:"type:jsonb"`
Labels JSONMap[string, string] `gorm:"type:jsonb" selector:"metadata.labels,hidden,private"`
Annotations JSONMap[string, string] `gorm:"type:jsonb"`
CreatedAt time.Time
UpdatedAt time.Time
}
CatalogItem represents a cached catalog item in the database.
func NewCatalogItemFromApiResource ¶ added in v1.1.0
func NewCatalogItemFromApiResource(orgId uuid.UUID, catalogName string, resource *domain.CatalogItem) (*CatalogItem, error)
func (*CatalogItem) ListSelectors ¶ added in v1.1.0
func (ci *CatalogItem) ListSelectors() selector.SelectorNameSet
ListSelectors implements selector.SelectorResolver.
func (*CatalogItem) ResolveSelector ¶ added in v1.1.0
func (ci *CatalogItem) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
ResolveSelector implements selector.SelectorResolver for spec.category and spec.type.
func (*CatalogItem) String ¶ added in v1.1.0
func (ci *CatalogItem) String() string
func (*CatalogItem) ToApiResource ¶ added in v1.1.0
func (ci *CatalogItem) ToApiResource() *domain.CatalogItem
type CertificateSigningRequest ¶
type CertificateSigningRequest struct {
Resource
// The desired state of the certificate signing request, stored as opaque JSON object.
Spec *JSONField[domain.CertificateSigningRequestSpec] `gorm:"type:jsonb"`
// The last reported state of the certificate signing request, stored as opaque JSON object.
Status *JSONField[domain.CertificateSigningRequestStatus] `gorm:"type:jsonb"`
}
func CertificateSigningRequestPtrToCertificateSigningRequest ¶ added in v0.4.0
func CertificateSigningRequestPtrToCertificateSigningRequest(p *CertificateSigningRequest) *CertificateSigningRequest
func NewCertificateSigningRequestFromApiResource ¶
func NewCertificateSigningRequestFromApiResource(resource *domain.CertificateSigningRequest) (*CertificateSigningRequest, error)
func (*CertificateSigningRequest) GetKind ¶ added in v0.4.0
func (csr *CertificateSigningRequest) GetKind() string
func (*CertificateSigningRequest) GetSpec ¶ added in v0.4.0
func (csr *CertificateSigningRequest) GetSpec() any
func (*CertificateSigningRequest) GetStatusAsJson ¶ added in v0.4.0
func (csr *CertificateSigningRequest) GetStatusAsJson() ([]byte, error)
func (*CertificateSigningRequest) HasNilSpec ¶ added in v0.4.0
func (csr *CertificateSigningRequest) HasNilSpec() bool
func (*CertificateSigningRequest) HasSameSpecAs ¶ added in v0.4.0
func (csr *CertificateSigningRequest) HasSameSpecAs(otherResource any) bool
func (*CertificateSigningRequest) ListSelectors ¶ added in v0.4.0
func (m *CertificateSigningRequest) ListSelectors() selector.SelectorNameSet
func (*CertificateSigningRequest) ResolveSelector ¶ added in v0.4.0
func (m *CertificateSigningRequest) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
func (CertificateSigningRequest) String ¶
func (csr CertificateSigningRequest) String() string
func (*CertificateSigningRequest) ToApiResource ¶
func (csr *CertificateSigningRequest) ToApiResource(opts ...APIResourceOption) (*domain.CertificateSigningRequest, error)
type ChangedFinding ¶ added in v1.2.0
type ChangedFinding struct {
ImageDigest string
CveID string
Severity string // Current: Critical, High, Medium, Low, None, Unknown
Status string // Current: affected, not_affected, fixed, unknown
SeverityChanged bool // True if severity changed (or new insert)
StatusChanged bool // True if status changed (or new insert)
}
ChangedFinding represents a vulnerability finding that was inserted or updated during the Trustify sync. Used to compute CVE event actions.
type Checkpoint ¶ added in v0.9.0
type Checkpoint struct {
Consumer string `gorm:"primaryKey"`
Key string `gorm:"primaryKey"`
Value []byte
CreatedAt time.Time `selector:"metadata.creationTimestamp"`
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
}
func (Checkpoint) String ¶ added in v0.9.0
func (cp Checkpoint) String() string
type DependencyRef ¶ added in v1.2.0
type DependencyRef struct {
OrgID uuid.UUID `gorm:"type:uuid;primaryKey"`
ResourceKey string `gorm:"primaryKey"` // e.g. "git:repo/ref", "http:repo/path", "secret:ns/name"
FleetName *string `gorm:"primaryKey;default:''"`
DeviceName *string `gorm:"primaryKey;default:''"`
RefType string // "git", "http", "secret"
RepositoryName *string
Revision *string
HTTPSuffix *string
SecretName *string
SecretNamespace *string
ConfigProviderName string
}
DependencyRef maps a fleet or device to an external dependency (git repo, HTTP resource, or K8s secret). The sync controller reads these rows as a polling work list (git/HTTP) and fan-out lookup (all types).
func (DependencyRef) TableName ¶ added in v1.2.0
func (DependencyRef) TableName() string
type Device ¶
type Device struct {
Resource
// The alias for the device.
Alias *string `selector:"metadata.alias"`
// The desired state, stored as opaque JSON object.
Spec *JSONField[domain.DeviceSpec] `gorm:"type:jsonb"`
// The last reported state, stored as opaque JSON object.
Status *JSONField[domain.DeviceStatus] `gorm:"type:jsonb"`
// Conditions set by the service, as opposed to the agent.
ServiceConditions *JSONField[ServiceConditions] `gorm:"type:jsonb"`
// The rendered device config
RenderedConfig *JSONField[*[]domain.ConfigProviderSpec] `gorm:"type:jsonb"`
// Timestamp when the device was rendered
RenderTimestamp time.Time
// The rendered application provided by the service.
RenderedApplications *JSONField[*[]domain.ApplicationProviderSpec] `gorm:"type:jsonb"`
// Join table with the relationship of devices to repositories (only maintained for standalone devices)
Repositories []Repository `gorm:"many2many:device_repos;constraint:OnDelete:CASCADE;"`
DeviceTimestamp DeviceTimestamp `gorm:"foreignKey:OrgID,Name;references:OrgID,Name;constraint:OnDelete:CASCADE"`
}
func (*Device) GetStatusAsJson ¶ added in v0.4.0
func (*Device) HasNilSpec ¶ added in v0.4.0
func (*Device) HasSameSpecAs ¶ added in v0.4.0
func (*Device) ListSelectors ¶ added in v0.4.0
func (m *Device) ListSelectors() selector.SelectorNameSet
func (*Device) MapSelectorName ¶ added in v0.4.0
func (m *Device) MapSelectorName(name selector.SelectorName) []selector.SelectorName
func (*Device) ResolveSelector ¶ added in v0.4.0
func (m *Device) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
func (*Device) ToApiResource ¶
func (d *Device) ToApiResource(opts ...APIResourceOption) (*domain.Device, error)
type DeviceLabel ¶ added in v0.5.0
type DeviceLabel struct {
OrgID uuid.UUID `gorm:"primaryKey;type:uuid;index:,composite:device_label_org_device" selector:"metadata.orgid,hidden,private"`
DeviceName string `gorm:"primaryKey;index:,composite:device_label_org_device" selector:"metadata.name"`
LabelKey string `gorm:"primaryKey;index:,composite:device_label_key" selector:"metadata.labels.key"`
LabelValue string `gorm:"index" selector:"metadata.labels.value"`
// Foreign Key Constraint with CASCADE DELETE
Device Device `gorm:"foreignKey:OrgID,DeviceName;references:OrgID,Name;constraint:OnDelete:CASCADE"`
}
func (*DeviceLabel) ListSelectors ¶ added in v0.5.0
func (m *DeviceLabel) ListSelectors() selector.SelectorNameSet
func (*DeviceLabel) MapSelectorName ¶ added in v0.5.0
func (m *DeviceLabel) MapSelectorName(name selector.SelectorName) []selector.SelectorName
type DeviceOpenCveEvent ¶ added in v1.2.0
type DeviceOpenCveEvent struct {
OrgID uuid.UUID `gorm:"type:uuid;primaryKey"`
DeviceName string `gorm:"type:text;primaryKey"`
CveID string `gorm:"type:text;primaryKey;column:cve_id"`
Severity string `gorm:"type:text;not null"` // Critical or High
FirstImageDigest *string `gorm:"type:text"`
FirstImageRef *string `gorm:"type:text"`
CreatedAt time.Time `gorm:"type:timestamptz;not null;default:now()"`
}
DeviceOpenCveEvent tracks currently open CVE events per device. This table serves as both a state cache for efficient delta computation and a synchronization primitive to prevent duplicate event emission. Primary key is (org_id, device_name, cve_id).
func (DeviceOpenCveEvent) TableName ¶ added in v1.2.0
func (DeviceOpenCveEvent) TableName() string
type DeviceTimestamp ¶ added in v1.0.0
type DeviceTimestamp struct {
OrgID uuid.UUID `gorm:"type:uuid;primaryKey;index:,composite:org_name,priority:1"`
// Uniquely identifies the resource within an organization and schema.
// Depending on the schema (kind), assigned by the device management system or the crypto identity of the device (public key). Immutable.
// This may become a URN later, so it's important API users treat this as an opaque handle.
Name string `gorm:"primaryKey;index:,composite:org_name,priority:2" selector:"metadata.name"`
// The last time the device was seen (reported status). Since this is updated frequently,
// we store it in a separate table to avoid bloating the main device table. In addition we don't index this field
// because the effort of maintaining the index outweighs the benefit of querying by last seen.
LastSeen *time.Time
}
type DeviceType ¶ added in v1.0.0
type DeviceType interface {
Device | DeviceWithTimestamp
}
type DeviceTypePtr ¶ added in v1.0.0
type DeviceTypePtr interface {
ToApiResource(opts ...APIResourceOption) (*domain.Device, error)
}
type DeviceWithTimestamp ¶ added in v1.0.0
func (*DeviceWithTimestamp) ToApiResource ¶ added in v1.0.0
func (d *DeviceWithTimestamp) ToApiResource(opts ...APIResourceOption) (*domain.Device, error)
type EnrollmentRequest ¶
type EnrollmentRequest struct {
Resource
// The desired state of the enrollment request, stored as opaque JSON object.
Spec *JSONField[domain.EnrollmentRequestSpec] `gorm:"type:jsonb"`
// The last reported state of the enrollment request, stored as opaque JSON object.
Status *JSONField[domain.EnrollmentRequestStatus] `gorm:"type:jsonb"`
}
func NewEnrollmentRequestFromApiResource ¶
func NewEnrollmentRequestFromApiResource(resource *domain.EnrollmentRequest) (*EnrollmentRequest, error)
func (*EnrollmentRequest) GetKind ¶ added in v0.4.0
func (e *EnrollmentRequest) GetKind() string
func (*EnrollmentRequest) GetStatusAsJson ¶ added in v0.4.0
func (e *EnrollmentRequest) GetStatusAsJson() ([]byte, error)
func (*EnrollmentRequest) HasNilSpec ¶ added in v0.4.0
func (e *EnrollmentRequest) HasNilSpec() bool
func (*EnrollmentRequest) HasSameSpecAs ¶ added in v0.4.0
func (e *EnrollmentRequest) HasSameSpecAs(otherResource any) bool
func (*EnrollmentRequest) ListSelectors ¶ added in v0.4.0
func (m *EnrollmentRequest) ListSelectors() selector.SelectorNameSet
func (*EnrollmentRequest) ResolveSelector ¶ added in v0.4.0
func (m *EnrollmentRequest) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
func (EnrollmentRequest) String ¶
func (e EnrollmentRequest) String() string
func (*EnrollmentRequest) ToApiResource ¶
func (e *EnrollmentRequest) ToApiResource(opts ...APIResourceOption) (*domain.EnrollmentRequest, error)
type Event ¶ added in v0.7.0
type Event struct {
Resource
Reason string `gorm:"type:string;index" selector:"reason"`
SourceComponent string `gorm:"type:string"`
Actor string `gorm:"type:string" selector:"actor"`
Type string `gorm:"type:string;index" selector:"type"`
Message string `gorm:"type:text"`
Details *JSONField[domain.EventDetails] `gorm:"type:jsonb"`
InvolvedObjectName string `gorm:"type:string;index:idx_involved_object" selector:"involvedObject.name"`
InvolvedObjectKind string `gorm:"type:string;index:idx_involved_object" selector:"involvedObject.kind"`
}
func NewEventFromApiResource ¶ added in v0.7.0
func (*Event) GetStatusAsJson ¶ added in v0.7.0
func (*Event) HasNilSpec ¶ added in v0.7.0
func (*Event) HasSameSpecAs ¶ added in v0.7.0
func (*Event) ToApiResource ¶ added in v0.7.0
func (e *Event) ToApiResource(opts ...APIResourceOption) (*domain.Event, error)
type Fleet ¶
type Fleet struct {
Resource
// The desired state, stored as opaque JSON object.
Spec *JSONField[domain.FleetSpec] `gorm:"type:jsonb"`
// The last reported state, stored as opaque JSON object.
Status *JSONField[domain.FleetStatus] `gorm:"type:jsonb"`
// Join table with the relationship of fleets to repositories
Repositories []Repository `gorm:"many2many:fleet_repos;constraint:OnDelete:CASCADE;"`
}
func FleetPtrToFleet ¶ added in v0.4.0
func (*Fleet) GetStatusAsJson ¶ added in v0.4.0
func (*Fleet) HasNilSpec ¶ added in v0.4.0
func (*Fleet) HasSameSpecAs ¶ added in v0.4.0
func (*Fleet) ListSelectors ¶ added in v0.4.0
func (m *Fleet) ListSelectors() selector.SelectorNameSet
func (*Fleet) ResolveSelector ¶ added in v0.4.0
func (m *Fleet) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
func (*Fleet) ToApiResource ¶
func (f *Fleet) ToApiResource(opts ...APIResourceOption) (*domain.Fleet, error)
type GitDependencyProbe ¶ added in v1.2.0
type GitDependencyProbe struct {
RepositoryName string
Revision string
Fingerprint *string
FleetNames StringArray
DeviceNames StringArray
RepoSpec *JSONField[domain.RepositorySpec] `gorm:"type:jsonb"`
}
GitDependencyProbe is the result of ListDueGitDependencies — one row per unique (repository_name, revision) pair that is due for polling. FleetNames and DeviceNames carry the fan-out targets collected via array_agg. RepoSpec carries the repository's JSONB spec so callers can extract the URL and auth without a separate GetRepository round-trip.
type HttpDependencyProbe ¶ added in v1.2.0
type HttpDependencyProbe struct {
RepositoryName string
HTTPSuffix string
Fingerprint *string
FleetNames StringArray
DeviceNames StringArray
RepoSpec *JSONField[domain.RepositorySpec] `gorm:"type:jsonb"`
}
HttpDependencyProbe is the result of ListDueHttpDependencies — one row per unique (repository_name, http_suffix) pair that is due for polling.
type JSONField ¶
type JSONField[T any] struct { Data T }
JSONField wraps an arbitrary struct so that it can be included in a GORM model, for use in a JSON/JSONB field
func MakeJSONField ¶
Return a copy of 'data', wrapped in a JSONField object
func (JSONField[T]) MarshalJSON ¶
func (*JSONField[T]) UnmarshalJSON ¶
type JSONMap ¶ added in v0.4.0
type JSONMap[K comparable, V any] map[K]V
JSONMap represents a generic map that can be stored as JSONB in PostgreSQL.
func MakeJSONMap ¶ added in v0.4.0
func MakeJSONMap[K comparable, V any](src map[K]V) JSONMap[K, V]
MakeJSONMap initializes a JSONMap from a standard map.
type Organization ¶ added in v0.9.0
type Organization = orgmodel.Organization
Organization is an alias to org/model.Organization to maintain compatibility
type Repository ¶
type Repository struct {
Resource
// The desired state, stored as opaque JSON object.
Spec *JSONField[domain.RepositorySpec] `gorm:"type:jsonb"`
// The last reported state, stored as opaque JSON object.
Status *JSONField[domain.RepositoryStatus] `gorm:"type:jsonb"`
// Join table with the relationship of repository to fleets
Fleets []Fleet `gorm:"many2many:fleet_repos;constraint:OnDelete:CASCADE;"`
// Join table with the relationship of repository to devices (only maintained for standalone devices)
Devices []Device `gorm:"many2many:device_repos;constraint:OnDelete:CASCADE;"`
}
func NewRepositoryFromApiResource ¶
func NewRepositoryFromApiResource(resource *domain.Repository) (*Repository, error)
func (*Repository) GetKind ¶ added in v0.4.0
func (r *Repository) GetKind() string
func (*Repository) GetStatusAsJson ¶ added in v0.4.0
func (r *Repository) GetStatusAsJson() ([]byte, error)
func (*Repository) HasNilSpec ¶ added in v0.4.0
func (r *Repository) HasNilSpec() bool
func (*Repository) HasSameSpecAs ¶ added in v0.4.0
func (r *Repository) HasSameSpecAs(otherResource any) bool
func (*Repository) ListSelectors ¶ added in v0.4.0
func (m *Repository) ListSelectors() selector.SelectorNameSet
func (*Repository) ResolveSelector ¶ added in v0.4.0
func (m *Repository) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
func (Repository) String ¶
func (r Repository) String() string
func (*Repository) ToApiResource ¶
func (r *Repository) ToApiResource(opts ...APIResourceOption) (*domain.Repository, error)
type Resource ¶
type Resource struct {
// Uniquely identifies the organization the resource belongs to.
// Assigned by IAM. Immutable.
OrgID uuid.UUID `gorm:"type:uuid;primaryKey;index:,composite:org_name,priority:1"`
Organization Organization `gorm:"foreignKey:OrgID"`
// Uniquely identifies the resource within an organization and schema.
// Depending on the schema (kind), assigned by the device management system or the crypto identity of the device (public key). Immutable.
// This may become a URN later, so it's important API users treat this as an opaque handle.
Name string `gorm:"primaryKey;index:,composite:org_name,priority:2" selector:"metadata.name"`
// The "kind/name" of the resource owner of this resource.
Owner *string `gorm:"index:owner_idx" selector:"metadata.owner"`
// Labels associated with the resource, used for selecting and querying objects.
// Labels are stored as a JSONB object, supporting flexible indexing and querying capabilities.
Labels JSONMap[string, string] `gorm:"type:jsonb" selector:"metadata.labels,hidden,private"`
// Annotations associated with the resource, used for storing additional metadata.
// Similar to labels, annotations are stored as a JSONB object to support flexible indexing and querying.
Annotations JSONMap[string, string] `gorm:"type:jsonb" selector:"metadata.annotations,hidden,private"`
Generation *int64
ResourceVersion *int64
CreatedAt time.Time `selector:"metadata.creationTimestamp"`
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
}
func (*Resource) GetAnnotations ¶ added in v0.4.0
func (*Resource) GetGeneration ¶ added in v0.4.0
func (*Resource) GetNonNilFieldsFromResource ¶ added in v0.4.0
func (*Resource) GetResourceVersion ¶ added in v0.4.0
func (*Resource) GetTimestamp ¶ added in v0.8.1
func (*Resource) SetAnnotations ¶ added in v0.4.0
func (*Resource) SetGeneration ¶ added in v0.4.0
func (*Resource) SetResourceVersion ¶ added in v0.4.0
type ResourceInterface ¶ added in v0.4.0
type ResourceInterface interface {
GetKind() string
GetName() string
GetOrgID() uuid.UUID
SetOrgID(uuid.UUID)
GetResourceVersion() *int64
SetResourceVersion(*int64)
GetGeneration() *int64
SetGeneration(*int64)
GetOwner() *string
SetOwner(*string)
GetLabels() JSONMap[string, string]
SetLabels(JSONMap[string, string])
GetAnnotations() JSONMap[string, string]
SetAnnotations(JSONMap[string, string])
GetNonNilFieldsFromResource() []string
HasNilSpec() bool
HasSameSpecAs(any) bool
GetStatusAsJson() ([]byte, error)
GetTimestamp() time.Time
}
type ResourceSync ¶
type ResourceSync struct {
Resource
// The desired state, stored as opaque JSON object.
Spec *JSONField[domain.ResourceSyncSpec] `gorm:"type:jsonb"`
// The last reported state, stored as opaque JSON object.
Status *JSONField[domain.ResourceSyncStatus] `gorm:"type:jsonb"`
}
func NewResourceSyncFromApiResource ¶
func NewResourceSyncFromApiResource(resource *domain.ResourceSync) (*ResourceSync, error)
func (*ResourceSync) GetKind ¶ added in v0.4.0
func (rs *ResourceSync) GetKind() string
func (*ResourceSync) GetStatusAsJson ¶ added in v0.4.0
func (rs *ResourceSync) GetStatusAsJson() ([]byte, error)
func (*ResourceSync) HasNilSpec ¶ added in v0.4.0
func (rs *ResourceSync) HasNilSpec() bool
func (*ResourceSync) HasSameSpecAs ¶ added in v0.4.0
func (rs *ResourceSync) HasSameSpecAs(otherResource any) bool
func (*ResourceSync) ListSelectors ¶ added in v0.4.0
func (m *ResourceSync) ListSelectors() selector.SelectorNameSet
func (*ResourceSync) ResolveSelector ¶ added in v0.4.0
func (m *ResourceSync) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
func (*ResourceSync) String ¶
func (rs *ResourceSync) String() string
func (*ResourceSync) ToApiResource ¶
func (rs *ResourceSync) ToApiResource(opts ...APIResourceOption) (*domain.ResourceSync, error)
type SchemaMigration ¶ added in v1.2.0
type SchemaMigration struct {
Key string `gorm:"primaryKey"`
AppliedAt time.Time `gorm:"not null"`
}
SchemaMigration tracks one-time data-migration steps that must run exactly once across all replicas. The Key is the primary key; inserting with ON CONFLICT DO NOTHING acts as a distributed lock: whichever replica wins the insert runs the migration, while concurrent replicas see 0 rows affected and skip it.
type SecretDependencyRef ¶ added in v1.2.0
type SecretDependencyRef struct {
OrgID uuid.UUID
FleetName string
DeviceName string
Fingerprint *string
}
SecretDependencyRef is a flat row returned by ListSecretDependencyTargets. One row per (org, fleet/device) referencing the queried secret. The query is cross-org because the K8s informer has no org context — it only knows (namespace, name) from the watch event.
type ServiceConditions ¶
type ServiceConditions struct {
Conditions *[]domain.Condition `json:"conditions,omitempty"`
DependencySync *domain.DependencySyncStatus `json:"dependencySync,omitempty"`
}
type StringArray ¶ added in v1.2.0
type StringArray []string
StringArray is a []string that scans PostgreSQL text arrays ({a,b,c}).
func (StringArray) GormDataType ¶ added in v1.2.0
func (StringArray) GormDataType() string
func (*StringArray) Scan ¶ added in v1.2.0
func (a *StringArray) Scan(src interface{}) error
type SyncState ¶ added in v1.2.0
type SyncState struct {
OrgID uuid.UUID `gorm:"type:uuid;primaryKey"`
// Format: "git:<repo-name>/<ref>", "http:<repo-name>/<suffix>", "secret:<namespace>/<name>"
ResourceKey string `gorm:"primaryKey"`
Fingerprint string
LastCheckedAt time.Time
LastChangeAt *time.Time
ProbeStatus string
ProbeMessage string
}
SyncState tracks the last-known fingerprint of an external dependency (git ref, HTTP resource, or K8s secret) for change detection.
type TemplateVersion ¶
type TemplateVersion struct {
OrgID uuid.UUID `gorm:"type:uuid;primary_key;"`
Organization Organization `gorm:"foreignKey:OrgID"`
Name string `gorm:"primary_key;" selector:"metadata.name"`
FleetName string `gorm:"primary_key;" selector:"metadata.owner"`
Fleet Fleet `gorm:"foreignkey:OrgID,FleetName;constraint:OnDelete:CASCADE;"`
Labels JSONMap[string, string] `gorm:"type:jsonb" selector:"metadata.labels,hidden,private"`
Annotations JSONMap[string, string] `gorm:"type:jsonb" selector:"metadata.annotations,hidden,private"`
Generation *int64
ResourceVersion *int64
CreatedAt time.Time `selector:"metadata.creationTimestamp"`
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
// The desired state, stored as opaque JSON object.
Spec *JSONField[domain.TemplateVersionSpec] `gorm:"type:jsonb"`
// The last reported state, stored as opaque JSON object.
Status *JSONField[domain.TemplateVersionStatus] `gorm:"type:jsonb"`
}
func NewTemplateVersionFromApiResource ¶
func NewTemplateVersionFromApiResource(resource *domain.TemplateVersion) (*TemplateVersion, error)
func (*TemplateVersion) GetAnnotations ¶ added in v0.4.0
func (tv *TemplateVersion) GetAnnotations() JSONMap[string, string]
func (*TemplateVersion) GetGeneration ¶ added in v0.4.0
func (tv *TemplateVersion) GetGeneration() *int64
func (*TemplateVersion) GetKind ¶ added in v0.4.0
func (tv *TemplateVersion) GetKind() string
func (*TemplateVersion) GetLabels ¶ added in v0.4.0
func (tv *TemplateVersion) GetLabels() JSONMap[string, string]
func (*TemplateVersion) GetName ¶ added in v0.4.0
func (tv *TemplateVersion) GetName() string
func (*TemplateVersion) GetNonNilFieldsFromResource ¶ added in v0.4.0
func (tv *TemplateVersion) GetNonNilFieldsFromResource() []string
func (*TemplateVersion) GetOrgID ¶ added in v0.4.0
func (tv *TemplateVersion) GetOrgID() uuid.UUID
func (*TemplateVersion) GetOwner ¶ added in v0.4.0
func (tv *TemplateVersion) GetOwner() *string
func (*TemplateVersion) GetResourceVersion ¶ added in v0.4.0
func (tv *TemplateVersion) GetResourceVersion() *int64
func (*TemplateVersion) GetStatusAsJson ¶ added in v0.4.0
func (tv *TemplateVersion) GetStatusAsJson() ([]byte, error)
func (*TemplateVersion) GetTimestamp ¶ added in v0.8.1
func (tv *TemplateVersion) GetTimestamp() time.Time
func (*TemplateVersion) HasNilSpec ¶ added in v0.4.0
func (tv *TemplateVersion) HasNilSpec() bool
func (*TemplateVersion) HasSameSpecAs ¶ added in v0.4.0
func (tv *TemplateVersion) HasSameSpecAs(otherResource any) bool
func (*TemplateVersion) SetAnnotations ¶ added in v0.4.0
func (tv *TemplateVersion) SetAnnotations(annotations JSONMap[string, string])
func (*TemplateVersion) SetGeneration ¶ added in v0.4.0
func (tv *TemplateVersion) SetGeneration(generation *int64)
func (*TemplateVersion) SetLabels ¶ added in v0.4.0
func (tv *TemplateVersion) SetLabels(labels JSONMap[string, string])
func (*TemplateVersion) SetOrgID ¶ added in v0.4.0
func (tv *TemplateVersion) SetOrgID(orgId uuid.UUID)
func (*TemplateVersion) SetOwner ¶ added in v0.4.0
func (tv *TemplateVersion) SetOwner(owner *string)
func (*TemplateVersion) SetResourceVersion ¶ added in v0.4.0
func (tv *TemplateVersion) SetResourceVersion(version *int64)
func (TemplateVersion) String ¶
func (tv TemplateVersion) String() string
func (*TemplateVersion) ToApiResource ¶
func (tv *TemplateVersion) ToApiResource(opts ...APIResourceOption) (*domain.TemplateVersion, error)
type VulnerabilityFinding ¶ added in v1.2.0
type VulnerabilityFinding struct {
ImageDigest string `gorm:"type:text;not null;primaryKey"`
CveID string `gorm:"type:text;not null;primaryKey"`
Status VulnerabilityStatus `gorm:"type:text;not null"`
Severity VulnerabilitySeverity `gorm:"type:text;not null"`
AdvisoryID *string `gorm:"type:text"`
Issuer *JSONField[VulnerabilityIssuer] `gorm:"type:jsonb"`
CvssScore *float64 `gorm:"type:numeric(3,1)"`
Description *string `gorm:"type:text"`
PublishedAt *time.Time `gorm:"type:timestamptz"`
FirstSeenAt time.Time `gorm:"type:timestamptz;not null;default:now()"`
UpdatedAt time.Time `gorm:"type:timestamptz;not null;autoUpdateTime"`
}
type VulnerabilityIssuer ¶ added in v1.2.0
type VulnerabilityIssuer struct {
// ID is the opaque UUID of the organization.
ID string `json:"id"`
// Name is the name of the organization.
Name string `json:"name"`
// CpeKey is the CPE key of the organization, if known.
CpeKey *string `json:"cpe_key,omitempty"`
// Website is the website of the organization, if known.
Website *string `json:"website,omitempty"`
}
VulnerabilityIssuer represents the issuer/organization of a vulnerability advisory.
type VulnerabilitySeverity ¶ added in v1.2.0
type VulnerabilitySeverity string
const ( VulnerabilitySeverityCritical VulnerabilitySeverity = "Critical" VulnerabilitySeverityHigh VulnerabilitySeverity = "High" VulnerabilitySeverityMedium VulnerabilitySeverity = "Medium" VulnerabilitySeverityLow VulnerabilitySeverity = "Low" VulnerabilitySeverityNone VulnerabilitySeverity = "None" VulnerabilitySeverityUnknown VulnerabilitySeverity = "Unknown" )
func VulnerabilitySeverityFromRank ¶ added in v1.2.0
func VulnerabilitySeverityFromRank(rank int) VulnerabilitySeverity
func (VulnerabilitySeverity) Rank ¶ added in v1.2.0
func (s VulnerabilitySeverity) Rank() int
type VulnerabilityStatus ¶ added in v1.2.0
type VulnerabilityStatus string
const ( VulnerabilityStatusAffected VulnerabilityStatus = "affected" VulnerabilityStatusNotAffected VulnerabilityStatus = "not_affected" VulnerabilityStatusFixed VulnerabilityStatus = "fixed" VulnerabilityStatusUnknown VulnerabilityStatus = "unknown" )
Source Files
¶
- authprovider.go
- catalog.go
- certificatesigningrequest.go
- checkpoint.go
- dependencyref.go
- device.go
- device_open_cve_event.go
- enrollmentrequest.go
- event.go
- fleet.go
- jsonfield.go
- organization.go
- repository.go
- resource.go
- resourcesync.go
- schema_migration.go
- selectors.go
- syncstate.go
- templateversion.go
- vulnerability_finding.go