ingestic

package
v0.0.0-...-a8b8e24 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: 15 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDocIdByControlIdAndProfileID

func GetDocIdByControlIdAndProfileID(controlID string, profileID string) string

func GetProfiles

func GetProfiles(profilesReport []relaxting.ESInSpecReportProfile) []relaxting.ProfileRunInfo

func MapReportToRunInfo

func MapReportToRunInfo(report *relaxting.ESInSpecReport, runDateTime time.Time) relaxting.ESComplianceRunInfo

Types

type ESClient

type ESClient struct {
	Conf config.Compliance
	// contains filtered or unexported fields
}

func NewESClient

func NewESClient(client *elastic.Client, conf config.Compliance) *ESClient

NewESClient returns new search client.

func (*ESClient) CancelProjectUpdateTask

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

func (*ESClient) CheckIfControlIdANdNodeIdExistsForControlIndex

func (backend *ESClient) CheckIfControlIdANdNodeIdExistsForControlIndex(docId []string, indexWithDateAndTime string) (map[string]*relaxting.ControlNodesInfo, error)

CheckIfControlIdExistsForControlIndex gets a control document from comp-1-control-* for upgrade process

func (*ESClient) CheckIfControlIdExistsForToday

func (backend *ESClient) CheckIfControlIdExistsForToday(docId []string, indexToday string) (map[string]string, error)

func (*ESClient) CreateTemplate

func (backend *ESClient) CreateTemplate(ctx context.Context, templateName string, mapping string)

func (*ESClient) GetDocByReportUUId

func (backend *ESClient) GetDocByReportUUId(ctx context.Context, reportUuid string, index string) (*relaxting.ESInSpecReport, error)

func (*ESClient) GetProfilesMissingMetadata

func (backend *ESClient) GetProfilesMissingMetadata(profileIDs []string) (map[string]*relaxting.ESInspecProfile, error)

Internal helper method to get profile meta information to complement reports being ingested without profile metadata information

func (*ESClient) GetReportsDailyLatestTrue

func (backend *ESClient) GetReportsDailyLatestTrue(ctx context.Context, upgradeTime time.Time) (map[string]string, map[string]bool, error)

GetReportsDailyLatestTrue Get the Nodes where daily latest flag is true from past 90 days from current date for upgrading

func (*ESClient) InitializeStore

func (backend *ESClient) InitializeStore(ctx context.Context)

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

func (*ESClient) InsertComplianceRunInfo

func (backend *ESClient) InsertComplianceRunInfo(ctx context.Context, report *relaxting.ESInSpecReport, runDateTime time.Time) error

func (*ESClient) InsertComplianceRunInfoUpgrade

func (backend *ESClient) InsertComplianceRunInfoUpgrade(ctx context.Context, report *relaxting.ESInSpecReport, runDateTime time.Time) error

func (*ESClient) InsertInspecProfile

func (backend *ESClient) InsertInspecProfile(ctx context.Context, data *relaxting.ESInspecProfile) error

func (*ESClient) InsertInspecReport

func (backend *ESClient) InsertInspecReport(ctx context.Context, id string, endTime time.Time, data *relaxting.ESInSpecReport) error

func (*ESClient) InsertInspecSummary

func (backend *ESClient) InsertInspecSummary(ctx context.Context, id string, endTime time.Time, data *relaxting.ESInSpecSummary) error

func (*ESClient) JobCancel

func (backend *ESClient) JobCancel(ctx context.Context, jobID string) error

func (*ESClient) JobStatus

func (backend *ESClient) JobStatus(ctx context.Context, jobID string) (project_update_lib.JobStatus, error)

func (*ESClient) ListProjectUpdateTasks

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

func (*ESClient) ProfileExists

func (backend *ESClient) ProfileExists(hash string) (bool, error)

ProfileExists returns true if profile exists already in ES.. false if not

func (*ESClient) ProfilesMissing

func (backend *ESClient) ProfilesMissing(allHashes []string) (missingHashes []string, err error)

ProfilesMissing takes an array of profile sha256 IDs and returns back the ones that are missing from the profiles metadata index

func (*ESClient) RunProjectUpdateTask

func (backend *ESClient) 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 (*ESClient) SetDailyLatestToFalseForControlIndex

func (backend *ESClient) SetDailyLatestToFalseForControlIndex(nodeId string) *elastic.Script

Sets the 'daily_latest' fields to 'false' for new control index This targets only one ES UTC index

func (*ESClient) SetDayLatestToFalseForControlIndex

func (backend *ESClient) SetDayLatestToFalseForControlIndex(nodeId string) (*elastic.Script, string, error)

Sets the 'day_latest' field to 'false' for all control index This way, the last 90 days is covered

func (*ESClient) SetNodesDayLatestFalseForUpgrade

func (backend *ESClient) SetNodesDayLatestFalseForUpgrade(ctx context.Context, nodeUuid string, endTime time.Time) error

SetNodesDayLatestFalse Sets the flag for the currently present data in os database

func (*ESClient) UpdateDayLatestToFalse

func (backend *ESClient) UpdateDayLatestToFalse(ctx context.Context, nodeId string, reportId string, index string, mapping mappings.Mapping, useSummaryIndex bool) error

Sets the 'day_latest' field to 'false' for all reports (except <reportId>) of node <nodeId> from yesterday upto 90 days UTC index.

func (*ESClient) UpdateProjectTags

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

func (*ESClient) UpdateReportProjectsTags

func (backend *ESClient) UpdateReportProjectsTags(ctx context.Context, projectTaggingRules map[string]*authz.ProjectRules) (string, error)

func (*ESClient) UpdateReportProjectsTagsForIndex

func (backend *ESClient) UpdateReportProjectsTagsForIndex(ctx context.Context, index string, projectTaggingRules map[string]*authz.ProjectRules) (string, error)

func (*ESClient) UpdateSummaryProjectsTags

func (backend *ESClient) UpdateSummaryProjectsTags(ctx context.Context, projectTaggingRules map[string]*authz.ProjectRules) (string, error)

func (*ESClient) UpdateSummaryProjectsTagsForIndex

func (backend *ESClient) UpdateSummaryProjectsTagsForIndex(ctx context.Context, index string, projectTaggingRules map[string]*authz.ProjectRules) (string, error)

func (*ESClient) UploadDataToControlIndex

func (backend *ESClient) UploadDataToControlIndex(ctx context.Context, reportuuid string, controls []relaxting.Control, endTime time.Time, docIds []string) error

UploadDataToControlIndex Uploades the data to new control index with comp-1-control-*

func (*ESClient) UploadDataToControlIndexForUpgrade

func (backend *ESClient) UploadDataToControlIndexForUpgrade(ctx context.Context, reportuuid string, controls []relaxting.Control, endTime time.Time, statusMap map[string]*relaxting.ControlNodesInfo) error

UploadDataToControlIndexForUpgrade Uploades the data to new control index with comp-1-control-* in the upgrade process Different from UploadDataToControlIndex as it pre-checks if the node exists already or not

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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