Documentation ¶
Index ¶
- func NewLogger() cmp.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 CellService
- func (s *CellService) CreateCell(ctx context.Context, b *platform.Cell) error
- func (s *CellService) DeleteCell(ctx context.Context, id platform.ID) error
- func (s *CellService) FindCellByID(ctx context.Context, id platform.ID) (*platform.Cell, error)
- func (s *CellService) FindCells(ctx context.Context, filter platform.CellFilter) ([]*platform.Cell, int, error)
- func (s *CellService) UpdateCell(ctx context.Context, id platform.ID, upd platform.CellUpdate) (*platform.Cell, error)
- type ConfigStore
- type DashboardService
- func (s *DashboardService) CreateDashboard(ctx context.Context, b *platform.Dashboard) error
- func (s *DashboardService) DeleteDashboard(ctx context.Context, id platform.ID) error
- func (s *DashboardService) FindDashboardByID(ctx context.Context, id platform.ID) (*platform.Dashboard, error)
- func (s *DashboardService) FindDashboards(ctx context.Context, filter platform.DashboardFilter) ([]*platform.Dashboard, int, error)
- func (s *DashboardService) UpdateDashboard(ctx context.Context, id platform.ID, upd platform.DashboardUpdate) (*platform.Dashboard, error)
- type DashboardsStore
- func (d *DashboardsStore) Add(ctx context.Context, newDashboard cmp.Dashboard) (cmp.Dashboard, error)
- func (d *DashboardsStore) All(ctx context.Context) ([]cmp.Dashboard, error)
- func (d *DashboardsStore) Delete(ctx context.Context, target cmp.Dashboard) error
- func (d *DashboardsStore) Get(ctx context.Context, id cmp.DashboardID) (cmp.Dashboard, error)
- func (d *DashboardsStore) Update(ctx context.Context, target cmp.Dashboard) error
- type Databases
- func (d *Databases) AllDB(ctx context.Context) ([]cmp.Database, error)
- func (d *Databases) AllRP(ctx context.Context, rpX string) ([]cmp.RetentionPolicy, error)
- func (d *Databases) Connect(ctx context.Context, src *cmp.Source) error
- func (d *Databases) CreateDB(ctx context.Context, db *cmp.Database) (*cmp.Database, error)
- func (d *Databases) CreateRP(ctx context.Context, rpX string, rp *cmp.RetentionPolicy) (*cmp.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) ([]cmp.Measurement, error)
- func (d *Databases) UpdateRP(ctx context.Context, rpX string, rpY string, rp *cmp.RetentionPolicy) (*cmp.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
- func (s *LayoutsStore) Add(ctx context.Context, layout cmp.Layout) (cmp.Layout, error)
- func (s *LayoutsStore) All(ctx context.Context) ([]cmp.Layout, error)
- func (s *LayoutsStore) Delete(ctx context.Context, layout cmp.Layout) error
- func (s *LayoutsStore) Get(ctx context.Context, id string) (cmp.Layout, error)
- func (s *LayoutsStore) Update(ctx context.Context, layout cmp.Layout) error
- type LogMessage
- type MappingsStore
- func (s *MappingsStore) Add(ctx context.Context, m *cmp.Mapping) (*cmp.Mapping, error)
- func (s *MappingsStore) All(ctx context.Context) ([]cmp.Mapping, error)
- func (s *MappingsStore) Delete(ctx context.Context, m *cmp.Mapping) error
- func (s *MappingsStore) Get(ctx context.Context, id string) (*cmp.Mapping, error)
- func (s *MappingsStore) Update(ctx context.Context, m *cmp.Mapping) error
- type OrganizationConfigStore
- type OrganizationsStore
- func (s *OrganizationsStore) Add(ctx context.Context, o *cmp.Organization) (*cmp.Organization, error)
- func (s *OrganizationsStore) All(ctx context.Context) ([]cmp.Organization, error)
- func (s *OrganizationsStore) CreateDefault(ctx context.Context) error
- func (s *OrganizationsStore) DefaultOrganization(ctx context.Context) (*cmp.Organization, error)
- func (s *OrganizationsStore) Delete(ctx context.Context, o *cmp.Organization) error
- func (s *OrganizationsStore) Get(ctx context.Context, q cmp.OrganizationQuery) (*cmp.Organization, error)
- func (s *OrganizationsStore) Update(ctx context.Context, o *cmp.Organization) error
- type ProtoboardsStore
- type Response
- type RolesStore
- func (s *RolesStore) Add(ctx context.Context, u *cmp.Role) (*cmp.Role, error)
- func (s *RolesStore) All(ctx context.Context) ([]cmp.Role, error)
- func (s *RolesStore) Delete(ctx context.Context, u *cmp.Role) error
- func (s *RolesStore) Get(ctx context.Context, name string) (*cmp.Role, error)
- func (s *RolesStore) Update(ctx context.Context, u *cmp.Role) error
- type ServersStore
- func (s *ServersStore) Add(ctx context.Context, srv cmp.Server) (cmp.Server, error)
- func (s *ServersStore) All(ctx context.Context) ([]cmp.Server, error)
- func (s *ServersStore) Delete(ctx context.Context, srv cmp.Server) error
- func (s *ServersStore) Get(ctx context.Context, id int) (cmp.Server, error)
- func (s *ServersStore) Update(ctx context.Context, srv cmp.Server) error
- type SourcesStore
- func (s *SourcesStore) Add(ctx context.Context, src cmp.Source) (cmp.Source, error)
- func (s *SourcesStore) All(ctx context.Context) ([]cmp.Source, error)
- func (s *SourcesStore) Delete(ctx context.Context, src cmp.Source) error
- func (s *SourcesStore) Get(ctx context.Context, ID int) (cmp.Source, error)
- func (s *SourcesStore) Update(ctx context.Context, src cmp.Source) error
- type Store
- func (s *Store) Cells(ctx context.Context) platform.CellService
- func (s *Store) Config(ctx context.Context) cmp.ConfigStore
- func (s *Store) Dashboards(ctx context.Context) cmp.DashboardsStore
- func (s *Store) DashboardsV2(ctx context.Context) platform.DashboardService
- func (s *Store) Layouts(ctx context.Context) cmp.LayoutsStore
- func (s *Store) Mappings(ctx context.Context) cmp.MappingsStore
- func (s *Store) OrganizationConfig(ctx context.Context) cmp.OrganizationConfigStore
- func (s *Store) Organizations(ctx context.Context) cmp.OrganizationsStore
- func (s *Store) Protoboards(ctx context.Context) cmp.ProtoboardsStore
- func (s *Store) Servers(ctx context.Context) cmp.ServersStore
- func (s *Store) Sources(ctx context.Context) cmp.SourcesStore
- func (s *Store) Users(ctx context.Context) cmp.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{}) cmp.Logger
- func (tl *TestLogger) Writer() *io.PipeWriter
- type TimeSeries
- func (t *TimeSeries) Connect(ctx context.Context, src *cmp.Source) error
- func (t *TimeSeries) New(cmp.Source, cmp.Logger) (cmp.TimeSeries, error)
- func (t *TimeSeries) Permissions(ctx context.Context) cmp.Permissions
- func (t *TimeSeries) Query(ctx context.Context, query cmp.Query) (cmp.Response, error)
- func (t *TimeSeries) Roles(ctx context.Context) (cmp.RolesStore, error)
- func (t *TimeSeries) Users(ctx context.Context) cmp.UsersStore
- func (t *TimeSeries) Write(ctx context.Context, points []cmp.Point) error
- type UsersStore
- func (s *UsersStore) Add(ctx context.Context, u *cmp.User) (*cmp.User, error)
- func (s *UsersStore) All(ctx context.Context) ([]cmp.User, error)
- func (s *UsersStore) Delete(ctx context.Context, u *cmp.User) error
- func (s *UsersStore) Get(ctx context.Context, q cmp.UserQuery) (*cmp.User, error)
- func (s *UsersStore) Num(ctx context.Context) (int, error)
- func (s *UsersStore) Update(ctx context.Context, u *cmp.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 CellService ¶
type CellService struct { CreateCellF func(context.Context, *platform.Cell) error FindCellByIDF func(context.Context, platform.ID) (*platform.Cell, error) FindCellsF func(context.Context, platform.CellFilter) ([]*platform.Cell, int, error) UpdateCellF func(context.Context, platform.ID, platform.CellUpdate) (*platform.Cell, error) DeleteCellF func(context.Context, platform.ID) error }
func (*CellService) CreateCell ¶
func (*CellService) DeleteCell ¶
func (*CellService) FindCellByID ¶
func (*CellService) FindCells ¶
func (s *CellService) FindCells(ctx context.Context, filter platform.CellFilter) ([]*platform.Cell, int, error)
func (*CellService) UpdateCell ¶
func (s *CellService) UpdateCell(ctx context.Context, id platform.ID, upd platform.CellUpdate) (*platform.Cell, error)
type ConfigStore ¶
ConfigStore stores global application configuration
func (ConfigStore) Initialize ¶
func (c ConfigStore) Initialize(ctx context.Context) error
Initialize is noop in mocks store
type DashboardService ¶
type DashboardService struct { CreateDashboardF func(context.Context, *platform.Dashboard) error FindDashboardByIDF func(context.Context, platform.ID) (*platform.Dashboard, error) FindDashboardsF func(context.Context, platform.DashboardFilter) ([]*platform.Dashboard, int, error) UpdateDashboardF func(context.Context, platform.ID, platform.DashboardUpdate) (*platform.Dashboard, error) DeleteDashboardF func(context.Context, platform.ID) error }
DashboardService ...
func (*DashboardService) CreateDashboard ¶
CreateDashboard ...
func (*DashboardService) DeleteDashboard ¶
DeleteDashboard ...
func (*DashboardService) FindDashboardByID ¶
func (s *DashboardService) FindDashboardByID(ctx context.Context, id platform.ID) (*platform.Dashboard, error)
FindDashboardByID ...
func (*DashboardService) FindDashboards ¶
func (s *DashboardService) FindDashboards(ctx context.Context, filter platform.DashboardFilter) ([]*platform.Dashboard, int, error)
FindDashboards ...
func (*DashboardService) UpdateDashboard ¶
func (s *DashboardService) UpdateDashboard(ctx context.Context, id platform.ID, upd platform.DashboardUpdate) (*platform.Dashboard, error)
UpdateDashboard ...
type DashboardsStore ¶
type DashboardsStore struct { AddF func(ctx context.Context, newDashboard cmp.Dashboard) (cmp.Dashboard, error) AllF func(ctx context.Context) ([]cmp.Dashboard, error) DeleteF func(ctx context.Context, target cmp.Dashboard) error GetF func(ctx context.Context, id cmp.DashboardID) (cmp.Dashboard, error) UpdateF func(ctx context.Context, target cmp.Dashboard) error }
DashboardsStore mock allows all functions to be set for testing
func (*DashboardsStore) Add ¶
func (d *DashboardsStore) Add(ctx context.Context, newDashboard cmp.Dashboard) (cmp.Dashboard, error)
Add ...
func (*DashboardsStore) Get ¶
func (d *DashboardsStore) Get(ctx context.Context, id cmp.DashboardID) (cmp.Dashboard, error)
Get ...
type Databases ¶
type Databases struct { AllDBF func(context.Context) ([]cmp.Database, error) ConnectF func(context.Context, *cmp.Source) error CreateDBF func(context.Context, *cmp.Database) (*cmp.Database, error) DropDBF func(context.Context, string) error AllRPF func(context.Context, string) ([]cmp.RetentionPolicy, error) CreateRPF func(context.Context, string, *cmp.RetentionPolicy) (*cmp.RetentionPolicy, error) UpdateRPF func(context.Context, string, string, *cmp.RetentionPolicy) (*cmp.RetentionPolicy, error) DropRPF func(context.Context, string, string) error GetMeasurementsF func(ctx context.Context, db string, limit, offset int) ([]cmp.Measurement, error) }
Databases mock allows all databases methods to be set for testing
func (*Databases) CreateRP ¶
func (d *Databases) CreateRP(ctx context.Context, rpX string, rp *cmp.RetentionPolicy) (*cmp.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) ([]cmp.Measurement, error)
GetMeasurements lists measurements 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 { AddF func(ctx context.Context, layout cmp.Layout) (cmp.Layout, error) AllF func(ctx context.Context) ([]cmp.Layout, error) DeleteF func(ctx context.Context, layout cmp.Layout) error GetF func(ctx context.Context, id string) (cmp.Layout, error) UpdateF func(ctx context.Context, layout cmp.Layout) error }
type MappingsStore ¶
type MappingsStore struct { AddF func(context.Context, *cmp.Mapping) (*cmp.Mapping, error) AllF func(context.Context) ([]cmp.Mapping, error) DeleteF func(context.Context, *cmp.Mapping) error UpdateF func(context.Context, *cmp.Mapping) error GetF func(context.Context, string) (*cmp.Mapping, error) }
type OrganizationConfigStore ¶
type OrganizationConfigStore struct { FindOrCreateF func(ctx context.Context, id string) (*cmp.OrganizationConfig, error) PutF func(ctx context.Context, c *cmp.OrganizationConfig) error }
func (*OrganizationConfigStore) FindOrCreate ¶
func (s *OrganizationConfigStore) FindOrCreate(ctx context.Context, id string) (*cmp.OrganizationConfig, error)
func (*OrganizationConfigStore) Put ¶
func (s *OrganizationConfigStore) Put(ctx context.Context, c *cmp.OrganizationConfig) error
type OrganizationsStore ¶
type OrganizationsStore struct { AllF func(context.Context) ([]cmp.Organization, error) AddF func(context.Context, *cmp.Organization) (*cmp.Organization, error) DeleteF func(context.Context, *cmp.Organization) error GetF func(ctx context.Context, q cmp.OrganizationQuery) (*cmp.Organization, error) UpdateF func(context.Context, *cmp.Organization) error CreateDefaultF func(context.Context) error DefaultOrganizationF func(context.Context) (*cmp.Organization, error) }
OrganizationsStore ...
func (*OrganizationsStore) Add ¶
func (s *OrganizationsStore) Add(ctx context.Context, o *cmp.Organization) (*cmp.Organization, error)
Add ...
func (*OrganizationsStore) All ¶
func (s *OrganizationsStore) All(ctx context.Context) ([]cmp.Organization, error)
All ...
func (*OrganizationsStore) CreateDefault ¶
func (s *OrganizationsStore) CreateDefault(ctx context.Context) error
CreateDefault ...
func (*OrganizationsStore) DefaultOrganization ¶
func (s *OrganizationsStore) DefaultOrganization(ctx context.Context) (*cmp.Organization, error)
DefaultOrganization ...
func (*OrganizationsStore) Delete ¶
func (s *OrganizationsStore) Delete(ctx context.Context, o *cmp.Organization) error
Delete ...
func (*OrganizationsStore) Get ¶
func (s *OrganizationsStore) Get(ctx context.Context, q cmp.OrganizationQuery) (*cmp.Organization, error)
Get ...
func (*OrganizationsStore) Update ¶
func (s *OrganizationsStore) Update(ctx context.Context, o *cmp.Organization) error
Update ...
type ProtoboardsStore ¶
type ProtoboardsStore struct { AllF func(ctx context.Context) ([]cmp.Protoboard, error) GetF func(ctx context.Context, id string) (cmp.Protoboard, error) }
func (*ProtoboardsStore) All ¶
func (s *ProtoboardsStore) All(ctx context.Context) ([]cmp.Protoboard, error)
func (*ProtoboardsStore) Get ¶
func (s *ProtoboardsStore) Get(ctx context.Context, id string) (cmp.Protoboard, error)
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response is a mocked cmp.Response
func NewResponse ¶
NewResponse returns a mocked cmp.Response
func (*Response) MarshalJSON ¶
MarshalJSON returns the res and err as the fake response.
type RolesStore ¶
type RolesStore struct { AllF func(context.Context) ([]cmp.Role, error) AddF func(context.Context, *cmp.Role) (*cmp.Role, error) DeleteF func(context.Context, *cmp.Role) error GetF func(ctx context.Context, name string) (*cmp.Role, error) UpdateF func(context.Context, *cmp.Role) error }
RolesStore mock allows all functions to be set for testing
type ServersStore ¶
type ServersStore struct { AllF func(context.Context) ([]cmp.Server, error) AddF func(context.Context, cmp.Server) (cmp.Server, error) DeleteF func(context.Context, cmp.Server) error GetF func(ctx context.Context, ID int) (cmp.Server, error) UpdateF func(context.Context, cmp.Server) error }
ServersStore mock allows all functions to be set for testing
type SourcesStore ¶
type SourcesStore struct { AllF func(context.Context) ([]cmp.Source, error) AddF func(context.Context, cmp.Source) (cmp.Source, error) DeleteF func(context.Context, cmp.Source) error GetF func(ctx context.Context, ID int) (cmp.Source, error) UpdateF func(context.Context, cmp.Source) error }
SourcesStore mock allows all functions to be set for testing
type Store ¶
type Store struct { SourcesStore cmp.SourcesStore MappingsStore cmp.MappingsStore ServersStore cmp.ServersStore LayoutsStore cmp.LayoutsStore ProtoboardsStore cmp.ProtoboardsStore UsersStore cmp.UsersStore DashboardsStore cmp.DashboardsStore OrganizationsStore cmp.OrganizationsStore ConfigStore cmp.ConfigStore OrganizationConfigStore cmp.OrganizationConfigStore CellService platform.CellService DashboardService platform.DashboardService }
Store is a server.DataStore
func (*Store) Dashboards ¶
func (s *Store) Dashboards(ctx context.Context) cmp.DashboardsStore
func (*Store) DashboardsV2 ¶
func (s *Store) DashboardsV2(ctx context.Context) platform.DashboardService
func (*Store) OrganizationConfig ¶
func (s *Store) OrganizationConfig(ctx context.Context) cmp.OrganizationConfigStore
func (*Store) Organizations ¶
func (s *Store) Organizations(ctx context.Context) cmp.OrganizationsStore
func (*Store) Protoboards ¶
func (s *Store) Protoboards(ctx context.Context) cmp.ProtoboardsStore
type TestLogger ¶
type TestLogger struct {
Messages []LogMessage
}
TestLogger is a cmp.Logger which allows assertions to be made on the contents of its messages.
func (*TestLogger) Dump ¶
func (tl *TestLogger) Dump(t *testing.T)
Dump dumps out logs into a given testing.T's logs
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
type TimeSeries ¶
type TimeSeries struct { // Connect will connect to the time series using the information in `Source`. ConnectF func(context.Context, *cmp.Source) error // Query retrieves time series data from the database. QueryF func(context.Context, cmp.Query) (cmp.Response, error) // Write records points into the TimeSeries WriteF func(context.Context, []cmp.Point) error // UsersStore represents the user accounts within the TimeSeries database UsersF func(context.Context) cmp.UsersStore // Permissions returns all valid names permissions in this database PermissionsF func(context.Context) cmp.Permissions // RolesF represents the roles. Roles group permissions and Users RolesF func(context.Context) (cmp.RolesStore, error) }
TimeSeries is a mockable CMP time series by overriding the functions.
func (*TimeSeries) Connect ¶
Connect will connect to the time series using the information in `Source`.
func (*TimeSeries) New ¶
func (t *TimeSeries) New(cmp.Source, cmp.Logger) (cmp.TimeSeries, error)
New implements TimeSeriesClient
func (*TimeSeries) Permissions ¶
func (t *TimeSeries) Permissions(ctx context.Context) cmp.Permissions
Permissions returns all valid names permissions in this database
func (*TimeSeries) Roles ¶
func (t *TimeSeries) Roles(ctx context.Context) (cmp.RolesStore, error)
Roles represents the roles. Roles group permissions and Users
func (*TimeSeries) Users ¶
func (t *TimeSeries) Users(ctx context.Context) cmp.UsersStore
Users represents the user accounts within the TimeSeries database
type UsersStore ¶
type UsersStore struct { AllF func(context.Context) ([]cmp.User, error) AddF func(context.Context, *cmp.User) (*cmp.User, error) DeleteF func(context.Context, *cmp.User) error GetF func(ctx context.Context, q cmp.UserQuery) (*cmp.User, error) UpdateF func(context.Context, *cmp.User) error NumF func(context.Context) (int, error) }
UsersStore mock allows all functions to be set for testing