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 api.ResourceKind, log logrus.FieldLogger) ...
- func CloseDB(db *gorm.DB)
- func CountRemainingItems(query *gorm.DB, nextValues []string, listParams ListParams) int64
- func DeleteTestDB(ctx context.Context, log *logrus.Logger, cfg *config.Config, store Store, ...)
- 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 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 *api.AuthProvider, ...) (*api.AuthProvider, error)
- func (s *AuthProviderStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.AuthProvider, ...) (*api.AuthProvider, bool, 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) (*api.AuthProvider, error)
- func (s *AuthProviderStore) GetAuthProviderByAuthorizationUrl(ctx context.Context, orgId uuid.UUID, authorizationUrl string) (*api.AuthProvider, error)
- func (s *AuthProviderStore) GetAuthProviderByIssuerAndClientId(ctx context.Context, orgId uuid.UUID, issuer string, clientId string) (*api.AuthProvider, error)
- func (s *AuthProviderStore) InitialMigration(ctx context.Context) error
- func (s *AuthProviderStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.AuthProviderList, error)
- func (s *AuthProviderStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.AuthProvider, ...) (*api.AuthProvider, error)
- func (s *AuthProviderStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.AuthProvider, ...) (*api.AuthProvider, error)
- type CertificateSigningRequest
- type CertificateSigningRequestStore
- func (s *CertificateSigningRequestStore) Create(ctx context.Context, orgId uuid.UUID, resource *api.CertificateSigningRequest, ...) (*api.CertificateSigningRequest, error)
- func (s *CertificateSigningRequestStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.CertificateSigningRequest, ...) (*api.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) (*api.CertificateSigningRequest, error)
- func (s *CertificateSigningRequestStore) InitialMigration(ctx context.Context) error
- func (s *CertificateSigningRequestStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.CertificateSigningRequestList, error)
- func (s *CertificateSigningRequestStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.CertificateSigningRequest, ...) (*api.CertificateSigningRequest, error)
- func (s *CertificateSigningRequestStore) UpdateConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []api.Condition) error
- func (s *CertificateSigningRequestStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.CertificateSigningRequest) (*api.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) CertificateSigningRequest() CertificateSigningRequest
- func (s *DataStore) CheckHealth(ctx context.Context) error
- func (s *DataStore) Checkpoint() Checkpoint
- func (s *DataStore) Close() error
- 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) TemplateVersion() TemplateVersion
- type Device
- type DeviceStatusType
- type DeviceStore
- func (s *DeviceStore) CompletionCounts(ctx context.Context, orgId uuid.UUID, owner string, templateVersion string, ...) ([]api.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 *api.Device, ...) (*api.Device, error)
- func (s *DeviceStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.Device, ...) (*api.Device, bool, 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) (*api.Device, error)
- func (s *DeviceStore) GetAllDeviceNames(ctx context.Context, orgId uuid.UUID) ([]string, 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, ...) (*api.Device, error)
- func (s *DeviceStore) GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*api.RepositoryList, error)
- func (s *DeviceStore) GetWithoutServiceConditions(ctx context.Context, orgId uuid.UUID, name string) (*api.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) (api.LabelList, error)
- func (s *DeviceStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.DeviceList, error)
- func (s *DeviceStore) ListDevicesByServiceCondition(ctx context.Context, orgId uuid.UUID, conditionType string, ...) (*api.DeviceList, error)
- func (s *DeviceStore) ListDisconnected(ctx context.Context, orgId uuid.UUID, listParams ListParams, ...) (*api.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) PrepareDevicesAfterRestore(ctx context.Context) (int64, 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, conditions []api.Condition, ...) error
- func (s *DeviceStore) Summary(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.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 *api.Device, ...) (*api.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 *api.Device, ...) (*api.Device, error)
- type DeviceStoreValidationCallback
- type EnrollmentRequest
- type EnrollmentRequestStore
- func (s *EnrollmentRequestStore) Create(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest, ...) (*api.EnrollmentRequest, error)
- func (s *EnrollmentRequestStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest, ...) (*api.EnrollmentRequest, bool, error)
- func (s *EnrollmentRequestStore) CreateWithFromAPI(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest, ...) (*api.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) (*api.EnrollmentRequest, error)
- func (s *EnrollmentRequestStore) InitialMigration(ctx context.Context) error
- func (s *EnrollmentRequestStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.EnrollmentRequestList, error)
- func (s *EnrollmentRequestStore) PrepareEnrollmentRequestsAfterRestore(ctx context.Context) (int64, error)
- func (s *EnrollmentRequestStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest, ...) (*api.EnrollmentRequest, error)
- func (s *EnrollmentRequestStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest, ...) (*api.EnrollmentRequest, error)
- type Event
- type EventCallback
- type EventCallbackCaller
- type EventStore
- func (s *EventStore) Create(ctx context.Context, orgId uuid.UUID, resource *api.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) (*api.EventList, error)
- type Fleet
- 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 *api.Fleet, ...) (*api.Fleet, error)
- func (s *FleetStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.Fleet, ...) (*api.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) (*api.Fleet, error)
- func (s *FleetStore) GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*api.RepositoryList, error)
- func (s *FleetStore) InitialMigration(ctx context.Context) error
- func (s *FleetStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams, ...) (*api.FleetList, error)
- func (s *FleetStore) ListDisruptionBudgetFleets(ctx context.Context, orgId uuid.UUID) (*api.FleetList, error)
- func (s *FleetStore) ListIgnoreOrg(ctx context.Context) ([]model.Fleet, error)
- func (s *FleetStore) ListRolloutDeviceSelection(ctx context.Context, orgId uuid.UUID) (*api.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 *api.Fleet, ...) (*api.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, conditions []api.Condition, ...) error
- func (s *FleetStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.Fleet) (*api.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 IntegrationTestCallback
- type ListOption
- type ListParams
- type ListQueryOption
- type Model
- 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 *api.Repository, ...) (*api.Repository, error)
- func (s *RepositoryStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.Repository, ...) (*api.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) (*api.Repository, error)
- func (s *RepositoryStore) GetDeviceRefs(ctx context.Context, orgId uuid.UUID, name string) (*api.DeviceList, error)
- func (s *RepositoryStore) GetFleetRefs(ctx context.Context, orgId uuid.UUID, name string) (*api.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) (*api.RepositoryList, error)
- func (s *RepositoryStore) ListIgnoreOrg(ctx context.Context) ([]model.Repository, error)
- func (s *RepositoryStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.Repository, ...) (*api.Repository, error)
- func (s *RepositoryStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.Repository, ...) (*api.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 *api.ResourceSync, ...) (*api.ResourceSync, error)
- func (s *ResourceSyncStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.ResourceSync, ...) (*api.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) (*api.ResourceSync, error)
- func (s *ResourceSyncStore) InitialMigration(ctx context.Context) error
- func (s *ResourceSyncStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.ResourceSyncList, error)
- func (s *ResourceSyncStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.ResourceSync, ...) (*api.ResourceSync, error)
- func (s *ResourceSyncStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.ResourceSync, ...) (*api.ResourceSync, error)
- type ServiceConditionsCallback
- type SortColumn
- type SortOrder
- type StatusCount
- type StatusCountList
- type Store
- type TemplateVersion
- type TemplateVersionStore
- func (s *TemplateVersionStore) Create(ctx context.Context, orgId uuid.UUID, resource *api.TemplateVersion, ...) (*api.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) (*api.TemplateVersion, error)
- func (s *TemplateVersionStore) GetLatest(ctx context.Context, orgId uuid.UUID, fleet string) (*api.TemplateVersion, error)
- func (s *TemplateVersionStore) InitialMigration(ctx context.Context) error
- func (s *TemplateVersionStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.TemplateVersionList, error)
- func (s *TemplateVersionStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.TemplateVersion, ...) error
Constants ¶
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 api.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 DeleteTestDB ¶
func ErrorFromGormError ¶ added in v0.3.0
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
Types ¶
type AuthProvider ¶ added in v1.0.0
type AuthProvider interface {
InitialMigration(ctx context.Context) error
Create(ctx context.Context, orgId uuid.UUID, authProvider *api.AuthProvider, eventCallback EventCallback) (*api.AuthProvider, error)
Update(ctx context.Context, orgId uuid.UUID, authProvider *api.AuthProvider, eventCallback EventCallback) (*api.AuthProvider, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, authProvider *api.AuthProvider, eventCallback EventCallback) (*api.AuthProvider, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string) (*api.AuthProvider, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.AuthProviderList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.AuthProvider, eventCallback EventCallback) (*api.AuthProvider, error)
GetAuthProviderByIssuerAndClientId(ctx context.Context, orgId uuid.UUID, issuer string, clientId string) (*api.AuthProvider, error)
GetAuthProviderByAuthorizationUrl(ctx context.Context, orgId uuid.UUID, authorizationUrl string) (*api.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)
}
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 *api.AuthProvider, eventCallback EventCallback) (*api.AuthProvider, error)
func (*AuthProviderStore) CreateOrUpdate ¶ added in v1.0.0
func (s *AuthProviderStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.AuthProvider, eventCallback EventCallback) (*api.AuthProvider, bool, 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) (*api.AuthProvider, error)
func (*AuthProviderStore) GetAuthProviderByAuthorizationUrl ¶ added in v1.0.0
func (s *AuthProviderStore) GetAuthProviderByAuthorizationUrl(ctx context.Context, orgId uuid.UUID, authorizationUrl string) (*api.AuthProvider, error)
func (*AuthProviderStore) GetAuthProviderByIssuerAndClientId ¶ added in v1.0.0
func (s *AuthProviderStore) GetAuthProviderByIssuerAndClientId(ctx context.Context, orgId uuid.UUID, issuer string, clientId string) (*api.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) (*api.AuthProviderList, error)
func (*AuthProviderStore) Update ¶ added in v1.0.0
func (s *AuthProviderStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.AuthProvider, eventCallback EventCallback) (*api.AuthProvider, error)
func (*AuthProviderStore) UpdateStatus ¶ added in v1.0.0
func (s *AuthProviderStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.AuthProvider, eventCallback EventCallback) (*api.AuthProvider, error)
type CertificateSigningRequest ¶
type CertificateSigningRequest interface {
InitialMigration(ctx context.Context) error
Create(ctx context.Context, orgId uuid.UUID, req *api.CertificateSigningRequest, eventCallback EventCallback) (*api.CertificateSigningRequest, error)
Update(ctx context.Context, orgId uuid.UUID, req *api.CertificateSigningRequest, eventCallback EventCallback) (*api.CertificateSigningRequest, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, certificatesigningrequest *api.CertificateSigningRequest, eventCallback EventCallback) (*api.CertificateSigningRequest, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string) (*api.CertificateSigningRequest, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.CertificateSigningRequestList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, certificatesigningrequest *api.CertificateSigningRequest) (*api.CertificateSigningRequest, error)
UpdateConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []api.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 *api.CertificateSigningRequest, eventCallback EventCallback) (*api.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 *api.CertificateSigningRequest, eventCallback EventCallback) (*api.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) (*api.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) (*api.CertificateSigningRequestList, error)
func (*CertificateSigningRequestStore) Update ¶ added in v0.2.0
func (s *CertificateSigningRequestStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.CertificateSigningRequest, eventCallback EventCallback) (*api.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 *api.CertificateSigningRequest) (*api.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) 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
type Device ¶
type Device interface {
InitialMigration(ctx context.Context) error
// Exposed to users
Create(ctx context.Context, orgId uuid.UUID, device *api.Device, eventCallback EventCallback) (*api.Device, error)
Update(ctx context.Context, orgId uuid.UUID, device *api.Device, fieldsToUnset []string, fromAPI bool, validationCallback DeviceStoreValidationCallback, eventCallback EventCallback) (*api.Device, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, device *api.Device, fieldsToUnset []string, fromAPI bool, validationCallback DeviceStoreValidationCallback, eventCallback EventCallback) (*api.Device, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string) (*api.Device, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.DeviceList, error)
Labels(ctx context.Context, orgId uuid.UUID, listParams ListParams) (api.LabelList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) (bool, error)
UpdateStatus(ctx context.Context, orgId uuid.UUID, device *api.Device, eventCallback EventCallback) (*api.Device, error)
GetRendered(ctx context.Context, orgId uuid.UUID, name string, knownRenderedVersion *string, consoleGrpcEndpoint string) (*api.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) (string, error)
SetServiceConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []api.Condition, callback ServiceConditionsCallback) error
OverwriteRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string, repositoryNames ...string) error
GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*api.RepositoryList, error)
PrepareDevicesAfterRestore(ctx context.Context) (int64, error)
RemoveConflictPausedAnnotation(ctx context.Context, orgId uuid.UUID, listParams ListParams) (int64, []string, error)
SetOutOfDate(ctx context.Context, orgId uuid.UUID, owner string) error
ListDisconnected(ctx context.Context, orgId uuid.UUID, listParams ListParams, cutoffTime time.Time) (*api.DeviceList, error)
GetWithoutServiceConditions(ctx context.Context, orgId uuid.UUID, name string) (*api.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) ([]api.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) (*api.DevicesSummary, error)
// Used by fleet selector
ListDevicesByServiceCondition(ctx context.Context, orgId uuid.UUID, conditionType string, conditionStatus string, listParams ListParams) (*api.DeviceList, error)
// Used by tests
SetIntegrationTestCreateOrUpdateCallback(IntegrationTestCallback)
CountByOrgAndStatus(ctx context.Context, orgId *uuid.UUID, statusType DeviceStatusType, groupByFleet bool) ([]CountByOrgAndStatusResult, error)
// Used for restoration
GetAllDeviceNames(ctx context.Context, orgId uuid.UUID) ([]string, error)
}
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) ([]api.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 *api.Device, fieldsToUnset []string, fromAPI bool, validationCallback DeviceStoreValidationCallback, eventCallback EventCallback) (*api.Device, bool, error)
func (*DeviceStore) Delete ¶
func (s *DeviceStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) (bool, error)
func (*DeviceStore) GetAllDeviceNames ¶ added in v0.10.0
GetAllDeviceNames returns all device names for a given organization This is used for restoration to add awaiting reconnection keys
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) (*api.RepositoryList, error)
func (*DeviceStore) GetWithoutServiceConditions ¶ added in v0.10.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) (api.LabelList, error)
func (*DeviceStore) List ¶
func (s *DeviceStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.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) (*api.DeviceList, error)
func (*DeviceStore) ListDisconnected ¶ added in v1.0.0
func (s *DeviceStore) ListDisconnected(ctx context.Context, orgId uuid.UUID, listParams ListParams, cutoffTime time.Time) (*api.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) PrepareDevicesAfterRestore ¶ added in v0.10.0
func (s *DeviceStore) PrepareDevicesAfterRestore(ctx context.Context) (int64, error)
PrepareDevicesAfterRestore sets the waitingForConnectionAfterRestore annotation on all devices, clears their lastSeen timestamps, and sets status summary using efficient SQL
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 []api.Condition, callback ServiceConditionsCallback) error
func (*DeviceStore) Summary ¶ added in v0.3.0
func (s *DeviceStore) Summary(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.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 *api.Device, fieldsToUnset []string, fromAPI bool, validationCallback DeviceStoreValidationCallback, eventCallback EventCallback) (*api.Device, error)
func (*DeviceStore) UpdateAnnotations ¶
func (*DeviceStore) UpdateRendered ¶
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 *api.EnrollmentRequest, callbackEvent EventCallback) (*api.EnrollmentRequest, error)
CreateWithFromAPI(ctx context.Context, orgId uuid.UUID, req *api.EnrollmentRequest, fromAPI bool, callbackEvent EventCallback) (*api.EnrollmentRequest, error)
Update(ctx context.Context, orgId uuid.UUID, req *api.EnrollmentRequest, callbackEvent EventCallback) (*api.EnrollmentRequest, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, enrollmentrequest *api.EnrollmentRequest, callbackEvent EventCallback) (*api.EnrollmentRequest, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string) (*api.EnrollmentRequest, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.EnrollmentRequestList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, callbackEvent EventCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, enrollmentrequest *api.EnrollmentRequest, callbackEvent EventCallback) (*api.EnrollmentRequest, error)
PrepareEnrollmentRequestsAfterRestore(ctx context.Context) (int64, 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 *api.EnrollmentRequest, eventCallback EventCallback) (*api.EnrollmentRequest, error)
func (*EnrollmentRequestStore) CreateOrUpdate ¶
func (s *EnrollmentRequestStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest, eventCallback EventCallback) (*api.EnrollmentRequest, bool, error)
func (*EnrollmentRequestStore) CreateWithFromAPI ¶ added in v0.10.0
func (s *EnrollmentRequestStore) CreateWithFromAPI(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest, fromAPI bool, eventCallback EventCallback) (*api.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) (*api.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) (*api.EnrollmentRequestList, error)
func (*EnrollmentRequestStore) PrepareEnrollmentRequestsAfterRestore ¶ added in v0.10.0
func (s *EnrollmentRequestStore) PrepareEnrollmentRequestsAfterRestore(ctx context.Context) (int64, error)
PrepareEnrollmentRequestsAfterRestore sets the awaitingReconnection annotation on all non-approved enrollment requests using efficient SQL
func (*EnrollmentRequestStore) Update ¶ added in v0.4.0
func (s *EnrollmentRequestStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest, eventCallback EventCallback) (*api.EnrollmentRequest, error)
func (*EnrollmentRequestStore) UpdateStatus ¶
func (s *EnrollmentRequestStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest, callbackEvent EventCallback) (*api.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 *api.Event) error
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.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 *api.Fleet, eventCallback EventCallback) (*api.Fleet, error)
Update(ctx context.Context, orgId uuid.UUID, fleet *api.Fleet, fieldsToUnset []string, fromAPI bool, eventCallback EventCallback) (*api.Fleet, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, fleet *api.Fleet, fieldsToUnset []string, fromAPI bool, eventCallback EventCallback) (*api.Fleet, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string, opts ...GetOption) (*api.Fleet, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams, opts ...ListOption) (*api.FleetList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, fleet *api.Fleet) (*api.Fleet, error)
ListRolloutDeviceSelection(ctx context.Context, orgId uuid.UUID) (*api.FleetList, error)
ListDisruptionBudgetFleets(ctx context.Context, orgId uuid.UUID) (*api.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 []api.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) (*api.RepositoryList, error)
// Used by domain metrics
CountByRolloutStatus(ctx context.Context, orgId *uuid.UUID, _ *string) ([]CountByRolloutStatusResult, error)
}
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) (*api.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) (*api.FleetList, error)
func (*FleetStore) ListDisruptionBudgetFleets ¶ added in v0.4.0
func (s *FleetStore) ListDisruptionBudgetFleets(ctx context.Context, orgId uuid.UUID) (*api.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) (*api.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 []api.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 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.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: api.Device AL is the API list, for example: api.DeviceList
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 *api.Repository, eventCallback EventCallback) (*api.Repository, error)
Update(ctx context.Context, orgId uuid.UUID, repository *api.Repository, eventCallback EventCallback) (*api.Repository, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, repository *api.Repository, eventCallback EventCallback) (*api.Repository, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string) (*api.Repository, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.RepositoryList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback EventCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.Repository, eventCallback EventCallback) (*api.Repository, error)
GetFleetRefs(ctx context.Context, orgId uuid.UUID, name string) (*api.FleetList, error)
GetDeviceRefs(ctx context.Context, orgId uuid.UUID, name string) (*api.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 *api.Repository, eventCallback EventCallback) (*api.Repository, error)
func (*RepositoryStore) CreateOrUpdate ¶
func (s *RepositoryStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.Repository, eventCallback EventCallback) (*api.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) (*api.Repository, error)
func (*RepositoryStore) GetDeviceRefs ¶
func (s *RepositoryStore) GetDeviceRefs(ctx context.Context, orgId uuid.UUID, name string) (*api.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) (*api.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 *api.Repository, eventCallback EventCallback) (*api.Repository, error)
func (*RepositoryStore) UpdateStatus ¶ added in v0.6.0
func (s *RepositoryStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.Repository, eventCallback EventCallback) (*api.Repository, error)
type ResourceSync ¶
type ResourceSync interface {
InitialMigration(ctx context.Context) error
Create(ctx context.Context, orgId uuid.UUID, resourceSync *api.ResourceSync, callbackEvent EventCallback) (*api.ResourceSync, error)
Update(ctx context.Context, orgId uuid.UUID, resourceSync *api.ResourceSync, callbackEvent EventCallback) (*api.ResourceSync, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resourceSync *api.ResourceSync, callbackEvent EventCallback) (*api.ResourceSync, bool, error)
Get(ctx context.Context, orgId uuid.UUID, name string) (*api.ResourceSync, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.ResourceSyncList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, callback RemoveOwnerCallback, callbackEvent EventCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.ResourceSync, eventCallback EventCallback) (*api.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 *api.ResourceSync, eventCallback EventCallback) (*api.ResourceSync, error)
func (*ResourceSyncStore) CreateOrUpdate ¶
func (s *ResourceSyncStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.ResourceSync, eventCallback EventCallback) (*api.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) (*api.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) (*api.ResourceSyncList, error)
func (*ResourceSyncStore) Update ¶ added in v0.2.0
func (s *ResourceSyncStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.ResourceSync, eventCallback EventCallback) (*api.ResourceSync, error)
func (*ResourceSyncStore) UpdateStatus ¶ added in v0.6.0
func (s *ResourceSyncStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.ResourceSync, eventCallback EventCallback) (*api.ResourceSync, error)
type ServiceConditionsCallback ¶ added in v0.9.0
type SortColumn ¶ added in v0.8.1
type SortColumn string
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
Event() Event
Checkpoint() Checkpoint
Organization() Organization
AuthProvider() AuthProvider
RunMigrations(context.Context) error
CheckHealth(context.Context) error
Close() error
}
type TemplateVersion ¶
type TemplateVersion interface {
InitialMigration(ctx context.Context) error
Create(ctx context.Context, orgId uuid.UUID, templateVersion *api.TemplateVersion, eventCallback EventCallback) (*api.TemplateVersion, error)
Get(ctx context.Context, orgId uuid.UUID, fleet string, name string) (*api.TemplateVersion, error)
List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.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) (*api.TemplateVersion, error)
UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.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 *api.TemplateVersion, eventCallback EventCallback) (*api.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) (*api.TemplateVersion, error)
func (*TemplateVersionStore) GetLatest ¶ added in v0.4.0
func (s *TemplateVersionStore) GetLatest(ctx context.Context, orgId uuid.UUID, fleet string) (*api.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) (*api.TemplateVersionList, error)
func (*TemplateVersionStore) UpdateStatus ¶
func (s *TemplateVersionStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.TemplateVersion, valid *bool) error