Documentation ¶
Index ¶
- func NewLogger() cloudhub.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 cloudhub.Dashboard) (cloudhub.Dashboard, error)
- func (d *DashboardsStore) All(ctx context.Context) ([]cloudhub.Dashboard, error)
- func (d *DashboardsStore) Delete(ctx context.Context, target cloudhub.Dashboard) error
- func (d *DashboardsStore) Get(ctx context.Context, id cloudhub.DashboardID) (cloudhub.Dashboard, error)
- func (d *DashboardsStore) Update(ctx context.Context, target cloudhub.Dashboard) error
- type Databases
- func (d *Databases) AllDB(ctx context.Context) ([]cloudhub.Database, error)
- func (d *Databases) AllRP(ctx context.Context, rpX string) ([]cloudhub.RetentionPolicy, error)
- func (d *Databases) Connect(ctx context.Context, src *cloudhub.Source) error
- func (d *Databases) CreateDB(ctx context.Context, db *cloudhub.Database) (*cloudhub.Database, error)
- func (d *Databases) CreateRP(ctx context.Context, rpX string, rp *cloudhub.RetentionPolicy) (*cloudhub.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) ([]cloudhub.Measurement, error)
- func (d *Databases) UpdateRP(ctx context.Context, rpX string, rpY string, rp *cloudhub.RetentionPolicy) (*cloudhub.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 *cloudhub.Mapping) (*cloudhub.Mapping, error)
- func (s *MappingsStore) All(ctx context.Context) ([]cloudhub.Mapping, error)
- func (s *MappingsStore) Delete(ctx context.Context, m *cloudhub.Mapping) error
- func (s *MappingsStore) Get(ctx context.Context, id string) (*cloudhub.Mapping, error)
- func (s *MappingsStore) Update(ctx context.Context, m *cloudhub.Mapping) error
- type OrganizationConfigStore
- func (s *OrganizationConfigStore) All(ctx context.Context) ([]cloudhub.OrganizationConfig, error)
- func (s *OrganizationConfigStore) FindOrCreate(ctx context.Context, id string) (*cloudhub.OrganizationConfig, error)
- func (s *OrganizationConfigStore) Put(ctx context.Context, c *cloudhub.OrganizationConfig) error
- type OrganizationsStore
- func (s *OrganizationsStore) Add(ctx context.Context, o *cloudhub.Organization) (*cloudhub.Organization, error)
- func (s *OrganizationsStore) All(ctx context.Context) ([]cloudhub.Organization, error)
- func (s *OrganizationsStore) CreateDefault(ctx context.Context) error
- func (s *OrganizationsStore) DefaultOrganization(ctx context.Context) (*cloudhub.Organization, error)
- func (s *OrganizationsStore) Delete(ctx context.Context, o *cloudhub.Organization) error
- func (s *OrganizationsStore) Get(ctx context.Context, q cloudhub.OrganizationQuery) (*cloudhub.Organization, error)
- func (s *OrganizationsStore) Update(ctx context.Context, o *cloudhub.Organization) error
- type ProtoboardsStore
- type Response
- type RolesStore
- func (s *RolesStore) Add(ctx context.Context, u *cloudhub.Role) (*cloudhub.Role, error)
- func (s *RolesStore) All(ctx context.Context) ([]cloudhub.Role, error)
- func (s *RolesStore) Delete(ctx context.Context, u *cloudhub.Role) error
- func (s *RolesStore) Get(ctx context.Context, name string) (*cloudhub.Role, error)
- func (s *RolesStore) Update(ctx context.Context, u *cloudhub.Role) error
- type ServersStore
- func (s *ServersStore) Add(ctx context.Context, srv cloudhub.Server) (cloudhub.Server, error)
- func (s *ServersStore) All(ctx context.Context) ([]cloudhub.Server, error)
- func (s *ServersStore) Delete(ctx context.Context, srv cloudhub.Server) error
- func (s *ServersStore) Get(ctx context.Context, id int) (cloudhub.Server, error)
- func (s *ServersStore) Update(ctx context.Context, srv cloudhub.Server) error
- type SourcesStore
- func (s *SourcesStore) Add(ctx context.Context, src cloudhub.Source) (cloudhub.Source, error)
- func (s *SourcesStore) All(ctx context.Context) ([]cloudhub.Source, error)
- func (s *SourcesStore) Delete(ctx context.Context, src cloudhub.Source) error
- func (s *SourcesStore) Get(ctx context.Context, ID int) (cloudhub.Source, error)
- func (s *SourcesStore) Update(ctx context.Context, src cloudhub.Source) error
- type Store
- func (s *Store) Config(ctx context.Context) cloudhub.ConfigStore
- func (s *Store) Dashboards(ctx context.Context) cloudhub.DashboardsStore
- func (s *Store) Layouts(ctx context.Context) cloudhub.LayoutsStore
- func (s *Store) Mappings(ctx context.Context) cloudhub.MappingsStore
- func (s *Store) OrganizationConfig(ctx context.Context) cloudhub.OrganizationConfigStore
- func (s *Store) Organizations(ctx context.Context) cloudhub.OrganizationsStore
- func (s *Store) Protoboards(ctx context.Context) cloudhub.ProtoboardsStore
- func (s *Store) Servers(ctx context.Context) cloudhub.ServersStore
- func (s *Store) Sources(ctx context.Context) cloudhub.SourcesStore
- func (s *Store) Users(ctx context.Context) cloudhub.UsersStore
- func (s *Store) Vspheres(ctx context.Context) cloudhub.VspheresStore
- 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{}) cloudhub.Logger
- func (tl *TestLogger) Writer() *io.PipeWriter
- type TimeSeries
- func (t *TimeSeries) Connect(ctx context.Context, src *cloudhub.Source) error
- func (t *TimeSeries) New(cloudhub.Source, cloudhub.Logger) (cloudhub.TimeSeries, error)
- func (t *TimeSeries) Permissions(ctx context.Context) cloudhub.Permissions
- func (t *TimeSeries) Query(ctx context.Context, query cloudhub.Query) (cloudhub.Response, error)
- func (t *TimeSeries) Roles(ctx context.Context) (cloudhub.RolesStore, error)
- func (t *TimeSeries) Users(ctx context.Context) cloudhub.UsersStore
- func (t *TimeSeries) Write(ctx context.Context, points []cloudhub.Point) error
- type UsersStore
- func (s *UsersStore) Add(ctx context.Context, u *cloudhub.User) (*cloudhub.User, error)
- func (s *UsersStore) All(ctx context.Context) ([]cloudhub.User, error)
- func (s *UsersStore) Delete(ctx context.Context, u *cloudhub.User) error
- func (s *UsersStore) Get(ctx context.Context, q cloudhub.UserQuery) (*cloudhub.User, error)
- func (s *UsersStore) Num(ctx context.Context) (int, error)
- func (s *UsersStore) Update(ctx context.Context, u *cloudhub.User) error
- type VspheresStore
- func (s *VspheresStore) Add(ctx context.Context, vs cloudhub.Vsphere) (cloudhub.Vsphere, error)
- func (s *VspheresStore) All(ctx context.Context) ([]cloudhub.Vsphere, error)
- func (s *VspheresStore) Delete(ctx context.Context, vs cloudhub.Vsphere) error
- func (s *VspheresStore) Get(ctx context.Context, id string) (cloudhub.Vsphere, error)
- func (s *VspheresStore) Update(ctx context.Context, vs cloudhub.Vsphere) 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 ConfigStore ¶
ConfigStore stores global application configuration
func (ConfigStore) Initialize ¶
func (c ConfigStore) Initialize(ctx context.Context) error
Initialize is noop in mocks store
type DashboardsStore ¶
type DashboardsStore struct { AddF func(ctx context.Context, newDashboard cloudhub.Dashboard) (cloudhub.Dashboard, error) AllF func(ctx context.Context) ([]cloudhub.Dashboard, error) DeleteF func(ctx context.Context, target cloudhub.Dashboard) error GetF func(ctx context.Context, id cloudhub.DashboardID) (cloudhub.Dashboard, error) UpdateF func(ctx context.Context, target cloudhub.Dashboard) error }
DashboardsStore mock allows all functions to be set for testing
func (*DashboardsStore) Add ¶
func (d *DashboardsStore) Add(ctx context.Context, newDashboard cloudhub.Dashboard) (cloudhub.Dashboard, error)
Add ...
func (*DashboardsStore) Get ¶
func (d *DashboardsStore) Get(ctx context.Context, id cloudhub.DashboardID) (cloudhub.Dashboard, error)
Get ...
type Databases ¶
type Databases struct { AllDBF func(context.Context) ([]cloudhub.Database, error) ConnectF func(context.Context, *cloudhub.Source) error CreateDBF func(context.Context, *cloudhub.Database) (*cloudhub.Database, error) DropDBF func(context.Context, string) error AllRPF func(context.Context, string) ([]cloudhub.RetentionPolicy, error) CreateRPF func(context.Context, string, *cloudhub.RetentionPolicy) (*cloudhub.RetentionPolicy, error) UpdateRPF func(context.Context, string, string, *cloudhub.RetentionPolicy) (*cloudhub.RetentionPolicy, error) DropRPF func(context.Context, string, string) error GetMeasurementsF func(ctx context.Context, db string, limit, offset int) ([]cloudhub.Measurement, error) }
Databases mock allows all databases methods to be set for testing
func (*Databases) CreateDB ¶
func (d *Databases) CreateDB(ctx context.Context, db *cloudhub.Database) (*cloudhub.Database, error)
CreateDB creates a database in the current data source
func (*Databases) CreateRP ¶
func (d *Databases) CreateRP(ctx context.Context, rpX string, rp *cloudhub.RetentionPolicy) (*cloudhub.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) ([]cloudhub.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) }
KapaClient Client is a mock Kapacitor client
func (*KapaClient) CreateTask ¶
func (p *KapaClient) CreateTask(opts client.CreateTaskOptions) (client.Task, error)
CreateTask ...
func (*KapaClient) DeleteTask ¶
func (p *KapaClient) DeleteTask(link client.Link) error
DeleteTask ...
func (*KapaClient) ListTasks ¶
func (p *KapaClient) ListTasks(opts *client.ListTasksOptions) ([]client.Task, error)
ListTasks ...
func (*KapaClient) Task ¶
func (p *KapaClient) Task(link client.Link, opts *client.TaskOptions) (client.Task, error)
Task ...
func (*KapaClient) UpdateTask ¶
func (p *KapaClient) UpdateTask(link client.Link, opts client.UpdateTaskOptions) (client.Task, error)
UpdateTask ...
type LayoutsStore ¶
type LayoutsStore struct { AllF func(ctx context.Context) ([]cloudhub.Layout, error) GetF func(ctx context.Context, id string) (cloudhub.Layout, error) }
LayoutsStore ...
type MappingsStore ¶
type MappingsStore struct { AddF func(context.Context, *cloudhub.Mapping) (*cloudhub.Mapping, error) AllF func(context.Context) ([]cloudhub.Mapping, error) DeleteF func(context.Context, *cloudhub.Mapping) error UpdateF func(context.Context, *cloudhub.Mapping) error GetF func(context.Context, string) (*cloudhub.Mapping, error) }
MappingsStore ...
type OrganizationConfigStore ¶
type OrganizationConfigStore struct { AllF func(ctx context.Context) ([]cloudhub.OrganizationConfig, error) FindOrCreateF func(ctx context.Context, id string) (*cloudhub.OrganizationConfig, error) PutF func(ctx context.Context, c *cloudhub.OrganizationConfig) error }
OrganizationConfigStore ...
func (*OrganizationConfigStore) All ¶
func (s *OrganizationConfigStore) All(ctx context.Context) ([]cloudhub.OrganizationConfig, error)
All ...
func (*OrganizationConfigStore) FindOrCreate ¶
func (s *OrganizationConfigStore) FindOrCreate(ctx context.Context, id string) (*cloudhub.OrganizationConfig, error)
FindOrCreate ...
func (*OrganizationConfigStore) Put ¶
func (s *OrganizationConfigStore) Put(ctx context.Context, c *cloudhub.OrganizationConfig) error
Put ...
type OrganizationsStore ¶
type OrganizationsStore struct { AllF func(context.Context) ([]cloudhub.Organization, error) AddF func(context.Context, *cloudhub.Organization) (*cloudhub.Organization, error) DeleteF func(context.Context, *cloudhub.Organization) error GetF func(ctx context.Context, q cloudhub.OrganizationQuery) (*cloudhub.Organization, error) UpdateF func(context.Context, *cloudhub.Organization) error CreateDefaultF func(context.Context) error DefaultOrganizationF func(context.Context) (*cloudhub.Organization, error) }
OrganizationsStore ...
func (*OrganizationsStore) Add ¶
func (s *OrganizationsStore) Add(ctx context.Context, o *cloudhub.Organization) (*cloudhub.Organization, error)
Add ...
func (*OrganizationsStore) All ¶
func (s *OrganizationsStore) All(ctx context.Context) ([]cloudhub.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) (*cloudhub.Organization, error)
DefaultOrganization ...
func (*OrganizationsStore) Delete ¶
func (s *OrganizationsStore) Delete(ctx context.Context, o *cloudhub.Organization) error
Delete ...
func (*OrganizationsStore) Get ¶
func (s *OrganizationsStore) Get(ctx context.Context, q cloudhub.OrganizationQuery) (*cloudhub.Organization, error)
Get ...
func (*OrganizationsStore) Update ¶
func (s *OrganizationsStore) Update(ctx context.Context, o *cloudhub.Organization) error
Update ...
type ProtoboardsStore ¶
type ProtoboardsStore struct { AllF func(ctx context.Context) ([]cloudhub.Protoboard, error) GetF func(ctx context.Context, id string) (cloudhub.Protoboard, error) }
ProtoboardsStore ...
func (*ProtoboardsStore) All ¶
func (s *ProtoboardsStore) All(ctx context.Context) ([]cloudhub.Protoboard, error)
All ...
func (*ProtoboardsStore) Get ¶
func (s *ProtoboardsStore) Get(ctx context.Context, id string) (cloudhub.Protoboard, error)
Get ...
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response is a mocked cloudhub.Response
func NewResponse ¶
NewResponse returns a mocked cloudhub.Response
func (*Response) MarshalJSON ¶
MarshalJSON returns the res and err as the fake response.
type RolesStore ¶
type RolesStore struct { AllF func(context.Context) ([]cloudhub.Role, error) AddF func(context.Context, *cloudhub.Role) (*cloudhub.Role, error) DeleteF func(context.Context, *cloudhub.Role) error GetF func(ctx context.Context, name string) (*cloudhub.Role, error) UpdateF func(context.Context, *cloudhub.Role) error }
RolesStore mock allows all functions to be set for testing
type ServersStore ¶
type ServersStore struct { AllF func(context.Context) ([]cloudhub.Server, error) AddF func(context.Context, cloudhub.Server) (cloudhub.Server, error) DeleteF func(context.Context, cloudhub.Server) error GetF func(ctx context.Context, ID int) (cloudhub.Server, error) UpdateF func(context.Context, cloudhub.Server) error }
ServersStore mock allows all functions to be set for testing
type SourcesStore ¶
type SourcesStore struct { AllF func(context.Context) ([]cloudhub.Source, error) AddF func(context.Context, cloudhub.Source) (cloudhub.Source, error) DeleteF func(context.Context, cloudhub.Source) error GetF func(ctx context.Context, ID int) (cloudhub.Source, error) UpdateF func(context.Context, cloudhub.Source) error }
SourcesStore mock allows all functions to be set for testing
type Store ¶
type Store struct { SourcesStore cloudhub.SourcesStore MappingsStore cloudhub.MappingsStore ServersStore cloudhub.ServersStore LayoutsStore cloudhub.LayoutsStore ProtoboardsStore cloudhub.ProtoboardsStore UsersStore cloudhub.UsersStore DashboardsStore cloudhub.DashboardsStore OrganizationsStore cloudhub.OrganizationsStore ConfigStore cloudhub.ConfigStore OrganizationConfigStore cloudhub.OrganizationConfigStore VspheresStore cloudhub.VspheresStore }
Store is a server.DataStore
func (*Store) Dashboards ¶
func (s *Store) Dashboards(ctx context.Context) cloudhub.DashboardsStore
Dashboards ...
func (*Store) Layouts ¶
func (s *Store) Layouts(ctx context.Context) cloudhub.LayoutsStore
Layouts ...
func (*Store) Mappings ¶
func (s *Store) Mappings(ctx context.Context) cloudhub.MappingsStore
Mappings ...
func (*Store) OrganizationConfig ¶
func (s *Store) OrganizationConfig(ctx context.Context) cloudhub.OrganizationConfigStore
OrganizationConfig ...
func (*Store) Organizations ¶
func (s *Store) Organizations(ctx context.Context) cloudhub.OrganizationsStore
Organizations ...
func (*Store) Protoboards ¶
func (s *Store) Protoboards(ctx context.Context) cloudhub.ProtoboardsStore
Protoboards ...
func (*Store) Servers ¶
func (s *Store) Servers(ctx context.Context) cloudhub.ServersStore
Servers ...
type TestLogger ¶
type TestLogger struct {
Messages []LogMessage
}
TestLogger is a cloudhub.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, *cloudhub.Source) error // Query retrieves time series data from the database. QueryF func(context.Context, cloudhub.Query) (cloudhub.Response, error) // Write records points into the TimeSeries WriteF func(context.Context, []cloudhub.Point) error // UsersStore represents the user accounts within the TimeSeries database UsersF func(context.Context) cloudhub.UsersStore // Permissions returns all valid names permissions in this database PermissionsF func(context.Context) cloudhub.Permissions // RolesF represents the roles. Roles group permissions and Users RolesF func(context.Context) (cloudhub.RolesStore, error) }
TimeSeries is a mockable CloudHub 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(cloudhub.Source, cloudhub.Logger) (cloudhub.TimeSeries, error)
New implements TimeSeriesClient
func (*TimeSeries) Permissions ¶
func (t *TimeSeries) Permissions(ctx context.Context) cloudhub.Permissions
Permissions returns all valid names permissions in this database
func (*TimeSeries) Roles ¶
func (t *TimeSeries) Roles(ctx context.Context) (cloudhub.RolesStore, error)
Roles represents the roles. Roles group permissions and Users
func (*TimeSeries) Users ¶
func (t *TimeSeries) Users(ctx context.Context) cloudhub.UsersStore
Users represents the user accounts within the TimeSeries database
type UsersStore ¶
type UsersStore struct { AllF func(context.Context) ([]cloudhub.User, error) AddF func(context.Context, *cloudhub.User) (*cloudhub.User, error) DeleteF func(context.Context, *cloudhub.User) error GetF func(ctx context.Context, q cloudhub.UserQuery) (*cloudhub.User, error) UpdateF func(context.Context, *cloudhub.User) error NumF func(context.Context) (int, error) }
UsersStore mock allows all functions to be set for testing
type VspheresStore ¶
type VspheresStore struct { AllF func(context.Context) ([]cloudhub.Vsphere, error) AddF func(context.Context, cloudhub.Vsphere) (cloudhub.Vsphere, error) DeleteF func(context.Context, cloudhub.Vsphere) error GetF func(context.Context, string) (cloudhub.Vsphere, error) UpdateF func(context.Context, cloudhub.Vsphere) error }
VspheresStore mock allows all functions to be set for testing