elasticsearch

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 32 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CustomRoleName    = "readWriteAnyDatabase"
	ApplicationKibana = "kibana-.kibana"
)
View Source
const (
	PrivilegeCreateSnapshot = "create_snapshot"
	PrivilegeManage         = "manage"
	PrivilegeManageILM      = "manage_ilm"
	PrivilegeManageRoleup   = "manage_rollup"
	PrivilegeMonitor        = "monitor"
	PrivilegeManageCCR      = "manage_ccr"
	PrivilegeRead           = "read"
	PrivilegeWrite          = "write"
	PrivilegeCreateIndex    = "create_index"
	PrivilegeIndexAny       = "*"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationPrivileges added in v0.0.8

type ApplicationPrivileges struct {
	Application string   `json:"application"`
	Privileges  []string `json:"privileges"`
	Resources   []string `json:"resources"`
}

type Client

type Client struct {
	ESClient
}

type Config added in v0.0.14

type Config struct {
	// contains filtered or unexported fields
}

type DBPrivileges added in v0.0.8

type DBPrivileges struct {
	Names                  []string `json:"names"`
	Privileges             []string `json:"privileges"`
	AllowRestrictedIndices bool     `json:"allow_restricted_indices"`
}

type ESClient

type ESClient interface {
	ClusterHealthInfo() (map[string]interface{}, error)
	ClusterStatus() (string, error)
	CountData(index string) (int, error)
	CreateDBUserRole(ctx context.Context) error
	CreateIndex(index string) error
	DeleteIndex(index string) error
	GetIndicesInfo() ([]interface{}, error)
	GetClusterWriteStatus(ctx context.Context, db *api.Elasticsearch) error
	GetClusterReadStatus(ctx context.Context, db *api.Elasticsearch) error
	GetTotalDiskUsage(ctx context.Context) (string, error)
	GetDBUserRole(ctx context.Context) (error, bool)
	IndexExistsOrNot(index string) error
	NodesStats() (map[string]interface{}, error)
	PutData(index, id string, data map[string]interface{}) error
	SyncCredentialFromSecret(secret *core.Secret) error
}

type ESClientV5

type ESClientV5 struct {
	// contains filtered or unexported fields
}

func (*ESClientV5) ClusterHealthInfo

func (es *ESClientV5) ClusterHealthInfo() (map[string]interface{}, error)

func (*ESClientV5) ClusterStatus

func (es *ESClientV5) ClusterStatus() (string, error)

func (*ESClientV5) CountData added in v0.0.8

func (es *ESClientV5) CountData(index string) (int, error)

func (*ESClientV5) CreateDBUserRole added in v0.0.8

func (es *ESClientV5) CreateDBUserRole(ctx context.Context) error

func (*ESClientV5) CreateIndex added in v0.0.8

func (es *ESClientV5) CreateIndex(index string) error

func (*ESClientV5) DeleteIndex added in v0.0.8

func (es *ESClientV5) DeleteIndex(index string) error

func (*ESClientV5) GetClusterReadStatus

func (es *ESClientV5) GetClusterReadStatus(ctx context.Context, db *api.Elasticsearch) error

func (*ESClientV5) GetClusterWriteStatus

func (es *ESClientV5) GetClusterWriteStatus(ctx context.Context, db *api.Elasticsearch) error

func (*ESClientV5) GetDBUserRole added in v0.0.8

func (es *ESClientV5) GetDBUserRole(ctx context.Context) (error, bool)

func (*ESClientV5) GetIndicesInfo

func (es *ESClientV5) GetIndicesInfo() ([]interface{}, error)

GetIndicesInfo will return the indices info of an Elasticsearch database

func (*ESClientV5) GetTotalDiskUsage added in v0.0.6

func (es *ESClientV5) GetTotalDiskUsage(ctx context.Context) (string, error)

func (*ESClientV5) IndexExistsOrNot added in v0.0.8

func (es *ESClientV5) IndexExistsOrNot(index string) error

func (*ESClientV5) NodesStats

func (es *ESClientV5) NodesStats() (map[string]interface{}, error)

func (*ESClientV5) PutData added in v0.0.8

func (es *ESClientV5) PutData(index, id string, data map[string]interface{}) error

func (*ESClientV5) SyncCredentialFromSecret

func (es *ESClientV5) SyncCredentialFromSecret(secret *core.Secret) error

kibana_system, logstash_system etc. internal users are not supported for versions 6.x.x and, kibana, logstash can be accessed using elastic superuser so, sysncing is not required for other builtin users

type ESClientV6

type ESClientV6 struct {
	// contains filtered or unexported fields
}

func (*ESClientV6) ClusterHealthInfo

func (es *ESClientV6) ClusterHealthInfo() (map[string]interface{}, error)

func (*ESClientV6) ClusterStatus

func (es *ESClientV6) ClusterStatus() (string, error)

func (*ESClientV6) CountData added in v0.0.8

func (es *ESClientV6) CountData(index string) (int, error)

func (*ESClientV6) CreateDBUserRole added in v0.0.8

func (es *ESClientV6) CreateDBUserRole(ctx context.Context) error

func (*ESClientV6) CreateIndex added in v0.0.8

func (es *ESClientV6) CreateIndex(index string) error

func (*ESClientV6) DeleteIndex added in v0.0.8

func (es *ESClientV6) DeleteIndex(index string) error

func (*ESClientV6) GetClusterReadStatus

func (es *ESClientV6) GetClusterReadStatus(ctx context.Context, db *api.Elasticsearch) error

func (*ESClientV6) GetClusterWriteStatus

func (es *ESClientV6) GetClusterWriteStatus(ctx context.Context, db *api.Elasticsearch) error

func (*ESClientV6) GetDBUserRole added in v0.0.8

func (es *ESClientV6) GetDBUserRole(ctx context.Context) (error, bool)

func (*ESClientV6) GetIndicesInfo

func (es *ESClientV6) GetIndicesInfo() ([]interface{}, error)

GetIndicesInfo will return the indices info of an Elasticsearch database

func (*ESClientV6) GetTotalDiskUsage added in v0.0.6

func (es *ESClientV6) GetTotalDiskUsage(ctx context.Context) (string, error)

func (*ESClientV6) IndexExistsOrNot added in v0.0.8

func (es *ESClientV6) IndexExistsOrNot(index string) error

func (*ESClientV6) NodesStats

func (es *ESClientV6) NodesStats() (map[string]interface{}, error)

func (*ESClientV6) PutData added in v0.0.8

func (es *ESClientV6) PutData(index, id string, data map[string]interface{}) error

func (*ESClientV6) SyncCredentialFromSecret

func (es *ESClientV6) SyncCredentialFromSecret(secret *core.Secret) error

kibana_system, logstash_system etc. internal users are not supported for versions 6.x.x and, kibana, logstash can be accessed using elastic superuser so, sysncing is not required for other builtin users

type ESClientV7

type ESClientV7 struct {
	// contains filtered or unexported fields
}

func (*ESClientV7) ClusterHealthInfo

func (es *ESClientV7) ClusterHealthInfo() (map[string]interface{}, error)

func (*ESClientV7) ClusterStatus

func (es *ESClientV7) ClusterStatus() (string, error)

func (*ESClientV7) CountData added in v0.0.8

func (es *ESClientV7) CountData(index string) (int, error)

func (*ESClientV7) CreateDBUserRole added in v0.0.8

func (es *ESClientV7) CreateDBUserRole(ctx context.Context) error

func (*ESClientV7) CreateIndex added in v0.0.8

func (es *ESClientV7) CreateIndex(index string) error

func (*ESClientV7) DeleteIndex added in v0.0.8

func (es *ESClientV7) DeleteIndex(index string) error

func (*ESClientV7) GetClusterReadStatus

func (es *ESClientV7) GetClusterReadStatus(ctx context.Context, db *api.Elasticsearch) error

func (*ESClientV7) GetClusterWriteStatus

func (es *ESClientV7) GetClusterWriteStatus(ctx context.Context, db *api.Elasticsearch) error

func (*ESClientV7) GetDBUserRole added in v0.0.8

func (es *ESClientV7) GetDBUserRole(ctx context.Context) (error, bool)

func (*ESClientV7) GetIndicesInfo

func (es *ESClientV7) GetIndicesInfo() ([]interface{}, error)

GetIndicesInfo will return the indices info of an Elasticsearch database

func (*ESClientV7) GetTotalDiskUsage added in v0.0.6

func (es *ESClientV7) GetTotalDiskUsage(ctx context.Context) (string, error)

func (*ESClientV7) IndexExistsOrNot added in v0.0.8

func (es *ESClientV7) IndexExistsOrNot(index string) error

func (*ESClientV7) NodesStats

func (es *ESClientV7) NodesStats() (map[string]interface{}, error)

func (*ESClientV7) PutData added in v0.0.8

func (es *ESClientV7) PutData(index, id string, data map[string]interface{}) error

func (*ESClientV7) SyncCredentialFromSecret

func (es *ESClientV7) SyncCredentialFromSecret(secret *core.Secret) error

type ESClientV8

type ESClientV8 struct {
	// contains filtered or unexported fields
}

func (*ESClientV8) ClusterHealthInfo

func (es *ESClientV8) ClusterHealthInfo() (map[string]interface{}, error)

func (*ESClientV8) ClusterStatus

func (es *ESClientV8) ClusterStatus() (string, error)

func (*ESClientV8) CountData added in v0.0.8

func (es *ESClientV8) CountData(index string) (int, error)

func (*ESClientV8) CreateDBUserRole added in v0.0.8

func (es *ESClientV8) CreateDBUserRole(ctx context.Context) error

func (*ESClientV8) CreateIndex added in v0.0.8

func (es *ESClientV8) CreateIndex(index string) error

func (*ESClientV8) DeleteIndex added in v0.0.8

func (es *ESClientV8) DeleteIndex(index string) error

func (*ESClientV8) GetClusterReadStatus

func (es *ESClientV8) GetClusterReadStatus(ctx context.Context, db *api.Elasticsearch) error

func (*ESClientV8) GetClusterWriteStatus

func (es *ESClientV8) GetClusterWriteStatus(ctx context.Context, db *api.Elasticsearch) error

func (*ESClientV8) GetDBUserRole added in v0.0.8

func (es *ESClientV8) GetDBUserRole(ctx context.Context) (error, bool)

func (*ESClientV8) GetIndicesInfo

func (es *ESClientV8) GetIndicesInfo() ([]interface{}, error)

GetIndicesInfo will return the indices' info of an Elasticsearch database

func (*ESClientV8) GetTotalDiskUsage added in v0.0.6

func (es *ESClientV8) GetTotalDiskUsage(ctx context.Context) (string, error)

func (*ESClientV8) IndexExistsOrNot added in v0.0.8

func (es *ESClientV8) IndexExistsOrNot(index string) error

func (*ESClientV8) NodesStats

func (es *ESClientV8) NodesStats() (map[string]interface{}, error)

func (*ESClientV8) PutData added in v0.0.8

func (es *ESClientV8) PutData(index, id string, data map[string]interface{}) error

func (*ESClientV8) SyncCredentialFromSecret

func (es *ESClientV8) SyncCredentialFromSecret(secret *core.Secret) error

type ESRestyClient added in v0.0.14

type ESRestyClient struct {
	Client *resty.Client
	Config *Config
}

func (*ESRestyClient) Ping added in v0.0.14

func (client *ESRestyClient) Ping() (string, error)

type KubeDBClientBuilder

type KubeDBClientBuilder struct {
	// contains filtered or unexported fields
}

func NewKubeDBClientBuilder

func NewKubeDBClientBuilder(kc client.Client, db *api.Elasticsearch) *KubeDBClientBuilder

func (*KubeDBClientBuilder) GetElasticClient

func (o *KubeDBClientBuilder) GetElasticClient() (*Client, error)

func (*KubeDBClientBuilder) GetElasticRestyClient added in v0.0.14

func (o *KubeDBClientBuilder) GetElasticRestyClient() (*ESRestyClient, error)

func (*KubeDBClientBuilder) ServiceURL

func (o *KubeDBClientBuilder) ServiceURL() string

func (*KubeDBClientBuilder) WithContext

func (*KubeDBClientBuilder) WithPod

func (o *KubeDBClientBuilder) WithPod(podName string) *KubeDBClientBuilder

func (*KubeDBClientBuilder) WithURL

type OSClientV1

type OSClientV1 struct {
	// contains filtered or unexported fields
}

func (*OSClientV1) ClusterHealthInfo

func (os *OSClientV1) ClusterHealthInfo() (map[string]interface{}, error)

func (*OSClientV1) ClusterStatus

func (os *OSClientV1) ClusterStatus() (string, error)

func (*OSClientV1) CountData added in v0.0.8

func (os *OSClientV1) CountData(index string) (int, error)

func (*OSClientV1) CreateDBUserRole added in v0.0.8

func (os *OSClientV1) CreateDBUserRole(ctx context.Context) error

func (*OSClientV1) CreateIndex added in v0.0.8

func (os *OSClientV1) CreateIndex(index string) error

func (*OSClientV1) DeleteIndex added in v0.0.8

func (os *OSClientV1) DeleteIndex(index string) error

func (*OSClientV1) GetClusterReadStatus

func (os *OSClientV1) GetClusterReadStatus(ctx context.Context, db *api.Elasticsearch) error

func (*OSClientV1) GetClusterWriteStatus

func (os *OSClientV1) GetClusterWriteStatus(ctx context.Context, db *api.Elasticsearch) error

func (*OSClientV1) GetDBUserRole added in v0.0.8

func (os *OSClientV1) GetDBUserRole(ctx context.Context) (error, bool)

func (*OSClientV1) GetIndicesInfo

func (os *OSClientV1) GetIndicesInfo() ([]interface{}, error)

GetIndicesInfo will return the indices' info of an Elasticsearch database

func (*OSClientV1) GetTotalDiskUsage added in v0.0.6

func (os *OSClientV1) GetTotalDiskUsage(ctx context.Context) (string, error)

func (*OSClientV1) IndexExistsOrNot added in v0.0.8

func (os *OSClientV1) IndexExistsOrNot(index string) error

func (*OSClientV1) NodesStats

func (os *OSClientV1) NodesStats() (map[string]interface{}, error)

func (*OSClientV1) PutData added in v0.0.8

func (os *OSClientV1) PutData(index, id string, data map[string]interface{}) error

func (*OSClientV1) SyncCredentialFromSecret

func (os *OSClientV1) SyncCredentialFromSecret(secret *core.Secret) error

type OSClientV2 added in v0.0.6

type OSClientV2 struct {
	// contains filtered or unexported fields
}

func (*OSClientV2) ClusterHealthInfo added in v0.0.6

func (os *OSClientV2) ClusterHealthInfo() (map[string]interface{}, error)

func (*OSClientV2) ClusterStatus added in v0.0.6

func (os *OSClientV2) ClusterStatus() (string, error)

func (*OSClientV2) CountData added in v0.0.8

func (os *OSClientV2) CountData(index string) (int, error)

func (*OSClientV2) CreateDBUserRole added in v0.0.8

func (os *OSClientV2) CreateDBUserRole(ctx context.Context) error

func (*OSClientV2) CreateIndex added in v0.0.8

func (os *OSClientV2) CreateIndex(index string) error

func (*OSClientV2) DeleteIndex added in v0.0.8

func (os *OSClientV2) DeleteIndex(index string) error

func (*OSClientV2) GetClusterReadStatus added in v0.0.6

func (os *OSClientV2) GetClusterReadStatus(ctx context.Context, db *api.Elasticsearch) error

func (*OSClientV2) GetClusterWriteStatus added in v0.0.6

func (os *OSClientV2) GetClusterWriteStatus(ctx context.Context, db *api.Elasticsearch) error

func (*OSClientV2) GetDBUserRole added in v0.0.8

func (os *OSClientV2) GetDBUserRole(ctx context.Context) (error, bool)

func (*OSClientV2) GetIndicesInfo added in v0.0.6

func (os *OSClientV2) GetIndicesInfo() ([]interface{}, error)

GetIndicesInfo will return the indices' info of an Elasticsearch database

func (*OSClientV2) GetTotalDiskUsage added in v0.0.6

func (os *OSClientV2) GetTotalDiskUsage(ctx context.Context) (string, error)

func (*OSClientV2) IndexExistsOrNot added in v0.0.8

func (os *OSClientV2) IndexExistsOrNot(index string) error

func (*OSClientV2) NodesStats added in v0.0.6

func (os *OSClientV2) NodesStats() (map[string]interface{}, error)

func (*OSClientV2) PutData added in v0.0.8

func (os *OSClientV2) PutData(index, id string, data map[string]interface{}) error

func (*OSClientV2) SyncCredentialFromSecret added in v0.0.6

func (os *OSClientV2) SyncCredentialFromSecret(secret *core.Secret) error

type TransientMetaPrivileges added in v0.0.8

type TransientMetaPrivileges struct {
	Enabled bool `json:"enabled"`
}

type UserRoleReq added in v0.0.8

type UserRoleReq struct {
	Cluster           []string                `json:"cluster"`
	Indices           []DBPrivileges          `json:"indices"`
	Applications      []ApplicationPrivileges `json:"applications"`
	RunAs             []string                `json:"run_as"`
	TransientMetaData TransientMetaPrivileges `json:"transient_metadata"`
}

type WriteRequestIndex added in v0.0.3

type WriteRequestIndex struct {
	Index WriteRequestIndexBody `json:"index"`
}

type WriteRequestIndexBody added in v0.0.3

type WriteRequestIndexBody struct {
	ID   string `json:"_id"`
	Type string `json:"_type,omitempty"`
}

Jump to

Keyboard shortcuts

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