Documentation ¶
Overview ¶
Package anon contains functions and data structures related to the map of anonymized fields. In the elasticsearch index and requests context, this map is used to guarantee that we do not expose sensitive information but keep the same experimental behavior. For instance, an anonymized request using the anonmap of an index anonymization must must hit the same set of shards as the original version.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Anonymizer ¶
type Anonymizer struct { FMap FieldsMap FRE FieldsRegexp }
Anonymizer anonymizes arbitrary object fields based on regular expressions.
func (*Anonymizer) Anonymize ¶
func (a *Anonymizer) Anonymize(objSlice ...map[string]interface{})
Anonymize anonymizes the passed-in objects updating its fields.
func (*Anonymizer) WriteFieldsMapToFile ¶
func (a *Anonymizer) WriteFieldsMapToFile(path string) error
WriteFieldsMapToFile writes a JSON version of the anonymized fields map to the specified file path.
type FieldsMap ¶
FieldsMap maps fields to their associated anonymized values.
func MustReadFieldsMap ¶
MustReadFieldsMap it is like ReadFieldsMapFromFile, but panic in case of errors.
func ReadFieldsMapFromFile ¶
ReadFieldsMapFromFile loads the map of anonymized fields from a file path.
func (FieldsMap) Anonymize ¶
Anonymize returns an anonymous version of the field key and updates the backing map, making sure that sucessive calls of this method return the same anonymous value.
func (FieldsMap) WriteJSONToFile ¶
WriteJSONToFile writes a JSON version of the anonymized fields map to the specified file path.
type FieldsRegexp ¶
FieldsRegexp keeps the regular expressions to be applied while anonymizing fields.
func FieldsRegexpFromStringSlice ¶
func FieldsRegexpFromStringSlice(fSlice []string) (FieldsRegexp, error)
FieldsRegexpFromStringSlice creates a new, populated FieldRegexp from a string slice. The field name-regexp separator is "::".
func MustParseFieldsRE ¶
func MustParseFieldsRE(fSlice []string) FieldsRegexp
MustParseFieldsRE is like FieldsRegexpFromStringSlice but panics in case of errors.