classic

package
v2.8.0-dev.57be8305 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package downloader is responsible for downloading configurations from Dynatrace.

The process looks like this:

result = array[api, templates]

for each api in apis:
	to_download = array[api, list]
	if api.isSingletonApi:
		to_download += (api, mock_download_value(api)) # Since we don't need a list-call, we can simply add this value to the array.
	else
		list <- dynatrace.ListAll(api) # List query for all configs of api
		list <- filter(list) # Remove unwanted values we already know we don't want to download
		to_download += (api, list)
	fi

	templates = array[]
	for each value in 'to_download':
		config <- dynatrace.Get(value)
		if skip(config) next # skip configs like presets

		template <- extract_and_sanitize(config)

		templates += template
	end_for

	results += (api, templates)
end_for

return result

```

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentFilter added in v2.5.0

type ContentFilter struct {
	// ShouldBeSkippedPreDownload is an optional callback indicating that a config should not be downloaded after the list of the configs
	ShouldBeSkippedPreDownload func(value dtclient.Value) bool

	// ShouldConfigBePersisted is an optional callback to check whether a config should be persisted after being downloaded
	ShouldConfigBePersisted func(json map[string]interface{}) bool
}

ContentFilter defines whether a given API value should be skipped - either already PreDownload or based on it's full json content

type Downloader

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

Downloader is responsible for downloading classic Dynatrace APIs. To create it sound, use NewDownloader construction function.

func NewDownloader

func NewDownloader(client dtclient.Client, opts ...Option) *Downloader

NewDownloader creates a new sound Downloader.

func (*Downloader) Download

func (d *Downloader) Download(projectName string, _ ...config.ClassicApiType) (project.ConfigsPerType, error)

type Option added in v2.5.0

type Option func(downloader *Downloader)

func WithAPIContentFilters

func WithAPIContentFilters(apiFilters map[string]ContentFilter) Option

func WithAPIs

func WithAPIs(apis api.APIs) Option

WithAPIs sets the endpoints from which Downloader is going to download. During settings, it checks does the given endpoints are known.

func WithFiltering added in v2.5.0

func WithFiltering(b bool) Option

Jump to

Keyboard shortcuts

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