manifest

package
v2.9.0-dev.dbc482d5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteManifest

func WriteManifest(context *WriterContext, manifestToWrite Manifest) error

Types

type Auth

type Auth struct {
	Token AuthSecret
	OAuth *OAuth
}

type AuthSecret

type AuthSecret struct {
	// Name is the name of the environment-variable of the token. It is used for converting monaco-v1 to monaco-v2 environments
	// where the value is not resolved, but the env-name has to be kept.
	Name string

	// Value holds the actual token value for the given [Name]. It is empty when converting vom monaco-v1 to monaco-v2
	Value string
}

AuthSecret contains a resolved secret value. It is used for the API-Token, ClientID, and ClientSecret.

type EnvironmentDefinition

type EnvironmentDefinition struct {
	Name  string
	Group string
	URL   URLDefinition
	Auth  Auth
}

EnvironmentDefinition holds all information about a Dynatrace environment

type EnvironmentDetails

type EnvironmentDetails struct {
	Group       string `json:"group"`
	Environment string `json:"environment"`
}

type EnvironmentLoaderError

type EnvironmentLoaderError struct {
	ManifestLoaderError
	EnvironmentDetails EnvironmentDetails `json:"environmentDetails"`
}

func (EnvironmentLoaderError) Error

func (e EnvironmentLoaderError) Error() string

type Environments

type Environments map[string]EnvironmentDefinition

Environments is a map of environment-name -> EnvironmentDefinition

func (Environments) Names

func (e Environments) Names() []string

Names returns the slice of environment names

type LoaderContext

type LoaderContext struct {
	// Fs holds the abstraction of the file system.
	Fs afero.Fs

	// ManifestPath holds the path from where the manifest should be loaded.
	ManifestPath string

	// Environments is a filter to what environments should be loaded.
	// If it's empty, all environments are loaded.
	// If both Environments and Groups are specified, the union of both results is returned.
	//
	// If Environments contains items that do not match any environment in the specified manifest file, the loading errors.
	Environments []string

	// Groups is a filter to what environment-groups (and thus environments) should be loaded.
	// If it's empty, all environment-groups are loaded.
	// If both Environments and Groups are specified, the union of both results is returned.
	//
	// If Groups contains items that do not match any environment in the specified manifest file, the loading errors.
	Groups []string

	// Opts are LoaderOptions holding optional configuration for LoadManifest
	Opts LoaderOptions
}

LoaderContext holds all information for LoadManifest

type LoaderOptions added in v2.6.0

type LoaderOptions struct {
	DontResolveEnvVars bool
}

LoaderOptions are optional configuration for LoadManifest

type Manifest

type Manifest struct {
	// Projects defined in the manifest, split by project-name
	Projects ProjectDefinitionByProjectID

	// Environments defined in the manifest, split by environment-name
	Environments Environments
}

func LoadManifest

func LoadManifest(context *LoaderContext) (Manifest, []error)

type ManifestLoaderError

type ManifestLoaderError struct {
	ManifestPath string `json:"manifestPath"`
	Reason       string `json:"reason"`
}

func (ManifestLoaderError) Error

func (e ManifestLoaderError) Error() string

type OAuth

type OAuth struct {
	ClientID      AuthSecret
	ClientSecret  AuthSecret
	TokenEndpoint *URLDefinition
}

func (OAuth) GetTokenEndpointValue

func (o OAuth) GetTokenEndpointValue() string

GetTokenEndpointValue returns the defined token endpoint or an empty string if it's not set.

type ProjectDefinition

type ProjectDefinition struct {
	Name  string
	Group string
	Path  string
}

func (ProjectDefinition) String

func (p ProjectDefinition) String() string

type ProjectDefinitionByProjectID

type ProjectDefinitionByProjectID map[string]ProjectDefinition

type ProjectLoaderError

type ProjectLoaderError struct {
	ManifestLoaderError
	Project string `json:"project"`
}

func (ProjectLoaderError) Error

func (e ProjectLoaderError) Error() string

type URLDefinition

type URLDefinition struct {
	// Type defines whether the [URLDefinition.Value] is loaded from an env var, or directly.
	Type URLType

	// Name is the name of the environment-variable of the token. It only has a value if [URLDefinition.Type] is "[EnvironmentURLType]"
	Name string

	// Value is the resolved value of the URL.
	// It is resolved during manifest reading.
	Value string
}

URLDefinition holds the value and origin of an environment-url.

type URLType

type URLType int

URLType describes from where the url is loaded. Possible values are EnvironmentURLType and ValueURLType. ValueURLType is the default value.

const (
	// ValueURLType describes that the url has been loaded directly as a value
	ValueURLType URLType = iota

	// EnvironmentURLType describes that the url has been loaded from an environment variable
	EnvironmentURLType
)

type WriterContext

type WriterContext struct {
	// Fs holds the abstraction of the file system.
	Fs afero.Fs

	// ManifestPath holds the path from where the manifest should be written to.
	ManifestPath string
}

WriterContext holds all information for WriteManifest

Jump to

Keyboard shortcuts

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