Documentation ¶
Index ¶
- func GetDocIdByControlIdAndProfileID(controlID string, profileID string) string
- func GetProfiles(profilesReport []relaxting.ESInSpecReportProfile) []relaxting.ProfileRunInfo
- func MapReportToRunInfo(report *relaxting.ESInSpecReport, runDateTime time.Time) relaxting.ESComplianceRunInfo
- type ESClient
- func (backend *ESClient) CancelProjectUpdateTask(ctx context.Context, projectUpdateID string, ...) error
- func (backend *ESClient) CheckIfControlIdANdNodeIdExistsForControlIndex(docId []string, indexWithDateAndTime string) (map[string]*relaxting.ControlNodesInfo, error)
- func (backend *ESClient) CheckIfControlIdExistsForToday(docId []string, indexToday string) (map[string]string, error)
- func (backend *ESClient) CreateTemplate(ctx context.Context, templateName string, mapping string)
- func (backend *ESClient) GetDocByReportUUId(ctx context.Context, reportUuid string, index string) (*relaxting.ESInSpecReport, error)
- func (backend *ESClient) GetProfilesMissingMetadata(profileIDs []string) (map[string]*relaxting.ESInspecProfile, error)
- func (backend *ESClient) GetReportsDailyLatestTrue(ctx context.Context, upgradeTime time.Time) (map[string]string, map[string]bool, error)
- func (backend *ESClient) InitializeStore(ctx context.Context)
- func (backend *ESClient) InsertComplianceRunInfo(ctx context.Context, report *relaxting.ESInSpecReport, runDateTime time.Time) error
- func (backend *ESClient) InsertComplianceRunInfoUpgrade(ctx context.Context, report *relaxting.ESInSpecReport, runDateTime time.Time) error
- func (backend *ESClient) InsertInspecProfile(ctx context.Context, data *relaxting.ESInspecProfile) error
- func (backend *ESClient) InsertInspecReport(ctx context.Context, id string, endTime time.Time, ...) error
- func (backend *ESClient) InsertInspecSummary(ctx context.Context, id string, endTime time.Time, ...) error
- func (backend *ESClient) JobCancel(ctx context.Context, jobID string) error
- func (backend *ESClient) JobStatus(ctx context.Context, jobID string) (project_update_lib.JobStatus, error)
- func (backend *ESClient) ListProjectUpdateTasks(ctx context.Context) ([]project_update_lib.SerializedProjectUpdateTask, error)
- func (backend *ESClient) MonitorProjectUpdateTask(ctx context.Context, projectUpdateID string, ...) (project_update_lib.SerializedProjectUpdateTaskStatus, error)
- func (backend *ESClient) ProfileExists(hash string) (bool, error)
- func (backend *ESClient) ProfilesMissing(allHashes []string) (missingHashes []string, err error)
- func (backend *ESClient) RunProjectUpdateTask(ctx context.Context, projectUpdateID string, params map[string]string, ...) (project_update_lib.SerializedProjectUpdateTaskID, ...)
- func (backend *ESClient) SetDailyLatestToFalseForControlIndex(nodeId string) *elastic.Script
- func (backend *ESClient) SetDayLatestToFalseForControlIndex(nodeId string) (*elastic.Script, string, error)
- func (backend *ESClient) SetNodesDayLatestFalseForUpgrade(ctx context.Context, nodeUuid string, endTime time.Time) error
- func (backend *ESClient) UpdateDayLatestToFalse(ctx context.Context, nodeId string, reportId string, index string, ...) error
- func (backend *ESClient) UpdateProjectTags(ctx context.Context, projectTaggingRules map[string]*authz.ProjectRules) ([]string, error)
- func (backend *ESClient) UpdateReportProjectsTags(ctx context.Context, projectTaggingRules map[string]*authz.ProjectRules) (string, error)
- func (backend *ESClient) UpdateReportProjectsTagsForIndex(ctx context.Context, index string, ...) (string, error)
- func (backend *ESClient) UpdateSummaryProjectsTags(ctx context.Context, projectTaggingRules map[string]*authz.ProjectRules) (string, error)
- func (backend *ESClient) UpdateSummaryProjectsTagsForIndex(ctx context.Context, index string, ...) (string, error)
- func (backend *ESClient) UploadDataToControlIndex(ctx context.Context, reportuuid string, controls []relaxting.Control, ...) error
- func (backend *ESClient) UploadDataToControlIndexForUpgrade(ctx context.Context, reportuuid string, controls []relaxting.Control, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 (*ESClient) CreateTemplate ¶
func (*ESClient) GetDocByReportUUId ¶
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 ¶
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 (*ESClient) InsertComplianceRunInfoUpgrade ¶
func (*ESClient) InsertInspecProfile ¶
func (*ESClient) InsertInspecReport ¶
func (*ESClient) InsertInspecSummary ¶
func (*ESClient) ListProjectUpdateTasks ¶
func (backend *ESClient) ListProjectUpdateTasks(ctx context.Context) ([]project_update_lib.SerializedProjectUpdateTask, error)
func (*ESClient) MonitorProjectUpdateTask ¶
func (backend *ESClient) MonitorProjectUpdateTask(ctx context.Context, projectUpdateID string, id project_update_lib.SerializedProjectUpdateTaskID) ( project_update_lib.SerializedProjectUpdateTaskStatus, error)
func (*ESClient) ProfileExists ¶
ProfileExists returns true if profile exists already in ES.. false if not
func (*ESClient) ProfilesMissing ¶
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 ¶
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 (*ESClient) UpdateReportProjectsTags ¶
func (*ESClient) UpdateReportProjectsTagsForIndex ¶
func (*ESClient) UpdateSummaryProjectsTags ¶
func (*ESClient) UpdateSummaryProjectsTagsForIndex ¶
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