Documentation
¶
Index ¶
- Constants
- Variables
- type ActiveGateAuthTokenInfo
- type ActiveGateAuthTokenParams
- type ActiveGateConnectionInfo
- type Client
- type CommunicationHost
- type ConfMap
- type ConnectionInfo
- type ConstraintViolation
- type EventData
- type EventDataAttachRules
- type GetLogMonSettingsResponse
- type GetRulesSettingsResponse
- type GetSettingsResponse
- type HostNotFoundErr
- type IngestRuleMatchers
- type K8sClusterME
- type LatestImageInfo
- type MonitoringSettings
- type NewFunc
- type OneAgentConnectionInfo
- type Option
- type ProcessModuleConfig
- func (pmc *ProcessModuleConfig) Add(newProperty ProcessModuleProperty) *ProcessModuleConfig
- func (pmc *ProcessModuleConfig) AddConnectionInfo(oneAgentConnectionInfo oneagent.ConnectionInfoStatus, tenantToken string) *ProcessModuleConfig
- func (pmc *ProcessModuleConfig) AddHostGroup(hostGroup string) *ProcessModuleConfig
- func (pmc *ProcessModuleConfig) AddNoProxy(noProxy string) *ProcessModuleConfig
- func (pmc *ProcessModuleConfig) AddProxy(proxy string) *ProcessModuleConfig
- func (pmc ProcessModuleConfig) IsEmpty() bool
- func (pmc *ProcessModuleConfig) SortPropertiesByKey()
- func (pmc ProcessModuleConfig) ToMap() ConfMap
- type ProcessModuleProperty
- type RuleItem
- type RulesResponseValue
- type ServerError
- type TokenScopes
Constants ¶
const ( PaasToken = "paasToken" APIToken = "apiToken" DataIngestToken = "dataIngestToken" )
const ( InstallerTypeDefault = "default" InstallerTypePaaS = "paas" )
Relevant installer types.
const ( TokenScopeInstallerDownload = "InstallerDownload" TokenScopeDataExport = "DataExport" TokenScopeMetricsIngest = "metrics.ingest" TokenScopeSettingsRead = "settings.read" TokenScopeSettingsWrite = "settings.write" TokenScopeActiveGateTokenCreate = "activeGateTokenManagement.create" )
Relevant token scopes
const ( ConditionTypeAPITokenSettingsRead = "ApiTokenSettingsRead" ConditionTypeAPITokenSettingsWrite = "ApiTokenSettingsWrite" )
const ( KubernetesSettingsSchemaID = "builtin:cloud.kubernetes" AppTransitionSchemaID = "builtin:app-transition.kubernetes" )
const APITokenHeader = "Api-Token "
const (
MarkedForTerminationEvent = "MARKED_FOR_TERMINATION"
)
const (
MetadataEnrichmentSettingsSchemaID = "builtin:kubernetes.generic.metadata.enrichment"
)
const (
OsUnix = "unix"
)
Variables ¶
var ( OptionalScopes = map[string]string{ TokenScopeSettingsRead: ConditionTypeAPITokenSettingsRead, TokenScopeSettingsWrite: ConditionTypeAPITokenSettingsWrite, } )
Functions ¶
This section is empty.
Types ¶
type ActiveGateAuthTokenInfo ¶
type ActiveGateConnectionInfo ¶
type ActiveGateConnectionInfo struct {
ConnectionInfo
}
type Client ¶
type Client interface {
// GetLatestAgentVersion gets the latest agent version for the given OS and installer type.
// Returns the version as received from the server on success.
//
// Returns an error for the following conditions:
// - os or installerType is empty
// - IO error or unexpected response
// - error response from the server (e.g. authentication failure)
// - the agent version is not set or empty
GetLatestAgentVersion(ctx context.Context, os, installerType string) (string, error)
// GetLatestAgent returns a reader with the contents of the download. Must be closed by caller.
GetLatestAgent(ctx context.Context, os, installerType, flavor, arch string, technologies []string, skipMetadata bool, writer io.Writer) error
// GetAgent downloads a specific agent version and writes it to the given io.Writer
GetAgent(ctx context.Context, os, installerType, flavor, arch, version string, technologies []string, skipMetadata bool, writer io.Writer) error
// GetAgentViaInstallerUrl downloads the agent from the user specified URL and writes it to the given io.Writer
GetAgentViaInstallerURL(ctx context.Context, url string, writer io.Writer) error
// GetAgentVersions on success returns an array of versions that can be used with GetAgent to
// download a specific agent version
GetAgentVersions(ctx context.Context, os, installerType, flavor string) ([]string, error)
GetOneAgentConnectionInfo(ctx context.Context) (OneAgentConnectionInfo, error)
GetProcessModuleConfig(ctx context.Context, prevRevision uint) (*ProcessModuleConfig, error)
// GetCommunicationHostForClient returns a CommunicationHost for the client's API URL. Or error, if failed to be parsed.
GetCommunicationHostForClient() (CommunicationHost, error)
// SendEvent posts events to dynatrace API
SendEvent(ctx context.Context, eventData *EventData) error
// GetEntityIDForIP returns the entity id for a given IP address.
// Returns an error in case the lookup failed.
GetEntityIDForIP(ctx context.Context, ip string) (string, error)
// GetTokenScopes returns the list of scopes assigned to a token if successful.
GetTokenScopes(ctx context.Context, token string) (TokenScopes, error)
// GetActiveGateConnectionInfo returns AgentTenantInfo for ActiveGate that holds UUID, Tenant Token and Endpoints
GetActiveGateConnectionInfo(ctx context.Context) (ActiveGateConnectionInfo, error)
// CreateOrUpdateKubernetesSetting returns the object id of the created k8s settings if successful, or an api error otherwise
CreateOrUpdateKubernetesSetting(ctx context.Context, name, kubeSystemUUID, scope string) (string, error)
// CreateLogMonitoringSetting returns the object id of the created logmonitoring settings if successful, or an api error otherwise
CreateLogMonitoringSetting(ctx context.Context, scope, clusterName string, ingestRuleMatchers []logmonitoring.IngestRuleMatchers) (string, error)
// CreateOrUpdateKubernetesAppSetting returns the object id of the created k8s app settings if successful, or an api error otherwise
CreateOrUpdateKubernetesAppSetting(ctx context.Context, scope string) (string, error)
// GetK8sClusterME returns the Kubernetes Cluster Monitored Entity for the give kubernetes cluster.
// Uses the `settings.read` scope to list the `builtin:cloud.kubernetes` settings.
// - Only 1 such setting exists per tenant per kubernetes cluster
// - The `scope` for the setting is the ID (example: KUBERNETES_CLUSTER-A1234567BCD8EFGH) of the Kubernetes Cluster Monitored Entity
// - The `label` of the setting is the Name (example: my-dynakube) of the Kubernetes Cluster Monitored Entity
// In case 0 settings are found, so no Kubernetes Cluster Monitored Entity exist, we return an empty object, without an error.
GetK8sClusterME(ctx context.Context, kubeSystemUUID string) (K8sClusterME, error)
// GetSettingsForMonitoredEntity returns the settings response with the number of settings objects,
// or an api error otherwise
GetSettingsForMonitoredEntity(ctx context.Context, monitoredEntity K8sClusterME, schemaID string) (GetSettingsResponse, error)
// GetSettingsForLogModule returns the settings response with the number of settings objects,
// or an api error otherwise
GetSettingsForLogModule(ctx context.Context, monitoredEntity string) (GetLogMonSettingsResponse, error)
GetRulesSettings(ctx context.Context, kubeSystemUUID string, entityID string) (GetRulesSettingsResponse, error)
GetActiveGateAuthToken(ctx context.Context, dynakubeName string) (*ActiveGateAuthTokenInfo, error)
GetLatestOneAgentImage(ctx context.Context) (*LatestImageInfo, error)
GetLatestCodeModulesImage(ctx context.Context) (*LatestImageInfo, error)
GetLatestActiveGateImage(ctx context.Context) (*LatestImageInfo, error)
// GetLatestActiveGateVersion gets the latest gateway version for the given OS and arch.
// Returns the version as received from the server on success.
GetLatestActiveGateVersion(ctx context.Context, os string) (string, error)
}
Client is the interface for the Dynatrace REST API client.
func NewClient ¶
NewClient creates a REST client for the given API base URL and authentication tokens. Returns an error if a token or the URL is empty.
The API base URL is different for managed and SaaS environments:
- SaaS: https://{environment-id}.live.dynatrace.com/api
- Managed: https://{domain}/e/{environment-id}/api
opts can be used to customize the created client, entries must not be nil.
type CommunicationHost ¶
CommunicationHost => struct of connection endpoint
func ParseEndpoint ¶
func ParseEndpoint(s string) (CommunicationHost, error)
type ConfMap ¶
ConfMap is the representation of a config file with sections that are divided by headers (map[header] == section) each section consists of key value pairs.
type ConnectionInfo ¶
type ConstraintViolation ¶ added in v1.4.0
type EventData ¶
type EventData struct {
EventType string `json:"eventType"`
Description string `json:"description"`
Source string `json:"source"`
AttachRules EventDataAttachRules `json:"attachRules"`
StartInMillis uint64 `json:"start"`
EndInMillis uint64 `json:"end"`
}
EventData struct which defines what event payload should contain
type EventDataAttachRules ¶
type EventDataAttachRules struct {
EntityIDs []string `json:"entityIds"`
}
type GetLogMonSettingsResponse ¶ added in v1.4.0
type GetLogMonSettingsResponse struct {
Items []logMonSettingsItem `json:"items"`
TotalCount int `json:"totalCount"`
}
type GetRulesSettingsResponse ¶ added in v1.3.0
type GetSettingsResponse ¶
type GetSettingsResponse struct {
TotalCount int `json:"totalCount"`
}
type HostNotFoundErr ¶
type HostNotFoundErr struct {
IP string
}
func (HostNotFoundErr) Error ¶
func (e HostNotFoundErr) Error() string
type IngestRuleMatchers ¶ added in v1.4.0
type K8sClusterME ¶ added in v1.7.0
K8sClusterME is representing the relevant info for a Kubernetes Cluster Monitored Entity
type LatestImageInfo ¶
func (LatestImageInfo) String ¶
func (image LatestImageInfo) String() string
type MonitoringSettings ¶
type MonitoringSettings struct {
CloudApplicationPipelineEnabled bool `json:"cloudApplicationPipelineEnabled"`
OpenMetricsPipelineEnabled bool `json:"openMetricsPipelineEnabled"`
EventProcessingActive bool `json:"eventProcessingActive"`
EventProcessingV2Active bool `json:"eventProcessingV2Active"`
FilterEvents bool `json:"filterEvents"`
}
type OneAgentConnectionInfo ¶
type OneAgentConnectionInfo struct {
ConnectionInfo
CommunicationHosts []CommunicationHost
}
type Option ¶
type Option func(*dynatraceClient)
Option can be passed to NewClient and customizes the created client instance.
func NetworkZone ¶
func SkipCertificateValidation ¶
SkipCertificateValidation creates an Option that specifies whether validation of the server's TLS certificate should be skipped. The default is false.
type ProcessModuleConfig ¶
type ProcessModuleConfig struct {
Properties []ProcessModuleProperty `json:"properties"`
Revision uint `json:"revision"`
}
func (*ProcessModuleConfig) Add ¶
func (pmc *ProcessModuleConfig) Add(newProperty ProcessModuleProperty) *ProcessModuleConfig
func (*ProcessModuleConfig) AddConnectionInfo ¶
func (pmc *ProcessModuleConfig) AddConnectionInfo(oneAgentConnectionInfo oneagent.ConnectionInfoStatus, tenantToken string) *ProcessModuleConfig
func (*ProcessModuleConfig) AddHostGroup ¶
func (pmc *ProcessModuleConfig) AddHostGroup(hostGroup string) *ProcessModuleConfig
func (*ProcessModuleConfig) AddNoProxy ¶ added in v1.0.0
func (pmc *ProcessModuleConfig) AddNoProxy(noProxy string) *ProcessModuleConfig
func (*ProcessModuleConfig) AddProxy ¶
func (pmc *ProcessModuleConfig) AddProxy(proxy string) *ProcessModuleConfig
func (ProcessModuleConfig) IsEmpty ¶
func (pmc ProcessModuleConfig) IsEmpty() bool
func (*ProcessModuleConfig) SortPropertiesByKey ¶ added in v1.5.0
func (pmc *ProcessModuleConfig) SortPropertiesByKey()
func (ProcessModuleConfig) ToMap ¶
func (pmc ProcessModuleConfig) ToMap() ConfMap
type ProcessModuleProperty ¶
type RuleItem ¶ added in v1.3.0
type RuleItem struct {
Value RulesResponseValue `json:"value"`
}
type RulesResponseValue ¶ added in v1.3.0
type RulesResponseValue struct {
Rules []dynakube.EnrichmentRule `json:"rules"`
}
type ServerError ¶
type ServerError struct {
Message string `json:"message"`
ConstraintViolations []ConstraintViolation `json:"constraintViolations,omitempty"`
Code int `json:"code"`
}
ServerError represents an error returned from the server (e.g. authentication failure).
func (ServerError) Error ¶
func (e ServerError) Error() string
Error formats the server error code and message.
type TokenScopes ¶
type TokenScopes []string
TokenScopes is a list of scopes assigned to a token
func (TokenScopes) Contains ¶
func (s TokenScopes) Contains(scope string) bool
Contains returns true if scope is included on the scopes, or false otherwise.
Source Files
¶
- activegate_auth_token.go
- activegate_connection_info.go
- activegate_version.go
- agent_version.go
- client.go
- communication_hosts.go
- config.go
- dynatrace_client.go
- endpoints.go
- image.go
- oneagent_connection_info.go
- processmoduleconfig.go
- send_event.go
- server_error.go
- settings.go
- settings_enrichment.go
- settings_kubernetes.go
- settings_logmonitoring.go
- token.go