elastic

package
v0.0.0-...-926d3c4 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

func New

func New(esURL string) (*Backend, error)

func (*Backend) CancelProjectUpdateTask

func (backend *Backend) CancelProjectUpdateTask(ctx context.Context, projectUpdateID string,
	id project_update_lib.SerializedProjectUpdateTaskID) error

func (*Backend) CreateAlias

func (es *Backend) CreateAlias(ctx context.Context, aliasName string, indexName string) error

func (*Backend) CreateBulkNodeAttributeUpdateRequest

func (es *Backend) CreateBulkNodeAttributeUpdateRequest(nodeAttr backend.NodeAttribute) elastic.BulkableRequest

func (*Backend) CreateBulkNodeRunInfoUpdateRequest

func (es *Backend) CreateBulkNodeRunInfoUpdateRequest(node backend.Run) elastic.BulkableRequest

func (*Backend) CreateBulkNodeUpdateRequest

func (es *Backend) CreateBulkNodeUpdateRequest(node backend.Node) elastic.BulkableRequest

func (*Backend) CreateBulkRunUpdateRequest

func (es *Backend) CreateBulkRunUpdateRequest(run backend.Run) elastic.BulkableRequest

func (*Backend) DeleteAllIndexesWithPrefix

func (es *Backend) DeleteAllIndexesWithPrefix(prefix string, ctx context.Context) error

func (*Backend) DeleteIndex

func (es *Backend) DeleteIndex(ctx context.Context, index string) error

DeleteIndex - delete index with name 'index'

func (*Backend) DeleteMarkedNodes

func (es *Backend) DeleteMarkedNodes(ctx context.Context, threshold string) (updateCount int, err error)

DeleteMarkedNodes will delete all the nodes from elasticsearch that no longer exists for the eyes of the config-mgmt-service. (that is, the nodes that has exists=false) The time constraint is the provided threshold

func (*Backend) DeleteNodeByFields

func (es *Backend) DeleteNodeByFields(ctx context.Context, orgName string, remoteHostname string, nodeName string) (int, error)

DeleteNodeByFields deletes a node from node state but it's org name, node name and source_fqdn

func (*Backend) DeleteNodeByID

func (es *Backend) DeleteNodeByID(ctx context.Context, nodeID string) (int, error)

DeleteNodeByID deletes a node from node-state by it's ID

func (*Backend) DeleteTemplate

func (es *Backend) DeleteTemplate(ctx context.Context, templateName string) error

DeleteTemplate - delete the template with name 'templateName' DELETE /_template/node-state

func (*Backend) DoesAliasExists

func (es *Backend) DoesAliasExists(ctx context.Context, aliasName string) bool

DoesAliasExists - does the alias 'aliasName' exists in elasticsearch

func (*Backend) DoesIndexExists

func (es *Backend) DoesIndexExists(ctx context.Context, indexName string) (bool, error)

DoesIndexExists - does the index 'indexName' exists in elasticsearch

func (*Backend) EmptyNodeLatestRunID

func (es *Backend) EmptyNodeLatestRunID(ctx context.Context, nodeEntityUUID string) error

EmptyNodeLatestRunID - Set the nodes latest Run ID to a empty string

func (*Backend) FindNodeIDByInstanceId

func (es *Backend) FindNodeIDByInstanceId(ctx context.Context, instanceId string) ([]string, error)

func (*Backend) FindNodeIDsByFields

func (es *Backend) FindNodeIDsByFields(ctx context.Context, filters map[string]string) ([]string, error)

func (*Backend) GetActions

func (es *Backend) GetActions(index string, pageSize int, cursorDate time.Time,
	cursorID string, next bool) ([]backend.InternalChefAction, int64, error)

func (*Backend) GetAllTimeseriesIndiceNames

func (es *Backend) GetAllTimeseriesIndiceNames(ctx context.Context, indexName string) ([]string, error)

GetAllTimeseriesIndiceNames - get all the indice names for the givin indexName tag. Example of indexName = converge-history, insights

func (*Backend) GetInsightsRunData

func (es *Backend) GetInsightsRunData(ctx context.Context, insightsIndex string, cursorID string) ([]backend.InsightsRunNodePayLoadData, error)

GetInsightsRunData -

func (*Backend) GetLatestA1NodeRun

func (es *Backend) GetLatestA1NodeRun(ctx context.Context,
	nodeEntityUUID string, a1IndexInsights string) (backend.InsightsRun, bool, error)

GetLatestA1NodeRun - get the newest A1 Node run from the insights index for the givin 'nodeEntityUUID'. Return InsightsRun - run data if found in elasticsearch bool if runs were found. Error trying to find runs

func (*Backend) GetNodeBasics

func (es *Backend) GetNodeBasics(ctx context.Context, cursorID string) ([]backend.NodeBasics, error)

GetNodeIds - Get the 100 node IDs & Checkin times after the cursorID. 'SearchAfter' is used because we can not pull all the nodes at once. If there where 10,000 nodes elasticsearch would not allow us to pull them all at once.

func (*Backend) GetNodeCount

func (es *Backend) GetNodeCount(ctx context.Context, indexName string) (int64, error)

GetNodeCount - count how many node-state documents are in an index

func (*Backend) InitializeStore

func (es *Backend) InitializeStore(ctx context.Context) error

InitializeStore runs the necessary initialization processes to make elasticsearch usable in particular it creates the indexes and aliases for documents to be added

func (*Backend) Initializing

func (es *Backend) Initializing() bool

func (*Backend) InsertNode

func (es *Backend) InsertNode(ctx context.Context, node backend.Node) error

InsertNode inserts the state of the node as a result of a Chef Client Run into node-state index

func (*Backend) InsertNodeAttribute

func (es *Backend) InsertNodeAttribute(ctx context.Context, nodeAttr backend.NodeAttribute) error

InsertNodeAttribute inserts the ohai attributes from a CCR into the node-attribute index

func (*Backend) InsertNodeRunDateInfo

func (es *Backend) InsertNodeRunDateInfo(ctx context.Context, nodeInfo backend.Run) error

func (*Backend) InsertRun

func (es *Backend) InsertRun(ctx context.Context, run backend.Run) error

InsertRun inserts a Chef Client Run into converge-history-YYYY.MM.DD index

func (*Backend) InsertUpsertNode

func (es *Backend) InsertUpsertNode(ctx context.Context, node backend.UpsertNode) error

InsertUpsertNode inserts the UpsertNode with the created date

func (*Backend) JobCancel

func (es *Backend) JobCancel(ctx context.Context, jobID string) error

func (*Backend) JobStatus

func (es *Backend) JobStatus(ctx context.Context, jobID string) (project_update_lib.JobStatus, error)

func (*Backend) ListProjectUpdateTasks

func (backend *Backend) ListProjectUpdateTasks(ctx context.Context) ([]project_update_lib.SerializedProjectUpdateTask, error)

func (*Backend) MarkForDeleteMultipleNodesByID

func (es *Backend) MarkForDeleteMultipleNodesByID(ctx context.Context, nodeIDs []string) (int, error)

MarkForDeleteMultipleNodesByID marks for delete multiple nodes by their IDs

func (*Backend) MarkMissingNodesForDeletion

func (es *Backend) MarkMissingNodesForDeletion(ctx context.Context, threshold string) ([]string, error)

MarkMissingNodesForDeletion will mark all the nodes that have been missing for over the specified threshold time as 'ready for deletion'. (that is, mark the node as exists=false)

func (*Backend) MarkNodesMissing

func (es *Backend) MarkNodesMissing(ctx context.Context, threshold string) ([]string, error)

MarkNodesMissing marks all nodes that have passed the specified threshold as 'missing'

func (*Backend) RecordLivenessPing

func (es *Backend) RecordLivenessPing(ctx context.Context, liveness backend.Liveness) error

func (*Backend) RefreshIndex

func (es *Backend) RefreshIndex(ctx context.Context, indexName string) error

func (*Backend) ReindexInsightstoActions

func (es *Backend) ReindexInsightstoActions(ctx context.Context,
	insightsIndexName string, actionsIndexName string) error

ReindexInsightstoActions -reindex the A1 insights indexes to the actions indexes Below is a link to how the actions were created in A1 https://github.com/chef/automate/blob/master/logstash/config/10-action-filter.conf

func (*Backend) ReindexInsightstoConvergeHistory

func (es *Backend) ReindexInsightstoConvergeHistory(ctx context.Context, insightsIndexName string, convergeHistoryIndexName string) error

ReindexInsightstoConvergeHistory - reindex the A1 insights indexes to the converge-history indexes

TODO: Still need to add the VersionedCookbooks to each run.

func (*Backend) ReindexNodeStateA1

func (es *Backend) ReindexNodeStateA1(ctx context.Context, a1NodeStateIndexName string) error

ReindexNodeStateA1 - reindex the A1 node-state index to the current node-state index

func (*Backend) ReindexNodeStateToLatest

func (es *Backend) ReindexNodeStateToLatest(ctx context.Context, previousIndex string) (string, error)

func (*Backend) RemoveAlias

func (es *Backend) RemoveAlias(ctx context.Context, aliasName string, indexName string) error

RemoveAlias - remove an alias from the index named 'indexName'

func (*Backend) RunProjectUpdateTask

func (backend *Backend) RunProjectUpdateTask(ctx context.Context, projectUpdateID string,
	params map[string]string, projectTaggingRules map[string]*authz.ProjectRules) (
	project_update_lib.SerializedProjectUpdateTaskID,
	project_update_lib.SerializedProjectUpdateTaskStatus,
	error)

func (*Backend) SendBulkRequest

func (es *Backend) SendBulkRequest(ctx context.Context, bulkUpdateRequests []elastic.BulkableRequest) error

func (*Backend) UpdateNode

func (es *Backend) UpdateNode(ctx context.Context, nodeEntityUUID string, insightsRun backend.InsightsRun,
	versionedCookbooks []backend.VersionedCookbook) error

UpdateNode - Update a node-state doc with the givin data.

func (*Backend) UpdateNodeProjectTags

func (es *Backend) UpdateNodeProjectTags(ctx context.Context, projectTaggingRules map[string]*authz.ProjectRules) (string, error)

UpdateNodeProjectTags - update project tagging with all the rules

All the conditions must be true for a rule to be true (ANDed together). Only one rule has to be true for the project to match (ORed together). If there are no rules the project does not match If the rule does not have any conditions it does not match any resources.

func (*Backend) UpdateProjectTags

func (es *Backend) UpdateProjectTags(ctx context.Context, projectTaggingRules map[string]*authz.ProjectRules) ([]string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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