Documentation ¶
Index ¶
- func NewLogger() chronograf.Logger
- type Authenticator
- func (a *Authenticator) Authorize(ctx context.Context, w http.ResponseWriter, p oauth2.Principal) error
- func (a *Authenticator) Expire(http.ResponseWriter)
- func (a *Authenticator) Extend(ctx context.Context, w http.ResponseWriter, p oauth2.Principal) (oauth2.Principal, error)
- func (a *Authenticator) Serialize(context.Context, oauth2.Principal) (string, error)
- func (a *Authenticator) ValidAuthorization(ctx context.Context, serializedAuthorization string) (oauth2.Principal, error)
- func (a *Authenticator) Validate(context.Context, *http.Request) (oauth2.Principal, error)
- type ConfigStore
- type DashboardsStore
- func (d *DashboardsStore) Add(ctx context.Context, newDashboard chronograf.Dashboard) (chronograf.Dashboard, error)
- func (d *DashboardsStore) All(ctx context.Context) ([]chronograf.Dashboard, error)
- func (d *DashboardsStore) Delete(ctx context.Context, target chronograf.Dashboard) error
- func (d *DashboardsStore) Get(ctx context.Context, id chronograf.DashboardID) (chronograf.Dashboard, error)
- func (d *DashboardsStore) Update(ctx context.Context, target chronograf.Dashboard) error
- type Databases
- func (d *Databases) AllDB(ctx context.Context) ([]chronograf.Database, error)
- func (d *Databases) AllRP(ctx context.Context, rpX string) ([]chronograf.RetentionPolicy, error)
- func (d *Databases) Connect(ctx context.Context, src *chronograf.Source) error
- func (d *Databases) CreateDB(ctx context.Context, db *chronograf.Database) (*chronograf.Database, error)
- func (d *Databases) CreateRP(ctx context.Context, rpX string, rp *chronograf.RetentionPolicy) (*chronograf.RetentionPolicy, error)
- func (d *Databases) DropDB(ctx context.Context, db string) error
- func (d *Databases) DropRP(ctx context.Context, rpX string, rpY string) error
- func (d *Databases) GetMeasurements(ctx context.Context, db string, limit, offset int) ([]chronograf.Measurement, error)
- func (d *Databases) UpdateRP(ctx context.Context, rpX string, rpY string, rp *chronograf.RetentionPolicy) (*chronograf.RetentionPolicy, error)
- type KapaClient
- func (p *KapaClient) CreateTask(opts client.CreateTaskOptions) (client.Task, error)
- func (p *KapaClient) DeleteTask(link client.Link) error
- func (p *KapaClient) ListTasks(opts *client.ListTasksOptions) ([]client.Task, error)
- func (p *KapaClient) Task(link client.Link, opts *client.TaskOptions) (client.Task, error)
- func (p *KapaClient) UpdateTask(link client.Link, opts client.UpdateTaskOptions) (client.Task, error)
- type LayoutsStore
- type LogMessage
- type MappingsStore
- func (s *MappingsStore) Add(ctx context.Context, m *chronograf.Mapping) (*chronograf.Mapping, error)
- func (s *MappingsStore) All(ctx context.Context) ([]chronograf.Mapping, error)
- func (s *MappingsStore) Delete(ctx context.Context, m *chronograf.Mapping) error
- func (s *MappingsStore) Get(ctx context.Context, id string) (*chronograf.Mapping, error)
- func (s *MappingsStore) Update(ctx context.Context, m *chronograf.Mapping) error
- type OrganizationConfigStore
- func (s *OrganizationConfigStore) All(ctx context.Context) ([]chronograf.OrganizationConfig, error)
- func (s *OrganizationConfigStore) FindOrCreate(ctx context.Context, id string) (*chronograf.OrganizationConfig, error)
- func (s *OrganizationConfigStore) Put(ctx context.Context, c *chronograf.OrganizationConfig) error
- type OrganizationsStore
- func (s *OrganizationsStore) Add(ctx context.Context, o *chronograf.Organization) (*chronograf.Organization, error)
- func (s *OrganizationsStore) All(ctx context.Context) ([]chronograf.Organization, error)
- func (s *OrganizationsStore) CreateDefault(ctx context.Context) error
- func (s *OrganizationsStore) DefaultOrganization(ctx context.Context) (*chronograf.Organization, error)
- func (s *OrganizationsStore) Delete(ctx context.Context, o *chronograf.Organization) error
- func (s *OrganizationsStore) Get(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error)
- func (s *OrganizationsStore) Update(ctx context.Context, o *chronograf.Organization) error
- type ProtoboardsStore
- type Response
- type RolesStore
- func (s *RolesStore) Add(ctx context.Context, u *chronograf.Role) (*chronograf.Role, error)
- func (s *RolesStore) All(ctx context.Context) ([]chronograf.Role, error)
- func (s *RolesStore) Delete(ctx context.Context, u *chronograf.Role) error
- func (s *RolesStore) Get(ctx context.Context, name string) (*chronograf.Role, error)
- func (s *RolesStore) Update(ctx context.Context, u *chronograf.Role) error
- type ServersStore
- func (s *ServersStore) Add(ctx context.Context, srv chronograf.Server) (chronograf.Server, error)
- func (s *ServersStore) All(ctx context.Context) ([]chronograf.Server, error)
- func (s *ServersStore) Delete(ctx context.Context, srv chronograf.Server) error
- func (s *ServersStore) Get(ctx context.Context, id int) (chronograf.Server, error)
- func (s *ServersStore) Update(ctx context.Context, srv chronograf.Server) error
- type SourcesStore
- func (s *SourcesStore) Add(ctx context.Context, src chronograf.Source) (chronograf.Source, error)
- func (s *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error)
- func (s *SourcesStore) Delete(ctx context.Context, src chronograf.Source) error
- func (s *SourcesStore) Get(ctx context.Context, ID int) (chronograf.Source, error)
- func (s *SourcesStore) Update(ctx context.Context, src chronograf.Source) error
- type Store
- func (s *Store) Config(ctx context.Context) chronograf.ConfigStore
- func (s *Store) Dashboards(ctx context.Context) chronograf.DashboardsStore
- func (s *Store) Layouts(ctx context.Context) chronograf.LayoutsStore
- func (s *Store) Mappings(ctx context.Context) chronograf.MappingsStore
- func (s *Store) OrganizationConfig(ctx context.Context) chronograf.OrganizationConfigStore
- func (s *Store) Organizations(ctx context.Context) chronograf.OrganizationsStore
- func (s *Store) Protoboards(ctx context.Context) chronograf.ProtoboardsStore
- func (s *Store) Servers(ctx context.Context) chronograf.ServersStore
- func (s *Store) Sources(ctx context.Context) chronograf.SourcesStore
- func (s *Store) Users(ctx context.Context) chronograf.UsersStore
- type TestLogger
- func (tl *TestLogger) Debug(args ...interface{})
- func (tl *TestLogger) Dump(t *testing.T)
- func (tl *TestLogger) Error(args ...interface{})
- func (tl *TestLogger) HasMessage(level string, body string) bool
- func (tl *TestLogger) Info(args ...interface{})
- func (tl *TestLogger) WithField(key string, value interface{}) chronograf.Logger
- func (tl *TestLogger) Writer() *io.PipeWriter
- type TimeSeries
- func (t *TimeSeries) Connect(ctx context.Context, src *chronograf.Source) error
- func (t *TimeSeries) New(chronograf.Source, chronograf.Logger) (chronograf.TimeSeries, error)
- func (t *TimeSeries) Permissions(ctx context.Context) chronograf.Permissions
- func (t *TimeSeries) Query(ctx context.Context, query chronograf.Query) (chronograf.Response, error)
- func (t *TimeSeries) Roles(ctx context.Context) (chronograf.RolesStore, error)
- func (t *TimeSeries) Users(ctx context.Context) chronograf.UsersStore
- func (t *TimeSeries) Write(ctx context.Context, points []chronograf.Point) error
- type UsersStore
- func (s *UsersStore) Add(ctx context.Context, u *chronograf.User) (*chronograf.User, error)
- func (s *UsersStore) All(ctx context.Context) ([]chronograf.User, error)
- func (s *UsersStore) Delete(ctx context.Context, u *chronograf.User) error
- func (s *UsersStore) Get(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error)
- func (s *UsersStore) Num(ctx context.Context) (int, error)
- func (s *UsersStore) Update(ctx context.Context, u *chronograf.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLogger ¶
func NewLogger() chronograf.Logger
NewLogger returns a mock logger that implements chronograf.Logger
Types ¶
type Authenticator ¶
type Authenticator struct { Principal oauth2.Principal ValidateErr error ExtendErr error Serialized string }
Authenticator implements a OAuth2 authenticator
func (*Authenticator) Authorize ¶
func (a *Authenticator) Authorize(ctx context.Context, w http.ResponseWriter, p oauth2.Principal) error
Authorize will grant privileges to a Principal
func (*Authenticator) Expire ¶
func (a *Authenticator) Expire(http.ResponseWriter)
Expire revokes privileges from a Principal
func (*Authenticator) Extend ¶
func (a *Authenticator) Extend(ctx context.Context, w http.ResponseWriter, p oauth2.Principal) (oauth2.Principal, error)
Extend will extend the lifetime of a already validated Principal
func (*Authenticator) ValidAuthorization ¶
func (a *Authenticator) ValidAuthorization(ctx context.Context, serializedAuthorization string) (oauth2.Principal, error)
ValidAuthorization returns the Principal
type ConfigStore ¶
type ConfigStore struct {
Config *chronograf.Config
}
ConfigStore stores global application configuration
func (ConfigStore) Get ¶
func (c ConfigStore) Get(ctx context.Context) (*chronograf.Config, error)
Get returns the whole global application configuration
func (ConfigStore) Initialize ¶
func (c ConfigStore) Initialize(ctx context.Context) error
Initialize is noop in mocks store
func (ConfigStore) Update ¶
func (c ConfigStore) Update(ctx context.Context, config *chronograf.Config) error
Update updates the whole global application configuration
type DashboardsStore ¶
type DashboardsStore struct { AddF func(ctx context.Context, newDashboard chronograf.Dashboard) (chronograf.Dashboard, error) AllF func(ctx context.Context) ([]chronograf.Dashboard, error) DeleteF func(ctx context.Context, target chronograf.Dashboard) error GetF func(ctx context.Context, id chronograf.DashboardID) (chronograf.Dashboard, error) UpdateF func(ctx context.Context, target chronograf.Dashboard) error }
func (*DashboardsStore) Add ¶
func (d *DashboardsStore) Add(ctx context.Context, newDashboard chronograf.Dashboard) (chronograf.Dashboard, error)
func (*DashboardsStore) All ¶
func (d *DashboardsStore) All(ctx context.Context) ([]chronograf.Dashboard, error)
func (*DashboardsStore) Delete ¶
func (d *DashboardsStore) Delete(ctx context.Context, target chronograf.Dashboard) error
func (*DashboardsStore) Get ¶
func (d *DashboardsStore) Get(ctx context.Context, id chronograf.DashboardID) (chronograf.Dashboard, error)
func (*DashboardsStore) Update ¶
func (d *DashboardsStore) Update(ctx context.Context, target chronograf.Dashboard) error
type Databases ¶
type Databases struct { AllDBF func(context.Context) ([]chronograf.Database, error) ConnectF func(context.Context, *chronograf.Source) error CreateDBF func(context.Context, *chronograf.Database) (*chronograf.Database, error) DropDBF func(context.Context, string) error AllRPF func(context.Context, string) ([]chronograf.RetentionPolicy, error) CreateRPF func(context.Context, string, *chronograf.RetentionPolicy) (*chronograf.RetentionPolicy, error) UpdateRPF func(context.Context, string, string, *chronograf.RetentionPolicy) (*chronograf.RetentionPolicy, error) DropRPF func(context.Context, string, string) error GetMeasurementsF func(ctx context.Context, db string, limit, offset int) ([]chronograf.Measurement, error) }
Databases mock allows all databases methods to be set for testing
func (*Databases) AllRP ¶
func (d *Databases) AllRP(ctx context.Context, rpX string) ([]chronograf.RetentionPolicy, error)
AllRP lists all retention policies in the current data source
func (*Databases) CreateDB ¶
func (d *Databases) CreateDB(ctx context.Context, db *chronograf.Database) (*chronograf.Database, error)
CreateDB creates a database in the current data source
func (*Databases) CreateRP ¶
func (d *Databases) CreateRP(ctx context.Context, rpX string, rp *chronograf.RetentionPolicy) (*chronograf.RetentionPolicy, error)
CreateRP creates a retention policy in the current data source
func (*Databases) GetMeasurements ¶
func (d *Databases) GetMeasurements(ctx context.Context, db string, limit, offset int) ([]chronograf.Measurement, error)
GetMeasurements lists measurements in the current data source
func (*Databases) UpdateRP ¶
func (d *Databases) UpdateRP(ctx context.Context, rpX string, rpY string, rp *chronograf.RetentionPolicy) (*chronograf.RetentionPolicy, error)
UpdateRP updates a retention policy in the current data source
type KapaClient ¶
type KapaClient struct { CreateTaskF func(opts client.CreateTaskOptions) (client.Task, error) DeleteTaskF func(link client.Link) error ListTasksF func(opts *client.ListTasksOptions) ([]client.Task, error) TaskF func(link client.Link, opts *client.TaskOptions) (client.Task, error) UpdateTaskF func(link client.Link, opts client.UpdateTaskOptions) (client.Task, error) }
Client is a mock Kapacitor client
func (*KapaClient) CreateTask ¶
func (p *KapaClient) CreateTask(opts client.CreateTaskOptions) (client.Task, error)
func (*KapaClient) DeleteTask ¶
func (p *KapaClient) DeleteTask(link client.Link) error
func (*KapaClient) ListTasks ¶
func (p *KapaClient) ListTasks(opts *client.ListTasksOptions) ([]client.Task, error)
func (*KapaClient) Task ¶
func (p *KapaClient) Task(link client.Link, opts *client.TaskOptions) (client.Task, error)
func (*KapaClient) UpdateTask ¶
func (p *KapaClient) UpdateTask(link client.Link, opts client.UpdateTaskOptions) (client.Task, error)
type LayoutsStore ¶
type LayoutsStore struct { AllF func(ctx context.Context) ([]chronograf.Layout, error) GetF func(ctx context.Context, id string) (chronograf.Layout, error) }
func (*LayoutsStore) All ¶
func (s *LayoutsStore) All(ctx context.Context) ([]chronograf.Layout, error)
func (*LayoutsStore) Get ¶
func (s *LayoutsStore) Get(ctx context.Context, id string) (chronograf.Layout, error)
type LogMessage ¶
type MappingsStore ¶
type MappingsStore struct { AddF func(context.Context, *chronograf.Mapping) (*chronograf.Mapping, error) AllF func(context.Context) ([]chronograf.Mapping, error) DeleteF func(context.Context, *chronograf.Mapping) error UpdateF func(context.Context, *chronograf.Mapping) error GetF func(context.Context, string) (*chronograf.Mapping, error) }
func (*MappingsStore) Add ¶
func (s *MappingsStore) Add(ctx context.Context, m *chronograf.Mapping) (*chronograf.Mapping, error)
func (*MappingsStore) All ¶
func (s *MappingsStore) All(ctx context.Context) ([]chronograf.Mapping, error)
func (*MappingsStore) Delete ¶
func (s *MappingsStore) Delete(ctx context.Context, m *chronograf.Mapping) error
func (*MappingsStore) Get ¶
func (s *MappingsStore) Get(ctx context.Context, id string) (*chronograf.Mapping, error)
func (*MappingsStore) Update ¶
func (s *MappingsStore) Update(ctx context.Context, m *chronograf.Mapping) error
type OrganizationConfigStore ¶
type OrganizationConfigStore struct { AllF func(ctx context.Context) ([]chronograf.OrganizationConfig, error) FindOrCreateF func(ctx context.Context, id string) (*chronograf.OrganizationConfig, error) PutF func(ctx context.Context, c *chronograf.OrganizationConfig) error }
func (*OrganizationConfigStore) All ¶
func (s *OrganizationConfigStore) All(ctx context.Context) ([]chronograf.OrganizationConfig, error)
func (*OrganizationConfigStore) FindOrCreate ¶
func (s *OrganizationConfigStore) FindOrCreate(ctx context.Context, id string) (*chronograf.OrganizationConfig, error)
func (*OrganizationConfigStore) Put ¶
func (s *OrganizationConfigStore) Put(ctx context.Context, c *chronograf.OrganizationConfig) error
type OrganizationsStore ¶
type OrganizationsStore struct { AllF func(context.Context) ([]chronograf.Organization, error) AddF func(context.Context, *chronograf.Organization) (*chronograf.Organization, error) DeleteF func(context.Context, *chronograf.Organization) error GetF func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) UpdateF func(context.Context, *chronograf.Organization) error CreateDefaultF func(context.Context) error DefaultOrganizationF func(context.Context) (*chronograf.Organization, error) }
func (*OrganizationsStore) Add ¶
func (s *OrganizationsStore) Add(ctx context.Context, o *chronograf.Organization) (*chronograf.Organization, error)
func (*OrganizationsStore) All ¶
func (s *OrganizationsStore) All(ctx context.Context) ([]chronograf.Organization, error)
func (*OrganizationsStore) CreateDefault ¶
func (s *OrganizationsStore) CreateDefault(ctx context.Context) error
func (*OrganizationsStore) DefaultOrganization ¶
func (s *OrganizationsStore) DefaultOrganization(ctx context.Context) (*chronograf.Organization, error)
func (*OrganizationsStore) Delete ¶
func (s *OrganizationsStore) Delete(ctx context.Context, o *chronograf.Organization) error
func (*OrganizationsStore) Get ¶
func (s *OrganizationsStore) Get(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error)
func (*OrganizationsStore) Update ¶
func (s *OrganizationsStore) Update(ctx context.Context, o *chronograf.Organization) error
type ProtoboardsStore ¶
type ProtoboardsStore struct { AllF func(ctx context.Context) ([]chronograf.Protoboard, error) GetF func(ctx context.Context, id string) (chronograf.Protoboard, error) }
func (*ProtoboardsStore) All ¶
func (s *ProtoboardsStore) All(ctx context.Context) ([]chronograf.Protoboard, error)
func (*ProtoboardsStore) Get ¶
func (s *ProtoboardsStore) Get(ctx context.Context, id string) (chronograf.Protoboard, error)
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response is a mocked chronograf.Response
func NewResponse ¶
NewResponse returns a mocked chronograf.Response
func (*Response) MarshalJSON ¶
MarshalJSON returns the res and err as the fake response.
type RolesStore ¶
type RolesStore struct { AllF func(context.Context) ([]chronograf.Role, error) AddF func(context.Context, *chronograf.Role) (*chronograf.Role, error) DeleteF func(context.Context, *chronograf.Role) error GetF func(ctx context.Context, name string) (*chronograf.Role, error) UpdateF func(context.Context, *chronograf.Role) error }
RolesStore mock allows all functions to be set for testing
func (*RolesStore) Add ¶
func (s *RolesStore) Add(ctx context.Context, u *chronograf.Role) (*chronograf.Role, error)
Add a new Role in the RolesStore
func (*RolesStore) All ¶
func (s *RolesStore) All(ctx context.Context) ([]chronograf.Role, error)
All lists all Roles from the RolesStore
func (*RolesStore) Delete ¶
func (s *RolesStore) Delete(ctx context.Context, u *chronograf.Role) error
Delete the Role from the RolesStore
func (*RolesStore) Get ¶
func (s *RolesStore) Get(ctx context.Context, name string) (*chronograf.Role, error)
Get retrieves a Role if name exists.
func (*RolesStore) Update ¶
func (s *RolesStore) Update(ctx context.Context, u *chronograf.Role) error
Update the Role's permissions or users
type ServersStore ¶
type ServersStore struct { AllF func(context.Context) ([]chronograf.Server, error) AddF func(context.Context, chronograf.Server) (chronograf.Server, error) DeleteF func(context.Context, chronograf.Server) error GetF func(ctx context.Context, ID int) (chronograf.Server, error) UpdateF func(context.Context, chronograf.Server) error }
ServersStore mock allows all functions to be set for testing
func (*ServersStore) Add ¶
func (s *ServersStore) Add(ctx context.Context, srv chronograf.Server) (chronograf.Server, error)
func (*ServersStore) All ¶
func (s *ServersStore) All(ctx context.Context) ([]chronograf.Server, error)
func (*ServersStore) Delete ¶
func (s *ServersStore) Delete(ctx context.Context, srv chronograf.Server) error
func (*ServersStore) Get ¶
func (s *ServersStore) Get(ctx context.Context, id int) (chronograf.Server, error)
func (*ServersStore) Update ¶
func (s *ServersStore) Update(ctx context.Context, srv chronograf.Server) error
type SourcesStore ¶
type SourcesStore struct { AllF func(context.Context) ([]chronograf.Source, error) AddF func(context.Context, chronograf.Source) (chronograf.Source, error) DeleteF func(context.Context, chronograf.Source) error GetF func(ctx context.Context, ID int) (chronograf.Source, error) UpdateF func(context.Context, chronograf.Source) error }
SourcesStore mock allows all functions to be set for testing
func (*SourcesStore) Add ¶
func (s *SourcesStore) Add(ctx context.Context, src chronograf.Source) (chronograf.Source, error)
Add creates a new source in the SourcesStore and returns Source with ID
func (*SourcesStore) All ¶
func (s *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error)
All returns all sources in the store
func (*SourcesStore) Delete ¶
func (s *SourcesStore) Delete(ctx context.Context, src chronograf.Source) error
Delete the Source from the store
func (*SourcesStore) Get ¶
func (s *SourcesStore) Get(ctx context.Context, ID int) (chronograf.Source, error)
Get retrieves Source if `ID` exists
func (*SourcesStore) Update ¶
func (s *SourcesStore) Update(ctx context.Context, src chronograf.Source) error
Update the Source in the store.
type Store ¶
type Store struct { SourcesStore chronograf.SourcesStore MappingsStore chronograf.MappingsStore ServersStore chronograf.ServersStore LayoutsStore chronograf.LayoutsStore ProtoboardsStore chronograf.ProtoboardsStore UsersStore chronograf.UsersStore DashboardsStore chronograf.DashboardsStore OrganizationsStore chronograf.OrganizationsStore ConfigStore chronograf.ConfigStore OrganizationConfigStore chronograf.OrganizationConfigStore }
Store is a server.DataStore
func (*Store) Config ¶
func (s *Store) Config(ctx context.Context) chronograf.ConfigStore
func (*Store) Dashboards ¶
func (s *Store) Dashboards(ctx context.Context) chronograf.DashboardsStore
func (*Store) Layouts ¶
func (s *Store) Layouts(ctx context.Context) chronograf.LayoutsStore
func (*Store) Mappings ¶
func (s *Store) Mappings(ctx context.Context) chronograf.MappingsStore
func (*Store) OrganizationConfig ¶
func (s *Store) OrganizationConfig(ctx context.Context) chronograf.OrganizationConfigStore
func (*Store) Organizations ¶
func (s *Store) Organizations(ctx context.Context) chronograf.OrganizationsStore
func (*Store) Protoboards ¶
func (s *Store) Protoboards(ctx context.Context) chronograf.ProtoboardsStore
func (*Store) Servers ¶
func (s *Store) Servers(ctx context.Context) chronograf.ServersStore
func (*Store) Sources ¶
func (s *Store) Sources(ctx context.Context) chronograf.SourcesStore
func (*Store) Users ¶
func (s *Store) Users(ctx context.Context) chronograf.UsersStore
type TestLogger ¶
type TestLogger struct {
Messages []LogMessage
}
TestLogger is a chronograf.Logger which allows assertions to be made on the contents of its messages.
func (*TestLogger) Debug ¶
func (tl *TestLogger) Debug(args ...interface{})
func (*TestLogger) Dump ¶
func (tl *TestLogger) Dump(t *testing.T)
Dump dumps out logs into a given testing.T's logs
func (*TestLogger) Error ¶
func (tl *TestLogger) Error(args ...interface{})
func (*TestLogger) HasMessage ¶
func (tl *TestLogger) HasMessage(level string, body string) bool
HasMessage will return true if the TestLogger has been called with an exact match of a particular log message at a particular log level
func (*TestLogger) Info ¶
func (tl *TestLogger) Info(args ...interface{})
func (*TestLogger) WithField ¶
func (tl *TestLogger) WithField(key string, value interface{}) chronograf.Logger
func (*TestLogger) Writer ¶
func (tl *TestLogger) Writer() *io.PipeWriter
type TimeSeries ¶
type TimeSeries struct { // Connect will connect to the time series using the information in `Source`. ConnectF func(context.Context, *chronograf.Source) error // Query retrieves time series data from the database. QueryF func(context.Context, chronograf.Query) (chronograf.Response, error) // Write records points into the TimeSeries WriteF func(context.Context, []chronograf.Point) error // UsersStore represents the user accounts within the TimeSeries database UsersF func(context.Context) chronograf.UsersStore // Permissions returns all valid names permissions in this database PermissionsF func(context.Context) chronograf.Permissions // RolesF represents the roles. Roles group permissions and Users RolesF func(context.Context) (chronograf.RolesStore, error) }
TimeSeries is a mockable chronograf time series by overriding the functions.
func (*TimeSeries) Connect ¶
func (t *TimeSeries) Connect(ctx context.Context, src *chronograf.Source) error
Connect will connect to the time series using the information in `Source`.
func (*TimeSeries) New ¶
func (t *TimeSeries) New(chronograf.Source, chronograf.Logger) (chronograf.TimeSeries, error)
New implements TimeSeriesClient
func (*TimeSeries) Permissions ¶
func (t *TimeSeries) Permissions(ctx context.Context) chronograf.Permissions
Permissions returns all valid names permissions in this database
func (*TimeSeries) Query ¶
func (t *TimeSeries) Query(ctx context.Context, query chronograf.Query) (chronograf.Response, error)
Query retrieves time series data from the database.
func (*TimeSeries) Roles ¶
func (t *TimeSeries) Roles(ctx context.Context) (chronograf.RolesStore, error)
Roles represents the roles. Roles group permissions and Users
func (*TimeSeries) Users ¶
func (t *TimeSeries) Users(ctx context.Context) chronograf.UsersStore
Users represents the user accounts within the TimeSeries database
func (*TimeSeries) Write ¶
func (t *TimeSeries) Write(ctx context.Context, points []chronograf.Point) error
Write records a point into the time series
type UsersStore ¶
type UsersStore struct { AllF func(context.Context) ([]chronograf.User, error) AddF func(context.Context, *chronograf.User) (*chronograf.User, error) DeleteF func(context.Context, *chronograf.User) error GetF func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) UpdateF func(context.Context, *chronograf.User) error NumF func(context.Context) (int, error) }
UsersStore mock allows all functions to be set for testing
func (*UsersStore) Add ¶
func (s *UsersStore) Add(ctx context.Context, u *chronograf.User) (*chronograf.User, error)
Add a new User in the UsersStore
func (*UsersStore) All ¶
func (s *UsersStore) All(ctx context.Context) ([]chronograf.User, error)
All lists all users from the UsersStore
func (*UsersStore) Delete ¶
func (s *UsersStore) Delete(ctx context.Context, u *chronograf.User) error
Delete the User from the UsersStore
func (*UsersStore) Get ¶
func (s *UsersStore) Get(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error)
Get retrieves a user if name exists.
func (*UsersStore) Num ¶
func (s *UsersStore) Num(ctx context.Context) (int, error)
Num returns the number of users in the UsersStore
func (*UsersStore) Update ¶
func (s *UsersStore) Update(ctx context.Context, u *chronograf.User) error
Update the user's permissions or roles