mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 01:15:22 +00:00
e452cc6a8a
- Add endpoints for osquery to register and continue a carve. - Implement client functionality for retrieving carve details and contents in fleetctl. - Add documentation on using file carving with Fleet. Addresses kolide/fleet#1714
76 lines
1.5 KiB
Go
76 lines
1.5 KiB
Go
package kolide
|
|
|
|
// Datastore combines all the interfaces in the Fleet DAL
|
|
type Datastore interface {
|
|
UserStore
|
|
QueryStore
|
|
CampaignStore
|
|
PackStore
|
|
LabelStore
|
|
HostStore
|
|
TargetStore
|
|
PasswordResetStore
|
|
SessionStore
|
|
AppConfigStore
|
|
InviteStore
|
|
ScheduledQueryStore
|
|
OsqueryOptionsStore
|
|
CarveStore
|
|
Name() string
|
|
Drop() error
|
|
// MigrateTables creates and migrates the table schemas
|
|
MigrateTables() error
|
|
// MigrateData populates built-in data
|
|
MigrateData() error
|
|
// MigrationStatus returns nil if migrations are complete, and an error
|
|
// if migrations need to be run.
|
|
MigrationStatus() (MigrationStatus, error)
|
|
Begin() (Transaction, error)
|
|
}
|
|
|
|
type MigrationStatus int
|
|
|
|
const (
|
|
NoMigrationsCompleted = iota
|
|
SomeMigrationsCompleted
|
|
AllMigrationsCompleted
|
|
)
|
|
|
|
// NotFoundError is returned when the datastore resource cannot be found.
|
|
type NotFoundError interface {
|
|
error
|
|
IsNotFound() bool
|
|
}
|
|
|
|
func IsNotFound(err error) bool {
|
|
e, ok := err.(NotFoundError)
|
|
if !ok {
|
|
return false
|
|
}
|
|
return e.IsNotFound()
|
|
}
|
|
|
|
// AlreadyExists is returned when creating a datastore resource that already
|
|
// exists.
|
|
type AlreadyExistsError interface {
|
|
error
|
|
IsExists() bool
|
|
}
|
|
|
|
// ForeignKeyError is returned when the operation fails due to foreign key
|
|
// constraints.
|
|
type ForeignKeyError interface {
|
|
error
|
|
IsForeignKey() bool
|
|
}
|
|
|
|
func IsForeignKey(err error) bool {
|
|
e, ok := err.(ForeignKeyError)
|
|
if !ok {
|
|
return false
|
|
}
|
|
return e.IsForeignKey()
|
|
}
|
|
|
|
type OptionalArg func() interface{}
|