export

package
v1.72.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 365 Imported by: 0

Documentation

Overview

* * @license * Copyright 2023 Dynatrace LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* * @license * Copyright 2023 Dynatrace LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const CALC_METRIC_REGEX = "CALC_METRIC_REGEX"
View Source
const ClearLine = "\033[2K"
View Source
const DYNATRACE_PROVIDER_SOURCE = "DYNATRACE_PROVIDER_SOURCE"
View Source
const DYNATRACE_PROVIDER_VERSION = "DYNATRACE_PROVIDER_VERSION"
View Source
const ENTITY_REGEX = "ENTITY_REGEX"
View Source
const ENV_VAR_CUSTOM_PROVIDER_LOCATION = "DYNATRACE_CUSTOM_PROVIDER_LOCATION"
View Source
const LEGACY_MZ_ID_REGEX = "LEGACY_MZ_ID"
View Source
const MAX_PATH_LENGTH_FILENAME_SHORTER = 240
View Source
const NONE = "NONE"
View Source
const V1_CONFIG_ID_REGEX = "V1_CONFIG_ID_REGEX"

Variables

View Source
var ANSI_ESCAPE_PATTERN = regexp.MustCompile(`\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])`)
View Source
var ATOMIC_DEPENDENCIES = os.Getenv("DYNATRACE_ATOMIC_DEPENDENCIES") == "true"

To allow -target to work with dependencies at an atomic level

View Source
var AllResources = map[ResourceType]ResourceDescriptor{}/* 331 elements not displayed */
View Source
var BackgroundContext = context.Background()
View Source
var CleanUp = &cleanUp{finalizers: []func(){
	cache.Cleanup,
}}
View Source
var DataSourceKindEntity = DataSourceKind("entity")
View Source
var DataSourceKindPolicy = DataSourceKind("policy")
View Source
var DataSourceKindTenant = DataSourceKind("tenant")
View Source
var DataSourceTypes = struct {
	Service          DataSourceType
	AWSIAMExternalID DataSourceType
}{
	"dynatrace_service",
	"dynatrace_aws_iam_external",
}
View Source
var Dependencies = struct {
	ManagementZone       Dependency
	DashboardLinkID      func(parent bool) Dependency
	HyperLinkDashboardID func() Dependency
	LegacyID             func(resourceType ResourceType) Dependency
	ID                   func(resourceType ResourceType) Dependency
	WeakID               func(resourceType ResourceType) Dependency
	QuotedID             func(resourceType ResourceType) Dependency
	ResourceID           func(resourceType ResourceType, parent bool) Dependency
	ServiceMethod        Dependency
	Service              Dependency
	HostGroup            Dependency
	Host                 Dependency
	Disk                 Dependency
	ProcessGroup         Dependency
	ProcessGroupInstance Dependency
	RequestAttribute     Dependency
	// CustomApplication    Dependency
	// MobileApplication       Dependency
	DeviceApplicationMethod Dependency
	// Application               Dependency
	ApplicationMethod Dependency
	// SyntheticTest             Dependency
	// HttpCheck                 Dependency
	K8sCluster                Dependency
	CloudApplication          Dependency
	CloudApplicationNamespace Dependency
	EnvironmentActiveGate     Dependency
	Tenant                    Dependency
	GlobalPolicy              Dependency
}{
	ManagementZone:       &mgmzdep{ResourceTypes.ManagementZoneV2},
	DashboardLinkID:      func(parent bool) Dependency { return &dashlinkdep{ResourceTypes.JSONDashboardBase, parent} },
	HyperLinkDashboardID: func() Dependency { return &dashdep{ResourceTypes.JSONDashboardBase, false} },
	LegacyID:             func(resourceType ResourceType) Dependency { return &legacyID{resourceType} },
	ID:                   func(resourceType ResourceType) Dependency { return &iddep{resourceType: resourceType, quoted: false} },
	WeakID: func(resourceType ResourceType) Dependency {
		return &iddep{resourceType: resourceType, quoted: false, onlyNonPostProcessed: true}
	},
	QuotedID:             func(resourceType ResourceType) Dependency { return &iddep{resourceType: resourceType, quoted: true} },
	ResourceID:           func(resourceType ResourceType, parent bool) Dependency { return &resourceIDDep{resourceType, parent} },
	ServiceMethod:        &entityds{"SERVICE_METHOD", "SERVICE_METHOD-[A-Z0-9]{16}", false},
	Service:              &entityds{"SERVICE", "SERVICE-[A-Z0-9]{16}", false},
	HostGroup:            &entityds{"HOST_GROUP", "HOST_GROUP-[A-Z0-9]{16}", false},
	Host:                 &entityds{"HOST", "HOST-[A-Z0-9]{16}", false},
	Disk:                 &entityds{"DISK", "DISK-[A-Z0-9]{16}", false},
	ProcessGroup:         &entityds{"PROCESS_GROUP", "PROCESS_GROUP-[A-Z0-9]{16}", false},
	ProcessGroupInstance: &entityds{"PROCESS_GROUP_INSTANCE", "PROCESS_GROUP_INSTANCE-[A-Z0-9]{16}", false},
	RequestAttribute:     &reqAttName{ResourceTypes.RequestAttribute},

	DeviceApplicationMethod: &entityds{"DEVICE_APPLICATION_METHOD", "DEVICE_APPLICATION_METHOD-[A-Z0-9]{16}", false},

	ApplicationMethod: &entityds{"APPLICATION_METHOD", "APPLICATION_METHOD-[A-Z0-9]{16}", false},

	K8sCluster:                &entityds{"KUBERNETES_CLUSTER", "KUBERNETES_CLUSTER-[A-Z0-9]{16}", false},
	CloudApplication:          &entityds{"CLOUD_APPLICATION", "CLOUD_APPLICATION-[A-Z0-9]{16}", false},
	CloudApplicationNamespace: &entityds{"CLOUD_APPLICATION_NAMESPACE", "CLOUD_APPLICATION_NAMESPACE-[A-Z0-9]{16}", false},
	EnvironmentActiveGate:     &entityds{"ENVIRONMENT_ACTIVE_GATE", "ENVIRONMENT_ACTIVE_GATE-[A-Z0-9]{16}", false},
	Tenant:                    &tenantds{},
	GlobalPolicy:              &policyds{},
}
View Source
var ENABLE_EXPORT_DASHBOARD = os.Getenv("DYNATRACE_ENABLE_EXPORT_DASHBOARD") == "true"
View Source
var EXPORT_IGNORE_RESOURCES_PATH = os.Getenv("DYNATRACE_EXPORT_IGNORE_RESOURCES")
View Source
var HCL_NO_FORMAT = os.Getenv("DYNATRACE_HCL_NO_FORMAT") == "true"

To speed things up when using Dynatrace Config Manager

View Source
var IMPORT_STATE_PATH = os.Getenv("DYNATRACE_IMPORT_STATE_PATH")
View Source
var JSON_DASHBOARD_BASE_PLUS = os.Getenv("DYNATRACE_JSON_DASHBOARD_BASE_PLUS") == "true"
View Source
var ModuleStati = struct {
	Untouched  ModuleStatus
	Discovered ModuleStatus
	Downloaded ModuleStatus
	Erronous   ModuleStatus
	Imported   ModuleStatus
}{
	"Untouched",
	"Discovered",
	"Downloaded",
	"Erronous",
	"Imported",
}
View Source
var NAME_REPLACE_DASH = os.Getenv("DYNATRACE_NAME_REPLACE_DASH") == "true"

To get more unique names when using Dynatrace Config Manager

View Source
var NO_REFRESH_ON_IMPORT = os.Getenv("DYNATRACE_NO_REFRESH_ON_IMPORT") == "true"
View Source
var OptimizedKeyRegexId = mergeMaps(OptimizedKeyRegexV1, map[string]optimizedIdDep{
	ENTITY_REGEX: {entityExtractionRegex, func(text string, id string) bool {
		entityIdType := string(id[0:(len(id) - 17)])
		return strings.Contains(text, entityIdType)
	}},
	CALC_METRIC_REGEX: {calcMetricKeyRegex, func(text string, id string) bool {
		return strings.Contains(text, "calc:")
	}},
})
View Source
var OptimizedKeyRegexMzLegacy = map[string]optimizedIdDep{}
View Source
var OptimizedKeyRegexV1 = map[string]optimizedIdDep{
	V1_CONFIG_ID_REGEX: {v1ConfigIdRegex, func(text string, id string) bool {
		return true
	}},
}
View Source
var PREV_STATE_ON = os.Getenv("DYNATRACE_PREV_STATE_ON") == "true"
View Source
var PREV_STATE_PATH_LINKED = os.Getenv("DYNATRACE_PREV_STATE_PATH_LINKED")
View Source
var PREV_STATE_PATH_THIS = os.Getenv("DYNATRACE_PREV_STATE_PATH_THIS")
View Source
var QUICK_INIT = os.Getenv("DYNATRACE_QUICK_INIT") == "true"
View Source
var RegexMutex *sync.Mutex = new(sync.Mutex)
View Source
var ResourceStati = struct {
	Downloaded    ResourceStatus
	Erronous      ResourceStatus
	Excluded      ResourceStatus
	Discovered    ResourceStatus
	PostProcessed ResourceStatus
}{
	"Downloaded",
	"Erronous",
	"Excluded",
	"Discovered",
	"PostProcessed",
}
View Source
var ResourceTypes = struct {
	AutoTag                             ResourceType
	AutoTagV2                           ResourceType
	CustomService                       ResourceType
	RequestAttribute                    ResourceType
	ApplicationAnomalies                ResourceType
	DatabaseAnomalies                   ResourceType
	DiskEventAnomalies                  ResourceType
	HostAnomalies                       ResourceType
	ServiceAnomalies                    ResourceType
	CustomAnomalies                     ResourceType
	WebApplication                      ResourceType
	MobileApplication                   ResourceType
	MaintenanceWindow                   ResourceType
	ManagementZone                      ResourceType
	SLO                                 ResourceType
	SLOV2                               ResourceType
	SpanAttribute                       ResourceType
	SpanCaptureRule                     ResourceType
	SpanContextPropagation              ResourceType
	SpanEntryPoint                      ResourceType
	ResourceAttributes                  ResourceType
	JiraNotification                    ResourceType
	WebHookNotification                 ResourceType
	AnsibleTowerNotification            ResourceType
	EmailNotification                   ResourceType
	OpsGenieNotification                ResourceType
	PagerDutyNotification               ResourceType
	ServiceNowNotification              ResourceType
	SlackNotification                   ResourceType
	TrelloNotification                  ResourceType
	VictorOpsNotification               ResourceType
	XMattersNotification                ResourceType
	Alerting                            ResourceType
	FrequentIssues                      ResourceType
	MetricEvents                        ResourceType
	IBMMQFilters                        ResourceType
	IMSBridge                           ResourceType
	QueueManager                        ResourceType
	KeyRequests                         ResourceType
	Maintenance                         ResourceType
	ManagementZoneV2                    ResourceType
	NetworkZones                        ResourceType
	AWSCredentials                      ResourceType
	AWSService                          ResourceType
	AzureCredentials                    ResourceType
	AzureService                        ResourceType
	CloudFoundryCredentials             ResourceType
	KubernetesCredentials               ResourceType
	Credentials                         ResourceType
	Dashboard                           ResourceType
	JSONDashboard                       ResourceType
	Documents                           ResourceType
	DirectShares                        ResourceType
	JSONDashboardBase                   ResourceType
	CalculatedServiceMetric             ResourceType
	CalculatedWebMetric                 ResourceType
	CalculatedMobileMetric              ResourceType
	CalculatedSyntheticMetric           ResourceType
	HostNaming                          ResourceType
	ProcessGroupNaming                  ResourceType
	ServiceNaming                       ResourceType
	NetworkZone                         ResourceType
	RequestNaming                       ResourceType
	BrowserMonitor                      ResourceType
	HTTPMonitor                         ResourceType
	HTTPMonitorScript                   ResourceType
	DashboardSharing                    ResourceType
	ApplicationDetection                ResourceType
	ApplicationErrorRules               ResourceType
	ApplicationDataPrivacy              ResourceType
	SyntheticLocation                   ResourceType
	Notification                        ResourceType
	QueueSharingGroups                  ResourceType
	AlertingProfile                     ResourceType
	RequestNamings                      ResourceType
	IAMUser                             ResourceType
	IAMGroup                            ResourceType
	IAMPermission                       ResourceType
	IAMPolicy                           ResourceType
	IAMPolicyBindings                   ResourceType
	IAMPolicyBindingsV2                 ResourceType
	ProcessGroupAnomalies               ResourceType
	DDUPool                             ResourceType
	ProcessGroupAlerting                ResourceType
	ServiceAnomaliesV2                  ResourceType
	DatabaseAnomaliesV2                 ResourceType
	ProcessMonitoringRule               ResourceType
	DiskAnomaliesV2                     ResourceType
	DiskSpecificAnomaliesV2             ResourceType
	HostAnomaliesV2                     ResourceType
	CustomAppAnomalies                  ResourceType
	CustomAppCrashRate                  ResourceType
	ProcessMonitoring                   ResourceType
	ProcessAvailability                 ResourceType
	AdvancedProcessGroupDetectionRule   ResourceType
	MobileAppAnomalies                  ResourceType
	MobileAppCrashRate                  ResourceType
	WebAppAnomalies                     ResourceType
	MutedRequests                       ResourceType
	ConnectivityAlerts                  ResourceType
	DeclarativeGrouping                 ResourceType
	HostMonitoring                      ResourceType
	HostProcessGroupMonitoring          ResourceType
	RUMIPLocations                      ResourceType
	CustomAppEnablement                 ResourceType
	MobileAppEnablement                 ResourceType
	WebAppEnablement                    ResourceType
	RUMProcessGroup                     ResourceType
	RUMProviderBreakdown                ResourceType
	UserExperienceScore                 ResourceType
	WebAppResourceCleanup               ResourceType
	UpdateWindows                       ResourceType
	ProcessGroupDetectionFlags          ResourceType
	ProcessGroupMonitoring              ResourceType
	ProcessGroupSimpleDetection         ResourceType
	LogMetrics                          ResourceType
	BrowserMonitorPerformanceThresholds ResourceType
	HttpMonitorPerformanceThresholds    ResourceType
	HttpMonitorCookies                  ResourceType
	SessionReplayWebPrivacy             ResourceType
	SessionReplayResourceCapture        ResourceType
	UsabilityAnalytics                  ResourceType
	SyntheticAvailability               ResourceType
	BrowserMonitorOutageHandling        ResourceType
	HttpMonitorOutageHandling           ResourceType
	CloudAppWorkloadDetection           ResourceType
	MainframeTransactionMonitoring      ResourceType
	MonitoredTechnologiesApache         ResourceType
	MonitoredTechnologiesDotNet         ResourceType
	MonitoredTechnologiesGo             ResourceType
	MonitoredTechnologiesIIS            ResourceType
	MonitoredTechnologiesJava           ResourceType
	MonitoredTechnologiesNGINX          ResourceType
	MonitoredTechnologiesNodeJS         ResourceType
	MonitoredTechnologiesOpenTracing    ResourceType
	MonitoredTechnologiesPHP            ResourceType
	MonitoredTechnologiesVarnish        ResourceType
	MonitoredTechnologiesWSMB           ResourceType
	ProcessVisibility                   ResourceType
	RUMHostHeaders                      ResourceType
	RUMIPDetermination                  ResourceType
	MobileAppRequestErrors              ResourceType
	TransactionStartFilters             ResourceType
	OneAgentFeatures                    ResourceType
	RUMOverloadPrevention               ResourceType
	RUMAdvancedCorrelation              ResourceType
	WebAppBeaconOrigins                 ResourceType
	WebAppResourceTypes                 ResourceType
	GenericTypes                        ResourceType
	GenericRelationships                ResourceType
	SLONormalization                    ResourceType
	DataPrivacy                         ResourceType
	ServiceFailure                      ResourceType
	ServiceHTTPFailure                  ResourceType
	DiskOptions                         ResourceType
	OSServices                          ResourceType
	ExtensionExecutionController        ResourceType
	NetTracerTraffic                    ResourceType
	AIXExtension                        ResourceType
	MetricMetadata                      ResourceType
	MetricQuery                         ResourceType
	ActiveGateToken                     ResourceType
	AGToken                             ResourceType
	AuditLog                            ResourceType
	K8sClusterAnomalies                 ResourceType
	K8sNamespaceAnomalies               ResourceType
	K8sNodeAnomalies                    ResourceType
	K8sWorkloadAnomalies                ResourceType
	ContainerBuiltinRule                ResourceType
	ContainerRule                       ResourceType
	ContainerTechnology                 ResourceType
	ContainerRegistry                   ResourceType
	RemoteEnvironments                  ResourceType
	WebAppCustomErrors                  ResourceType
	WebAppRequestErrors                 ResourceType
	UserSettings                        ResourceType
	DashboardsGeneral                   ResourceType
	DashboardsPresets                   ResourceType
	LogProcessing                       ResourceType
	LogEvents                           ResourceType
	LogTimestamp                        ResourceType
	LogGrail                            ResourceType
	LogCustomAttribute                  ResourceType
	LogSensitiveDataMasking             ResourceType
	LogStorage                          ResourceType
	LogBuckets                          ResourceType
	LogSecurityContext                  ResourceType
	EULASettings                        ResourceType
	APIDetectionRules                   ResourceType
	ServiceExternalWebRequest           ResourceType
	ServiceExternalWebService           ResourceType
	ServiceFullWebRequest               ResourceType
	ServiceFullWebService               ResourceType
	DashboardsAllowlist                 ResourceType
	FailureDetectionParameters          ResourceType
	FailureDetectionRules               ResourceType
	LogOneAgent                         ResourceType
	IssueTracking                       ResourceType
	GeolocationSettings                 ResourceType
	UserSessionCustomMetrics            ResourceType
	CustomUnits                         ResourceType
	DiskAnalytics                       ResourceType
	NetworkTraffic                      ResourceType
	TokenSettings                       ResourceType
	ExtensionExecutionRemote            ResourceType
	K8sPVCAnomalies                     ResourceType
	UserActionCustomMetrics             ResourceType
	WebAppJavascriptVersion             ResourceType
	WebAppJavascriptUpdates             ResourceType
	OpenTelemetryMetrics                ResourceType
	ActiveGateUpdates                   ResourceType
	OneAgentDefaultMode                 ResourceType
	OneAgentDefaultVersion              ResourceType
	OneAgentUpdates                     ResourceType
	OwnershipTeams                      ResourceType
	OwnershipConfig                     ResourceType
	LogCustomSource                     ResourceType
	ApplicationDetectionV2              ResourceType
	Kubernetes                          ResourceType
	CloudFoundry                        ResourceType
	DiskAnomalyDetectionRules           ResourceType
	AWSAnomalies                        ResourceType
	VMwareAnomalies                     ResourceType
	BusinessEventsOneAgent              ResourceType
	BusinessEventsOneAgentOutgoing      ResourceType
	BusinessEventsBuckets               ResourceType
	BusinessEventsMetrics               ResourceType
	BusinessEventsProcessing            ResourceType
	BusinessEventsSecurityContext       ResourceType
	WebAppKeyPerformanceCustom          ResourceType
	WebAppKeyPerformanceLoad            ResourceType
	WebAppKeyPerformanceXHR             ResourceType
	MobileAppKeyPerformance             ResourceType
	BuiltinProcessMonitoring            ResourceType
	LimitOutboundConnections            ResourceType
	SpanEvents                          ResourceType
	VMware                              ResourceType
	CustomDevice                        ResourceType
	K8sMonitoring                       ResourceType
	AutomationWorkflow                  ResourceType
	AutomationBusinessCalendar          ResourceType
	AutomationSchedulingRule            ResourceType
	CustomTags                          ResourceType
	HostMonitoringMode                  ResourceType
	HostMonitoringAdvanced              ResourceType
	IPAddressMasking                    ResourceType
	AppSecVulnerabilitySettings         ResourceType
	AppSecVulnerabilityThirdParty       ResourceType
	AppSecVulnerabilityCode             ResourceType
	AppSecNotification                  ResourceType
	AppSecVulnerabilityAlerting         ResourceType
	AppSecAttackAlerting                ResourceType
	AppSecAttackSettings                ResourceType
	AppSecAttackRules                   ResourceType
	AppSecAttackAllowlist               ResourceType
	GenericSetting                      ResourceType
	UnifiedServicesMetrics              ResourceType
	UnifiedServicesOpenTel              ResourceType
	PlatformBucket                      ResourceType
	KeyUserAction                       ResourceType
	UrlBasedSampling                    ResourceType
	AttributeAllowList                  ResourceType
	AttributeBlockList                  ResourceType
	AttributeMasking                    ResourceType
	AttributesPreferences               ResourceType
	OneAgentSideMasking                 ResourceType
	HubSubscriptions                    ResourceType
	MobileNotifications                 ResourceType
	CrashdumpAnalytics                  ResourceType
	AppMonitoring                       ResourceType
	GrailSecurityContext                ResourceType
	SiteReliabilityGuardian             ResourceType
	JiraForWorkflows                    ResourceType
	SlackForWorkflows                   ResourceType
	Policy                              ResourceType
	KubernetesApp                       ResourceType
	GrailMetricsAllowall                ResourceType
	GrailMetricsAllowlist               ResourceType
	WebAppBeaconEndpoint                ResourceType
	WebAppCustomConfigProperties        ResourceType
	WebAppInjectionCookie               ResourceType
	UserGroup                           ResourceType
	User                                ResourceType
	PolicyBinding                       ResourceType
	MgmzPermission                      ResourceType
	ManagedNetworkZones                 ResourceType
	HubExtensionConfig                  ResourceType
	HubActiveExtensionVersion           ResourceType
	DatabaseAppFeatureFlags             ResourceType
	InfraOpsAppFeatureFlags             ResourceType
	EBPFServiceDiscovery                ResourceType
	DavisAnomalyDetectors               ResourceType
	LogDebugSettings                    ResourceType
	InfraOpsAppSettings                 ResourceType
	DiskEdgeAnomalyDetectors            ResourceType
	Reports                             ResourceType
	NetworkMonitor                      ResourceType
	NetworkMonitorOutageHandling        ResourceType
	HubPermissions                      ResourceType
	K8sAutomationConnections            ResourceType
	WebAppCustomInjectionRules          ResourceType
	DiscoveryDefaultRules               ResourceType
	DiscoveryFeatureFlags               ResourceType
	HistogramMetrics                    ResourceType
	KubernetesEnrichment                ResourceType
	DevObsGitOnPrem                     ResourceType
	AWSAutomationConnections            ResourceType
	DevObsAgentOptin                    ResourceType
	DevObsDataMasking                   ResourceType
	DavisCoPilot                        ResourceType
	OpenPipelineLogs                    ResourceType
	OpenPipelineEvents                  ResourceType
	OpenPipelineSecurityEvents          ResourceType
	OpenPipelineBusinessEvents          ResourceType
	OpenPipelineSDLCEvents              ResourceType
	CloudDevelopmentEnvironments        ResourceType
	KubernetesSPM                       ResourceType
	LogAgentFeatureFlags                ResourceType
	ProblemRecordPropagationRules       ResourceType
	ProblemFields                       ResourceType
	AutomationControllerConnections     ResourceType
	EventDrivenAnsibleConnections       ResourceType
	ServiceNowConnection                ResourceType
	PagerDutyConnection                 ResourceType
	MSTeamsConnection                   ResourceType
	DefaultLaunchpad                    ResourceType
	JenkinsConnection                   ResourceType
	GitLabConnection                    ResourceType
	MSEntraIDConnection                 ResourceType
	GitHubConnection                    ResourceType
	Microsoft365EmailConnection         ResourceType

}{}/* 331 elements not displayed */
View Source
var SHORTER_NAMES = os.Getenv("DYNATRACE_SHORTER_NAMES") == "true"
View Source
var ULTRA_PARALLEL = os.Getenv("DYNATRACE_ULTRA_PARALLEL") == "true"

Functions

func AsDataSource added in v1.22.0

func AsDataSource(resource *Resource) string

func CeilDivide added in v1.52.0

func CeilDivide(a, b int) int

func ConfigureRESTLog

func ConfigureRESTLog() (err error)

func ContainsResource added in v1.70.0

func ContainsResource(nonPostProcessedResources []*Resource, resource *Resource) bool

func DefaultReplace

func DefaultReplace(s string, cnt int) string

func GetHash32 added in v1.52.0

func GetHash32(input string) uint32

func GetHash64 added in v1.52.0

func GetHash64(input string) uint64

func GetHashName added in v1.52.0

func GetHashName(name string) string

func IsIgnoredResource added in v1.58.0

func IsIgnoredResource(resourceType ResourceType, id string) bool

func LoadIgnoreResourcesMap added in v1.58.0

func LoadIgnoreResourcesMap() error

func LoadStateFile added in v1.52.0

func LoadStateFile(filePath string) (*state, error)

func LoadStateLinked added in v1.52.0

func LoadStateLinked() (*state, error)

func LoadStateThis added in v1.52.0

func LoadStateThis() (*state, error)

func ResourceName

func ResourceName(s string, cnt int) string

func Service

func Service(credentials *settings.Credentials, resourceType ResourceType) settings.CRUDService[settings.Settings]

func SetOptimizedRegexModule added in v1.55.0

func SetOptimizedRegexModule(module *Module)

func SetOptimizedRegexResource added in v1.55.0

func SetOptimizedRegexResource(resource *Resource)

func ToParent added in v1.56.1

func ToParent(keyVal string) string

func ValidateResource

func ValidateResource(keyVal string) (string, string)

Types

type DataSource

type DataSource struct {
	ID         string
	Type       string
	Name       string
	Kind       DataSourceKind
	UniqueName string
}

type DataSourceKind added in v1.56.0

type DataSourceKind string

type DataSourceType

type DataSourceType string

func (DataSourceType) Trim

func (me DataSourceType) Trim() string

type Dependency

type Dependency interface {
	Replace(environment *Environment, s string, replacingIn ResourceType, resourceId string, nonPostProcessedResources []*Resource) (string, []any)
	ResourceType() ResourceType
	DataSourceType() DataSourceType
	IsParent() bool
}

func Coalesce

func Coalesce(d Dependency) Dependency

type Environment

type Environment struct {
	OutputFolder          string
	Credentials           *settings.Credentials
	Modules               map[ResourceType]*Module
	Flags                 Flags
	ResArgs               map[string][]string
	ChildResourceOverride bool
	PrevStateMapCommon    *StateMap
	PrevNamesByModule     map[string][]string
	ImportStateMap        *StateMap
	ChildParentGroups     map[ResourceType]ResourceType
	IsParentMap           map[ResourceType]bool
	HasDependenciesTo     map[ResourceType]bool
	// contains filtered or unexported fields
}

func Initialize

func Initialize(cfgGetter config.Getter) (environment *Environment, err error)

func (*Environment) CreateFile

func (me *Environment) CreateFile(name string) (*os.File, error)

func (*Environment) DataSource

func (me *Environment) DataSource(id string, kind DataSourceKind, excepts ...ResourceType) *DataSource

func (*Environment) ExecuteImport

func (me *Environment) ExecuteImport() error

func (*Environment) Export

func (me *Environment) Export() (err error)

func (*Environment) FetchEntity added in v1.56.0

func (me *Environment) FetchEntity(id string) *DataSource

func (*Environment) Finish

func (me *Environment) Finish() (err error)

func (*Environment) FinishExport added in v1.52.0

func (me *Environment) FinishExport() error

func (*Environment) GetAttentionFolder

func (me *Environment) GetAttentionFolder() string

func (*Environment) GetChildResources added in v1.29.0

func (me *Environment) GetChildResources(optSort ...bool) []*Resource

func (*Environment) GetFlawedFolder

func (me *Environment) GetFlawedFolder() string

func (*Environment) GetFolder

func (me *Environment) GetFolder() string

func (*Environment) GetNonPostProcessedResources

func (me *Environment) GetNonPostProcessedResources() []*Resource

func (*Environment) GetReferringResources added in v1.57.0

func (me *Environment) GetReferringResources(resource *Resource) []*Resource

func (*Environment) GetResourceTypesWithDownloads

func (me *Environment) GetResourceTypesWithDownloads() []ResourceType

func (*Environment) InitialDownload

func (me *Environment) InitialDownload() error

func (*Environment) IsReferenced added in v1.57.0

func (me *Environment) IsReferenced(resource *Resource) bool

func (*Environment) LoadImportState added in v1.52.0

func (me *Environment) LoadImportState() error

func (*Environment) Module

func (me *Environment) Module(resType ResourceType) *Module

func (*Environment) PostProcess

func (me *Environment) PostProcess() error

func (*Environment) PreProcess added in v1.52.0

func (me *Environment) PreProcess() error

func (*Environment) ProcessChildParentGroups added in v1.52.0

func (me *Environment) ProcessChildParentGroups()

func (*Environment) ProcessHasDependenciesTo added in v1.52.0

func (me *Environment) ProcessHasDependenciesTo()

func (*Environment) ProcessPrevState added in v1.52.0

func (me *Environment) ProcessPrevState() error

func (*Environment) RefersTo

func (me *Environment) RefersTo(resource *Resource, parentType ResourceType) bool

func (*Environment) RemoveNonReferencedModules added in v1.22.0

func (me *Environment) RemoveNonReferencedModules() (err error)

func (*Environment) RunQuickInit added in v1.52.0

func (me *Environment) RunQuickInit() error

func (*Environment) RunTerraformInit added in v1.52.0

func (me *Environment) RunTerraformInit() error

func (*Environment) TenantID added in v1.34.0

func (me *Environment) TenantID() string

func (*Environment) WriteDataSourceFiles

func (me *Environment) WriteDataSourceFiles() (err error)

func (*Environment) WriteMainFile

func (me *Environment) WriteMainFile() error

func (*Environment) WriteMainProviderFile added in v1.52.0

func (me *Environment) WriteMainProviderFile() error

func (*Environment) WriteProviderFiles

func (me *Environment) WriteProviderFiles() (err error)

func (*Environment) WriteQuickModulesJSON added in v1.52.0

func (me *Environment) WriteQuickModulesJSON() error

func (*Environment) WriteResourceFiles

func (me *Environment) WriteResourceFiles() (err error)

func (*Environment) WriteVariablesFiles

func (me *Environment) WriteVariablesFiles() (err error)

type Flags

type Flags struct {
	FollowReferences    bool
	PersistIDs          bool
	FlagMigrationOutput bool
	FlagVerbose         bool
	FlagHardLinks       bool
	FlagPreviewOnly     bool
	Flat                bool
	ImportStateV2       bool
	Exclude             bool
	DataSources         bool
	SkipTerraformInit   bool
	Include             bool
}

type IgnoreResourcesMap added in v1.58.0

type IgnoreResourcesMap map[string]map[string][]string
var IGNORE_RESOURCES_MAP *IgnoreResourcesMap = nil

type Module

type Module struct {
	Environment *Environment
	Type        ResourceType
	Resources   map[string]*Resource
	DataSources map[string]*DataSource

	Status                 ModuleStatus
	Error                  error
	PrivDescriptor         *ResourceDescriptor
	Service                settings.CRUDService[settings.Settings]
	ChildParentIDNameMap   map[string]string
	ModuleMutex            *sync.Mutex
	SplitPathModuleNameMap map[string]string
	SplitList              *splitList
	ChildModules           map[ResourceType]*Module
	IdRegexType            string
	LegacyIdMap            map[string]*Resource
	DataSourceLock         *sync.Mutex
	DescriptorLock         sync.Mutex
	// contains filtered or unexported fields
}

func (*Module) ContainsPostProcessedResources

func (me *Module) ContainsPostProcessedResources() bool

func (*Module) CreateBundleFile added in v1.52.0

func (me *Module) CreateBundleFile(bundle bundleToDownload) (*os.File, error)

func (*Module) CreateFile

func (me *Module) CreateFile(name string) (*os.File, error)

func (*Module) CreateFileSpecificPath added in v1.52.0

func (me *Module) CreateFileSpecificPath(name string, specificPath string) (*os.File, error)

func (*Module) DataSource

func (me *Module) DataSource(id string, kind DataSourceKind, excepts ...ResourceType) *DataSource

func (*Module) Discover

func (me *Module) Discover() error

func (*Module) Download

func (me *Module) Download(multiThreaded bool, keys ...string) (err error)

func (*Module) ExecuteImportV2 added in v1.29.0

func (me *Module) ExecuteImportV2(fs afero.Fs) (resList resources, err error)

func (*Module) FolderNameOverride added in v1.56.1

func (me *Module) FolderNameOverride() string

func (*Module) GetAttentionFolder

func (me *Module) GetAttentionFolder(relative ...bool) string

func (*Module) GetBundleFile added in v1.52.0

func (me *Module) GetBundleFile(bundle bundleToDownload) (string, error)

func (*Module) GetBundleFileName added in v1.52.0

func (me *Module) GetBundleFileName(bundle bundleToDownload) string

func (*Module) GetChildOfResources added in v1.52.0

func (me *Module) GetChildOfResources() []*Resource

func (*Module) GetChildResources added in v1.29.0

func (me *Module) GetChildResources() []*Resource

func (*Module) GetDataSources added in v1.56.0

func (me *Module) GetDataSources(dataSources map[string]*DataSource)

func (*Module) GetDependencyOptimizationInfo added in v1.55.0

func (me *Module) GetDependencyOptimizationInfo() (string, bool)

func (*Module) GetDescriptor added in v1.56.1

func (me *Module) GetDescriptor() *ResourceDescriptor

func (*Module) GetFile

func (me *Module) GetFile(name string) string

func (*Module) GetFileSpecificPath added in v1.52.0

func (me *Module) GetFileSpecificPath(name string, specificPath string) string

func (*Module) GetFlawedFolder

func (me *Module) GetFlawedFolder(relative ...bool) string

func (*Module) GetFolder

func (me *Module) GetFolder(relative ...bool) string

func (*Module) GetLegacyIdMap added in v1.55.0

func (me *Module) GetLegacyIdMap() map[string]*Resource

func (*Module) GetNonPostProcessedResources

func (me *Module) GetNonPostProcessedResources() []*Resource

func (*Module) GetPostProcessedResources added in v1.29.0

func (me *Module) GetPostProcessedResources() []*Resource

func (*Module) GetReferencedResourceTypes

func (me *Module) GetReferencedResourceTypes() []ResourceType

func (*Module) GetReferringResources added in v1.57.0

func (me *Module) GetReferringResources(resource *Resource) []*Resource

func (*Module) GetRegexType added in v1.55.0

func (me *Module) GetRegexType() string

func (*Module) GetResourceReferences

func (me *Module) GetResourceReferences() []*Resource

func (*Module) GetResourcesAndChildOfResources added in v1.52.0

func (me *Module) GetResourcesAndChildOfResources() []*Resource

func (*Module) GetResourcesReferencedFromOtherModules

func (me *Module) GetResourcesReferencedFromOtherModules() []*Resource

func (*Module) IsBundleImpossible added in v1.52.0

func (me *Module) IsBundleImpossible() bool

func (*Module) IsReferenced added in v1.57.0

func (me *Module) IsReferenced(resource *Resource) bool

func (*Module) IsReferencedAsDataSource added in v1.22.0

func (me *Module) IsReferencedAsDataSource() bool

func (*Module) MkdirAll

func (me *Module) MkdirAll(flawed bool) error

func (*Module) OpenFile

func (me *Module) OpenFile(name string) (file *os.File, err error)

func (*Module) ProvideDataSources added in v1.30.1

func (me *Module) ProvideDataSources(except map[string]*DataSource) (dsm map[string]string, err error)

func (*Module) PurgeFolder added in v1.22.0

func (me *Module) PurgeFolder() (err error)

func (*Module) RefersTo

func (me *Module) RefersTo(resource *Resource, parentType ResourceType) bool

func (*Module) Resource

func (me *Module) Resource(id string) *Resource

func (*Module) SortedDataSources added in v1.56.0

func (me *Module) SortedDataSources() (result []*DataSource)

func (*Module) WriteDataSourcesFile

func (me *Module) WriteDataSourcesFile(logToScreen bool) (err error)

func (*Module) WriteProviderFile

func (me *Module) WriteProviderFile(logToScreen bool) (err error)

func (*Module) WriteResourcesFile

func (me *Module) WriteResourcesFile() (err error)

func (*Module) WriteVariablesFile

func (me *Module) WriteVariablesFile(logToScreen bool) (err error)

type ModuleStatus

type ModuleStatus string

func (ModuleStatus) IsOneOf

func (me ModuleStatus) IsOneOf(stati ...ModuleStatus) bool

type ReplaceFunc

type ReplaceFunc func(s string, cnt int) string

type Resource

type Resource struct {
	ID                              string
	LegacyID                        string
	Name                            string
	UniqueName                      string
	Type                            ResourceType
	Module                          *Module
	Status                          ResourceStatus
	Error                           error
	ResourceReferences              []*Resource
	DataSourceReferences            []*DataSource
	OutputFileAbs                   string
	Flawed                          bool
	XParent                         *Resource
	ParentID                        *string
	SplitId                         int
	BundleFilePath                  string
	ExtractedIdsPerDependencyModule map[string]map[string]bool
	ResourceMutex                   *sync.Mutex
}

func (*Resource) CreateFile

func (me *Resource) CreateFile() (*os.File, error)

func (*Resource) Download

func (me *Resource) Download() error

func (*Resource) GetAttentionFile

func (me *Resource) GetAttentionFile() string

func (*Resource) GetExtractedIdsPerRegexType added in v1.55.0

func (me *Resource) GetExtractedIdsPerRegexType(idRegexType string, tfFileContent string, optimizers map[string]optimizedIdDep) map[string]bool

func (*Resource) GetFile

func (me *Resource) GetFile() string

func (*Resource) GetFileName

func (me *Resource) GetFileName() string

func (*Resource) GetFlawedFile added in v1.22.2

func (me *Resource) GetFlawedFile() string

func (*Resource) GetParent added in v1.34.0

func (me *Resource) GetParent() *Resource

func (*Resource) GetReferringResources added in v1.57.0

func (me *Resource) GetReferringResources() []*Resource

func (*Resource) GetResourceReferences

func (me *Resource) GetResourceReferences() []*Resource

func (*Resource) IsReferenced added in v1.57.0

func (me *Resource) IsReferenced() bool

func (*Resource) IsReferencedAsDataSource added in v1.22.0

func (me *Resource) IsReferencedAsDataSource() bool

func (*Resource) PostProcess

func (me *Resource) PostProcess(nonPostProcessedResources []*Resource) error

func (*Resource) ReadFile

func (me *Resource) ReadFile() ([]byte, error)

func (*Resource) RefersTo

func (me *Resource) RefersTo(other *Resource) bool

func (*Resource) SetName

func (me *Resource) SetName(name string) *Resource

type ResourceDescriptor

type ResourceDescriptor struct {
	Dependencies []Dependency
	Service      func(credentials *settings.Credentials) settings.CRUDService[settings.Settings]

	Parent     *ResourceType
	FolderName string
	// contains filtered or unexported fields
}

func NewChildResourceDescriptor added in v1.29.0

func NewChildResourceDescriptor[T settings.Settings](fn func(credentials *settings.Credentials) settings.CRUDService[T], parent ResourceType, dependencies ...Dependency) ResourceDescriptor

func NewResourceDescriptor

func NewResourceDescriptor[T settings.Settings](fn func(credentials *settings.Credentials) settings.CRUDService[T], dependencies ...Dependency) ResourceDescriptor

func NewResourceDescriptorWithFolderOverride added in v1.56.1

func NewResourceDescriptorWithFolderOverride[T settings.Settings](fn func(credentials *settings.Credentials) settings.CRUDService[T], folderName string, dependencies ...Dependency) ResourceDescriptor

func (ResourceDescriptor) Except

func (me ResourceDescriptor) Except(except func(id string, name string) bool) ResourceDescriptor

func (ResourceDescriptor) NewSettings

func (me ResourceDescriptor) NewSettings() settings.Settings

func (ResourceDescriptor) Specify

type ResourceExclusion added in v1.58.1

type ResourceExclusion struct {
	ResourceType ResourceType
	Reason       string
}

type ResourceExclusionGroup added in v1.58.1

type ResourceExclusionGroup struct {
	Reason     string
	Exclusions []ResourceExclusion
}

func GetExcludeListedResourceGroups added in v1.58.1

func GetExcludeListedResourceGroups() []ResourceExclusionGroup

type ResourceStatus

type ResourceStatus string

func (ResourceStatus) IsOneOf

func (me ResourceStatus) IsOneOf(stati ...ResourceStatus) bool

type ResourceType

type ResourceType string

func GetExcludeListedResources added in v1.52.0

func GetExcludeListedResources() []ResourceType

func (ResourceType) AsDataSource added in v1.22.0

func (me ResourceType) AsDataSource() string

func (ResourceType) CanGetVoidedIfNotReferenced added in v1.57.0

func (rt ResourceType) CanGetVoidedIfNotReferenced() bool

func (ResourceType) GetChildren added in v1.30.0

func (me ResourceType) GetChildren() []ResourceType

func (ResourceType) GetFolderName added in v1.56.1

func (me ResourceType) GetFolderName(override string) string

func (ResourceType) GetParent added in v1.56.1

func (me ResourceType) GetParent() ResourceType

func (ResourceType) IsChildResource added in v1.34.0

func (me ResourceType) IsChildResource() bool

func (ResourceType) IsPotentialCircularDependencyTo added in v1.57.0

func (rt ResourceType) IsPotentialCircularDependencyTo(referringResourceID string, referredToResourceType ResourceType, referredToResourceID string) bool

func (ResourceType) Less added in v1.57.0

func (rt ResourceType) Less(other ResourceType) bool

func (ResourceType) Trim

func (me ResourceType) Trim() string

func (ResourceType) VoidResource added in v1.57.0

func (rt ResourceType) VoidResource(resource *Resource, contents []byte) ([]byte, bool)

type StateMap added in v1.52.0

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

func BuildStateMap added in v1.52.0

func BuildStateMap(stateLoaded *state) *StateMap

func NewStateMap added in v1.52.0

func NewStateMap() *StateMap

func (*StateMap) AddToStateMap added in v1.52.0

func (sm *StateMap) AddToStateMap(key string, res resource)

func (*StateMap) AddToStateMapByID added in v1.52.0

func (sm *StateMap) AddToStateMapByID(res resource)

func (*StateMap) AddToStateMapByName added in v1.52.0

func (sm *StateMap) AddToStateMapByName(res resource)

func (*StateMap) ExtractCommonStates added in v1.52.0

func (sm *StateMap) ExtractCommonStates(smLinked *StateMap) (*StateMap, map[string][]string)

func (*StateMap) GetPrevUniqueName added in v1.52.0

func (sm *StateMap) GetPrevUniqueName(res *Resource) string

func (*StateMap) GetResourceSplitId added in v1.52.0

func (sm *StateMap) GetResourceSplitId(res *Resource) (int, bool)

type StateResource added in v1.52.0

type StateResource struct {
	Resource resource
	Used     bool
}

type TerraformInitModule added in v1.52.0

type TerraformInitModule struct {
	Key    string `json:"Key"`
	Source string `json:"Source"`
	Dir    string `json:"Dir"`
}

type TerraformInitModuleList added in v1.52.0

type TerraformInitModuleList struct {
	Modules []TerraformInitModule `json:"Modules"`
}

type UniqueNamer

type UniqueNamer interface {
	Name(string) string
	Replace(ReplaceFunc) UniqueNamer
	BlockName(string)
	SetNameWritten(string) bool
}

func NewUniqueNamer

func NewUniqueNamer() UniqueNamer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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