config

package
v2.17.2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IdParameter is special. it is not allowed to be set via the config,
	// but needs to work as normal parameter otherwise (e.g. it can be referenced).
	IdParameter = "id"

	// NameParameter is special in that it needs to exist for a config.
	NameParameter = "name"

	// ScopeParameter is special. It is the set scope as a parameter.
	// A user must not set it as a parameter in the config.
	// It is only a parameter iff the config is a settings-config.
	ScopeParameter = "scope"

	// InsertAfterParameter is special. It points to another settings object and is used
	// for establishing an ordering between different settings objects.
	// It is only a parameter iff the config is a settings-config.
	InsertAfterParameter = "insertAfter"

	// SkipParameter is special in that config should be deployed or not
	SkipParameter = "skip"

	// NonUniqueNameConfigDuplicationParameter is a special parameter set on non-unique name API configurations
	// that appear multiple times in a project
	NonUniqueNameConfigDuplicationParameter = "__MONACO_NUN_API_DUP__"
)

Variables

DefaultParameterParsers map defining a set of default parsers which can be used to load configurations

ReservedParameterNames holds all parameter names that may not be specified by a user in a config.

Functions

func GetNameForConfig added in v2.9.2

func GetNameForConfig(c Config) (any, error)

Types

type AutomationResource

type AutomationResource string

AutomationResource defines which resource is an AutomationType

const (
	Workflow         AutomationResource = "workflow"
	BusinessCalendar AutomationResource = "business-calendar"
	SchedulingRule   AutomationResource = "scheduling-rule"
)

type AutomationType

type AutomationType struct {
	// Resource identifies which Automation resource is used in this config.
	// Currently, this can be Workflow, BusinessCalendar, or SchedulingRule.
	Resource AutomationResource
}

AutomationType represents any Dynatrace Platform automation-resource

func (AutomationType) ID

func (AutomationType) ID() TypeId

type BucketType added in v2.7.0

type BucketType struct{}

func (BucketType) ID added in v2.7.0

func (BucketType) ID() TypeId

type CircularDependencyParameterSortError added in v2.8.0

type CircularDependencyParameterSortError struct {
	Location           coordinate.Coordinate           `json:"location"`
	EnvironmentDetails configErrors.EnvironmentDetails `json:"environmentDetails"`
	ParameterName      string                          `json:"parameterName"`
	DependsOn          []parameter.ParameterReference  `json:"dependsOn"`
}

func (CircularDependencyParameterSortError) Coordinates added in v2.8.0

func (CircularDependencyParameterSortError) Error added in v2.8.0

func (CircularDependencyParameterSortError) LocationDetails added in v2.8.0

type ClassicApiType

type ClassicApiType struct {
	Api string
}

func (ClassicApiType) ID

func (ClassicApiType) ID() TypeId

type Config

type Config struct {
	// template used to render the request send to the dynatrace api
	Template template.Template
	// coordinates which specify the location of this configuration
	Coordinate coordinate.Coordinate
	// group this config belongs to
	Group string
	// name of the environment this configuration is for
	Environment string
	// Type holds information of the underlying config type (classic, settings, entities)
	Type Type
	// map of all parameters which will be resolved and are then available
	// in the template
	Parameters Parameters

	// Skip flag indicates if the deployment of this configuration should be skipped. It is resolved during project loading.
	Skip bool

	// SkipForConversion is only used for converting v1-configs to v2-configs.
	// It is required as the object itself does only store the resolved 'skip' value, not the actual parameter.
	SkipForConversion parameter.Parameter

	// OriginObjectId is the DT object ID of the object when it was downloaded from an environment
	OriginObjectId string
}

Config struct defining a configuration which can be deployed.

func (*Config) HasRefTo added in v2.16.0

func (c *Config) HasRefTo(configType string) bool

HasRefTo returns true if he config has a reference to another config of the given type

func (*Config) References

func (c *Config) References() []coordinate.Coordinate

func (*Config) Render

func (c *Config) Render(properties map[string]interface{}) (string, error)

func (*Config) ResolveParameterValues added in v2.8.0

func (c *Config) ResolveParameterValues(entities EntityLookup) (parameter.Properties, []error)

ResolveParameterValues will resolve the values of all config.Parameters of a config.Config and return them as a parameter.Properties map. Resolving will ensure that parameters are resolved in the right order if they have dependencies between each other. To be able to resolve reference.ReferenceParameter values an EntityLookup needs to be provided, which contains all config.ResolvedEntity values of configurations that the config.Config could depend on. Ordering of configurations to ensure that possible dependency configurations are contained in teh EntityLookup is responsibility of the caller of ResolveParameterValues.

ResolveParameterValues will return a slice of errors for any failures during sorting or resolving parameters.

type DocumentKind added in v2.14.2

type DocumentKind string

DocumentKind defines the type of a document. Currently, it can be a dashboard or a notebook.

const (
	DashboardKind DocumentKind = "dashboard"
	NotebookKind  DocumentKind = "notebook"
)

type DocumentType added in v2.14.0

type DocumentType struct {
	// Kind indicates the type of document.
	Kind DocumentKind

	// Private indicates if a document is private, otherwise by default it is visible to other users.
	Private bool
}

DocumentType represents a Dynatrace platform document.

func (DocumentType) ID added in v2.14.0

func (DocumentType) ID() TypeId

type EntityLookup added in v2.8.0

type EntityLookup interface {
	parameter.PropertyResolver

	GetResolvedEntity(config coordinate.Coordinate) (entities.ResolvedEntity, bool)
}

EntityLookup is used in parameter resolution to fetch the resolved entity of deployed configuration

type EntityType

type EntityType struct {
	EntitiesType string
}

func (EntityType) ID

func (EntityType) ID() TypeId

type OpenPipelineType added in v2.14.3

type OpenPipelineType struct {
	// Kind indicates the type of OpenPipeline.
	Kind string
}

OpenPipelineType represents an OpenPipeline configuration.

func (OpenPipelineType) ID added in v2.14.3

func (OpenPipelineType) ID() TypeId

type Parameters

type Parameters map[string]parameter.Parameter

Parameters defines a map of name to parameter

type ParamsRefErr added in v2.8.0

type ParamsRefErr struct {
	Location           coordinate.Coordinate           `json:"location"`
	EnvironmentDetails configErrors.EnvironmentDetails `json:"environmentDetails"`
	ParameterName      string                          `json:"parameterName"`
	Reference          parameter.ParameterReference    `json:"parameterReference"`
	Reason             string                          `json:"reason"`
}

func (ParamsRefErr) Coordinates added in v2.8.0

func (e ParamsRefErr) Coordinates() coordinate.Coordinate

func (ParamsRefErr) Error added in v2.8.0

func (e ParamsRefErr) Error() string

func (ParamsRefErr) LocationDetails added in v2.8.0

func (e ParamsRefErr) LocationDetails() configErrors.EnvironmentDetails

type SettingsType

type SettingsType struct {
	SchemaId, SchemaVersion string
}

func (SettingsType) ID

func (SettingsType) ID() TypeId

type Type

type Type interface {
	// ID returns the type-id.
	ID() TypeId
}

type TypeId

type TypeId string
const (
	SettingsTypeId     TypeId = "settings"
	ClassicApiTypeId   TypeId = "classic"
	EntityTypeId       TypeId = "entity"
	AutomationTypeId   TypeId = "automation"
	BucketTypeId       TypeId = "bucket"
	DocumentTypeId     TypeId = "document"
	OpenPipelineTypeId TypeId = "openpipeline"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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