Documentation
¶
Overview ¶
This package is responsible for the communicating with elasticsearch, mainly transferring objects to requests to send to elasticsearch and parsing the responses from elasticsearch
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct {
Application string `json:"application"`
Privileges []string `json:"privileges"`
Resources []string `json:"resources"`
}
type Client ¶
type Client struct {
*es7.Client
}
func NewClient ¶
func NewClient(url, username, password string, roots *x509.CertPool) (*Client, error)
func (Client) CreateUser ¶
func (cli Client) CreateUser(user User) error
CreateUser will create the Elasticsearch user and roles (if any roles are defined for the user). If the roles exist they will be updated.
func (Client) UpdateUser ¶
func (cli Client) UpdateUser(user User) error
UpdateUser will update the Elasticsearch users password and roles (if an roles are defined for the user). If the roles don't exist they will be created.
func (Client) UserExists ¶
func (cli Client) UserExists(username string) (bool, error)
UserExists queries Elasticsearch to see if a user with the given username already exists
type Role ¶
type Role struct {
Name string `json:"-"`
Definition *RoleDefinition
}
Role represents an Elasticsearch role that may be attached to a User
type RoleDefinition ¶
type RoleDefinition struct {
Cluster []string `json:"cluster"`
Indices []RoleIndex `json:"indices"`
Applications []Application `json:"applications,omitempty"`
}
type RoleIndex ¶
type RoleIndex struct {
Names []string `json:"names"`
Privileges []string `json:"privileges"`
}
type User ¶
type User struct {
Username string
Password string
Roles []Role
}
User represents an Elasticsearch user, which may or may not have roles attached to it
func (User) RoleNames ¶
func (u User) RoleNames() []string
RoleNames is a convenience function for getting the names of all the roles defined for this Elasticsearch user
func (User) SecretName ¶
func (u User) SecretName() string
SecretName returns the name of the secret that should be used to store the information of this user