Documentation ¶
Index ¶
- func Difference(wants []string, haves []string) (revoke []string, add []string)
- func ToChronograf(perms Permissions) chronograf.Permissions
- type Client
- func (c *Client) Connect(ctx context.Context, src *chronograf.Source) error
- func (c *Client) Permissions(context.Context) chronograf.Permissions
- func (c *Client) Query(ctx context.Context, q chronograf.Query) (chronograf.Response, error)
- func (c *Client) Roles(ctx context.Context) (chronograf.RolesStore, error)
- func (c *Client) Users(context.Context) chronograf.UsersStore
- func (c *Client) Write(ctx context.Context, points []chronograf.Point) error
- type Cluster
- type Ctrl
- type DataNode
- type Error
- type LDAPConfig
- type MetaClient
- func (m *MetaClient) AddRoleUsers(ctx context.Context, name string, users []string) error
- func (m *MetaClient) ChangePassword(ctx context.Context, name, passwd string) error
- func (m *MetaClient) CreateRole(ctx context.Context, name string) error
- func (m *MetaClient) CreateUpdateUser(ctx context.Context, action, name, passwd string) error
- func (m *MetaClient) CreateUser(ctx context.Context, name, passwd string) error
- func (m *MetaClient) DeleteRole(ctx context.Context, name string) error
- func (m *MetaClient) DeleteUser(ctx context.Context, name string) error
- func (m *MetaClient) Do(ctx context.Context, path, method string, authorizer influx.Authorizer, ...) (*http.Response, error)
- func (m *MetaClient) GetLDAPConfig(ctx context.Context) (*LDAPConfig, error)
- func (m *MetaClient) Post(ctx context.Context, path string, action interface{}, params map[string]string) error
- func (m *MetaClient) RemoveRolePerms(ctx context.Context, name string, perms Permissions) error
- func (m *MetaClient) RemoveRoleUsers(ctx context.Context, name string, users []string) error
- func (m *MetaClient) RemoveUserPerms(ctx context.Context, name string, perms Permissions) error
- func (m *MetaClient) Role(ctx context.Context, name string) (*Role, error)
- func (m *MetaClient) Roles(ctx context.Context, name *string) (*Roles, error)
- func (m *MetaClient) SetRolePerms(ctx context.Context, name string, perms Permissions) error
- func (m *MetaClient) SetRoleUsers(ctx context.Context, name string, users []string) error
- func (m *MetaClient) SetUserPerms(ctx context.Context, name string, perms Permissions) error
- func (m *MetaClient) ShowCluster(ctx context.Context) (*Cluster, error)
- func (m *MetaClient) User(ctx context.Context, name string) (*User, error)
- func (m *MetaClient) UserRoles(ctx context.Context) (map[string]Roles, error)
- func (m *MetaClient) Users(ctx context.Context, name *string) (*Users, error)
- type Node
- type Permissions
- type Role
- type RoleAction
- type Roles
- type RolesStore
- func (c *RolesStore) Add(ctx context.Context, u *chronograf.Role) (*chronograf.Role, error)
- func (c *RolesStore) All(ctx context.Context) ([]chronograf.Role, error)
- func (c *RolesStore) Delete(ctx context.Context, u *chronograf.Role) error
- func (c *RolesStore) Get(ctx context.Context, name string) (*chronograf.Role, error)
- func (c *RolesStore) Update(ctx context.Context, u *chronograf.Role) error
- type User
- type UserAction
- type UserStore
- func (c *UserStore) Add(ctx context.Context, u *chronograf.User) (*chronograf.User, error)
- func (c *UserStore) All(ctx context.Context) ([]chronograf.User, error)
- func (c *UserStore) Delete(ctx context.Context, u *chronograf.User) error
- func (c *UserStore) Get(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error)
- func (c *UserStore) Num(ctx context.Context) (int, error)
- func (c *UserStore) Update(ctx context.Context, u *chronograf.User) error
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Difference ¶
Difference compares two sets and returns a set to be removed and a set to be added
func ToChronograf ¶
func ToChronograf(perms Permissions) chronograf.Permissions
ToChronograf converts enterprise permissions shape to chronograf shape
Types ¶
type Client ¶
type Client struct { Ctrl UsersStore chronograf.UsersStore RolesStore chronograf.RolesStore Logger chronograf.Logger // contains filtered or unexported fields }
Client is a device for retrieving time series data from an Influx Enterprise cluster. It is configured using the addresses of one or more meta node URLs. Data node URLs are retrieved automatically from the meta nodes and queries are appropriately load balanced across the cluster.
func NewClientWithTimeSeries ¶
func NewClientWithTimeSeries(lg chronograf.Logger, mu string, authorizer influx.Authorizer, tls, insecure bool, series ...chronograf.TimeSeries) (*Client, error)
NewClientWithTimeSeries initializes a Client with a known set of TimeSeries.
func NewClientWithURL ¶
func NewClientWithURL(mu string, authorizer influx.Authorizer, tls bool, insecure bool, lg chronograf.Logger) (*Client, error)
NewClientWithURL initializes an Enterprise client with a URL to a Meta Node. Acceptable URLs include host:port combinations as well as scheme://host:port varieties. TLS is used when the URL contains "https" or when the TLS parameter is set. authorizer will add the correct `Authorization` headers on the out-bound request.
func (*Client) Connect ¶
Connect prepares a Client to process queries. It must be called prior to calling Query
func (*Client) Permissions ¶
func (c *Client) Permissions(context.Context) chronograf.Permissions
Permissions returns all Influx Enterprise permission strings
func (*Client) Query ¶
func (c *Client) Query(ctx context.Context, q chronograf.Query) (chronograf.Response, error)
Query retrieves timeseries information pertaining to a specified query. It can be cancelled by using a provided context.
func (*Client) Roles ¶
func (c *Client) Roles(ctx context.Context) (chronograf.RolesStore, error)
Roles provide a grouping of permissions given to a grouping of users
func (*Client) Users ¶
func (c *Client) Users(context.Context) chronograf.UsersStore
Users is the interface to the users within Influx Enterprise
type Ctrl ¶
type Ctrl interface { ShowCluster(ctx context.Context) (*Cluster, error) Users(ctx context.Context, name *string) (*Users, error) User(ctx context.Context, name string) (*User, error) CreateUser(ctx context.Context, name, passwd string) error DeleteUser(ctx context.Context, name string) error ChangePassword(ctx context.Context, name, passwd string) error SetUserPerms(ctx context.Context, name string, perms Permissions) error UserRoles(ctx context.Context) (map[string]Roles, error) Roles(ctx context.Context, name *string) (*Roles, error) Role(ctx context.Context, name string) (*Role, error) CreateRole(ctx context.Context, name string) error DeleteRole(ctx context.Context, name string) error SetRolePerms(ctx context.Context, name string, perms Permissions) error SetRoleUsers(ctx context.Context, name string, users []string) error AddRoleUsers(ctx context.Context, name string, users []string) error RemoveRoleUsers(ctx context.Context, name string, users []string) error }
Ctrl represents administrative controls over an Influx Enterprise cluster
type DataNode ¶
type DataNode struct { ID uint64 `json:"id"` // Meta store ID. TCPAddr string `json:"tcpAddr"` // RPC addr, e.g., host:8088. HTTPAddr string `json:"httpAddr"` // Client addr, e.g., host:8086. HTTPScheme string `json:"httpScheme"` // "http" or "https" for HTTP addr. Status string `json:"status,omitempty"` // The cluster status of the node. }
DataNode represents a data node in an Influx Enterprise Cluster
type Error ¶
type Error struct {
Error string `json:"error"`
}
Error is JSON error message return by Influx Enterprise's meta API.
type LDAPConfig ¶
type LDAPConfig struct {
Structured jsonLDAPConfig `json:"structured"`
}
LDAPConfig represents the configuration for ldap from influxdb
type MetaClient ¶
MetaClient represents a Meta node in an Influx Enterprise cluster
func NewMetaClient ¶
func NewMetaClient(url *url.URL, InsecureSkipVerify bool, authorizer influx.Authorizer) *MetaClient
NewMetaClient represents a meta node in an Influx Enterprise cluster
func (*MetaClient) AddRoleUsers ¶
AddRoleUsers updates a role to have additional users.
func (*MetaClient) ChangePassword ¶
func (m *MetaClient) ChangePassword(ctx context.Context, name, passwd string) error
ChangePassword updates a user's password in Influx Enterprise
func (*MetaClient) CreateRole ¶
func (m *MetaClient) CreateRole(ctx context.Context, name string) error
CreateRole adds a role to Influx Enterprise
func (*MetaClient) CreateUpdateUser ¶
func (m *MetaClient) CreateUpdateUser(ctx context.Context, action, name, passwd string) error
CreateUpdateUser is a helper function to POST to the /user Influx Enterprise endpoint
func (*MetaClient) CreateUser ¶
func (m *MetaClient) CreateUser(ctx context.Context, name, passwd string) error
CreateUser adds a user to Influx Enterprise
func (*MetaClient) DeleteRole ¶
func (m *MetaClient) DeleteRole(ctx context.Context, name string) error
DeleteRole removes a role from Influx Enterprise
func (*MetaClient) DeleteUser ¶
func (m *MetaClient) DeleteUser(ctx context.Context, name string) error
DeleteUser removes a user from Influx Enterprise
func (*MetaClient) Do ¶
func (m *MetaClient) Do(ctx context.Context, path, method string, authorizer influx.Authorizer, params map[string]string, body io.Reader) (*http.Response, error)
Do is a cancelable function to interface with Influx Enterprise's Meta API
func (*MetaClient) GetLDAPConfig ¶
func (m *MetaClient) GetLDAPConfig(ctx context.Context) (*LDAPConfig, error)
GetLDAPConfig get the current ldap config response from influxdb enterprise
func (*MetaClient) Post ¶
func (m *MetaClient) Post(ctx context.Context, path string, action interface{}, params map[string]string) error
Post is a helper function to POST to Influx Enterprise
func (*MetaClient) RemoveRolePerms ¶
func (m *MetaClient) RemoveRolePerms(ctx context.Context, name string, perms Permissions) error
RemoveRolePerms revokes permissions from a role
func (*MetaClient) RemoveRoleUsers ¶
RemoveRoleUsers updates a role to remove some users.
func (*MetaClient) RemoveUserPerms ¶
func (m *MetaClient) RemoveUserPerms(ctx context.Context, name string, perms Permissions) error
RemoveUserPerms revokes permissions for a user in Influx Enterprise
func (*MetaClient) Roles ¶
Roles gets all the roles. If name is not nil it filters for a single role
func (*MetaClient) SetRolePerms ¶
func (m *MetaClient) SetRolePerms(ctx context.Context, name string, perms Permissions) error
SetRolePerms removes permissions not in set and then adds the requested perms to role
func (*MetaClient) SetRoleUsers ¶
SetRoleUsers removes users not in role and then adds the requested users to role
func (*MetaClient) SetUserPerms ¶
func (m *MetaClient) SetUserPerms(ctx context.Context, name string, perms Permissions) error
SetUserPerms removes permissions not in set and then adds the requested perms
func (*MetaClient) ShowCluster ¶
func (m *MetaClient) ShowCluster(ctx context.Context) (*Cluster, error)
ShowCluster returns the cluster configuration (not health)
type Node ¶
type Node struct { ID uint64 `json:"id"` Addr string `json:"addr"` HTTPScheme string `json:"httpScheme"` TCPAddr string `json:"tcpAddr"` }
Node represent any meta or data node in an Influx Enterprise cluster
type Permissions ¶
Permissions maps resources to a set of permissions. Specifically, it maps a database to a set of permissions
func ToEnterprise ¶
func ToEnterprise(perms chronograf.Permissions) Permissions
ToEnterprise converts chronograf permission shape to enterprise
type Role ¶
type Role struct { Name string `json:"name"` NewName string `json:"newName,omitempty"` Permissions Permissions `json:"permissions,omitempty"` Users []string `json:"users,omitempty"` }
Role is a restricted set of permissions assigned to a set of users.
type RoleAction ¶
RoleAction represents an action to be taken with a role.
type Roles ¶
type Roles struct {
Roles []Role `json:"roles,omitempty"`
}
Roles is a set of roles
func (*Roles) ToChronograf ¶
func (r *Roles) ToChronograf() []chronograf.Role
ToChronograf converts enterprise roles to chronograf
type RolesStore ¶
type RolesStore struct { Ctrl Logger chronograf.Logger }
RolesStore uses a control client operate on Influx Enterprise roles. Roles are groups of permissions applied to groups of users
func (*RolesStore) Add ¶
func (c *RolesStore) Add(ctx context.Context, u *chronograf.Role) (*chronograf.Role, error)
Add creates a new Role in Influx Enterprise This must be done in three smaller steps: creating, setting permissions, setting users.
func (*RolesStore) All ¶
func (c *RolesStore) All(ctx context.Context) ([]chronograf.Role, error)
All is all Roles in influx
func (*RolesStore) Delete ¶
func (c *RolesStore) Delete(ctx context.Context, u *chronograf.Role) error
Delete the Role from Influx Enterprise
func (*RolesStore) Get ¶
func (c *RolesStore) Get(ctx context.Context, name string) (*chronograf.Role, error)
Get retrieves a Role if name exists.
func (*RolesStore) Update ¶
func (c *RolesStore) Update(ctx context.Context, u *chronograf.Role) error
Update the Role's permissions and roles
type User ¶
type User struct { Name string `json:"name"` Password string `json:"password,omitempty"` Permissions Permissions `json:"permissions,omitempty"` }
User represents an enterprise user.
type UserAction ¶
UserAction represents and action to be taken with a user.
type UserStore ¶
type UserStore struct { Ctrl Logger chronograf.Logger }
UserStore uses a control client operate on Influx Enterprise users
func (*UserStore) Add ¶
func (c *UserStore) Add(ctx context.Context, u *chronograf.User) (*chronograf.User, error)
Add creates a new User in Influx Enterprise
func (*UserStore) Get ¶
func (c *UserStore) Get(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error)
Get retrieves a user if name exists.