store

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NullOrgId                = uuid.MustParse("00000000-0000-0000-0000-000000000000")
	MaxRecordsPerListRequest = 1000
	CurrentContinueVersion   = 1
)

Functions

func AddPaginationToQuery

func AddPaginationToQuery(query *gorm.DB, limit int, cont *Continue) *gorm.DB

func AnnotationsMatchExpressionsQuery added in v0.3.0

func AnnotationsMatchExpressionsQuery(query *gorm.DB, matchExpressions api.MatchExpressions) (*gorm.DB, error)

func CloseDB

func CloseDB(db *gorm.DB)

func CountRemainingItems

func CountRemainingItems(query *gorm.DB, lastItemName string) int64

func DeleteTestDB

func DeleteTestDB(log *logrus.Logger, cfg *config.Config, store Store, dbName string)

func ErrorFromGormError added in v0.3.0

func ErrorFromGormError(err error) error

func FieldFilterSelectionQuery added in v0.2.0

func FieldFilterSelectionQuery(query *gorm.DB, fieldMap map[string][]string) *gorm.DB

FieldFilterSelectionQuery takes a GORM DB query and a map of search parameters. To search for a key-value pair in the in a JSON object use the key to reflect location in the JSON data and the value to reflect the value to search for. example map[string]string{"status.config.summary.status": "UpToDate"} will search status.config.summary.status for the value "UpToDate". To search for multiple values in the same field, separate the values with a comma.

func GetNonNilFieldsFromResource

func GetNonNilFieldsFromResource(resource model.Resource) []string

func InitDB

func InitDB(cfg *config.Config, log *logrus.Logger) (*gorm.DB, error)

func LabelMatchExpressionsQuery added in v0.3.0

func LabelMatchExpressionsQuery(query *gorm.DB, matchExpressions api.MatchExpressions) (*gorm.DB, error)

func LabelSelectionQuery

func LabelSelectionQuery(query *gorm.DB, labels map[string]string, inverse bool) *gorm.DB

LabelSelectionQuery applies a label-based selection query to the given GORM DB query. It takes a map of labels and a GORM DB query as input. The function returns the modified DB query.

func ListQuery added in v0.3.0

func ListQuery(model any) *listQuery

Types

type CertificateSigningRequest

type CertificateSigningRequest interface {
	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)
	List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.CertificateSigningRequestList, error)
	Get(ctx context.Context, orgId uuid.UUID, name string) (*api.CertificateSigningRequest, error)
	CreateOrUpdate(ctx context.Context, orgId uuid.UUID, certificatesigningrequest *api.CertificateSigningRequest) (*api.CertificateSigningRequest, bool, error)
	UpdateStatus(ctx context.Context, orgId uuid.UUID, certificatesigningrequest *api.CertificateSigningRequest) (*api.CertificateSigningRequest, error)
	DeleteAll(ctx context.Context, orgId uuid.UUID) error
	Delete(ctx context.Context, orgId uuid.UUID, name string) error
	UpdateConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []api.Condition) error
	InitialMigration() 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

Warning: this is a user-facing function and will set the Status to nil

func (*CertificateSigningRequestStore) CreateOrUpdate

func (*CertificateSigningRequestStore) Delete

func (s *CertificateSigningRequestStore) Delete(ctx context.Context, orgId uuid.UUID, name string) error

func (*CertificateSigningRequestStore) DeleteAll

func (s *CertificateSigningRequestStore) DeleteAll(ctx context.Context, orgId uuid.UUID) error

func (*CertificateSigningRequestStore) Get

func (*CertificateSigningRequestStore) InitialMigration

func (s *CertificateSigningRequestStore) InitialMigration() error

func (*CertificateSigningRequestStore) List

func (*CertificateSigningRequestStore) Update added in v0.2.0

Warning: this is a user-facing function and will set the Status to nil

func (*CertificateSigningRequestStore) UpdateConditions

func (s *CertificateSigningRequestStore) UpdateConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []api.Condition) error

func (*CertificateSigningRequestStore) UpdateStatus

type Continue

type Continue struct {
	Version int
	Name    string
	Count   int64
}

func ParseContinueString

func ParseContinueString(contStr *string) (*Continue, error)

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) Close

func (s *DataStore) Close() error

func (*DataStore) Device

func (s *DataStore) Device() Device

func (*DataStore) EnrollmentRequest

func (s *DataStore) EnrollmentRequest() EnrollmentRequest

func (*DataStore) Fleet

func (s *DataStore) Fleet() Fleet

func (*DataStore) InitialMigration

func (s *DataStore) InitialMigration() error

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 {
	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, callback DeviceStoreCallback) (*api.Device, error)
	List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.DeviceList, error)
	Summary(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.DevicesSummary, error)
	Get(ctx context.Context, orgId uuid.UUID, name string) (*api.Device, error)
	CreateOrUpdate(ctx context.Context, orgId uuid.UUID, device *api.Device, fieldsToUnset []string, fromAPI bool, callback DeviceStoreCallback) (*api.Device, bool, error)
	UpdateStatus(ctx context.Context, orgId uuid.UUID, device *api.Device) (*api.Device, error)
	UpdateSummaryStatusBatch(ctx context.Context, orgId uuid.UUID, deviceNames []string, status api.DeviceSummaryStatusType, statusInfo string) error
	DeleteAll(ctx context.Context, orgId uuid.UUID, callback DeviceStoreAllDeletedCallback) error
	Delete(ctx context.Context, orgId uuid.UUID, name string, callback DeviceStoreCallback) 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)
	InitialMigration() error
	SetIntegrationTestCreateOrUpdateCallback(IntegrationTestCallback)
}

func NewDevice

func NewDevice(db *gorm.DB, log logrus.FieldLogger) Device

type DeviceStore

type DeviceStore struct {
	IntegrationTestCreateOrUpdateCallback IntegrationTestCallback
	// contains filtered or unexported fields
}

func (*DeviceStore) Create

func (s *DeviceStore) Create(ctx context.Context, orgId uuid.UUID, resource *api.Device, callback DeviceStoreCallback) (*api.Device, error)

func (*DeviceStore) CreateOrUpdate

func (s *DeviceStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.Device, fieldsToUnset []string, fromAPI bool, 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) Get

func (s *DeviceStore) Get(ctx context.Context, orgId uuid.UUID, name string) (*api.Device, error)

func (*DeviceStore) GetRendered

func (s *DeviceStore) GetRendered(ctx context.Context, orgId uuid.UUID, name string, knownRenderedVersion *string, consoleGrpcEndpoint string) (*api.RenderedDeviceSpec, error)

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) OverwriteRepositoryRefs

func (s *DeviceStore) OverwriteRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string, repositoryNames ...string) error

func (*DeviceStore) SetIntegrationTestCreateOrUpdateCallback

func (s *DeviceStore) SetIntegrationTestCreateOrUpdateCallback(c IntegrationTestCallback)

func (*DeviceStore) SetServiceConditions

func (s *DeviceStore) SetServiceConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []api.Condition) 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) Update added in v0.2.0

func (s *DeviceStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.Device, fieldsToUnset []string, fromAPI bool, callback DeviceStoreCallback) (*api.Device, error)

func (*DeviceStore) UpdateAnnotations

func (s *DeviceStore) UpdateAnnotations(ctx context.Context, orgId uuid.UUID, name string, annotations map[string]string, deleteKeys []string) error

func (*DeviceStore) UpdateRendered

func (s *DeviceStore) UpdateRendered(ctx context.Context, orgId uuid.UUID, name, renderedConfig, renderedApplications string) error

func (*DeviceStore) UpdateStatus

func (s *DeviceStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.Device) (*api.Device, error)

func (*DeviceStore) UpdateSummaryStatusBatch

func (s *DeviceStore) UpdateSummaryStatusBatch(ctx context.Context, orgId uuid.UUID, deviceNames []string, status api.DeviceSummaryStatusType, statusInfo string) error

type DeviceStoreAllDeletedCallback

type DeviceStoreAllDeletedCallback func(orgId uuid.UUID)

type DeviceStoreCallback

type DeviceStoreCallback func(before *model.Device, after *model.Device)

type EnrollmentRequest

type EnrollmentRequest interface {
	Create(ctx context.Context, orgId uuid.UUID, req *api.EnrollmentRequest) (*api.EnrollmentRequest, error)
	List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.EnrollmentRequestList, error)
	Get(ctx context.Context, orgId uuid.UUID, name string) (*api.EnrollmentRequest, error)
	CreateOrUpdate(ctx context.Context, orgId uuid.UUID, enrollmentrequest *api.EnrollmentRequest) (*api.EnrollmentRequest, bool, error)
	UpdateStatus(ctx context.Context, orgId uuid.UUID, enrollmentrequest *api.EnrollmentRequest) (*api.EnrollmentRequest, error)
	DeleteAll(ctx context.Context, orgId uuid.UUID) error
	Delete(ctx context.Context, orgId uuid.UUID, name string) error
	InitialMigration() 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 (*EnrollmentRequestStore) CreateOrUpdate

func (s *EnrollmentRequestStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest) (*api.EnrollmentRequest, bool, error)

func (*EnrollmentRequestStore) Delete

func (s *EnrollmentRequestStore) Delete(ctx context.Context, orgId uuid.UUID, name string) error

func (*EnrollmentRequestStore) DeleteAll

func (s *EnrollmentRequestStore) DeleteAll(ctx context.Context, orgId uuid.UUID) error

func (*EnrollmentRequestStore) Get

func (*EnrollmentRequestStore) InitialMigration

func (s *EnrollmentRequestStore) InitialMigration() error

func (*EnrollmentRequestStore) List

func (*EnrollmentRequestStore) UpdateStatus

func (s *EnrollmentRequestStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.EnrollmentRequest) (*api.EnrollmentRequest, error)

type Fleet

type Fleet interface {
	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, callback FleetStoreCallback) (*api.Fleet, error)
	List(ctx context.Context, orgId uuid.UUID, listParams ListParams, opts ...ListOption) (*api.FleetList, error)
	Get(ctx context.Context, orgId uuid.UUID, name string, opts ...GetOption) (*api.Fleet, error)
	CreateOrUpdate(ctx context.Context, orgId uuid.UUID, fleet *api.Fleet, callback FleetStoreCallback) (*api.Fleet, bool, error)
	CreateOrUpdateMultiple(ctx context.Context, orgId uuid.UUID, callback FleetStoreCallback, fleets ...*api.Fleet) error
	UpdateStatus(ctx context.Context, orgId uuid.UUID, fleet *api.Fleet) (*api.Fleet, error)
	UpdateStatusMultiple(ctx context.Context, orgId uuid.UUID, fleets ...*api.Fleet) error
	DeleteAll(ctx context.Context, orgId uuid.UUID, callback FleetStoreAllDeletedCallback) error
	Delete(ctx context.Context, orgId uuid.UUID, callback FleetStoreCallback, names ...string) 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)
	InitialMigration() error
}

func NewFleet

func NewFleet(db *gorm.DB, log logrus.FieldLogger) Fleet

type FleetStore

type FleetStore struct {
	// contains filtered or unexported fields
}

func (*FleetStore) Create

func (s *FleetStore) Create(ctx context.Context, orgId uuid.UUID, resource *api.Fleet, callback FleetStoreCallback) (*api.Fleet, error)

func (*FleetStore) CreateOrUpdate

func (s *FleetStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *api.Fleet, callback FleetStoreCallback) (*api.Fleet, bool, error)

func (*FleetStore) CreateOrUpdateMultiple

func (s *FleetStore) CreateOrUpdateMultiple(ctx context.Context, orgId uuid.UUID, callback FleetStoreCallback, resources ...*api.Fleet) error

func (*FleetStore) Delete

func (s *FleetStore) Delete(ctx context.Context, orgId uuid.UUID, callback FleetStoreCallback, names ...string) error

func (*FleetStore) DeleteAll

func (s *FleetStore) DeleteAll(ctx context.Context, orgId uuid.UUID, callback FleetStoreAllDeletedCallback) error

func (*FleetStore) Get

func (s *FleetStore) Get(ctx context.Context, orgId uuid.UUID, name string, opts ...GetOption) (*api.Fleet, 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) 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) OverwriteRepositoryRefs

func (s *FleetStore) OverwriteRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string, repositoryNames ...string) error

func (*FleetStore) UnsetOwner

func (s *FleetStore) UnsetOwner(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, owner string) error

func (*FleetStore) UnsetOwnerByKind

func (s *FleetStore) UnsetOwnerByKind(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, resourceKind string) error

func (*FleetStore) Update added in v0.2.0

func (s *FleetStore) Update(ctx context.Context, orgId uuid.UUID, resource *api.Fleet, callback FleetStoreCallback) (*api.Fleet, error)

func (*FleetStore) UpdateAnnotations

func (s *FleetStore) UpdateAnnotations(ctx context.Context, orgId uuid.UUID, name string, annotations map[string]string, deleteKeys []string) error

func (*FleetStore) UpdateConditions

func (s *FleetStore) UpdateConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []api.Condition) error

func (*FleetStore) UpdateStatus

func (s *FleetStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.Fleet) (*api.Fleet, error)

func (*FleetStore) UpdateStatusMultiple

func (s *FleetStore) UpdateStatusMultiple(ctx context.Context, orgId uuid.UUID, resources ...*api.Fleet) error

type FleetStoreAllDeletedCallback

type FleetStoreAllDeletedCallback func(orgId uuid.UUID)

type FleetStoreCallback

type FleetStoreCallback func(before *model.Fleet, after *model.Fleet)

type GetOption

type GetOption func(*getOptions)

func WithSummary

func WithSummary(val bool) GetOption

type IntegrationTestCallback

type IntegrationTestCallback func()

type ListOption

type ListOption func(*listOptions)

func WithDeviceCount

func WithDeviceCount(val bool) ListOption

type ListParams

type ListParams struct {
	Labels                      map[string]string
	LabelMatchExpressions       v1alpha1.MatchExpressions
	AnnotationsMatchExpressions v1alpha1.MatchExpressions
	Filter                      map[string][]string
	InvertLabels                *bool
	Owners                      []string
	Limit                       int
	Continue                    *Continue
	FleetName                   *string
	FieldSelector               fields.Selector
	SortBy                      *SortField
}

type Repository

type Repository interface {
	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)
	List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.RepositoryList, error)
	ListIgnoreOrg() ([]model.Repository, error)
	DeleteAll(ctx context.Context, orgId uuid.UUID, callback RepositoryStoreAllDeletedCallback) error
	Get(ctx context.Context, orgId uuid.UUID, name string) (*api.Repository, error)
	GetInternal(ctx context.Context, orgId uuid.UUID, name string) (*model.Repository, error)
	CreateOrUpdate(ctx context.Context, orgId uuid.UUID, repository *api.Repository, callback RepositoryStoreCallback) (*api.Repository, bool, error)
	Delete(ctx context.Context, orgId uuid.UUID, name string, callback RepositoryStoreCallback) 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)
	InitialMigration() 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 (s *RepositoryStore) GetFleetRefs(ctx context.Context, orgId uuid.UUID, name string) (*api.FleetList, error)

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 RepositoryStoreAllDeletedCallback

type RepositoryStoreAllDeletedCallback func(uuid.UUID)

type RepositoryStoreCallback

type RepositoryStoreCallback func(*model.Repository)

type ResourceSync

type ResourceSync interface {
	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)
	List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.ResourceSyncList, error)
	ListIgnoreOrg() ([]model.ResourceSync, error)
	DeleteAll(ctx context.Context, orgId uuid.UUID, callback removeAllResourceSyncOwnerCallback) error
	Get(ctx context.Context, orgId uuid.UUID, name string) (*api.ResourceSync, error)
	CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resourceSync *api.ResourceSync) (*api.ResourceSync, bool, error)
	Delete(ctx context.Context, orgId uuid.UUID, name string, callback removeOwnerCallback) error
	UpdateStatusIgnoreOrg(resourceSync *model.ResourceSync) error
	InitialMigration() 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) Delete

func (s *ResourceSyncStore) Delete(ctx context.Context, orgId uuid.UUID, name string, callback removeOwnerCallback) error

func (*ResourceSyncStore) DeleteAll

func (s *ResourceSyncStore) DeleteAll(ctx context.Context, orgId uuid.UUID, callback removeAllResourceSyncOwnerCallback) 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 SortField added in v0.3.0

type SortField struct {
	FieldName selector.SelectorFieldName
	Order     v1alpha1.SortOrder
}

type SortOrder added in v0.3.0

type SortOrder string

type StatusCount

type StatusCount struct {
	Category      string
	StatusSummary string
	Count         int64
}

type StatusCountList added in v0.3.0

type StatusCountList []StatusCount

func CountStatusList added in v0.3.0

func CountStatusList(ctx context.Context, query *gorm.DB, status ...string) (StatusCountList, error)

func (StatusCountList) List added in v0.3.0

func (s StatusCountList) List(status string) map[string]int64

type Store

type Store interface {
	Device() Device
	EnrollmentRequest() EnrollmentRequest
	CertificateSigningRequest() CertificateSigningRequest
	Fleet() Fleet
	TemplateVersion() TemplateVersion
	Repository() Repository
	ResourceSync() ResourceSync
	InitialMigration() error
	Close() error
}

func NewStore

func NewStore(db *gorm.DB, log logrus.FieldLogger) Store

func PrepareDBForUnitTests

func PrepareDBForUnitTests(log *logrus.Logger) (Store, *config.Config, string, *gorm.DB)

type TemplateVersion

type TemplateVersion interface {
	Create(ctx context.Context, orgId uuid.UUID, templateVersion *api.TemplateVersion, callback TemplateVersionStoreCallback) (*api.TemplateVersion, error)
	List(ctx context.Context, orgId uuid.UUID, listParams ListParams) (*api.TemplateVersionList, error)
	DeleteAll(ctx context.Context, orgId uuid.UUID, fleet *string) error
	Get(ctx context.Context, orgId uuid.UUID, fleet string, name string) (*api.TemplateVersion, error)
	Delete(ctx context.Context, orgId uuid.UUID, fleet string, name string) error
	UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *api.TemplateVersion, valid *bool, callback TemplateVersionStoreCallback) error
	GetNewestValid(ctx context.Context, orgId uuid.UUID, fleet string) (*api.TemplateVersion, error)
	InitialMigration() 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 (*TemplateVersionStore) Delete

func (s *TemplateVersionStore) Delete(ctx context.Context, orgId uuid.UUID, fleet string, name string) error

func (*TemplateVersionStore) DeleteAll

func (s *TemplateVersionStore) DeleteAll(ctx context.Context, orgId uuid.UUID, fleet *string) error

func (*TemplateVersionStore) Get

func (s *TemplateVersionStore) Get(ctx context.Context, orgId uuid.UUID, fleet string, name string) (*api.TemplateVersion, error)

func (*TemplateVersionStore) GetNewestValid

func (s *TemplateVersionStore) GetNewestValid(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(tv *model.TemplateVersion)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL