Documentation ¶
Index ¶
- Constants
- type ActiveGateAuthTokenInfo
- type ActiveGateAuthTokenParams
- type ActiveGateConnectionInfo
- type Client
- type CommunicationHost
- type ConfMap
- type ConnectionInfo
- type EventData
- type EventDataAttachRules
- type GetSettingsResponse
- type HostNotFoundErr
- type LatestImageInfo
- type MonitoredEntity
- type MonitoringSettings
- type OneAgentConnectionInfo
- type Option
- type ProcessModuleConfig
- func (pmc *ProcessModuleConfig) Add(newProperty ProcessModuleProperty) *ProcessModuleConfig
- func (pmc *ProcessModuleConfig) AddConnectionInfo(oneAgentConnectionInfo dynatracev1beta1.OneAgentConnectionInfoStatus, ...) *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) ToMap() ConfMap
- type ProcessModuleProperty
- type ServerError
- type TokenScopes
Constants ¶
const ( DynatracePaasToken = "paasToken" DynatraceApiToken = "apiToken" DynatraceDataIngestToken = "dataIngestToken" )
const ( InstallerTypeDefault = "default" // Commented for linter, left for further reference // InstallerTypeUnattended = "default-unattended" InstallerTypePaaS = "paas" )
Known installer types.
const ( TokenScopeInstallerDownload = "InstallerDownload" TokenScopeDataExport = "DataExport" TokenScopeMetricsIngest = "metrics.ingest" TokenScopeEntitiesRead = "entities.read" TokenScopeSettingsRead = "settings.read" TokenScopeSettingsWrite = "settings.write" TokenScopeActiveGateTokenCreate = "activeGateTokenManagement.create" )
Known token scopes
const ( SettingsSchemaId = "builtin:cloud.kubernetes" AppTransitionSchemaId = "builtin:app-transition.kubernetes" )
const (
MarkedForTerminationEvent = "MARKED_FOR_TERMINATION"
)
const (
OsUnix = "unix"
)
Known OS values.
Variables ¶
This section is empty.
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(os, installerType string) (string, error) // GetLatestAgent returns a reader with the contents of the download. Must be closed by caller. GetLatestAgent(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(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(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(os, installerType, flavor, arch string) ([]string, error) GetOneAgentConnectionInfo() (OneAgentConnectionInfo, error) GetProcessModuleConfig(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(eventData *EventData) error // GetEntityIDForIP returns the entity id for a given IP address. // // Returns an error in case the lookup failed. GetEntityIDForIP(ip string) (string, error) // GetTokenScopes returns the list of scopes assigned to a token if successful. GetTokenScopes(token string) (TokenScopes, error) // GetActiveGateConnectionInfo returns AgentTenantInfo for ActiveGate that holds UUID, Tenant Token and Endpoints GetActiveGateConnectionInfo() (ActiveGateConnectionInfo, error) // CreateOrUpdateKubernetesSetting returns the object id of the created k8s settings if successful, or an api error otherwise CreateOrUpdateKubernetesSetting(name, kubeSystemUUID, scope string) (string, error) // CreateOrUpdateKubernetesAppSetting returns the object id of the created k8s app settings if successful, or an api error otherwise CreateOrUpdateKubernetesAppSetting(scope string) (string, error) // GetMonitoredEntitiesForKubeSystemUUID returns a (possibly empty) list of k8s monitored entities for the given uuid, // or an api error otherwise GetMonitoredEntitiesForKubeSystemUUID(kubeSystemUUID string) ([]MonitoredEntity, error) // GetSettingsForMonitoredEntities returns the settings response with the number of settings objects, // or an api error otherwise GetSettingsForMonitoredEntities(monitoredEntities []MonitoredEntity, schemaId string) (GetSettingsResponse, error) // GetSettingsForMonitoredEntities returns the settings response with the number of settings objects, // or an api error otherwise GetActiveGateAuthToken(dynakubeName string) (*ActiveGateAuthTokenInfo, error) GetLatestOneAgentImage() (*LatestImageInfo, error) GetLatestCodeModulesImage() (*LatestImageInfo, error) GetLatestActiveGateImage() (*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(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 ¶
type CommunicationHost struct { Protocol string // nolint:unused Host string // nolint:unused Port uint32 // nolint:unused }
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 EventData ¶
type EventData struct { EventType string `json:"eventType"` StartInMillis uint64 `json:"start"` EndInMillis uint64 `json:"end"` Description string `json:"description"` AttachRules EventDataAttachRules `json:"attachRules"` Source string `json:"source"` }
EventData struct which defines what event payload should contain
type EventDataAttachRules ¶
type EventDataAttachRules struct {
EntityIDs []string `json:"entityIds"`
}
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 LatestImageInfo ¶
func (LatestImageInfo) String ¶
func (image LatestImageInfo) String() string
type MonitoredEntity ¶
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 { Revision uint `json:"revision"` Properties []ProcessModuleProperty `json:"properties"` }
func (*ProcessModuleConfig) Add ¶
func (pmc *ProcessModuleConfig) Add(newProperty ProcessModuleProperty) *ProcessModuleConfig
func (*ProcessModuleConfig) AddConnectionInfo ¶
func (pmc *ProcessModuleConfig) AddConnectionInfo(oneAgentConnectionInfo dynatracev1beta1.OneAgentConnectionInfoStatus, 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) ToMap ¶
func (pmc ProcessModuleConfig) ToMap() ConfMap
type ProcessModuleProperty ¶
type ServerError ¶
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.