settings

package
v2.6.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithFilters

func WithFilters(filters Filters) func(*Downloader)

WithFilters sets specific settings filters for settings 2.0 object that needs to be filtered following to some custom criteria

Types

type Downloader

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

Downloader is responsible for downloading Settings 2.0 objects

func NewDownloader

func NewDownloader(client dtclient.SettingsClient, opts ...func(*Downloader)) *Downloader

NewDownloader creates a new downloader for Settings 2.0 objects

func (*Downloader) Download

func (d *Downloader) Download(projectName string, schemaIDs ...config.SettingsType) (v2.ConfigsPerType, error)

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