download

package
v2.9.1 Latest Latest
Warning

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

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

Documentation

Overview

Package download provides all functionality required to download configuration from a Dynatrace tenant as Monaco configuration files.

Basically, the download happens in 3 steps.

  1. Download all specified APIs (or all APIs if non are specified) from Dynatrace into our in-memory representation.
  2. Resolve dependencies between the components
  3. Write the in-memory representation to disk

Downloading

Entry point: pkg/github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/download/downloader.DownloadAllConfigs

Downloading happens in the downloader-subpackage.

Dependency resolution

Entry point: [ResolveDependencies]

Our current approach for dependency resolution is very basic. We collect all ids off all the configs we downloaded, and search all templates for any occurances of those ids. In case of an occurrence, the occurrence is replaced by a generic variable, and added as a reference.

Persistence

Entry point: WriteToDisk

When persisting, all configs that were downloaded are stored in a project folder inside either a specified outputFolder, or a default folder named 'download_{TIMESTAMP}'.

If any existing configs are located there, they are overwritten.

In addition to downloaded configurations, a manifest file is created which can be used to deploy the downloaded configs. If a manifest.yaml already exists in the outputFolder a timestamp is appended and a new manifest created to ensure a config 'update' does not destroy existing manifests.

The result of WriteToDisk will be a full configuration project and manifest with which that project can be deployed, written to the Filesystem.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateProjectData

func CreateProjectData(downloadedConfigs project.ConfigsPerType, projectName string) project.Project

func WriteToDisk

func WriteToDisk(fs afero.Fs, writerContext WriterContext) error

WriteToDisk writes all projects to the disk

Types

type Downloader

type Downloader[T config.Type] interface {

	// Download downloads configurations from a Dynatrace environment.
	// If only projectName is given, it will download all configuration.
	// If additionally specific configuration names/types are given, then it will only download those
	Download(projectName string, specificConfigs ...T) (projectv2.ConfigsPerType, error)
}

Downloader represents a component that is responsible for downloading configuration for a given project from Dynatrace

type WriterContext

type WriterContext struct {
	EnvironmentUrl string
	ProjectToWrite project.Project
	Auth           manifest.Auth
	OutputFolder   string
	ForceOverwrite bool
	// contains filtered or unexported fields
}

func (WriterContext) GetOutputFolderFilePath

func (c WriterContext) GetOutputFolderFilePath() string

Directories

Path Synopsis
Package downloader is responsible for downloading configurations from Dynatrace.
Package downloader is responsible for downloading configurations from Dynatrace.
internal

Jump to

Keyboard shortcuts

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