Documentation ¶
Index ¶
- Constants
- type DashboardsStore
- func (s *DashboardsStore) Add(ctx context.Context, d chronograf.Dashboard) (chronograf.Dashboard, error)
- func (s *DashboardsStore) All(ctx context.Context) ([]chronograf.Dashboard, error)
- func (s *DashboardsStore) Delete(ctx context.Context, d chronograf.Dashboard) error
- func (s *DashboardsStore) Get(ctx context.Context, id chronograf.DashboardID) (chronograf.Dashboard, error)
- func (s *DashboardsStore) Update(ctx context.Context, d chronograf.Dashboard) error
- type OrganizationConfigStore
- 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 ServersStore
- func (s *ServersStore) Add(ctx context.Context, d chronograf.Server) (chronograf.Server, error)
- func (s *ServersStore) All(ctx context.Context) ([]chronograf.Server, error)
- func (s *ServersStore) Delete(ctx context.Context, d chronograf.Server) error
- func (s *ServersStore) Get(ctx context.Context, id int) (chronograf.Server, error)
- func (s *ServersStore) Update(ctx context.Context, d chronograf.Server) error
- type SourcesStore
- func (s *SourcesStore) Add(ctx context.Context, d chronograf.Source) (chronograf.Source, error)
- func (s *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error)
- func (s *SourcesStore) Delete(ctx context.Context, d chronograf.Source) error
- func (s *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error)
- func (s *SourcesStore) Update(ctx context.Context, d chronograf.Source) 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, usr *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, usr *chronograf.User) error
Constants ¶
const ContextKey = contextKey("organization")
ContextKey is the key used to specify the organization via context
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DashboardsStore ¶
type DashboardsStore struct {
// contains filtered or unexported fields
}
DashboardsStore facade on a DashboardStore that filters dashboards by organization.
func NewDashboardsStore ¶
func NewDashboardsStore(s chronograf.DashboardsStore, org string) *DashboardsStore
NewDashboardsStore creates a new DashboardsStore from an existing chronograf.DashboardStore and an organization string
func (*DashboardsStore) Add ¶
func (s *DashboardsStore) Add(ctx context.Context, d chronograf.Dashboard) (chronograf.Dashboard, error)
Add creates a new Dashboard in the DashboardsStore with dashboard.Organization set to be the organization from the dashboard store.
func (*DashboardsStore) All ¶
func (s *DashboardsStore) All(ctx context.Context) ([]chronograf.Dashboard, error)
All retrieves all dashboards from the underlying DashboardStore and filters them by organization.
func (*DashboardsStore) Delete ¶
func (s *DashboardsStore) Delete(ctx context.Context, d chronograf.Dashboard) error
Delete the dashboard from DashboardsStore
func (*DashboardsStore) Get ¶
func (s *DashboardsStore) Get(ctx context.Context, id chronograf.DashboardID) (chronograf.Dashboard, error)
Get returns a Dashboard if the id exists and belongs to the organization that is set.
func (*DashboardsStore) Update ¶
func (s *DashboardsStore) Update(ctx context.Context, d chronograf.Dashboard) error
Update the dashboard in DashboardsStore.
type OrganizationConfigStore ¶
type OrganizationConfigStore struct {
// contains filtered or unexported fields
}
OrganizationConfigStore facade on a OrganizationConfig that filters OrganizationConfigs by organization.
func NewOrganizationConfigStore ¶
func NewOrganizationConfigStore(s chronograf.OrganizationConfigStore, orgID string) *OrganizationConfigStore
NewOrganizationConfigStore creates a new OrganizationConfigStore from an existing chronograf.OrganizationConfigStore and an organization string
func (*OrganizationConfigStore) FindOrCreate ¶
func (s *OrganizationConfigStore) FindOrCreate(ctx context.Context, orgID string) (*chronograf.OrganizationConfig, error)
FindOrCreate gets an organization's config or creates one if none exists
func (*OrganizationConfigStore) Put ¶
func (s *OrganizationConfigStore) Put(ctx context.Context, c *chronograf.OrganizationConfig) error
Put the OrganizationConfig in OrganizationConfigStore.
type OrganizationsStore ¶
type OrganizationsStore struct {
// contains filtered or unexported fields
}
OrganizationsStore facade on a OrganizationStore that filters organizations by organization.
func NewOrganizationsStore ¶
func NewOrganizationsStore(s chronograf.OrganizationsStore, org string) *OrganizationsStore
NewOrganizationsStore creates a new OrganizationsStore from an existing chronograf.OrganizationStore and an organization string
func (*OrganizationsStore) Add ¶
func (s *OrganizationsStore) Add(ctx context.Context, o *chronograf.Organization) (*chronograf.Organization, error)
Add creates a new Organization in the OrganizationsStore with organization.Organization set to be the organization from the organization store.
func (*OrganizationsStore) All ¶
func (s *OrganizationsStore) All(ctx context.Context) ([]chronograf.Organization, error)
All retrieves all organizations from the underlying OrganizationStore and filters them by organization.
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
Delete the organization from OrganizationsStore
func (*OrganizationsStore) Get ¶
func (s *OrganizationsStore) Get(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error)
Get returns a Organization if the id exists and belongs to the organization that is set.
func (*OrganizationsStore) Update ¶
func (s *OrganizationsStore) Update(ctx context.Context, o *chronograf.Organization) error
Update the organization in OrganizationsStore.
type ServersStore ¶
type ServersStore struct {
// contains filtered or unexported fields
}
ServersStore facade on a ServerStore that filters servers by organization.
func NewServersStore ¶
func NewServersStore(s chronograf.ServersStore, org string) *ServersStore
NewServersStore creates a new ServersStore from an existing chronograf.ServerStore and an organization string
func (*ServersStore) Add ¶
func (s *ServersStore) Add(ctx context.Context, d chronograf.Server) (chronograf.Server, error)
Add creates a new Server in the ServersStore with server.Organization set to be the organization from the server store.
func (*ServersStore) All ¶
func (s *ServersStore) All(ctx context.Context) ([]chronograf.Server, error)
All retrieves all servers from the underlying ServerStore and filters them by organization.
func (*ServersStore) Delete ¶
func (s *ServersStore) Delete(ctx context.Context, d chronograf.Server) error
Delete the server from ServersStore
func (*ServersStore) Get ¶
func (s *ServersStore) Get(ctx context.Context, id int) (chronograf.Server, error)
Get returns a Server if the id exists and belongs to the organization that is set.
func (*ServersStore) Update ¶
func (s *ServersStore) Update(ctx context.Context, d chronograf.Server) error
Update the server in ServersStore.
type SourcesStore ¶
type SourcesStore struct {
// contains filtered or unexported fields
}
SourcesStore facade on a SourceStore that filters sources by organization.
func NewSourcesStore ¶
func NewSourcesStore(s chronograf.SourcesStore, org string) *SourcesStore
NewSourcesStore creates a new SourcesStore from an existing chronograf.SourceStore and an organization string
func (*SourcesStore) Add ¶
func (s *SourcesStore) Add(ctx context.Context, d chronograf.Source) (chronograf.Source, error)
Add creates a new Source in the SourcesStore with source.Organization set to be the organization from the source store.
func (*SourcesStore) All ¶
func (s *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error)
All retrieves all sources from the underlying SourceStore and filters them by organization.
func (*SourcesStore) Delete ¶
func (s *SourcesStore) Delete(ctx context.Context, d chronograf.Source) error
Delete the source from SourcesStore
func (*SourcesStore) Get ¶
func (s *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error)
Get returns a Source if the id exists and belongs to the organization that is set.
func (*SourcesStore) Update ¶
func (s *SourcesStore) Update(ctx context.Context, d chronograf.Source) error
Update the source in SourcesStore.
type UsersStore ¶
type UsersStore struct {
// contains filtered or unexported fields
}
UsersStore facade on a UserStore that filters a users roles by organization.
The high level idea here is to use the same underlying store for all users. In particular, this is done by having all the users Roles field be a set of all of the users roles in all organizations. Each CRUD method here takes care to ensure that the only roles that are modified are the roles for the organization that was provided on the UsersStore.
func NewUsersStore ¶
func NewUsersStore(s chronograf.UsersStore, org string) *UsersStore
NewUsersStore creates a new UsersStore from an existing chronograf.UserStore and an organization string
func (*UsersStore) Add ¶
func (s *UsersStore) Add(ctx context.Context, u *chronograf.User) (*chronograf.User, error)
Add creates a new User in the UsersStore. It validates that the user provided only has roles for the organization set on the UsersStore. If a user is not found in the underlying, it calls the underlying UsersStore Add method. If a user is found, it removes any existing roles a user has for an organization and appends the roles specified on the provided user and calls the uderlying UsersStore Update method.
func (*UsersStore) All ¶
func (s *UsersStore) All(ctx context.Context) ([]chronograf.User, error)
All returns all users where roles have been filters to be exclusively for the organization provided on the UsersStore.
func (*UsersStore) Delete ¶
func (s *UsersStore) Delete(ctx context.Context, usr *chronograf.User) error
Delete a user from the UsersStore. This is done by stripping a user of any roles it has in the organization speicified on the UsersStore.
func (*UsersStore) Get ¶
func (s *UsersStore) Get(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error)
Get searches the UsersStore for using the query. The roles returned on the user are filtered to only contain roles that are for the organization specified on the organization store.
func (*UsersStore) Num ¶
func (s *UsersStore) Num(ctx context.Context) (int, error)
Num returns the number of users in the UsersStore This is unperformant, but should rarely be used.
func (*UsersStore) Update ¶
func (s *UsersStore) Update(ctx context.Context, usr *chronograf.User) error
Update a user in the UsersStore.