enterprise

package
v0.0.0-...-0b6d2f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2021 License: AGPL-3.0, AGPL-3.0-or-later Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Difference

func Difference(wants []string, haves []string) (revoke []string, add []string)

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

func (c *Client) Connect(ctx context.Context, src *chronograf.Source) error

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

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

Users is the interface to the users within Influx Enterprise

func (*Client) Write

func (c *Client) Write(ctx context.Context, points []chronograf.Point) error

Write records points into a time series

type Cluster

type Cluster struct {
	DataNodes []DataNode `json:"data"`
	MetaNodes []Node     `json:"meta"`
}

Cluster is a collection of data nodes and non-data nodes within a Plutonium cluster.

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

type MetaClient struct {
	URL *url.URL
	// contains filtered or unexported fields
}

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

func (m *MetaClient) AddRoleUsers(ctx context.Context, name string, users []string) error

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

func (m *MetaClient) RemoveRoleUsers(ctx context.Context, name string, users []string) error

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) Role

func (m *MetaClient) Role(ctx context.Context, name string) (*Role, error)

Role returns a single named role

func (*MetaClient) Roles

func (m *MetaClient) Roles(ctx context.Context, name *string) (*Roles, error)

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

func (m *MetaClient) SetRoleUsers(ctx context.Context, name string, users []string) error

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)

func (*MetaClient) User

func (m *MetaClient) User(ctx context.Context, name string) (*User, error)

User returns a single Influx Enterprise user

func (*MetaClient) UserRoles

func (m *MetaClient) UserRoles(ctx context.Context) (map[string]Roles, error)

UserRoles returns a map of users to all of their current roles

func (*MetaClient) Users

func (m *MetaClient) Users(ctx context.Context, name *string) (*Users, error)

Users gets all the users. If name is not nil it filters for a single user

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

type Permissions map[string][]string

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

type RoleAction struct {
	Action string `json:"action"`
	Role   *Role  `json:"role"`
}

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

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

type UserAction struct {
	Action string `json:"action"`
	User   *User  `json:"user"`
}

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

Add creates a new User in Influx Enterprise

func (*UserStore) All

func (c *UserStore) All(ctx context.Context) ([]chronograf.User, error)

All is all users in influx

func (*UserStore) Delete

func (c *UserStore) Delete(ctx context.Context, u *chronograf.User) error

Delete the User from Influx Enterprise

func (*UserStore) Get

Get retrieves a user if name exists.

func (*UserStore) Num

func (c *UserStore) Num(ctx context.Context) (int, error)

Num of users in Influx

func (*UserStore) Update

func (c *UserStore) Update(ctx context.Context, u *chronograf.User) error

Update the user's permissions or roles

type Users

type Users struct {
	Users []User `json:"users,omitempty"`
}

Users represents a set of enterprise users.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL