settings

package
v2.15.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSettingsFilters = Filters{
	"builtin:logmonitoring.logs-on-grail-activate": {
		ShouldDiscard: func(json map[string]interface{}) (bool, string) {
			return json["activated"] == false, "'activated' field is set to false"
		},
	},

	"builtin:logmonitoring.log-buckets-rules": {
		ShouldDiscard: func(json map[string]interface{}) (bool, string) {
			return json["ruleName"] == "default", formatDefaultDiscardReasonMsg(json["ruleName"])
		},
	},

	"builtin:bizevents-processing-buckets.rule": {
		ShouldDiscard: func(json map[string]interface{}) (bool, string) {
			return json["ruleName"] == "default", formatDefaultDiscardReasonMsg(json["ruleName"])
		},
	},

	"builtin:alerting.profile": {
		ShouldDiscard: func(json map[string]interface{}) (bool, string) {
			return json["name"] == "Default" || json["name"] == "Default for ActiveGate Token Expiry", formatDefaultDiscardReasonMsg(json["name"])
		},
	},

	"builtin:logmonitoring.log-events": {
		ShouldDiscard: func(json map[string]interface{}) (bool, string) {
			return json["summary"] == "Default Kubernetes Log Events", formatDefaultDiscardReasonMsg("Default Kubernetes Log Events")
		},
	},
}

DefaultSettingsFilters is the default Filters used for settings 2.0

Functions

func Download added in v2.10.1

func Download(client client.SettingsClient, projectName string, filters Filters, schemaIDs ...config.SettingsType) (v2.ConfigsPerType, error)

Types

type Filter

type Filter struct {
	// ShouldDiscard contains logic whether a settings object should be discarded
	// based on specific criteria on the settings value payload. It returns true or false
	// depending on the specific implementation and a reason that gives more context to the
	// evaluation result, e.g. a filter that discards settings that contain a field "foo"
	// with a value "bar" in their payload would be implemented like:
	// func (json map[string]interface{}) (bool, string) { return json["foo"] == "bar",  "foo is set to bar" }
	ShouldDiscard func(map[string]interface{}) (discard bool, reason string)
}

Filter can be used to filter/discard settings 2.0

type Filters

type Filters map[string]Filter

Filters represents a map of settings 2.0 Filters

func (Filters) Get

func (f Filters) Get(schemaID string) Filter

Get returns the filter for a given key

Jump to

Keyboard shortcuts

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