Documentation
¶
Index ¶
- Variables
- func AddPaginationToQuery(query *gorm.DB, limit int, cont *Continue) *gorm.DB
- func CloseDB(db *gorm.DB)
- func CountRemainingItems(query *gorm.DB, lastItemName string) int64
- func DeleteTestDB(log *logrus.Logger, cfg *config.Config, store Store, dbName string)
- func ErrorFromGormError(err error) error
- func GetNonNilFieldsFromResource(resource model.Resource) []string
- func InitDB(cfg *config.Config, log *logrus.Logger) (*gorm.DB, error)
- func ListQuery(model any) *listQuery
- 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) error
- func (s *CertificateSigningRequestStore) DeleteAll(ctx context.Context, orgId uuid.UUID) error
- func (s *CertificateSigningRequestStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*api.CertificateSigningRequest, error)
- func (s *CertificateSigningRequestStore) InitialMigration() 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 CompletionCount
- type Continue
- type CreateOrUpdateMode
- type DataStore
- func (s *DataStore) CertificateSigningRequest() CertificateSigningRequest
- func (s *DataStore) Close() error
- func (s *DataStore) Device() Device
- func (s *DataStore) EnrollmentRequest() EnrollmentRequest
- func (s *DataStore) Fleet() Fleet
- func (s *DataStore) InitialMigration() error
- func (s *DataStore) Repository() Repository
- func (s *DataStore) ResourceSync() ResourceSync
- func (s *DataStore) TemplateVersion() TemplateVersion
- type Device
- type DeviceStore
- func (s *DeviceStore) CompletionCounts(ctx context.Context, orgId uuid.UUID, owner string, templateVersion string, ...) ([]CompletionCount, 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) 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, ...) error
- func (s *DeviceStore) DeleteAll(ctx context.Context, orgId uuid.UUID, callback DeviceStoreAllDeletedCallback) error
- func (s *DeviceStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*api.Device, error)
- func (s *DeviceStore) GetRendered(ctx context.Context, orgId uuid.UUID, name string, ...) (*api.RenderedDeviceSpec, error)
- func (s *DeviceStore) GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*api.RepositoryList, error)
- func (s *DeviceStore) InitialMigration() error
- func (s *DeviceStore) List(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) SetIntegrationTestCreateOrUpdateCallback(c IntegrationTestCallback)
- 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, ...) error
- func (s *DeviceStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.Device) (*api.Device, error)
- func (s *DeviceStore) UpdateSummaryStatusBatch(ctx context.Context, orgId uuid.UUID, deviceNames []string, ...) error
- type DeviceStoreAllDeletedCallback
- type DeviceStoreCallback
- 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) Delete(ctx context.Context, orgId uuid.UUID, name string) error
- func (s *EnrollmentRequestStore) DeleteAll(ctx context.Context, orgId uuid.UUID) error
- func (s *EnrollmentRequestStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*api.EnrollmentRequest, error)
- func (s *EnrollmentRequestStore) InitialMigration() error
- func (s *EnrollmentRequestStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.EnrollmentRequestList, 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 Fleet
- type FleetStore
- 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, callback FleetStoreCallback) error
- func (s *FleetStore) DeleteAll(ctx context.Context, orgId uuid.UUID, callback FleetStoreAllDeletedCallback) 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() 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() ([]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 FleetStoreAllDeletedCallback
- type FleetStoreCallback
- 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, bool, error)
- func (s *GenericStore[P, M, A, AL]) Delete(ctx context.Context, resource M, ...) error
- func (s *GenericStore[P, M, A, AL]) DeleteAll(ctx context.Context, orgId uuid.UUID, callback func(orgId uuid.UUID)) 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, 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 Model
- type Repository
- type RepositoryStore
- 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, ...) error
- func (s *RepositoryStore) DeleteAll(ctx context.Context, orgId uuid.UUID, ...) 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() error
- func (s *RepositoryStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.RepositoryList, error)
- func (s *RepositoryStore) ListIgnoreOrg() ([]model.Repository, error)
- func (s *RepositoryStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.Repository, ...) (*api.Repository, error)
- func (s *RepositoryStore) UpdateStatusIgnoreOrg(resource *model.Repository) error
- type RepositoryStoreAllDeletedCallback
- type RepositoryStoreCallback
- type Resource
- type ResourceSync
- type ResourceSyncStore
- 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) DeleteAll(ctx context.Context, orgId uuid.UUID, ...) error
- func (s *ResourceSyncStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*api.ResourceSync, error)
- func (s *ResourceSyncStore) InitialMigration() error
- func (s *ResourceSyncStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.ResourceSyncList, error)
- func (s *ResourceSyncStore) ListIgnoreOrg() ([]model.ResourceSync, error)
- func (s *ResourceSyncStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.ResourceSync) (*api.ResourceSync, error)
- func (s *ResourceSyncStore) UpdateStatusIgnoreOrg(resource *model.ResourceSync) error
- 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) error
- func (s *TemplateVersionStore) DeleteAll(ctx context.Context, orgId uuid.UUID, fleet *string) 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() 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
- type TemplateVersionStoreCallback
Constants ¶
This section is empty.
Variables ¶
var ( NullOrgId = uuid.MustParse("00000000-0000-0000-0000-000000000000") MaxRecordsPerListRequest = 1000 CurrentContinueVersion = 1 )
Functions ¶
func AddPaginationToQuery ¶
func DeleteTestDB ¶
func ErrorFromGormError ¶ added in v0.3.0
Types ¶
type CertificateSigningRequest ¶
type CertificateSigningRequest interface {
InitialMigration() error
Create(ctx context.Context, orgId uuid.UUID, req *api.CertificateSigningRequest) (*api.CertificateSigningRequest, error)
Update(ctx context.Context, orgId uuid.UUID, req *api.CertificateSigningRequest) (*api.CertificateSigningRequest, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, certificatesigningrequest *api.CertificateSigningRequest) (*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) error
DeleteAll(ctx context.Context, orgId uuid.UUID) 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) (*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) (*api.CertificateSigningRequest, bool, 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() 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) (*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 CompletionCount ¶ added in v0.4.0
type Continue ¶
func ParseContinueString ¶
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) CertificateSigningRequest ¶
func (s *DataStore) CertificateSigningRequest() CertificateSigningRequest
func (*DataStore) EnrollmentRequest ¶
func (s *DataStore) EnrollmentRequest() EnrollmentRequest
func (*DataStore) InitialMigration ¶
func (*DataStore) Repository ¶
func (s *DataStore) Repository() Repository
func (*DataStore) ResourceSync ¶
func (s *DataStore) ResourceSync() ResourceSync
func (*DataStore) TemplateVersion ¶
func (s *DataStore) TemplateVersion() TemplateVersion
type Device ¶
type Device interface {
InitialMigration() error
Create(ctx context.Context, orgId uuid.UUID, device *api.Device, callback DeviceStoreCallback) (*api.Device, error)
Update(ctx context.Context, orgId uuid.UUID, device *api.Device, fieldsToUnset []string, fromAPI bool, validationCallback DeviceStoreValidationCallback, callback DeviceStoreCallback) (*api.Device, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, device *api.Device, fieldsToUnset []string, fromAPI bool, validationCallback DeviceStoreValidationCallback, callback DeviceStoreCallback) (*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)
Delete(ctx context.Context, orgId uuid.UUID, name string, callback DeviceStoreCallback) error
DeleteAll(ctx context.Context, orgId uuid.UUID, callback DeviceStoreAllDeletedCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, device *api.Device) (*api.Device, error)
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) ([]CompletionCount, error)
CountByLabels(ctx context.Context, orgId uuid.UUID, listParams ListParams, groupBy []string, busyOnly bool) ([]map[string]any, error)
Summary(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.DevicesSummary, error)
UpdateSummaryStatusBatch(ctx context.Context, orgId uuid.UUID, deviceNames []string, status api.DeviceSummaryStatusType, statusInfo string) error
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 string) error
GetRendered(ctx context.Context, orgId uuid.UUID, name string, knownRenderedVersion *string, consoleGrpcEndpoint string) (*api.RenderedDeviceSpec, error)
SetServiceConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []api.Condition) 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)
SetIntegrationTestCreateOrUpdateCallback(IntegrationTestCallback)
}
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) ([]CompletionCount, 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, busyOnly bool) ([]map[string]any, error)
CountByLabels is used for rollout policy disruption budget to provide device count values grouped by the label values.
func (*DeviceStore) CreateOrUpdate ¶
func (s *DeviceStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.Device, fieldsToUnset []string, fromAPI bool, validationCallback DeviceStoreValidationCallback, callback DeviceStoreCallback) (*api.Device, bool, error)
func (*DeviceStore) Delete ¶
func (s *DeviceStore) Delete(ctx context.Context, orgId uuid.UUID, name string, callback DeviceStoreCallback) error
func (*DeviceStore) DeleteAll ¶
func (s *DeviceStore) DeleteAll(ctx context.Context, orgId uuid.UUID, callback DeviceStoreAllDeletedCallback) error
func (*DeviceStore) GetRendered ¶
func (*DeviceStore) GetRepositoryRefs ¶
func (s *DeviceStore) GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*api.RepositoryList, error)
func (*DeviceStore) InitialMigration ¶
func (s *DeviceStore) InitialMigration() error
func (*DeviceStore) List ¶
func (s *DeviceStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*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) SetIntegrationTestCreateOrUpdateCallback ¶
func (s *DeviceStore) SetIntegrationTestCreateOrUpdateCallback(c IntegrationTestCallback)
func (*DeviceStore) SetServiceConditions ¶
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, callback DeviceStoreCallback) (*api.Device, error)
func (*DeviceStore) UpdateAnnotations ¶
func (*DeviceStore) UpdateRendered ¶
func (*DeviceStore) UpdateStatus ¶
func (*DeviceStore) UpdateSummaryStatusBatch ¶
func (s *DeviceStore) UpdateSummaryStatusBatch(ctx context.Context, orgId uuid.UUID, deviceNames []string, status api.DeviceSummaryStatusType, statusInfo string) error
type DeviceStoreCallback ¶
type DeviceStoreValidationCallback ¶ added in v0.4.0
type EnrollmentRequest ¶
type EnrollmentRequest interface {
InitialMigration() error
Create(ctx context.Context, orgId uuid.UUID, req *api.EnrollmentRequest) (*api.EnrollmentRequest, error)
Update(ctx context.Context, orgId uuid.UUID, req *api.EnrollmentRequest) (*api.EnrollmentRequest, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, enrollmentrequest *api.EnrollmentRequest) (*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) error
DeleteAll(ctx context.Context, orgId uuid.UUID) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, enrollmentrequest *api.EnrollmentRequest) (*api.EnrollmentRequest, error)
}
func NewEnrollmentRequest ¶
func NewEnrollmentRequest(db *gorm.DB, log logrus.FieldLogger) EnrollmentRequest
type EnrollmentRequestStore ¶
type EnrollmentRequestStore struct {
// contains filtered or unexported fields
}
func (*EnrollmentRequestStore) Create ¶
func (s *EnrollmentRequestStore) Create(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest) (*api.EnrollmentRequest, error)
func (*EnrollmentRequestStore) CreateOrUpdate ¶
func (s *EnrollmentRequestStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest) (*api.EnrollmentRequest, bool, 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() error
func (*EnrollmentRequestStore) List ¶
func (s *EnrollmentRequestStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.EnrollmentRequestList, error)
func (*EnrollmentRequestStore) Update ¶ added in v0.4.0
func (s *EnrollmentRequestStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest) (*api.EnrollmentRequest, error)
func (*EnrollmentRequestStore) UpdateStatus ¶
func (s *EnrollmentRequestStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest) (*api.EnrollmentRequest, error)
type Fleet ¶
type Fleet interface {
InitialMigration() error
Create(ctx context.Context, orgId uuid.UUID, fleet *api.Fleet, callback FleetStoreCallback) (*api.Fleet, error)
Update(ctx context.Context, orgId uuid.UUID, fleet *api.Fleet, fieldsToUnset []string, fromAPI bool, callback FleetStoreCallback) (*api.Fleet, error)
ListRolloutDeviceSelection(ctx context.Context, orgId uuid.UUID) (*api.FleetList, error)
ListDisruptionBudgetFleets(ctx context.Context, orgId uuid.UUID) (*api.FleetList, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, fleet *api.Fleet, fieldsToUnset []string, fromAPI bool, callback FleetStoreCallback) (*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, callback FleetStoreCallback) error
DeleteAll(ctx context.Context, orgId uuid.UUID, callback FleetStoreAllDeletedCallback) error
UpdateStatus(ctx context.Context, orgId uuid.UUID, fleet *api.Fleet) (*api.Fleet, 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
ListIgnoreOrg() ([]model.Fleet, error)
UpdateConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []api.Condition) error
UpdateAnnotations(ctx context.Context, orgId uuid.UUID, name string, annotations map[string]string, deleteKeys []string) 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)
}
type FleetStore ¶
type FleetStore struct {
// contains filtered or unexported fields
}
func (*FleetStore) CreateOrUpdate ¶
func (*FleetStore) Delete ¶
func (s *FleetStore) Delete(ctx context.Context, orgId uuid.UUID, name string, callback FleetStoreCallback) error
func (*FleetStore) DeleteAll ¶
func (s *FleetStore) DeleteAll(ctx context.Context, orgId uuid.UUID, callback FleetStoreAllDeletedCallback) 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() 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 ¶
func (s *FleetStore) ListIgnoreOrg() ([]model.Fleet, error)
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 ¶
type FleetStoreCallback ¶
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
}
type Model ¶ added in v0.4.0
type Model interface {
model.CertificateSigningRequest | model.Device | model.EnrollmentRequest | model.Fleet | model.Repository | model.ResourceSync | model.TemplateVersion
}
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 Repository ¶
type Repository interface {
InitialMigration() error
Create(ctx context.Context, orgId uuid.UUID, repository *api.Repository, callback RepositoryStoreCallback) (*api.Repository, error)
Update(ctx context.Context, orgId uuid.UUID, repository *api.Repository, callback RepositoryStoreCallback) (*api.Repository, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, repository *api.Repository, callback RepositoryStoreCallback) (*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, callback RepositoryStoreCallback) error
DeleteAll(ctx context.Context, orgId uuid.UUID, callback RepositoryStoreAllDeletedCallback) error
ListIgnoreOrg() ([]model.Repository, error)
GetInternal(ctx context.Context, orgId uuid.UUID, name string) (*model.Repository, error)
UpdateStatusIgnoreOrg(repository *model.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)
}
func NewRepository ¶
func NewRepository(db *gorm.DB, log logrus.FieldLogger) Repository
type RepositoryStore ¶
type RepositoryStore struct {
// contains filtered or unexported fields
}
func (*RepositoryStore) Create ¶
func (s *RepositoryStore) Create(ctx context.Context, orgId uuid.UUID, resource *api.Repository, callback RepositoryStoreCallback) (*api.Repository, error)
func (*RepositoryStore) CreateOrUpdate ¶
func (s *RepositoryStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.Repository, callback RepositoryStoreCallback) (*api.Repository, bool, error)
func (*RepositoryStore) Delete ¶
func (s *RepositoryStore) Delete(ctx context.Context, orgId uuid.UUID, name string, callback RepositoryStoreCallback) error
func (*RepositoryStore) DeleteAll ¶
func (s *RepositoryStore) DeleteAll(ctx context.Context, orgId uuid.UUID, callback RepositoryStoreAllDeletedCallback) 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() 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() ([]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, callback RepositoryStoreCallback) (*api.Repository, error)
func (*RepositoryStore) UpdateStatusIgnoreOrg ¶
func (s *RepositoryStore) UpdateStatusIgnoreOrg(resource *model.Repository) error
type RepositoryStoreCallback ¶
type RepositoryStoreCallback func(uuid.UUID, *api.Repository, *api.Repository)
type ResourceSync ¶
type ResourceSync interface {
InitialMigration() error
Create(ctx context.Context, orgId uuid.UUID, resourceSync *api.ResourceSync) (*api.ResourceSync, error)
Update(ctx context.Context, orgId uuid.UUID, resourceSync *api.ResourceSync) (*api.ResourceSync, error)
CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resourceSync *api.ResourceSync) (*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) error
DeleteAll(ctx context.Context, orgId uuid.UUID, callback removeAllResourceSyncOwnerCallback) error
ListIgnoreOrg() ([]model.ResourceSync, error)
UpdateStatusIgnoreOrg(resourceSync *model.ResourceSync) error
}
func NewResourceSync ¶
func NewResourceSync(db *gorm.DB, log logrus.FieldLogger) ResourceSync
type ResourceSyncStore ¶
type ResourceSyncStore struct {
// contains filtered or unexported fields
}
func (*ResourceSyncStore) Create ¶
func (s *ResourceSyncStore) Create(ctx context.Context, orgId uuid.UUID, resource *api.ResourceSync) (*api.ResourceSync, error)
func (*ResourceSyncStore) CreateOrUpdate ¶
func (s *ResourceSyncStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.ResourceSync) (*api.ResourceSync, bool, 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() error
func (*ResourceSyncStore) List ¶
func (s *ResourceSyncStore) List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.ResourceSyncList, error)
func (*ResourceSyncStore) ListIgnoreOrg ¶
func (s *ResourceSyncStore) ListIgnoreOrg() ([]model.ResourceSync, error)
A method to get all ResourceSyncs , regardless of ownership. Used internally by the the ResourceSync monitor. TODO: Add pagination, perhaps via gorm scopes.
func (*ResourceSyncStore) Update ¶ added in v0.2.0
func (s *ResourceSyncStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.ResourceSync) (*api.ResourceSync, error)
func (*ResourceSyncStore) UpdateStatusIgnoreOrg ¶
func (s *ResourceSyncStore) UpdateStatusIgnoreOrg(resource *model.ResourceSync) error
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
InitialMigration() error
Close() error
}
type TemplateVersion ¶
type TemplateVersion interface {
InitialMigration() error
Create(ctx context.Context, orgId uuid.UUID, templateVersion *api.TemplateVersion, callback TemplateVersionStoreCallback) (*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) error
DeleteAll(ctx context.Context, orgId uuid.UUID, fleet *string) 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, callback TemplateVersionStoreCallback) 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, callback TemplateVersionStoreCallback) (*api.TemplateVersion, 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() 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, callback TemplateVersionStoreCallback) error
type TemplateVersionStoreCallback ¶
type TemplateVersionStoreCallback func(uuid.UUID, *api.TemplateVersion, *api.TemplateVersion)