Documentation ¶
Index ¶
- type DBOption
- type Datastore
- func (d *Datastore) AddHostToPack(hid, pid uint) error
- func (d *Datastore) AddLabelToPack(lid uint, pid uint, opts ...kolide.OptionalArg) error
- func (d *Datastore) AppConfig() (*kolide.AppConfig, error)
- func (d *Datastore) ApplyEnrollSecretSpec(spec *kolide.EnrollSecretSpec) error
- func (d *Datastore) ApplyLabelSpecs(specs []*kolide.LabelSpec) (err error)
- func (d *Datastore) ApplyOptions(spec *kolide.OptionsSpec) (err error)
- func (d *Datastore) ApplyPackSpecs(specs []*kolide.PackSpec) (err error)
- func (d *Datastore) ApplyQueries(authorID uint, queries []*kolide.Query) (err error)
- func (d *Datastore) AuthenticateHost(nodeKey string) (*kolide.Host, error)
- func (d *Datastore) Begin() (kolide.Transaction, error)
- func (d *Datastore) CleanupDistributedQueryCampaigns(now time.Time) (expired uint, err error)
- func (d *Datastore) CleanupIncomingHosts(now time.Time) error
- func (d *Datastore) Close() error
- func (ds *Datastore) ConfirmPendingEmailChange(id uint, token string) (newEmail string, err error)
- func (d *Datastore) CountHostsInTargets(hostIDs []uint, labelIDs []uint, now time.Time) (kolide.TargetMetrics, error)
- func (d *Datastore) DeleteHost(hid uint) error
- func (d *Datastore) DeleteInvite(id uint) error
- func (d *Datastore) DeleteLabel(name string) error
- func (d *Datastore) DeletePack(name string) error
- func (d *Datastore) DeletePasswordResetRequest(req *kolide.PasswordResetRequest) error
- func (d *Datastore) DeletePasswordResetRequestsForUser(userID uint) error
- func (d *Datastore) DeleteQueries(ids []uint) (uint, error)
- func (d *Datastore) DeleteQuery(name string) error
- func (d *Datastore) DeleteScheduledQuery(id uint) error
- func (d *Datastore) DestroyAllSessionsForUser(id uint) error
- func (d *Datastore) DestroySession(session *kolide.Session) error
- func (d *Datastore) DistributedQueryCampaign(id uint) (*kolide.DistributedQueryCampaign, error)
- func (d *Datastore) DistributedQueryCampaignTargetIDs(id uint) (hostIDs []uint, labelIDs []uint, err error)
- func (d *Datastore) Drop() error
- func (d *Datastore) EnrollHost(osqueryHostID, nodeKey, secretName string) (*kolide.Host, error)
- func (d *Datastore) FindPassswordResetByID(id uint) (*kolide.PasswordResetRequest, error)
- func (d *Datastore) FindPassswordResetByToken(token string) (*kolide.PasswordResetRequest, error)
- func (d *Datastore) FindPassswordResetByTokenAndUserID(token string, id uint) (*kolide.PasswordResetRequest, error)
- func (d *Datastore) FindPassswordResetsByUserID(id uint) ([]*kolide.PasswordResetRequest, error)
- func (d *Datastore) GenerateHostStatusStatistics(now time.Time) (online, offline, mia, new uint, e error)
- func (d *Datastore) GetEnrollSecretSpec() (*kolide.EnrollSecretSpec, error)
- func (d *Datastore) GetLabelSpec(name string) (*kolide.LabelSpec, error)
- func (d *Datastore) GetLabelSpecs() ([]*kolide.LabelSpec, error)
- func (d *Datastore) GetOptions() (*kolide.OptionsSpec, error)
- func (d *Datastore) GetPackSpec(name string) (spec *kolide.PackSpec, err error)
- func (d *Datastore) GetPackSpecs() (specs []*kolide.PackSpec, err error)
- func (d *Datastore) HealthCheck() error
- func (d *Datastore) Host(id uint) (*kolide.Host, error)
- func (d *Datastore) HostByIdentifier(identifier string) (*kolide.Host, error)
- func (d *Datastore) HostIDsByName(hostnames []string) ([]uint, error)
- func (d *Datastore) HostIDsInTargets(hostIDs []uint, labelIDs []uint) ([]uint, error)
- func (d *Datastore) Invite(id uint) (*kolide.Invite, error)
- func (d *Datastore) InviteByEmail(email string) (*kolide.Invite, error)
- func (d *Datastore) InviteByToken(token string) (*kolide.Invite, error)
- func (d *Datastore) Label(lid uint) (*kolide.Label, error)
- func (d *Datastore) LabelIDsByName(labels []string) ([]uint, error)
- func (d *Datastore) LabelQueriesForHost(host *kolide.Host, cutoff time.Time) (map[string]string, error)
- func (d *Datastore) ListExplicitHostsInPack(pid uint, opt kolide.ListOptions) ([]uint, error)
- func (d *Datastore) ListHosts(opt kolide.HostListOptions) ([]*kolide.Host, error)
- func (d *Datastore) ListHostsInLabel(lid uint, opt kolide.ListOptions) ([]kolide.Host, error)
- func (d *Datastore) ListHostsInPack(pid uint, opt kolide.ListOptions) ([]uint, error)
- func (d *Datastore) ListInvites(opt kolide.ListOptions) ([]*kolide.Invite, error)
- func (d *Datastore) ListLabels(opt kolide.ListOptions) ([]*kolide.Label, error)
- func (d *Datastore) ListLabelsForHost(hid uint) ([]kolide.Label, error)
- func (d *Datastore) ListLabelsForPack(pid uint) ([]*kolide.Label, error)
- func (d *Datastore) ListPacks(opt kolide.ListOptions) ([]*kolide.Pack, error)
- func (d *Datastore) ListPacksForHost(hid uint) ([]*kolide.Pack, error)
- func (d *Datastore) ListQueries(opt kolide.ListOptions) ([]*kolide.Query, error)
- func (d *Datastore) ListScheduledQueriesInPack(id uint, opts kolide.ListOptions) ([]*kolide.ScheduledQuery, error)
- func (d *Datastore) ListSessionsForUser(id uint) ([]*kolide.Session, error)
- func (d *Datastore) ListUniqueHostsInLabels(labels []uint) ([]kolide.Host, error)
- func (d *Datastore) ListUsers(opt kolide.ListOptions) ([]*kolide.User, error)
- func (d *Datastore) ManageHostExpiryEvent(hostExpiryEnabled bool, hostExpiryWindow int) error
- func (d *Datastore) MarkHostSeen(host *kolide.Host, t time.Time) error
- func (d *Datastore) MarkSessionAccessed(session *kolide.Session) error
- func (d *Datastore) MigrateData() error
- func (d *Datastore) MigrateTables() error
- func (d *Datastore) MigrationStatus() (kolide.MigrationStatus, error)
- func (d *Datastore) Name() string
- func (d *Datastore) NewAppConfig(info *kolide.AppConfig) (*kolide.AppConfig, error)
- func (d *Datastore) NewDistributedQueryCampaign(camp *kolide.DistributedQueryCampaign) (*kolide.DistributedQueryCampaign, error)
- func (d *Datastore) NewDistributedQueryCampaignTarget(target *kolide.DistributedQueryCampaignTarget) (*kolide.DistributedQueryCampaignTarget, error)
- func (d *Datastore) NewHost(host *kolide.Host) (*kolide.Host, error)
- func (d *Datastore) NewInvite(i *kolide.Invite) (*kolide.Invite, error)
- func (d *Datastore) NewLabel(label *kolide.Label, opts ...kolide.OptionalArg) (*kolide.Label, error)
- func (d *Datastore) NewPack(pack *kolide.Pack, opts ...kolide.OptionalArg) (*kolide.Pack, error)
- func (d *Datastore) NewPasswordResetRequest(req *kolide.PasswordResetRequest) (*kolide.PasswordResetRequest, error)
- func (d *Datastore) NewQuery(query *kolide.Query, opts ...kolide.OptionalArg) (*kolide.Query, error)
- func (d *Datastore) NewScheduledQuery(sq *kolide.ScheduledQuery, opts ...kolide.OptionalArg) (*kolide.ScheduledQuery, error)
- func (d *Datastore) NewSession(session *kolide.Session) (*kolide.Session, error)
- func (d *Datastore) NewUser(user *kolide.User) (*kolide.User, error)
- func (d *Datastore) OptionsForPlatform(platform string) (json.RawMessage, error)
- func (d *Datastore) Pack(pid uint) (*kolide.Pack, error)
- func (d *Datastore) PackByName(name string, opts ...kolide.OptionalArg) (*kolide.Pack, bool, error)
- func (ds *Datastore) PendingEmailChange(uid uint, newEmail, token string) error
- func (d *Datastore) Query(id uint) (*kolide.Query, error)
- func (d *Datastore) QueryByName(name string, opts ...kolide.OptionalArg) (*kolide.Query, error)
- func (d *Datastore) RecordLabelQueryExecutions(host *kolide.Host, results map[uint]bool, updated time.Time) error
- func (d *Datastore) RemoveHostFromPack(hid, pid uint) error
- func (d *Datastore) RemoveLabelFromPack(lid, pid uint) error
- func (d *Datastore) SaveAppConfig(info *kolide.AppConfig) error
- func (d *Datastore) SaveDistributedQueryCampaign(camp *kolide.DistributedQueryCampaign) error
- func (d *Datastore) SaveHost(host *kolide.Host) error
- func (d *Datastore) SaveInvite(i *kolide.Invite) error
- func (d *Datastore) SaveLabel(label *kolide.Label) (*kolide.Label, error)
- func (d *Datastore) SavePack(pack *kolide.Pack) error
- func (d *Datastore) SavePasswordResetRequest(req *kolide.PasswordResetRequest) error
- func (d *Datastore) SaveQuery(q *kolide.Query) error
- func (d *Datastore) SaveScheduledQuery(sq *kolide.ScheduledQuery) (*kolide.ScheduledQuery, error)
- func (d *Datastore) SaveUser(user *kolide.User) error
- func (d *Datastore) ScheduledQuery(id uint) (*kolide.ScheduledQuery, error)
- func (d *Datastore) SearchHosts(query string, omit ...uint) ([]*kolide.Host, error)
- func (d *Datastore) SearchLabels(query string, omit ...uint) ([]kolide.Label, error)
- func (d *Datastore) SessionByID(id uint) (*kolide.Session, error)
- func (d *Datastore) SessionByKey(key string) (*kolide.Session, error)
- func (d *Datastore) User(username string) (*kolide.User, error)
- func (d *Datastore) UserByEmail(email string) (*kolide.User, error)
- func (d *Datastore) UserByID(id uint) (*kolide.User, error)
- func (d *Datastore) VerifyEnrollSecret(secret string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBOption ¶
type DBOption func(o *dbOptions) error
DBOption is used to pass optional arguments to a database connection
func LimitAttempts ¶
LimitAttempts sets a the number of attempts to try establishing a connection to the database backend the default value is 15 attempts
type Datastore ¶
type Datastore struct {
// contains filtered or unexported fields
}
Datastore is an implementation of kolide.Datastore interface backed by MySQL
func (*Datastore) AddHostToPack ¶
AddHostToPack associates a kolide.Host with a kolide.Pack
func (*Datastore) AddLabelToPack ¶
AddLabelToPack associates a kolide.Label with a kolide.Pack
func (*Datastore) ApplyEnrollSecretSpec ¶
func (d *Datastore) ApplyEnrollSecretSpec(spec *kolide.EnrollSecretSpec) error
func (*Datastore) ApplyLabelSpecs ¶
func (*Datastore) ApplyOptions ¶
func (d *Datastore) ApplyOptions(spec *kolide.OptionsSpec) (err error)
func (*Datastore) ApplyPackSpecs ¶
func (*Datastore) ApplyQueries ¶
func (*Datastore) AuthenticateHost ¶
func (*Datastore) CleanupDistributedQueryCampaigns ¶
func (*Datastore) CleanupIncomingHosts ¶
func (*Datastore) ConfirmPendingEmailChange ¶
ConfirmPendingEmailChange finds email change record, updates user with new email, then deletes change record if everything succeeds.
func (*Datastore) CountHostsInTargets ¶
func (*Datastore) DeleteHost ¶
func (*Datastore) DeleteInvite ¶
func (*Datastore) DeleteLabel ¶
DeleteLabel deletes a kolide.Label
func (*Datastore) DeletePack ¶
DeletePack deletes a kolide.Pack so that it won't show up in results.
func (*Datastore) DeletePasswordResetRequest ¶
func (d *Datastore) DeletePasswordResetRequest(req *kolide.PasswordResetRequest) error
func (*Datastore) DeletePasswordResetRequestsForUser ¶
func (*Datastore) DeleteQueries ¶
DeleteQueries deletes the existing query objects with the provided IDs. The number of deleted queries is returned along with any error.
func (*Datastore) DeleteQuery ¶
DeleteQuery deletes Query identified by Query.ID.
func (*Datastore) DeleteScheduledQuery ¶
func (*Datastore) DestroyAllSessionsForUser ¶
func (*Datastore) DestroySession ¶
func (*Datastore) DistributedQueryCampaign ¶
func (d *Datastore) DistributedQueryCampaign(id uint) (*kolide.DistributedQueryCampaign, error)
func (*Datastore) DistributedQueryCampaignTargetIDs ¶
func (*Datastore) EnrollHost ¶
EnrollHost enrolls a host
func (*Datastore) FindPassswordResetByID ¶
func (d *Datastore) FindPassswordResetByID(id uint) (*kolide.PasswordResetRequest, error)
func (*Datastore) FindPassswordResetByToken ¶
func (d *Datastore) FindPassswordResetByToken(token string) (*kolide.PasswordResetRequest, error)
func (*Datastore) FindPassswordResetByTokenAndUserID ¶
func (*Datastore) FindPassswordResetsByUserID ¶
func (d *Datastore) FindPassswordResetsByUserID(id uint) ([]*kolide.PasswordResetRequest, error)
func (*Datastore) GenerateHostStatusStatistics ¶
func (*Datastore) GetEnrollSecretSpec ¶
func (d *Datastore) GetEnrollSecretSpec() (*kolide.EnrollSecretSpec, error)
func (*Datastore) GetLabelSpec ¶
func (*Datastore) GetOptions ¶
func (d *Datastore) GetOptions() (*kolide.OptionsSpec, error)
func (*Datastore) GetPackSpec ¶
func (*Datastore) GetPackSpecs ¶
func (*Datastore) HealthCheck ¶
HealthCheck returns an error if the MySQL backend is not healthy.
func (*Datastore) HostByIdentifier ¶
func (*Datastore) HostIDsByName ¶
func (*Datastore) HostIDsInTargets ¶
func (*Datastore) InviteByEmail ¶
InviteByEmail finds an Invite with a particular email, if one exists.
func (*Datastore) InviteByToken ¶
InviteByToken finds an Invite with a particular token, if one exists.
func (*Datastore) LabelIDsByName ¶
func (*Datastore) LabelQueriesForHost ¶
func (*Datastore) ListExplicitHostsInPack ¶
func (*Datastore) ListHostsInLabel ¶
ListHostsInLabel returns a list of kolide.Host that are associated with kolide.Label referened by Label ID
func (*Datastore) ListHostsInPack ¶
func (*Datastore) ListInvites ¶
ListInvites lists all invites in the Fleet database. Supply query options using the opt parameter. See kolide.ListOptions
func (*Datastore) ListLabels ¶
ListLabels returns all labels limited or sorted by kolide.ListOptions.
func (*Datastore) ListLabelsForHost ¶
ListLabelsForHost returns a list of kolide.Label for a given host id.
func (*Datastore) ListLabelsForPack ¶
ListLabelsForPack will return a list of kolide.Label records associated with kolide.Pack
func (*Datastore) ListPacks ¶
ListPacks returns all kolide.Pack records limited and sorted by kolide.ListOptions
func (*Datastore) ListPacksForHost ¶
func (*Datastore) ListQueries ¶
ListQueries returns a list of queries with sort order and results limit determined by passed in kolide.ListOptions
func (*Datastore) ListScheduledQueriesInPack ¶
func (d *Datastore) ListScheduledQueriesInPack(id uint, opts kolide.ListOptions) ([]*kolide.ScheduledQuery, error)
func (*Datastore) ListSessionsForUser ¶
func (*Datastore) ListUniqueHostsInLabels ¶
func (*Datastore) ListUsers ¶
ListUsers lists all users with limit, sort and offset passed in with kolide.ListOptions
func (*Datastore) ManageHostExpiryEvent ¶
func (*Datastore) MarkHostSeen ¶
func (*Datastore) MarkSessionAccessed ¶
func (*Datastore) MigrateData ¶
func (*Datastore) MigrateTables ¶
func (*Datastore) MigrationStatus ¶
func (d *Datastore) MigrationStatus() (kolide.MigrationStatus, error)
func (*Datastore) NewAppConfig ¶
func (*Datastore) NewDistributedQueryCampaign ¶
func (d *Datastore) NewDistributedQueryCampaign(camp *kolide.DistributedQueryCampaign) (*kolide.DistributedQueryCampaign, error)
func (*Datastore) NewDistributedQueryCampaignTarget ¶
func (d *Datastore) NewDistributedQueryCampaignTarget(target *kolide.DistributedQueryCampaignTarget) (*kolide.DistributedQueryCampaignTarget, error)
func (*Datastore) NewLabel ¶
func (d *Datastore) NewLabel(label *kolide.Label, opts ...kolide.OptionalArg) (*kolide.Label, error)
NewLabel creates a new kolide.Label
func (*Datastore) NewPasswordResetRequest ¶
func (d *Datastore) NewPasswordResetRequest(req *kolide.PasswordResetRequest) (*kolide.PasswordResetRequest, error)
func (*Datastore) NewQuery ¶
func (d *Datastore) NewQuery(query *kolide.Query, opts ...kolide.OptionalArg) (*kolide.Query, error)
NewQuery creates a New Query.
func (*Datastore) NewScheduledQuery ¶
func (d *Datastore) NewScheduledQuery(sq *kolide.ScheduledQuery, opts ...kolide.OptionalArg) (*kolide.ScheduledQuery, error)
func (*Datastore) NewSession ¶
func (*Datastore) OptionsForPlatform ¶
func (d *Datastore) OptionsForPlatform(platform string) (json.RawMessage, error)
func (*Datastore) PackByName ¶
func (*Datastore) PendingEmailChange ¶
func (*Datastore) QueryByName ¶
func (*Datastore) RecordLabelQueryExecutions ¶
func (*Datastore) RemoveHostFromPack ¶
RemoveHostFromPack will remove the association between a kolide.Host and a kolide.Pack
func (*Datastore) RemoveLabelFromPack ¶
RemoreLabelFromPack will remove the association between a kolide.Label and a kolide.Pack
func (*Datastore) SaveDistributedQueryCampaign ¶
func (d *Datastore) SaveDistributedQueryCampaign(camp *kolide.DistributedQueryCampaign) error
func (*Datastore) SaveInvite ¶
SaveInvite modifies existing Invite
func (*Datastore) SavePasswordResetRequest ¶
func (d *Datastore) SavePasswordResetRequest(req *kolide.PasswordResetRequest) error
func (*Datastore) SaveScheduledQuery ¶
func (d *Datastore) SaveScheduledQuery(sq *kolide.ScheduledQuery) (*kolide.ScheduledQuery, error)
func (*Datastore) ScheduledQuery ¶
func (d *Datastore) ScheduledQuery(id uint) (*kolide.ScheduledQuery, error)
func (*Datastore) SearchHosts ¶
SearchHosts find hosts by query containing an IP address, a host name or UUID. Optionally pass a list of IDs to omit from the search
func (*Datastore) SearchLabels ¶
SearchLabels performs wildcard searches on kolide.Label name