relaxting

package
v0.0.0-...-d983439 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 38 Imported by: 13

Documentation

Index

Constants

View Source
const (
	WholeCalMonthBadDateRangeErrMsg   string = "" /* 147-byte string literal not displayed */
	StartDateGreaterThanEndDateErrMsg string = "bad date range. end date must be greater than or equal to start date"
	RestOfDaysDiffMonthOrYearErrMsg   string = "restOfDays only computes indices within the same month. spanning months not supported"
	TimeParseError                    string = "could not parse %s error: %s.  please check format of date"
	CompDailySumIndexPrefix           string = mappings.IndexNameSum + "-"
	CompDailyRepIndexPrefix           string = mappings.IndexNameRep + "-"
	CompDailyControlIndexPrefix       string = mappings.IndexNameControl + "-"
	ComplianceDailySumTwenty          string = CompDailySumIndexPrefix + "20*"
	ComplianceDailyRepTwenty          string = CompDailyRepIndexPrefix + "20*"
	CompProfilesIndex                 string = mappings.IndexNameProf
	CompRunInfoIndex                  string = mappings.IndexNameComplianceRunInfo
)
View Source
const (
	InvalidLevel = iota - 1
	ReportLevel
	ProfileLevel
	ControlLevel
)
View Source
const MaxScrollRecordSize = 10000

Variables

View Source
var NowFunc nowFuncT

Functions

func BulkInsertComplianceReportDocs

func BulkInsertComplianceReportDocs(client *elastic.Client, ctx context.Context, index string, docsArray []*ESInSpecReport) error

func BulkInsertComplianceSummaryDocs

func BulkInsertComplianceSummaryDocs(client *elastic.Client, ctx context.Context, index string, docsArray []*ESInSpecSummary) error

func FetchLatestDataOrNot

func FetchLatestDataOrNot(filters map[string][]string) bool

func FilterByProjects

func FilterByProjects(ctx context.Context, filters map[string][]string) (map[string][]string, error)

func GetEsIndex

func GetEsIndex(filters map[string][]string, useSummaryIndex bool) (esIndex string, err error)

GetEsIndex returns the index(s) to query based on the end_time filter A good reason would be when you pass a job_id and you don't know when it ran so you want to search all indices

func GetFilterDepth

func GetFilterDepth(filters map[string][]string) int

func GetMaxInnerResultWindow

func GetMaxInnerResultWindow(backend ES2Backend) (int64, error)

func IndexDates

func IndexDates(prefix string, startTimeAsStringRFC3339 string, endTimeAsStringRFC3339 string) (indices string, err error)

IndexDates takes a start time and end time, both as strings, formatted as RFC3339 UTC, and returns a comma separated list of strings, each of which is an ES index wildcard.

func LogQueryPartMin

func LogQueryPartMin(indices string, partToPrint interface{}, name string)

func MapKeys

func MapKeys(m map[string]string) []string

MapKeys returns the keys of a map as an array

func MapValues

func MapValues(m map[string]string) []string

MapValues returns the values of a map as an array

func Remove

func Remove(arr *[]string, i int)

Removes element with index i from array arr

func ReportComplianceStatus

func ReportComplianceStatus(summary *reportingTypes.NodeControlSummary) (status string)

ReportComplianceStatus returns the overall compliance status of a report based on the passed/failed/skipped control counts

func ResetClockImplementation

func ResetClockImplementation()

func RunMigrations

func RunMigrations(backend ES2Backend, statusSrv *statusserver.Server) error

func SetMaxInnerResultWindow

func SetMaxInnerResultWindow(backend ES2Backend) error

func StoreExists

func StoreExists(client *elastic.Client, indexName string) (bool, error)

func ValidateTimeRangeForFilters

func ValidateTimeRangeForFilters(startTime string, endTime string) error

Types

type A1ElasticSearchIndices

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

type A2V1ElasticSearchIndices

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

type A2V2CompRunIndices

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

type A2V2ElasticSearchIndices

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

type A2V3ElasticSearchIndices

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

type A2V4ElasticSearchIndices

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

type A2V5ElasticSearchIndices

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

type A2V6ElasticSearchIndices

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

type AggregatedComplianceSummary

type AggregatedComplianceSummary struct {
	Failures  int `json:"failures"`
	Majors    int `json:"majors"`
	Minors    int `json:"minors"`
	Criticals int `json:"criticals"`
	Passed    int `json:"passed"`
	Skipped   int `json:"skipped"`
}

type AggregatedComplianceSummaryA2v2

type AggregatedComplianceSummaryA2v2 struct {
	Failures  int `json:"failures"`
	Majors    int `json:"majors"`
	Minors    int `json:"minors"`
	Criticals int `json:"criticals"`
	Passed    int `json:"passed"`
	Skipped   int `json:"skipped"`
}

type AssetSummary

type AssetSummary struct {
	Passed  int32 `json:"passed"`
	Skipped int32 `json:"skipped"`
	Failed  int32 `json:"failed"`
	Waived  int32 `json:"waived"`
}

type Control

type Control struct {
	ControlID   string                            `json:"control_id"`
	Title       string                            `json:"title"`
	WaivedStr   string                            `json:"waived_str"`
	WaiverData  interface{}                       `json:"waiver_data"`
	Impact      float64                           `json:"impact"`
	EndTime     time.Time                         `json:"end_time"`
	DailyLatest bool                              `json:"daily_latest"`
	DayLatest   bool                              `json:"day_latest"`
	Status      string                            `json:"status"`
	Nodes       []Node                            `json:"nodes"`
	StringTags  []ESInSpecReportControlStringTags `json:"string_tags"`
	Profile     Profile                           `json:"profile"`
}

type ControlDepth

type ControlDepth struct {
	*QueryInfo
}

type ControlMeta

type ControlMeta struct {
	Name   string
	Title  string
	Impact float32
}

ControlMeta is for getting extra info from inspec_profiles needed for report 8

type ControlMetaA2v2

type ControlMetaA2v2 struct {
	Name   string
	Title  string
	Impact float32
}

ControlMeta is for getting extra info from inspec_profiles needed for report 8

type ControlNodesInfo

type ControlNodesInfo struct {
	Status string             `json:"status"`
	Nodes  []NodesControlInfo `json:"nodes"`
}

type ControlRunInfo

type ControlRunInfo struct {
	ID          string                            `json:"id"`
	ControlTags []ESInSpecReportControlStringTags `json:"control_tags"`
}

type ControlSource

type ControlSource struct {
	ID        string  `json:"id"`
	Impact    float32 `json:"impact"`
	Status    string  `json:"status"`
	WaivedStr string  `json:"waived_str"`
}

type ControlStatSummary

type ControlStatSummary struct {
	Name     string `json:"name"`
	Profile  string `json:"profile"`
	Failures int    `json:"failures"`
}

type ControlStatSummaryA2v2

type ControlStatSummaryA2v2 struct {
	Name     string `json:"name"`
	Profile  string `json:"profile"`
	Failures int    `json:"failures"`
}

type ControlStats

type ControlStats struct {
	Control string  `json:"control"`
	Title   string  `json:"title"`
	Passed  int     `json:"passed"`
	Failed  int     `json:"failed"`
	Skipped int     `json:"skipped"`
	Impact  float32 `json:"impact"`
}

type ControlStatsA2v2

type ControlStatsA2v2 struct {
	Control string  `json:"control"`
	Title   string  `json:"title"`
	Passed  int     `json:"passed"`
	Failed  int     `json:"failed"`
	Skipped int     `json:"skipped"`
	Impact  float32 `json:"impact"`
}

type DateRange

type DateRange struct {
	StartTime time.Time
	EndTime   time.Time
}

type Depends

type Depends struct {
	Name        string `json:"name"`
	Path        string `json:"path"`
	Status      string `json:"status"`
	SkipMessage string `json:"skip_message"`
}

type DependsA2v2

type DependsA2v2 struct {
	Name        string `json:"name"`
	Path        string `json:"path"`
	Status      string `json:"status"`
	SkipMessage string `json:"skip_message"`
}

type Depth

type Depth interface {
	// contains filtered or unexported methods
}

type ES2Backend

type ES2Backend struct {
	ESUrl                      string
	Enterprise                 string
	ChefDeliveryUser           string
	ChefDeliveryToken          string
	PGdb                       *pgdb.DB
	IsEnhancedReportingEnabled bool
}

func (*ES2Backend) ES2Client

func (backend *ES2Backend) ES2Client() (*elastic.Client, error)

func (*ES2Backend) GetAllProfilesFromNodes

func (backend *ES2Backend) GetAllProfilesFromNodes(from int32, size int32, filters map[string][]string, sort_field string,
	sort_asc bool) ([]*reportingapi.ProfileMin, *reportingapi.ProfileCounts, error)

TODO: header with amount of results GetAllProfilesFromNodes - list all of the profiles from scan data

func (ES2Backend) GetAsset

func (backend ES2Backend) GetAsset(ctx context.Context, filters map[string][]string, size int32, from int32, assetsType string) ([]*reportingapi.Assets, error)

func (ES2Backend) GetAssetSummary

func (backend ES2Backend) GetAssetSummary(ctx context.Context, filters map[string][]string) (*reportingapi.AssetSummary, error)

func (ES2Backend) GetConfigs

func (backend ES2Backend) GetConfigs(ctx context.Context) (int, error)

func (*ES2Backend) GetControlListItems

func (backend *ES2Backend) GetControlListItems(ctx context.Context, filters map[string][]string,
	size int32, pageNumber int32) (*reportingapi.ControlItems, error)

func (*ES2Backend) GetControlListItemsRange

func (backend *ES2Backend) GetControlListItemsRange(ctx context.Context, filters map[string][]string,
	size int32, pageNumber int32) (*reportingapi.ControlItems, error)

func (ES2Backend) GetControlListStatsByProfileID

func (backend ES2Backend) GetControlListStatsByProfileID(profileID string, from int, size int,
	filters map[string][]string, sortField string, sortAsc bool) ([]*stats.ControlStats, error)

GetControlListStatsByProfileID returns the control list for a given profile or profile and a child control the data retrieved from this appears at the bottom of the a2 page when you select a profile from list

func (*ES2Backend) GetNode

func (backend *ES2Backend) GetNode(nodeUuid string, filters map[string][]string) (*reportingapi.Node, error)

func (*ES2Backend) GetNodeControlListItems

func (backend *ES2Backend) GetNodeControlListItems(ctx context.Context, filters map[string][]string, reportID string) (*reportingapi.ControlElements, error)

GetNodeControlListItems returns the paginated control list response.

func (*ES2Backend) GetNodeInfoFromReportID

func (backend *ES2Backend) GetNodeInfoFromReportID(reportId string, filters map[string][]string) (*reportingapi.NodeHeaderInfo, error)

GetNodeInfoFromReportID returns report header information of a single report

func (*ES2Backend) GetNodes

func (backend *ES2Backend) GetNodes(from int32, size int32, filters map[string][]string,
	sortField string, sortAsc bool) ([]*reportingapi.Node, TotalNodeCounts, error)

TODO: header with amount of results TODO: need to be able to sort on

"latest_report.controls.failed.total":    "controls_sums.failed.total",
"latest_report.controls.failed.critical": "controls_sums.failed.critical"

GetNodes - list all of the nodes or all nodes for a profile-id

func (*ES2Backend) GetProfile

func (backend *ES2Backend) GetProfile(hash string) (reportingapi.Profile, error)

internal helper method to get profile information

func (ES2Backend) GetProfileListWithAggregatedComplianceSummaries

func (backend ES2Backend) GetProfileListWithAggregatedComplianceSummaries(
	filters map[string][]string, size int32) ([]*stats.ProfileList, error)

GetProfileListWithAggregatedComplianceSummaries - Report #6 todo - Where in A2 UI is this being called? It now works with deep filtering but not sure if we need it.

func (ES2Backend) GetProfileSummaryByProfileId

func (backend ES2Backend) GetProfileSummaryByProfileId(profileId string, filters map[string][]string) (*stats.ProfileSummary, error)

GetProfileSummaryByProfileId across nodes - report 8 - top this is the summary that appears at the top of the page when you select a profile from profiles list at the moment this one does not immediately need to be deep aware as the only things that are used from it in a2 api are version, maintainer and license todo - deep filtering - this should be made depth aware as this still needs to be consumed by api users todo - do we need to handle waiver info in here too?

func (*ES2Backend) GetReport

func (backend *ES2Backend) GetReport(reportId string, filters map[string][]string) (*reportingapi.Report, error)

GetReport returns the information about a single report

func (ES2Backend) GetReportIds

func (backend ES2Backend) GetReportIds(esIndex string, filters map[string][]string) (*reportingapi.ReportIds, error)

func (*ES2Backend) GetReportManagerRequest

func (backend *ES2Backend) GetReportManagerRequest(reportId string, filters map[string][]string) (*reportingapi.ReportResponse, error)

GetReportManagerRequest takes report id and filters to populate the report manager request

func (*ES2Backend) GetReports

func (backend *ES2Backend) GetReports(from int32, size int32, filters map[string][]string,
	sortField string, sortAsc bool) ([]*reportingapi.ReportSummaryLevelOne, int64, error)

GetReports returns all reports in a given timeframe TODO: support timeframe and pagination

func (ES2Backend) GetStatsFailures

func (backend ES2Backend) GetStatsFailures(reportTypes []string, size int, filters map[string][]string) (*stats.Failures, error)

GetStatsFailures - Gets top failures, aggregate data for the given set of filters

func (ES2Backend) GetStatsSummary

func (backend ES2Backend) GetStatsSummary(filters map[string][]string) (*stats.ReportSummary, error)

GetStatsSummary - Report #16

func (ES2Backend) GetStatsSummaryControls

func (backend ES2Backend) GetStatsSummaryControls(filters map[string][]string) (*stats.ControlsSummary, error)

GetStatsSummaryControls - Gets summary stats, control centric, aggregate data for the given set of filters

func (ES2Backend) GetStatsSummaryControlsRange

func (backend ES2Backend) GetStatsSummaryControlsRange(filters map[string][]string) (*stats.ControlsSummary, error)

GetStatsSummaryControlsRange - Gets summary stats, control centric, aggregate data for the given set of filters with date range

func (ES2Backend) GetStatsSummaryNodes

func (backend ES2Backend) GetStatsSummaryNodes(filters map[string][]string) (*stats.NodeSummary, error)

GetStatsSummaryNodes - Gets summary stats, node centric, aggregate data for the given set of filters

func (ES2Backend) GetSuggestions

func (backend ES2Backend) GetSuggestions(ctx context.Context, typeParam string, filters map[string][]string, text string, size32 int32, typeParamKey string) ([]*reportingapi.Suggestion, error)

GetSuggestions - Report #12

func (ES2Backend) GetTrend

func (backend ES2Backend) GetTrend(filters map[string][]string, interval int, trendType string) ([]*stats.Trend, error)

GetTrend get either a nodes or controls trend graph

func (ES2Backend) GetUniqueNodesCount

func (backend ES2Backend) GetUniqueNodesCount(daysSinceLastPost int64, lastTelemetryReportedAt time.Time) (int64, error)

GetUniqueNodesCount: Get the unique nodes count based on the lastTelemetryReportedAt

func (ES2Backend) GetUnreachable

func (backend ES2Backend) GetUnreachable(ctx context.Context, filters map[string][]string) (int32, error)

func (ES2Backend) NewDepth

func (backend ES2Backend) NewDepth(filters map[string][]string, latestOnly bool) (Depth, error)

func (*ES2Backend) ReindexStatus

func (backend *ES2Backend) ReindexStatus(ctx context.Context, taskID string) (bool, error)

func (ES2Backend) StoreProfile

func (backend ES2Backend) StoreProfile(profile inspec.Profile) error

StoreProfile stores an InSpec profile to ES

type ESComplianceRunInfo

type ESComplianceRunInfo struct {
	NodeID       string    `json:"node_uuid"`
	ResourceId   string    `json:""`
	ResourceType string    `json:""`
	Status       string    `json:"status"`
	FirstRun     time.Time `json:"first_run"`
	LastRun      time.Time `json:"last_run"`
	Platform     struct {
		Name    string `json:"name"`
		Release string `json:"release"`
		Full    string `json:"full"`
	} `json:"platform_version"`
	ChefServer    string           `json:"chef_server"`
	Organization  string           `json:"organization"`
	InspecVersion string           `json:"version"`
	PolicyName    string           `json:"policy_name"`
	Profiles      []ProfileRunInfo `json:"profiles"`
	Recipe        []string         `json:"recipes"`
	Role          []string         `json:"roles"`
	ChefTags      []string         `json:"chef_tags"`
	Environment   string           `json:"environment"`
	PolicyGroup   string           `json:"policy_group"`
}

type ESInSpecReport

type ESInSpecReport struct {
	ID            string    `json:"_id,omitempty"`
	InSpecVersion string    `json:"version"`
	NodeID        string    `json:"node_uuid"`
	ReportID      string    `json:"report_uuid"`
	DailyLatest   bool      `json:"daily_latest"`
	DayLatest     bool      `json:"day_latest"`
	NodeName      string    `json:"node_name"`
	Environment   string    `json:"environment"`
	EndTime       time.Time `json:"end_time"`
	Status        string    `json:"status"`
	StatusMessage string    `json:"status_message"`
	JobID         string    `json:"job_uuid"`
	Roles         []string  `json:"roles"`
	Recipes       []string  `json:"recipes"`
	Platform      struct {
		Name    string `json:"name"`
		Release string `json:"release"`
		Full    string `json:"full"`
	} `json:"platform"`
	ControlsSums reporting.NodeControlSummary `json:"controls_sums"`
	Profiles     []ESInSpecReportProfile      `json:"profiles"`
	Statistics   struct {
		Duration float32 `json:"duration"`
	} `json:"statistics"`
	DocVersion       string   `json:"doc_version"`
	ESTimestamp      string   `json:"@timestamp"`
	Projects         []string `json:"projects"`
	PolicyName       string   `json:"policy_name"`
	PolicyGroup      string   `json:"policy_group"`
	OrganizationName string   `json:"organization_name"`
	SourceFQDN       string   `json:"source_fqdn"`
	ChefTags         []string `json:"chef_tags"`
	// Elastic won't accept empty string for a field of data type 'ip'. Defining IPAddress
	// as pointer so we can assign null to it when we get a report without an IP
	IPAddress    *string `json:"ipaddress"`
	FQDN         string  `json:"fqdn"`
	RunTimeLimit float32 `json:"run_time_limit"`
}

Used to unmarshal report documents stored in comp-r-* ElasticSearch indices

type ESInSpecReportA2v2

type ESInSpecReportA2v2 struct {
	ID            string    `json:"_id,omitempty"`
	InSpecVersion string    `json:"version"`
	NodeID        string    `json:"node_uuid"`
	ReportID      string    `json:"report_uuid"`
	DailyLatest   bool      `json:"daily_latest"`
	NodeName      string    `json:"node_name"`
	Environment   string    `json:"environment"`
	EndTime       time.Time `json:"end_time"`
	Status        string    `json:"status"`
	JobID         string    `json:"job_uuid"`
	Roles         []string  `json:"roles"`
	Recipes       []string  `json:"recipes"`
	Platform      struct {
		Name    string `json:"name"`
		Release string `json:"release"`
	} `json:"platform"`
	Controls    NodeControlSummaryA2v2      `json:"controls"`
	ProfilesMin []ESInSpecReportMinA2v2     `json:"profiles_min"`
	Profiles    []ESInSpecReportProfileA2v2 `json:"profiles"`
	Statistics  struct {
		Duration float32 `json:"duration"`
	} `json:"statistics"`
	DocVersion  string `json:"doc_version"`
	ESTimestamp string `json:"@timestamp"`
}

Main type for the report documents used in the timeseries

type ESInSpecReportControl

type ESInSpecReportControl struct {
	ID                   string                                     `json:"id"`
	Impact               float32                                    `json:"impact"`
	Title                string                                     `json:"title"`
	Status               string                                     `json:"status"`
	Results              []*ESInSpecReportControlsResult            `json:"results"`
	WaiverData           *ESInSpecReportControlsWaiverData          `json:"waiver_data"`
	WaivedStr            string                                     `json:"waived_str"`
	Tags                 string                                     `json:"tags"`
	StringTags           []ESInSpecReportControlStringTags          `json:"string_tags"`
	Refs                 []ESInSpecReportControlRefs                `json:"refs"`
	RemovedResultsCounts *ESInSpecReportControlRemovedResultsCounts `json:"removed_results_counts"`
}

type ESInSpecReportControlA2v2

type ESInSpecReportControlA2v2 struct {
	ID      string                              `json:"id"`
	Impact  float32                             `json:"impact"`
	Title   string                              `json:"title"`
	Status  string                              `json:"status"`
	Results []*ESInSpecReportControlsResultA2v2 `json:"results"`
	Tags    string                              `json:"tags"`
}

type ESInSpecReportControlRefs

type ESInSpecReportControlRefs struct {
	Ref string `json:"ref"`
	Url string `json:"url"`
}

type ESInSpecReportControlRemovedResultsCounts

type ESInSpecReportControlRemovedResultsCounts struct {
	Failed  int `json:"failed"`
	Skipped int `json:"skipped"`
	Passed  int `json:"passed"`
}

type ESInSpecReportControlStringTags

type ESInSpecReportControlStringTags struct {
	Key    string   `json:"key"`
	Values []string `json:"values"`
}

func StringTagsFromProtoFields

func StringTagsFromProtoFields(tKey string, tValue *structpb.Value) *ESInSpecReportControlStringTags

StringTagsFromProtoFields extracts tags supported from generic protobuf struct

type ESInSpecReportControlsResult

type ESInSpecReportControlsResult struct {
	Status      string  `json:"status"`
	CodeDesc    string  `json:"code_desc"`
	RunTime     float32 `json:"run_time"`
	StartTime   string  `json:"start_time,omitempty"`
	Message     string  `json:"message,omitempty"`
	SkipMessage string  `json:"skip_message,omitempty"`
	ResourceId  string  `json:"resource_id"`
}

type ESInSpecReportControlsResultA2v2

type ESInSpecReportControlsResultA2v2 struct {
	Status      string  `json:"status"`
	CodeDesc    string  `json:"code_desc"`
	RunTime     float32 `json:"run_time"`
	StartTime   string  `json:"start_time,omitempty"`
	Message     string  `json:"message,omitempty"`
	SkipMessage string  `json:"skip_message,omitempty"`
}

type ESInSpecReportControlsWaiverData

type ESInSpecReportControlsWaiverData struct {
	ExpirationDate     string `json:"expiration_date"`
	Justification      string `json:"justification"`
	Run                bool   `json:"run"`
	SkippedDueToWaiver bool   `json:"skipped_due_to_waiver"`
	Message            string `json:"message"`
}

type ESInSpecReportDepends

type ESInSpecReportDepends struct {
	Name        string `json:"name"`
	Status      string `json:"status"`
	SkipMessage string `json:"skip_message"`
}

type ESInSpecReportDependsA2v2

type ESInSpecReportDependsA2v2 struct {
	Name        string `json:"name"`
	Status      string `json:"status"`
	SkipMessage string `json:"skip_message"`
}

type ESInSpecReportMinA2v2

type ESInSpecReportMinA2v2 struct {
	Name        string                      `json:"name"`
	Version     string                      `json:"version"`
	Namespace   string                      `json:"namespace,omitempty"`
	SHA256      string                      `json:"sha256"`
	Controls    []ESInSpecReportControlA2v2 `json:"controls"`
	Depends     []ESInSpecReportDependsA2v2 `json:"depends"`
	Status      string                      `json:"status"`
	SkipMessage string                      `json:"skip_message"`
}

type ESInSpecReportProfile

type ESInSpecReportProfile struct {
	Name          string                       `json:"name"`
	Title         string                       `json:"title"`
	Profile       string                       `json:"profile"`
	Full          string                       `json:"full"`
	Version       string                       `json:"version"`
	Namespace     string                       `json:"namespace,omitempty"`
	SHA256        string                       `json:"sha256"`
	Controls      []ESInSpecReportControl      `json:"controls"`
	ControlsSums  reporting.NodeControlSummary `json:"controls_sums"`
	Depends       []ESInSpecReportDepends      `json:"depends"`
	Status        string                       `json:"status"`
	SkipMessage   string                       `json:"skip_message"`
	StatusMessage string                       `json:"status_message"`
}

type ESInSpecReportProfileA2v2

type ESInSpecReportProfileA2v2 struct {
	Name        string                      `json:"name"`
	Title       string                      `json:"title"`
	Profile     string                      `json:"profile"`
	Version     string                      `json:"version"`
	Namespace   string                      `json:"namespace,omitempty"`
	SHA256      string                      `json:"sha256"`
	Controls    []ESInSpecReportControlA2v2 `json:"controls"`
	Depends     []ESInSpecReportDependsA2v2 `json:"depends"`
	Status      string                      `json:"status"`
	SkipMessage string                      `json:"skip_message"`
}

type ESInSpecSummary

type ESInSpecSummary struct {
	NodeID        string    `json:"node_uuid"`
	InSpecVersion string    `json:"version"`
	ReportID      string    `json:"report_uuid"`
	DailyLatest   bool      `json:"daily_latest"`
	DayLatest     bool      `json:"day_latest"`
	NodeName      string    `json:"node_name"`
	Environment   string    `json:"environment"`
	EndTime       time.Time `json:"end_time"`
	Status        string    `json:"status"`
	StatusMessage string    `json:"status_message"`
	JobID         string    `json:"job_uuid"`
	Roles         []string  `json:"roles"`
	Recipes       []string  `json:"recipes"`
	Platform      struct {
		Name    string `json:"name"`
		Release string `json:"release"`
		Full    string `json:"full"`
	} `json:"platform"`
	ControlsSums reporting.NodeControlSummary `json:"controls_sums"`
	Profiles     []ESInSpecSummaryProfile     `json:"profiles"`
	Statistics   struct {
		Duration float32 `json:"duration"`
	} `json:"statistics"`
	DocVersion       string   `json:"doc_version"`
	ESTimestamp      string   `json:"@timestamp"`
	PolicyName       string   `json:"policy_name"`
	PolicyGroup      string   `json:"policy_group"`
	OrganizationName string   `json:"organization_name"`
	SourceFQDN       string   `json:"source_fqdn"`
	ChefTags         []string `json:"chef_tags"`
	Projects         []string `json:"projects"`
}

Used to unmarshal summary documents stored in comp-s-* ElasticSearch indices

type ESInSpecSummaryA2v2

type ESInSpecSummaryA2v2 struct {
	NodeID      string    `json:"node_uuid"`
	ReportID    string    `json:"report_uuid"`
	DailyLatest bool      `json:"daily_latest"`
	NodeName    string    `json:"node_name"`
	Environment string    `json:"environment"`
	EndTime     time.Time `json:"end_time"`
	Status      string    `json:"status"`
	JobID       string    `json:"job_uuid"`
	Roles       []string  `json:"roles"`
	Recipes     []string  `json:"recipes"`
	Platform    struct {
		Name    string `json:"name"`
		Release string `json:"release"`
	} `json:"platform"`
	Controls     NodeControlSummaryA2v2              `json:"controls"`
	ProfilesSums []ESInspecProfileControlSummaryA2v2 `json:"profiles_sums"`
	DocVersion   string                              `json:"doc_version"`
	ESTimestamp  string                              `json:"@timestamp"`
}

Main type for the summary documents used in the timeseries

type ESInSpecSummaryProfile

type ESInSpecSummaryProfile struct {
	Profile      string                       `json:"profile"`
	Status       string                       `json:"status"`
	Name         string                       `json:"name"`
	Title        string                       `json:"title"`
	Version      string                       `json:"version"`
	Full         string                       `json:"full"`
	SHA256       string                       `json:"sha256"`
	ControlsSums reporting.NodeControlSummary `json:"controls_sums"`
}

type ESInspecAttribute

type ESInspecAttribute struct {
	Name    string `json:"name"`
	Options struct {
		Description string `json:"description,omitempty"`
		Default     string `json:"default"`
	} `json:"options,omitempty"`
}

type ESInspecControl

type ESInspecControl struct {
	ID             string                `json:"id"`
	Code           string                `json:"code"`
	Desc           string                `json:"desc"`
	Impact         float32               `json:"impact"`
	Title          string                `json:"title"`
	SourceLocation inspec.SourceLocation `json:"source_location"`
	Refs           string                `json:"refs"`
	Tags           string                `json:"tags"`
	Results        []reportingapi.Result `json:"results,omitempty"`
}

type ESInspecProfile

type ESInspecProfile struct {
	Name           string                  `json:"name"`
	Title          string                  `json:"title"`
	Version        string                  `json:"version"`
	Summary        string                  `json:"summary"`
	Maintainer     string                  `json:"maintainer"`
	License        string                  `json:"license"`
	Copyright      string                  `json:"copyright"`
	CopyrightEmail string                  `json:"copyright_email"`
	Controls       []ESInspecControl       `json:"controls"`
	Supports       []*ingestinspec.Support `json:"supports"`
	Attributes     []ESInspecAttribute     `json:"attributes"`
	Dependencies   []inspec.Dependency     `json:"depends,omitempty"`
	Sha256         string                  `json:"sha256"`
	Groups         []inspec.Group          `json:"groups"`
	// ES specific not required by code, harmonized with logstash
	DocVersion  string `json:"doc_version"`
	ESTimestamp string `json:"@timestamp"`
}

type ESInspecProfileControlSummaryA2v2

type ESInspecProfileControlSummaryA2v2 struct {
	Profile  string                 `json:"profile"`
	Status   string                 `json:"status"`
	Controls NodeControlSummaryA2v2 `json:"controls"`
}

type ESMigrationInfo

type ESMigrationInfo struct {
	MostRecentValidLatestDate time.Time `json:"most_recent_valid_latest_date,omitempty"`
	CurrentIndicesVersion     string    `json:"current_indices_version,omitempty"`
}

type EndTimeSource

type EndTimeSource struct {
	EndTime time.Time `json:"end_time"`
}

type EnvironmentStatSummary

type EnvironmentStatSummary struct {
	Name     string `json:"name"`
	Failures int    `json:"failures"`
}

type EnvironmentStatSummaryA2v2

type EnvironmentStatSummaryA2v2 struct {
	Name     string `json:"name"`
	Failures int    `json:"failures"`
}

type Failure

type Failure struct {
	Total    int `json:"total"`
	Minor    int `json:"minor"`
	Major    int `json:"major"`
	Critical int `json:"critical"`
}

type FailureA2v2

type FailureA2v2 struct {
	Total    int `json:"total"`
	Minor    int `json:"minor"`
	Major    int `json:"major"`
	Critical int `json:"critical"`
}

type FirstRunInfo

type FirstRunInfo struct {
	LastRun string `json:"last_run""`
}

type Node

type Node struct {
	NodeUUID    string    `json:"node_uuid"`
	NodeEndTime time.Time `json:"node_end_time"`
	Status      string    `json:"status"`
	DayLatest   bool      `json:"day_latest"`
	DailyLatest bool      `json:"daily_latest"`
	ReportUUID  string    `json:"report_uuid"`
	NodeName    string    `json:"node_name"`
	Environment string    `json:"environment"`
	Roles       []string  `json:"roles"`
	Recipes     []string  `json:"recipes"`
	Platform    struct {
		Name    string `json:"name"`
		Release string `json:"release"`
		Full    string `json:"full"`
	} `json:"platform"`
	PolicyName       string   `json:"policy_name"`
	PolicyGroup      string   `json:"policy_group"`
	OrganizationName string   `json:"organization_name"`
	SourceFQDN       string   `json:"source_fqdn"`
	ChefTags         []string `json:"chef_tags"`
	JobID            string   `json:"job_uuid"`
}

type NodeControlSummaryA2v2

type NodeControlSummaryA2v2 struct {
	Total  int `json:"total"`
	Passed struct {
		Total int `json:"total"`
	} `json:"passed"`
	Skipped struct {
		Total int `json:"total"`
	} `json:"skipped"`
	Failed struct {
		Total    int `json:"total"`
		Minor    int `json:"minor"`
		Major    int `json:"major"`
		Critical int `json:"critical"`
	} `json:"failed"`
}

type NodeListWithAggregatedComplianceSummary

type NodeListWithAggregatedComplianceSummary struct {
	NodeID      string    `json:"node_id"`
	Name        string    `json:"node_name"`
	Environment string    `json:"environment"`
	EndTime     time.Time `json:"end_time"`
	Platform    Platform  `json:"platform"`
	Failed      Failure   `json:"failed"`
}

type NodeListWithAggregatedComplianceSummaryA2v2

type NodeListWithAggregatedComplianceSummaryA2v2 struct {
	NodeID      string       `json:"node_id"`
	Name        string       `json:"node_name"`
	Environment string       `json:"environment"`
	EndTime     time.Time    `json:"end_time"`
	Platform    PlatformA2v2 `json:"platform"`
	Failed      FailureA2v2  `json:"failed"`
}

type NodesControlInfo

type NodesControlInfo struct {
	NodeUUID    string    `json:"node_uuid"`
	NodeEndTime time.Time `json:"node_end_time"`
}

type NodesUpgradation

type NodesUpgradation struct {
	NodeUUID  string `json:"node_uuid"`
	EndTime   string `json:"end_time"`
	DayLatest bool   `json:"day_latest"`
}

type OS

type OS struct {
	Name string `json:"name"`
}

type OSA2v2

type OSA2v2 struct {
	Name string `json:"name"`
}

type PassedFailedSkipped

type PassedFailedSkipped struct {
	Passed  int32 `json:"passed"`
	Failed  int32 `json:"failed"`
	Skipped int32 `json:"skipped"`
}

type PassedFailedSkippedA2v2

type PassedFailedSkippedA2v2 struct {
	Passed  int32 `json:"passed"`
	Failed  int32 `json:"failed"`
	Skipped int32 `json:"skipped"`
}

type Platform

type Platform struct {
	Name    string `json:"name"`
	Release string `json:"release"`
}

type PlatformA2v2

type PlatformA2v2 struct {
	Name    string `json:"name"`
	Release string `json:"release"`
}

type PlatformStatSummary

type PlatformStatSummary struct {
	Name     string `json:"name"`
	Failures int    `json:"failures"`
}

type PlatformStatSummaryA2v2

type PlatformStatSummaryA2v2 struct {
	Name     string `json:"name"`
	Failures int    `json:"failures"`
}

type Profile

type Profile struct {
	ProfileID string `json:"profile_id"`
	Name      string `json:"name"`
	Title     string `json:"title"`
}

type ProfileDepth

type ProfileDepth struct {
	*QueryInfo
}

type ProfileListWithAggregatedComplianceSummary

type ProfileListWithAggregatedComplianceSummary struct {
	Name      string `json:"name"`
	ID        string `json:"id"`
	Failures  int    `json:"failures"`
	Majors    int    `json:"majors"`
	Minors    int    `json:"minors"`
	Criticals int    `json:"criticals"`
	Passed    int    `json:"passed"`
	Skipped   int    `json:"skipped"`
}

type ProfileListWithAggregatedComplianceSummaryA2v2

type ProfileListWithAggregatedComplianceSummaryA2v2 struct {
	Name      string `json:"name"`
	ID        string `json:"id"`
	Failures  int    `json:"failures"`
	Majors    int    `json:"majors"`
	Minors    int    `json:"minors"`
	Criticals int    `json:"criticals"`
	Passed    int    `json:"passed"`
	Skipped   int    `json:"skipped"`
}

type ProfileMinA2v2

type ProfileMinA2v2 struct {
	Name    string `json:"name"`
	Title   string `json:"title"`
	ID      string `json:"id"`
	Version string `json:"version"`
	Status  string `json:"status,omitempty"`
}

type ProfileRunInfo

type ProfileRunInfo struct {
	SHA256   string           `json:"sha256"`
	Controls []ControlRunInfo `json:"controls"`
	Name     string           `json:"name"`
	Title    string           `json:"title"`
	Full     string           `json:"full"`
}

type ProfileSource

type ProfileSource struct {
	Sha256       string                       `json:"sha256"`
	Name         string                       `json:"name"`
	Version      string                       `json:"version"`
	ControlsSums reporting.NodeControlSummary `json:"controls_sums"`
	Status       string                       `json:"status"`
}

type ProfileStatSummary

type ProfileStatSummary struct {
	Name     string `json:"name"`
	ID       string `json:"id"`
	Failures int    `json:"failures"`
}

type ProfileStatSummaryA2v2

type ProfileStatSummaryA2v2 struct {
	Name     string `json:"name"`
	ID       string `json:"id"`
	Failures int    `json:"failures"`
}

type QueryInfo

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

type ReportDepth

type ReportDepth struct {
	*QueryInfo
}

type ReportId

type ReportId struct {
	ReportUuid string `json:"report_uuid"`
	EndTime    string `json:"end_time"`
	NodeUuid   string `json:"node_uuid"`
}

type ReportingTransport

type ReportingTransport struct {
	Enterprise        string
	ChefDeliveryUser  string
	ChefDeliveryToken string
}

ReportingTransport structure for Automate login

func (*ReportingTransport) RoundTrip

func (tr *ReportingTransport) RoundTrip(r *http.Request) (*http.Response, error)

type StatsComplianceSummary

type StatsComplianceSummary struct {
	Compliant    int `json:"compliant"`
	Skipped      int `json:"skipped"`
	Noncompliant int `json:"noncompliant"`
	HighRisk     int `json:"high_risk"`
	MediumRisk   int `json:"medium_risk"`
	LowRisk      int `json:"low_risk"`
}

type StatsComplianceSummaryA2v2

type StatsComplianceSummaryA2v2 struct {
	Compliant    int `json:"compliant"`
	Skipped      int `json:"skipped"`
	Noncompliant int `json:"noncompliant"`
	HighRisk     int `json:"high_risk"`
	MediumRisk   int `json:"medium_risk"`
	LowRisk      int `json:"low_risk"`
}

type StatsTopFailures

type StatsTopFailures struct {
	Profiles     []ProfileStatSummary     `json:"profiles,omitempty"`
	Platforms    []PlatformStatSummary    `json:"platforms,omitempty"`
	Controls     []ControlStatSummary     `json:"controls,omitempty"`
	Environments []EnvironmentStatSummary `json:"environments,omitempty"`
}

type StatsTopFailuresA2v2

type StatsTopFailuresA2v2 struct {
	Profiles     []ProfileStatSummaryA2v2     `json:"profiles,omitempty"`
	Platforms    []PlatformStatSummaryA2v2    `json:"platforms,omitempty"`
	Controls     []ControlStatSummaryA2v2     `json:"controls,omitempty"`
	Environments []EnvironmentStatSummaryA2v2 `json:"environments,omitempty"`
}

type Status

type Status struct {
	Status string `json:"status"`
}

type Straddle

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

type Suggestion

type Suggestion struct {
	Text    string  `json:"text"`
	Id      string  `json:"id,omitempty"`
	Score   float32 `json:"score"`
	Version string  `json:"version,omitempty"`
}

type SuggestionA2v2

type SuggestionA2v2 struct {
	Text    string  `json:"text"`
	Id      string  `json:"id,omitempty"`
	Score   float32 `json:"score"`
	Version string  `json:"version,omitempty"`
}

type TimeBucketedReportIds

type TimeBucketedReportIds struct {
	Date      string
	ReportIds []string
}

type TotalNodeCounts

type TotalNodeCounts struct {
	Total, Passed, Failed, Skipped, Waived int32
}

type TrendBucket

type TrendBucket struct {
	StartTime *time.Time
	EndTime   *time.Time
}

Jump to

Keyboard shortcuts

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